Hi Luís,

I've finally sat down and corrected the changes i had made to my
cffi-uffi-compat.lisp file (basically copied/pasted the missing definitions
from UFFI) and did the things you suggested

a) added a dependency on babel to the cffi-uffi-compat.asd file

b) added the foreign-encoded-octet-count function at the end of the file and
added to list of exported symbols

c) added an extra key parameter (encoding) to the function
convert-from-foreign-string, i believe this the parameter name was changed
from locale to encoding on the new UFFI version, i could have simply
replaced the locale parameter but since they aren't even being used on the
function body i thought it was better to keep both and avoid breaking
compatibility with other code.

Please give it a look, i know it's not much work but since i had to do it
for my client's webapp here goes a small patch with my modifications. Hope
this is helpful for anyone.


Cheers,

Alexandre Paes


On Sat, Aug 7, 2010 at 7:23 AM, Luís Oliveira <luis...@gmail.com> wrote:

> Hello Alexandre,
>
> On Fri, Aug 6, 2010 at 12:27 PM, Alexandre Paes
> <alex.p...@streetdogstudio.com> wrote:
> > Is this something i'm doing wrong or the cffi-uffi-compat package is not
> > fully uffi-2.0.0 compatible?
>
> UFFI 2.0.0 is indeed more recent than the latest uffi-compat.
>
>
> > Any ideas of how i should tackle this issue?
>
> You could implement the new UFFI 2.0.0 functions. That would be great.
>
> You should be able to use what's in CFFI and Babel to do so. (For
> example, if UFFI 2 does provide a string-to-octets function, you
> should change CFFI-UFFI-COMPAT to depend on Babel and use
> babel:string-to-octets to implement uffi:string-to-octets.)
>
> Cheers,
>
> --
> Luís Oliveira
> http://r42.eu/~luis/ <http://r42.eu/%7Eluis/>
>
diff -rN old-cffi/cffi-uffi-compat.asd new-cffi/cffi-uffi-compat.asd
39c39
<   :depends-on (cffi))
---
>   :depends-on (cffi babel))
diff -rN old-cffi/uffi-compat/uffi-compat.lisp new-cffi/uffi-compat/uffi-compat.lisp
83a84
>    #:foreign-encoded-octet-count
575a577
>                                        (encoding :default)
581c583
<   (declare (ignore locale null-terminated-p))
---
>   (declare (ignore locale encoding null-terminated-p))
625a628,632
> 
> ;; From UFFI 2.0.0
> (defun foreign-encoded-octet-count (str &key encoding)
>   (let ((encoding (or encoding babel-encodings:*default-character-encoding*)))
>     (babel:string-size-in-octets str :encoding encoding)))
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to