Quoth Peter Danenberg on Pungenday, the 10th of Discord:
> The attached patch merely replaces pointer with c-pointer; seems to
> work.
While we're at it, we should be able to send binary data over OUT; the
signature of FCGX_PutStr is:
DLLAPI int FCGX_PutStr(const char *str, int n, FCGX_Stream *stream);
so let's change the binding to:
(foreign-lambda int "FCGX_PutStr" blob int fcgx-stream)
otherwise, we get:
Error: (##sys#make-c-string) cannot represent string with NUL bytes
as C string
See attached patch.
Index: fastcgi.scm
===================================================================
--- fastcgi.scm (revision 23250)
+++ fastcgi.scm (working copy)
@@ -50,7 +50,7 @@
;;;
(define-foreign-type fcgx-stream c-pointer)
-(define-foreign-type fcgx-param-array (pointer c-string))
+(define-foreign-type fcgx-param-array (c-pointer c-string))
(define (fcgx-init-if-necessary!)
(unless (or *fcgi-has-been-initialised*
@@ -125,7 +125,7 @@
(foreign-lambda c-string "FCGX_GetParam" c-string fcgx-param-array))
(define fcgx-put-str
- (foreign-lambda int "FCGX_PutStr" c-string int fcgx-stream))
+ (foreign-lambda int "FCGX_PutStr" blob int fcgx-stream))
(define fcgx-has-seen-eof
(foreign-lambda bool "FCGX_HasSeenEOF" fcgx-stream))
@@ -199,8 +199,8 @@
;;; Utility function for incrementing a char**.
(define sarray-pointer+1
(foreign-lambda*
- (pointer c-string)
- (((pointer c-string) p))
+ (c-pointer c-string)
+ (((c-pointer c-string) p))
"return(p + 1);"))
(define (wrap-env e)
@@ -213,7 +213,7 @@
;; Convert the char ** array into a list of key/value cons pairs.
(let loop ((strlist '()) (p e))
(let ((deref
- ((foreign-lambda* c-string (((pointer c-string) ps))
"return(*ps);")
+ ((foreign-lambda* c-string (((c-pointer c-string) ps))
"return(*ps);")
p)))
(cond
(deref
_______________________________________________
Chicken-hackers mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-hackers