From: Kevin Rosenberg Date: Mon, 16 Aug 2010 17:34:29 +0000 (-0600) Subject: Commit patch for invocation uffi:convert-from-foreign-=string X-Git-Tag: v5.1.2^0 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=31ac96a3d5e7edbe15c673ce40ba5c1fc94aa62b Commit patch for invocation uffi:convert-from-foreign-=string --- diff --git a/ChangeLog b/ChangeLog index f50d67c..6bb0e1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-08-16 Kevin Rosenberg + * Version 5.1.2 + * uffi/clsql-uffi.lisp: Commit patch from JT Klein fixing + invocation of uffi:convert-from-foreign-string macro. When + time allows, I'll investigate changing UFFI's macro to + a function call and then revert this patch. + 2010-06-15 Kevin Rosenberg * Version 5.1.1 * clsql-{uffi,mysql}.asd: Modify operation-done-p functions diff --git a/debian/changelog b/debian/changelog index 6235ba6..978ad6c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-sql (5.1.2-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Mon, 16 Aug 2010 11:27:41 -0600 + cl-sql (5.1.1-1) unstable; urgency=low * New upstream diff --git a/uffi/clsql-uffi.lisp b/uffi/clsql-uffi.lisp index 11038d5..79d423f 100644 --- a/uffi/clsql-uffi.lisp +++ b/uffi/clsql-uffi.lisp @@ -109,36 +109,47 @@ (c-strtoul char-ptr uffi:+null-cstring-pointer+ 10)) (defun convert-raw-field (char-ptr type &key length encoding) - (declare (optimize (speed 3) (safety 0) (space 0)) - (type char-ptr-def char-ptr)) - (cond - ((uffi:null-pointer-p char-ptr) - nil) - (t - (case type - (:double - (atof char-ptr)) - (:int - (atol char-ptr)) - (:int32 - (atoi char-ptr)) - (:uint32 - (strtoul char-ptr)) - (:uint - (strtoul char-ptr)) - ((:int64 :uint64) - (uffi:with-foreign-object (high32-ptr :unsigned-int) - (let ((low32 (atol64 char-ptr high32-ptr)) - (high32 (uffi:deref-pointer high32-ptr :unsigned-int))) - (if (zerop high32) - low32 - (make-64-bit-integer high32 low32))))) - (:blob - (if length - (uffi:convert-from-foreign-usb8 char-ptr length) - (error "Can't return blob since length is not specified."))) - (t - (uffi:convert-from-foreign-string char-ptr - :null-terminated-p (not length) - :length length - :encoding encoding)))))) + (declare (optimize (speed 3) (safety 0) (space 0)) + (type char-ptr-def char-ptr)) + (cond + ((uffi:null-pointer-p char-ptr) + nil) + (t + (case type + (:double + (atof char-ptr)) + (:int + (atol char-ptr)) + (:int32 + (atoi char-ptr)) + (:uint32 + (strtoul char-ptr)) + (:uint + (strtoul char-ptr)) + ((:int64 :uint64) + (uffi:with-foreign-object (high32-ptr :unsigned-int) + (let ((low32 (atol64 char-ptr high32-ptr)) + (high32 (uffi:deref-pointer high32-ptr :unsigned-int))) + (if (zerop high32) + low32 + (make-64-bit-integer high32 low32))))) + (:blob + (if length + (uffi:convert-from-foreign-usb8 char-ptr length) + (error "Can't return blob since length is not specified."))) + (t + (if encoding + (if length + (uffi:convert-from-foreign-string char-ptr + :null-terminated-p nil + :length length + :encoding encoding) + (uffi:convert-from-foreign-string char-ptr + :null-terminated-p t + :encoding encoding)) + (if length + (uffi:convert-from-foreign-string char-ptr + :null-terminated-p nil + :length length) + (uffi:convert-from-foreign-string char-ptr + :null-terminated-p t))))))))