[gimp] plug-ins/file-sgi: Quickfix for -Wtype-limits warnings



commit 9d0e69d43bd51a2627eb625ca8a578f0126041f2
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue Oct 5 08:04:17 2010 +0200

    plug-ins/file-sgi: Quickfix for -Wtype-limits warnings
    
    Quickfix for "warning: comparison is always false due to limited range
    of data type".

 plug-ins/file-sgi/sgi.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/file-sgi/sgi.c b/plug-ins/file-sgi/sgi.c
index 5cfbab9..ed51d63 100644
--- a/plug-ins/file-sgi/sgi.c
+++ b/plug-ins/file-sgi/sgi.c
@@ -333,22 +333,24 @@ load_image (const gchar  *filename,
    * Get the image dimensions and create the image...
    */
 
-  /* Sanitize dimensions */
-  if (sgip->xsize == 0 || sgip->xsize > GIMP_MAX_IMAGE_SIZE)
+  /* Sanitize dimensions (note that they are unsigned short and can
+   * thus never be larger than GIMP_MAX_IMAGE_SIZE
+   */
+  if (sgip->xsize == 0 /*|| sgip->xsize > GIMP_MAX_IMAGE_SIZE*/)
     {
       g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
               _("Invalid width: %hu"), sgip->xsize);
       return -1;
     }
 
-  if (sgip->ysize == 0 || sgip->ysize > GIMP_MAX_IMAGE_SIZE)
+  if (sgip->ysize == 0 /*|| sgip->ysize > GIMP_MAX_IMAGE_SIZE*/)
     {
       g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
               _("Invalid height: %hu"), sgip->ysize);
       return -1;
     }
 
-  if (sgip->zsize == 0 || sgip->zsize > GIMP_MAX_IMAGE_SIZE)
+  if (sgip->zsize == 0 /*|| sgip->zsize > GIMP_MAX_IMAGE_SIZE*/)
     {
       g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
               _("Invalid number of channels: %hu"), sgip->zsize);



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