summaryrefslogtreecommitdiff
path: root/tests/test-common.c
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-01-17 08:43:43 +0000
committerPhilip Withnall <withnall@endlessm.com>2017-02-07 11:04:20 +0000
commitebb88fe9661b0f493267d4bfaddec1023d8f6641 (patch)
tree81d9eb8a1bcf0113cf9e37d29424645898775aa7 /tests/test-common.c
parent8f6453c0cf6956d35afe9d8d789c959779564dd9 (diff)
downloadgdk-pixbuf-ebb88fe9661b0f493267d4bfaddec1023d8f6641.tar.gz
tests: Fix signed/unsigned handling in pixdata_equal()
The return values from the GdkPixbuf getters are signed, so assign them to signed variables and then check that the returned values are non-negative. Coverity IDs: 1388535, 1388536, 1388537 https://bugzilla.gnome.org/show_bug.cgi?id=777374
Diffstat (limited to 'tests/test-common.c')
-rw-r--r--tests/test-common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test-common.c b/tests/test-common.c
index a75655fd5..2f4f3a411 100644
--- a/tests/test-common.c
+++ b/tests/test-common.c
@@ -194,7 +194,7 @@ pixdata_equal (GdkPixbuf *test,
if (memcmp (gdk_pixbuf_get_pixels (test), gdk_pixbuf_get_pixels (ref),
gdk_pixbuf_get_byte_length (test)) != 0)
{
- guint x, y, width, height, n_channels, rowstride;
+ gint x, y, width, height, n_channels, rowstride;
const guchar *test_pixels, *ref_pixels;
rowstride = gdk_pixbuf_get_rowstride (test);
@@ -204,6 +204,10 @@ pixdata_equal (GdkPixbuf *test,
test_pixels = gdk_pixbuf_get_pixels (test);
ref_pixels = gdk_pixbuf_get_pixels (ref);
+ g_assert_cmpint (width, >=, 0);
+ g_assert_cmpint (height, >=, 0);
+ g_assert_cmpint (n_channels, >=, 0);
+
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)