[gdk-pixbuf] tests: Fix signed/unsigned handling in pixdata_equal()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] tests: Fix signed/unsigned handling in pixdata_equal()
- Date: Tue, 7 Feb 2017 11:16:02 +0000 (UTC)
commit ebb88fe9661b0f493267d4bfaddec1023d8f6641
Author: Philip Withnall <withnall endlessm com>
Date: Tue Jan 17 08:43:43 2017 +0000
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
tests/test-common.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/tests/test-common.c b/tests/test-common.c
index a75655f..2f4f3a4 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++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]