Skip to content
  • Allison Karlitskaya's avatar
    Fix a sign-compare warning · 2a7f9d61
    Allison Karlitskaya authored
    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.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=668843
    2a7f9d61