After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 560585 - gjs_string_from_utf8() n_bytes argument
gjs_string_from_utf8() n_bytes argument
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2008-11-13 01:53 UTC by Owen Taylor
Modified: 2009-08-01 02:46 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Owen Taylor 2008-11-13 01:53:54 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)...)
Comment 1 Havoc Pennington 2008-11-13 03:59:44 UTC
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 ...)
Comment 2 Owen Taylor 2008-11-13 17:42:51 UTC
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.)
Comment 3 Johan (not receiving bugmail) Dahlin 2008-11-13 19:14:41 UTC
This also applies to gjs_filename_from_utf8 as I copied the prototype.
Comment 4 Lucas Rocha 2009-08-01 02:46:43 UTC
Fixed in master. Closing.