diff -u -r ../orig/cffi_0.10.4/src/cffi-sbcl.lisp cffi_0.10.4/src/cffi-sbcl.lisp
--- ../orig/cffi_0.10.4/src/cffi-sbcl.lisp	2009-02-01 13:17:00.000000000 -0500
+++ cffi_0.10.4/src/cffi-sbcl.lisp	2009-03-07 21:03:14.000000000 -0500
@@ -273,11 +273,52 @@
           else do (setf return-type (convert-foreign-type type))
           finally (return (values types fargs return-type)))))
 
+
+(defun uchar-narrow (x)
+  (mask-field (byte 8 0) x))
+
+(defun char-narrow (x)
+  (let ((val (mask-field (byte 7 0) x)))
+    (if (ldb-test (byte 1 7) x)
+        (- val 128)
+        val)))
+
+(defun ushort-narrow (x)
+  (mask-field (byte 16 0) x))
+
+(defun short-narrow (x)
+  (let ((val (mask-field (byte 15 0) x)))
+    (if (ldb-test (byte 1 15) x)
+        (- val 32768)
+        val)))
+
 (defmacro %%foreign-funcall (name types fargs rettype)
   "Internal guts of %FOREIGN-FUNCALL."
-  `(alien-funcall
-    (extern-alien ,name (function ,rettype ,@types))
-    ,@fargs))
+  ;;(break "In %%foreign-funcall, rettype = ~S~%" rettype)
+  (case rettype
+    (sb-alien:unsigned-char
+     `(uchar-narrow (alien-funcall
+                     (extern-alien ,name (function ,rettype ,@types) ,@fargs))))
+    (sb-alien:char
+     `(char-narrow (alien-funcall
+                    (extern-alien ,name (function ,rettype ,@types) ,@fargs))))
+    (sb-alien:unsigned-short
+     `(ushort-narrow (alien-funcall
+                      (extern-alien ,name (function ,rettype ,@types) ,@fargs))))
+    (sb-alien:short
+     `(short-narrow (alien-funcall
+                     (extern-alien ,name (function ,rettype ,@types) ,@fargs))))
+    (t
+     `(alien-funcall
+       (extern-alien ,name (function ,rettype ,@types))
+       ,@fargs))))
+
+;; (defmacro %%foreign-funcall (name types fargs rettype)
+;;   "Internal guts of %FOREIGN-FUNCALL."
+;;   `(alien-funcall
+;;     (extern-alien ,name (function ,rettype ,@types))
+;;     ,@fargs)
+;;   )
 
 (defmacro %foreign-funcall (name args &key library calling-convention)
   "Perform a foreign function call, document it more later."
@@ -292,8 +333,26 @@
   (multiple-value-bind (types fargs rettype)
       (foreign-funcall-type-and-args args)
     (with-unique-names (function)
-      `(with-alien ((,function (* (function ,rettype ,@types)) ,ptr))
-         (alien-funcall ,function ,@fargs)))))
+      (case rettype
+        (sb-alien:unsigned-char
+         `(uchar-narrow
+           (with-alien ((,function (* (function ,rettype ,@types)) ,ptr))
+            (alien-funcall ,function ,@fargs))))
+        (sb-alien:char
+         `(char-narrow
+           (with-alien ((,function (* (function ,rettype ,@types)) ,ptr))
+            (alien-funcall ,function ,@fargs))))
+        (sb-alien:unsigned-short
+         `(ushort-narrow
+           (with-alien ((,function (* (function ,rettype ,@types)) ,ptr))
+            (alien-funcall ,function ,@fargs))))
+        (sb-alien:short
+         `(short-narrow
+           (with-alien ((,function (* (function ,rettype ,@types)) ,ptr))
+            (alien-funcall ,function ,@fargs))))
+        (t
+         `(with-alien ((,function (* (function ,rettype ,@types)) ,ptr))
+            (alien-funcall ,function ,@fargs)))))))
 
 ;;;# Callbacks
 

