Re: [Vala] libidn bindings?



Hello again. So I've started my my effort and since it's my first
attempt, I'd like some opinions and review.

I started with stringprep and punycode parts. Some functions are kinda
difficult to use in Vala, as they require preallocated buffer to store
output and some even use input buffer for it. So I've created some
inline methods to honor Vala's "immutable strings" rule.

I've also bound some structs under different name, so it is more
obvious what they are (I know I probably shouldn't do that.. I'll
change it back if that's a problem.)


I've also stumbled across a strange problem. In the Punycode.decode
inline method, I have to copy the input string (even when I don't use
the copy at all), otherwise it crashes sometimes. It's probably some
mistake I made in the inline methods, but I have no idea how can that
copy affect anything. C code gives me no clue. Can anyone look into
it?

For the test case to work, you have to add following bindings to glib-2.0.vapi:

        [CCode (array_length = true)]
        public unichar[] utf8_to_ucs4 (string str, long len = -1, out long
items_read = null) throws ConvertError;
        [CCode (array_length = true)]
        public unichar[] utf8_to_ucs4_fast (string str, long len = -1);
        
        public string ucs4_to_utf8 (unichar[] input, out long items_read =
null, out long items_written = null) throws ConvertError;

By the way, C documentation of libidn is here:
http://www.gnu.org/software/libidn/manual/libidn.html#Stringprep-Functions

Thanks in advance for any pointers.

Dne 13. červen 2009 20:55 Jiří Zárevúcky <zarevucky jiri gmail com> napsal(a):
Hello. Is there anyone working on those? There is no mention on this
list or bugzilla, so I suppose there isn't. I've already started
frying my brain with it. :)

Attachment: libidn.vapi
Description: Text Data

Attachment: libidn-test.vala
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]