gimp r25255 - in trunk: . plug-ins/common



Author: muks
Date: Thu Mar 27 07:50:47 2008
New Revision: 25255
URL: http://svn.gnome.org/viewvc/gimp?rev=25255&view=rev

Log:
2008-03-27  Mukund Sivaraman  <muks mukund org>

        * plug-ins/common/dicom.c: Validated samples_per_pixel, changed
        the loop counter data type, and patched code to work on big endian
        CPUs.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/common/dicom.c

Modified: trunk/plug-ins/common/dicom.c
==============================================================================
--- trunk/plug-ins/common/dicom.c	(original)
+++ trunk/plug-ins/common/dicom.c	Thu Mar 27 07:50:47 2008
@@ -501,8 +501,15 @@
 
   if ((width > GIMP_MAX_IMAGE_SIZE) || (height > GIMP_MAX_IMAGE_SIZE))
     {
-      g_message ("'%s' has a larger image size than GIMP can handle.",
-                 gimp_filename_to_utf8 (filename));
+      g_message ("'%s' has a larger image size (%d x %d) than GIMP can handle.",
+                 gimp_filename_to_utf8 (filename), width, height);
+      gimp_quit ();
+    }
+
+  if (samples_per_pixel > 3)
+    {
+      g_message ("'%s' has samples per pixel of %d which GIMP cannot handle.",
+                 gimp_filename_to_utf8 (filename), samples_per_pixel);
       gimp_quit ();
     }
 
@@ -566,7 +573,7 @@
   gint     height            = info->height;
   gint     samples_per_pixel = info->samples_per_pixel;
   guint16 *buf16             = (guint16 *) pix_buffer;
-  gint     pix_idx;
+  gulong   pix_idx;
 
   if (info->bpp == 16)
     {
@@ -575,7 +582,7 @@
        * (i.e., compensate for high_bit and bits_stored).
        */
       for (pix_idx = 0; pix_idx < width * height * samples_per_pixel; pix_idx++)
-        buf16[pix_idx] = GUINT16_SWAP_LE_BE (buf16[pix_idx]) >>
+        buf16[pix_idx] = g_htons (buf16[pix_idx]) >>
                          ((info->high_bit + 1) - info->bits_stored);
     }
 



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