[gimp] fix bogus checks against unsigned variables.
- From: Simon Budig <simon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] fix bogus checks against unsigned variables.
- Date: Fri, 15 Aug 2014 23:00:41 +0000 (UTC)
commit 9a245989c0ce9bb6ce150159bfce29df1b2a0647
Author: Simon Budig <simon budig de>
Date: Fri Aug 15 22:50:32 2014 +0200
fix bogus checks against unsigned variables.
Spotted by Andrey Karpov using static code analysis:
http://www.viva64.com/en/b/0273/
app/operations/gimpcageconfig.c | 1 -
libgimpbase/gimpwire.c | 4 ----
plug-ins/common/file-xmc.c | 2 +-
plug-ins/script-fu/tinyscheme/scheme.c | 3 ++-
4 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/app/operations/gimpcageconfig.c b/app/operations/gimpcageconfig.c
index 774489c..29677f8 100644
--- a/app/operations/gimpcageconfig.c
+++ b/app/operations/gimpcageconfig.c
@@ -425,7 +425,6 @@ gimp_cage_config_get_bounding_box (GimpCageConfig *gcc)
GimpCagePoint *point;
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)
return bounding_box;
diff --git a/libgimpbase/gimpwire.c b/libgimpbase/gimpwire.c
index 8794509..71fbb77 100644
--- a/libgimpbase/gimpwire.c
+++ b/libgimpbase/gimpwire.c
@@ -96,8 +96,6 @@ gimp_wire_read (GIOChannel *channel,
gsize count,
gpointer user_data)
{
- g_return_val_if_fail (count >= 0, FALSE);
-
if (wire_read_func)
{
if (!(* wire_read_func) (channel, buf, count, user_data))
@@ -167,8 +165,6 @@ gimp_wire_write (GIOChannel *channel,
gsize count,
gpointer user_data)
{
- g_return_val_if_fail (count >= 0, FALSE);
-
if (wire_write_func)
{
if (!(* wire_write_func) (channel, (guint8 *) buf, count, user_data))
diff --git a/plug-ins/common/file-xmc.c b/plug-ins/common/file-xmc.c
index c5f2513..caf5812 100644
--- a/plug-ins/common/file-xmc.c
+++ b/plug-ins/common/file-xmc.c
@@ -871,7 +871,7 @@ load_thumbnail (const gchar *filename,
size = READ32 (fp, error)
positions[*thumb_num_layers] = READ32 (fp, error)
/* 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)
{/* the image size is closer than current selected image */
min_diff = diff;
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index 989fdd2..fc47880 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -1651,7 +1651,8 @@ static gunichar basic_inchar(port *pt) {
len = pt->rep.string.past_the_end - pt->rep.string.curr;
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 */
pt->rep.string.curr += len;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]