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 762735 - [PATCH] The minimum value of an uint64_t is 0, not G_MININT32
[PATCH] The minimum value of an uint64_t is 0, not G_MININT32
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: tp-aw
unspecified
Other FreeBSD
: Normal normal
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2016-02-26 15:09 UTC by Ting-Wei Lan
Modified: 2016-04-15 14:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
account-settings: The minimum value of an uint64_t is 0 (1.09 KB, patch)
2016-02-26 15:11 UTC, Ting-Wei Lan
none Details | Review
account-settings: The minimum value of an uint64_t is 0 (1.04 KB, patch)
2016-02-26 15:13 UTC, Ting-Wei Lan
none Details | Review
account-settings: The minimum value of unsigned integers are 0 (1.75 KB, patch)
2016-03-04 03:49 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2016-02-26 15:09:25 UTC
In file tp-account-widgets/tpaw-account-settings.c, function tpaw_account_settings_get_int32:

else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT64))
  ret = CLAMP (g_variant_get_uint64 (v), (guint64) G_MININT32, G_MAXINT32);

This causes a compiler warning because it may assign a bad value to ret.
Comment 1 Ting-Wei Lan 2016-02-26 15:11:53 UTC
Created attachment 322467 [details] [review]
account-settings: The minimum value of an uint64_t is 0
Comment 2 Ting-Wei Lan 2016-02-26 15:13:31 UTC
Created attachment 322468 [details] [review]
account-settings: The minimum value of an uint64_t is 0
Comment 3 Debarshi Ray 2016-03-03 19:23:12 UTC
Review of attachment 322468 [details] [review]:

Thanks for the patch!

::: tp-account-widgets/tpaw-account-settings.c
@@ +886,3 @@
     ret = CLAMP (g_variant_get_int64 (v), G_MININT32, G_MAXINT32);
   else if (g_variant_is_of_type (v, G_VARIANT_TYPE_UINT64))
+    ret = CLAMP (g_variant_get_uint64 (v), 0, G_MAXINT32);

What about the G_VARIANT_TYPE_UINT32 case a few lines above? It also affects the G_VARIANT_TYPE_UINT64 case in tpaw_account_settings_get_int64, doesn't it?
Comment 4 Ting-Wei Lan 2016-03-04 03:49:10 UTC
Created attachment 323059 [details] [review]
account-settings: The minimum value of unsigned integers are 0
Comment 5 Debarshi Ray 2016-03-07 19:10:38 UTC
Review of attachment 323059 [details] [review]:

From #empathy on GIMPNet:

13:25 <rishi> cassidy: xclaesse: Hey! Do you want to double check               
      https://bugzilla.gnome.org/show_bug.cgi?id=762735 and                     
      https://bugzilla.gnome.org/show_bug.cgi?id=762738
13:26 <rishi> I am more worried about the first one because it can have subtle  
      side-effects.
13:26 <rishi> I am not very familiar with the code - just did a fly-by review.
14:38 <xclaesse> rishi, looks good to me
Comment 6 Ting-Wei Lan 2016-03-07 19:35:31 UTC
Attachment 323059 [details] pushed as 47ef181 - account-settings: The minimum value of unsigned integers are 0