mirror of https://github.com/GNOME/gimp.git
fix bogus checks against unsigned variables.
Spotted by Andrey Karpov using static code analysis: http://www.viva64.com/en/b/0273/
This commit is contained in:
parent
a83ba26f42
commit
9a245989c0
|
@ -425,7 +425,6 @@ gimp_cage_config_get_bounding_box (GimpCageConfig *gcc)
|
||||||
GimpCagePoint *point;
|
GimpCagePoint *point;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_CAGE_CONFIG (gcc), bounding_box);
|
g_return_val_if_fail (GIMP_IS_CAGE_CONFIG (gcc), bounding_box);
|
||||||
g_return_val_if_fail (gcc->cage_points->len >= 0, bounding_box);
|
|
||||||
|
|
||||||
if (gcc->cage_points->len == 0)
|
if (gcc->cage_points->len == 0)
|
||||||
return bounding_box;
|
return bounding_box;
|
||||||
|
|
|
@ -96,8 +96,6 @@ gimp_wire_read (GIOChannel *channel,
|
||||||
gsize count,
|
gsize count,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (count >= 0, FALSE);
|
|
||||||
|
|
||||||
if (wire_read_func)
|
if (wire_read_func)
|
||||||
{
|
{
|
||||||
if (!(* wire_read_func) (channel, buf, count, user_data))
|
if (!(* wire_read_func) (channel, buf, count, user_data))
|
||||||
|
@ -167,8 +165,6 @@ gimp_wire_write (GIOChannel *channel,
|
||||||
gsize count,
|
gsize count,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (count >= 0, FALSE);
|
|
||||||
|
|
||||||
if (wire_write_func)
|
if (wire_write_func)
|
||||||
{
|
{
|
||||||
if (!(* wire_write_func) (channel, (guint8 *) buf, count, user_data))
|
if (!(* wire_write_func) (channel, (guint8 *) buf, count, user_data))
|
||||||
|
|
|
@ -871,7 +871,7 @@ load_thumbnail (const gchar *filename,
|
||||||
size = READ32 (fp, error)
|
size = READ32 (fp, error)
|
||||||
positions[*thumb_num_layers] = READ32 (fp, error)
|
positions[*thumb_num_layers] = READ32 (fp, error)
|
||||||
/* is this image is more preferred than selected before? */
|
/* is this image is more preferred than selected before? */
|
||||||
diff = ABS(thumb_size - size);
|
diff = MAX (thumb_size, size) - MIN (thumb_size, size);
|
||||||
if (diff < min_diff)
|
if (diff < min_diff)
|
||||||
{/* the image size is closer than current selected image */
|
{/* the image size is closer than current selected image */
|
||||||
min_diff = diff;
|
min_diff = diff;
|
||||||
|
|
|
@ -1651,7 +1651,8 @@ static gunichar basic_inchar(port *pt) {
|
||||||
len = pt->rep.string.past_the_end - pt->rep.string.curr;
|
len = pt->rep.string.past_the_end - pt->rep.string.curr;
|
||||||
c = g_utf8_get_char_validated(pt->rep.string.curr, len);
|
c = g_utf8_get_char_validated(pt->rep.string.curr, len);
|
||||||
|
|
||||||
if (c >= 0) /* Valid UTF-8 character? */
|
if (c != (gunichar) -1 &&
|
||||||
|
c != (gunichar) -2) /* Valid UTF-8 character? */
|
||||||
{
|
{
|
||||||
len = g_unichar_to_utf8(c, NULL); /* Length of UTF-8 sequence */
|
len = g_unichar_to_utf8(c, NULL); /* Length of UTF-8 sequence */
|
||||||
pt->rep.string.curr += len;
|
pt->rep.string.curr += len;
|
||||||
|
|
Loading…
Reference in New Issue