Validated samples_per_pixel, changed the loop counter data type, and

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.


svn path=/trunk/; revision=25255
This commit is contained in:
Mukund Sivaraman 2008-03-27 07:50:47 +00:00 committed by Mukund Sivaraman
parent 2df60469ba
commit e147e1ded0
2 changed files with 17 additions and 4 deletions

View file

@ -1,3 +1,9 @@
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.
2008-03-27 Sven Neumann <sven@gimp.org>
* app/gui/gui.c (gui_init): disable automatic startup notification.

View file

@ -501,8 +501,15 @@ load_image (const gchar *filename)
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 @@ dicom_loader (guint8 *pix_buffer,
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 @@ dicom_loader (guint8 *pix_buffer,
* (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);
}