GNOME Bugzilla – Bug 659870
gvalue: Fix signedness of g_value_get_char()
Last modified: 2017-11-17 12:10:59 UTC
The documentation for G_TYPE_CHAR says: "The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed integer." However the return value for this function was just "char" which has an unspecified signedness, which happens to work on signed char platforms like x86, but will fail on e.g. ppc or ARM. Fix this by explicitly specifying gint8 and guint8 for all 4 of these functions.
Created attachment 197290 [details] [review] gvalue: Fix signedness of g_value_get_char()
One major problem with this is it's technically an ABI break on unsigned char platforms. We either: 1) Accept it 2) Add a new g_value_get_char2 which only exists on unsigned-char platforms. This would be horribly ugly =(
Created attachment 197294 [details] [review] gvalue: Add explicitly signed g_value_get_schar() and g_value_set_schar() Let's go the other way and not break ABI.
Review of attachment 197294 [details] [review]: Other than that, looks right to me. ::: gobject/gvaluetypes.h @@ +182,3 @@ gchar g_value_get_char (const GValue *value); +void g_value_set_schar (GValue *value, + gint8 v_char); Need to add deprecation guards in the header.
Review of attachment 197294 [details] [review]: Actually, we've already branched, so feel free to commit to master
Attachment 197294 [details] pushed as f42fe6c - gvalue: Add explicitly signed g_value_get_schar() and g_value_set_schar()
*** Bug 688444 has been marked as a duplicate of this bug. ***
*** Bug 666833 has been marked as a duplicate of this bug. ***