Index: GraphicsMagick-1.2.5/coders/viff.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/viff.c	2008-06-11 02:06:42.000000000 +0200
+++ GraphicsMagick-1.2.5/coders/viff.c	2016-06-14 11:49:00.801712641 +0200
@@ -43,6 +43,15 @@
 #include "magick/magick.h"
 #include "magick/monitor.h"
 #include "magick/utility.h"
+
+#define GetPixelRed(pixel) ((pixel)->red)
+#define GetPixelGreen(pixel) ((pixel)->green)
+#define GetPixelBlue(pixel) ((pixel)->blue)
+
+#define SetPixelRed(pixel,value) ((pixel)->red=(Quantum) (value))
+#define SetPixelGreen(pixel,value) ((pixel)->green=(Quantum) (value))
+#define SetPixelBlue(pixel,value) ((pixel)->blue=(Quantum) (value))
+
 
 /*
   Forward declarations.
@@ -222,7 +231,6 @@ static Image *ReadVIFFImage(const ImageI
     count;
 
   unsigned char
-    buffer[7],
     *viff_pixels;
 
   unsigned int
@@ -262,11 +270,12 @@ static Image *ReadVIFFImage(const ImageI
     /*
       Initialize VIFF image.
     */
-    (void) ReadBlob(image,7,(char *) buffer);
-    viff_info.file_type=buffer[0];
-    viff_info.release=buffer[1];
-    viff_info.version=buffer[2];
-    viff_info.machine_dependency=buffer[3];
+    (void) ReadBlob(image,sizeof(viff_info.file_type),&viff_info.file_type);
+    (void) ReadBlob(image,sizeof(viff_info.release),&viff_info.release);
+    (void) ReadBlob(image,sizeof(viff_info.version),&viff_info.version);
+    (void) ReadBlob(image,sizeof(viff_info.machine_dependency),
+      &viff_info.machine_dependency);
+    (void) ReadBlob(image,sizeof(viff_info.reserve),viff_info.reserve);
     (void) ReadBlob(image,512,(char *) viff_info.comment);
     viff_info.comment[511]='\0';
     if (strlen(viff_info.comment) > 4)
@@ -618,7 +627,7 @@ static Image *ReadVIFFImage(const ImageI
           }
           if ((image->columns % 8) != 0)
             {
-              for (bit=0; bit < (long) (image->columns % 8); bit++)
+              for (bit=0; bit < (int) (image->columns % 8); bit++)
                 indexes[x+bit]=(IndexPacket)
                   ((*p) & (0x01 << bit) ? !polarity : polarity);
               p++;
@@ -896,7 +910,6 @@ static unsigned int WriteVIFFImage(const
     *q;
 
   unsigned char
-    buffer[8],
     *viff_pixels;
 
   unsigned int
@@ -1008,24 +1021,27 @@ static unsigned int WriteVIFFImage(const
     /*
       Write VIFF image header (pad to 1024 bytes).
     */
-    buffer[0]=viff_info.identifier;
-    buffer[1]=viff_info.file_type;
-    buffer[2]=viff_info.release;
-    buffer[3]=viff_info.version;
-    buffer[4]=viff_info.machine_dependency;
-    buffer[5]=viff_info.reserve[0];
-    buffer[6]=viff_info.reserve[1];
-    buffer[7]=viff_info.reserve[2];
-    (void) WriteBlob(image,8,(char *) buffer);
+    (void) WriteBlob(image,sizeof(viff_info.identifier),(unsigned char *)
+      &viff_info.identifier);
+    (void) WriteBlob(image,sizeof(viff_info.file_type),(unsigned char *)
+      &viff_info.file_type);
+    (void) WriteBlob(image,sizeof(viff_info.release),(unsigned char *)
+      &viff_info.release);
+    (void) WriteBlob(image,sizeof(viff_info.version),(unsigned char *)
+      &viff_info.version);
+    (void) WriteBlob(image,sizeof(viff_info.machine_dependency),
+      (unsigned char *) &viff_info.machine_dependency);
+    (void) WriteBlob(image,sizeof(viff_info.reserve),(unsigned char *)
+      viff_info.reserve);
     (void) WriteBlob(image,512,(char *) viff_info.comment);
     (void) WriteBlobMSBLong(image,viff_info.rows);
     (void) WriteBlobMSBLong(image,viff_info.columns);
     (void) WriteBlobMSBLong(image,viff_info.subrows);
     (void) WriteBlobMSBLong(image,(unsigned long) viff_info.x_offset);
     (void) WriteBlobMSBLong(image,(unsigned long) viff_info.y_offset);
-    viff_info.x_bits_per_pixel=(63 << 24) | (128 << 16);
+    viff_info.x_bits_per_pixel=(unsigned int)((63 << 24) | (128 << 16));
     (void) WriteBlobMSBLong(image,(unsigned long) viff_info.x_bits_per_pixel);
-    viff_info.y_bits_per_pixel=(63 << 24) | (128 << 16);
+    viff_info.y_bits_per_pixel=(unsigned int)((63 << 24) | (128 << 16));
     (void) WriteBlobMSBLong(image,(unsigned long) viff_info.y_bits_per_pixel);
     (void) WriteBlobMSBLong(image,viff_info.location_type);
     (void) WriteBlobMSBLong(image,viff_info.location_dimension);
