gdkimage-x11 patch



Hi:

The sense of the assertions seems to be reversed in the newly-added
bounds checking.

OK to commit this patch?  Or am I just confused ?

-Bill



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.3704
diff -u -r1.3704 ChangeLog
--- ChangeLog	4 Oct 2002 16:17:26 -0000	1.3704
+++ ChangeLog	4 Oct 2002 16:50:39 -0000
@@ -1,3 +1,18 @@
+Fri Oct  4 17:38:27 2002  Bill Haneman <bill haneman sun com>
+
+	* gdk/x11/gdkimage-x11.c: 
+	(gdk_image_get_pixel): Fixed sense of bounds checks.
+	(gdk_image_put_pixel): Ditto.
+
+	* gdk/linux-fb/gdkimage-x11.c: 
+	(gdk_image_get_pixel): Fixed sense of bounds checks.
+	(gdk_image_put_pixel): Ditto.
+
+	* gdk/win32/gdkimage-x11.c: 
+	(gdk_image_get_pixel): Fixed sense of bounds checks.
+	(gdk_image_put_pixel): Ditto.
+		
+
 Fri Oct  4 12:05:27 2002  Owen Taylor  <otaylor redhat com>
 
 	* demos/Makefile.am (pixbuf_csource): Fix envars
Index: gdk/x11/gdkimage-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkimage-x11.c,v
retrieving revision 1.48
diff -u -r1.48 gdkimage-x11.c
--- gdk/x11/gdkimage-x11.c	24 Sep 2002 20:29:28 -0000	1.48
+++ gdk/x11/gdkimage-x11.c	4 Oct 2002 16:50:39 -0000
@@ -697,8 +697,8 @@
   GdkImagePrivateX11 *private;
 
   g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-  g_return_val_if_fail (x < 0 || x >= image->width, 0);
-  g_return_val_if_fail (y < 0 || y >= image->height, 0);
+  g_return_val_if_fail (x >= 0 && x < image->width, 0);
+  g_return_val_if_fail (y >= 0 && y < image->height, 0);
 
   private = PRIVATE_DATA (image);
 
@@ -719,8 +719,8 @@
   GdkImagePrivateX11 *private;
 
   g_return_if_fail (GDK_IS_IMAGE (image));
-  g_return_if_fail (x < 0 || x >= image->width);
-  g_return_if_fail (y < 0 || y >= image->height);
+  g_return_if_fail (x >= 0 && x < image->width);
+  g_return_if_fail (y >= 0 && y < image->height);
 
   private = PRIVATE_DATA (image);
 
Index: gdk/linux-fb/gdkimage-fb.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/linux-fb/gdkimage-fb.c,v
retrieving revision 1.20
diff -u -r1.20 gdkimage-fb.c
--- gdk/linux-fb/gdkimage-fb.c	25 Sep 2002 12:58:36 -0000	1.20
+++ gdk/linux-fb/gdkimage-fb.c	4 Oct 2002 16:50:39 -0000
@@ -264,8 +264,8 @@
   GdkImagePrivateFB *private;
 
   g_return_val_if_fail (image != NULL, 0);
-  g_return_val_if_fail (x < 0 || x >= image->width, 0);
-  g_return_val_if_fail (y < 0 || y >= image->height, 0);
+  g_return_val_if_fail (x >= 0 && x < image->width, 0);
+  g_return_val_if_fail (y >= 0 && y < image->height, 0);
 
   private = GDK_IMAGE_PRIVATE_DATA (image);
 
@@ -298,8 +298,8 @@
   guchar *ptr = image->mem;
 
   g_return_if_fail (image != NULL);
-  g_return_if_fail (x < 0 || x >= image->width);
-  g_return_if_fail (y < 0 || y >= image->height);
+  g_return_if_fail (x >= 0 && x < image->width);
+  g_return_if_fail (y >= 0 && y < image->height);
 
   switch (image->depth)
     {
Index: gdk/win32/gdkimage-win32.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/win32/gdkimage-win32.c,v
retrieving revision 1.37
diff -u -r1.37 gdkimage-win32.c
--- gdk/win32/gdkimage-win32.c	24 Sep 2002 20:29:27 -0000	1.37
+++ gdk/win32/gdkimage-win32.c	4 Oct 2002 16:50:39 -0000
@@ -265,8 +265,8 @@
   guchar *pixelp;
 
   g_return_val_if_fail (image != NULL, 0);
-  g_return_val_if_fail (x < 0 || x >= image->width, 0);
-  g_return_val_if_fail (y < 0 || y >= image->height, 0);
+  g_return_val_if_fail (x >= 0 && x < image->width, 0);
+  g_return_val_if_fail (y >= 0 && y < image->height, 0);
 
   if (!(x >= 0 && x < image->width && y >= 0 && y < image->height))
       return 0;
@@ -313,8 +313,8 @@
   guchar *pixelp;
 
   g_return_if_fail (image != NULL);
-  g_return_if_fail (x < 0 || x >= image->width);
-  g_return_if_fail (y < 0 || y >= image->height);
+  g_return_if_fail (x >= 0 && x < image->width);
+  g_return_if_fail (y >= 0 && y < image->height);
 
   if  (!(x >= 0 && x < image->width && y >= 0 && y < image->height))
     return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]