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 668843 - Fix a sign-compare warning
Fix a sign-compare warning
Status: RESOLVED FIXED
Product: gucharmap
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gucharmap maintainers
gucharmap maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-27 14:34 UTC by Allison Karlitskaya (desrt)
Modified: 2012-01-27 20:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix a sign-compare warning (1.40 KB, patch)
2012-01-27 14:34 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2012-01-27 14:34:08 UTC
See patch
Comment 1 Allison Karlitskaya (desrt) 2012-01-27 14:34:10 UTC
Created attachment 206268 [details] [review]
Fix a sign-compare warning

We had

  if (signed < unsigned - unsigned)

which had been 'fixed' to

  if (signed < (int)unsigned - unsigned)

which didn't work because the subtraction between the two unsigned
values caused the signed value to be promoted back to unsigned again.
Change that to

  if (signed < (int) (unsigned - unsigned))

which means that the signed math will be done on the unsigned ints, but
the result will properly be interpreted as being signed before doing the
compare.
Comment 2 Allison Karlitskaya (desrt) 2012-01-27 20:14:52 UTC
Attachment 206268 [details] pushed as 2a7f9d6 - Fix a sign-compare warning