GNOME Bugzilla – Bug 560585
gjs_string_from_utf8() n_bytes argument
Last modified: 2009-08-01 02:46:43 UTC
JSBool gjs_string_from_utf8 (JSContext *context, const char *utf8_string, gsize n_bytes, jsval *value_p); If n_bytes == -1 is allowed (and it is used and tested) I'd suggest changing n_bytes to long (like in GLib) or gssize. (I don't know any practical issues with this as long as sizeof(gsize) >= sizeof(long)...)
Yes (do we not have the right gcc warning enabled to complain about -1 here, or were we just failing to notice the warnings go by ...)
gjs is currently being compiled without *any* additional warning flags. I'll submit a patch to fix that in a moment. But to get the -1 to warn, you would need -Wsign-conversion which is bit on the annoying side. (Tried it, it didn't trigger that much from gjs - maybe 10-15 places. But it is triggering one warning in the GLib headers.)
This also applies to gjs_filename_from_utf8 as I copied the prototype.
Fixed in master. Closing.