On Sat, 2010-05-22 at 06:38 -0400, Arc Riley wrote:
> I'm migrating some C code to Genie and ran into a troubling limitation; the
> following line of code does not seem to have an equivalent in Genie:
> 
>         session->wbuff = g_string_append_len(session->wbuff, str+sent,
> len-sent);
> 
> What this means is "when you can't send all the data you'd like, append the
> rest to our (known to be empty) GString buffer".
> 
> The key part here is "the rest" - getting a slice of an array, such as C's
> array + value syntax (Incompatible operand) or Python's array[start:] syntax
> (error: syntax error, expected `]' but got `:' with previous identifier).
> 
> We can't use Genie strings for the buffer because UTF8 length != byte
> length.
> _______________________________________________

You should be using the StringBuilder class for this

public unowned StringBuilder append_len (string val, ssize_t len);

(StringBuilder is a GString)

Also string class has a size method which uses strlen - it would
probably be clearer if it was called ByteLength

See http://git.gnome.org/browse/vala/tree/vapi/glib-2.0.vapi

If there are still problems let me know - I will be bug fixing genie
tomorrow

jamie


_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to