progs/samples: Byte swap individual members of struct _rawImageRec.
authorVinson Lee <vlee@vmware.com>
Thu, 10 Dec 2009 23:41:13 +0000 (15:41 -0800)
committerVinson Lee <vlee@vmware.com>
Thu, 10 Dec 2009 23:41:13 +0000 (15:41 -0800)
progs/samples/rgbtoppm.c

index 56ca5b0efe9e0e9753cab41a221ed2854d4df23c..dcb74228dfffde8743d802a6306e5070a836eed4 100644 (file)
@@ -93,7 +93,12 @@ static ImageRec *ImageOpen(char *fileName)
     fread(image, 1, 12, image->file);
 
     if (swapFlag) {
-        ConvertShort(&image->imagic, 6);
+        ConvertShort(&image->imagic, 1);
+        ConvertShort(&image->type, 1);
+        ConvertShort(&image->dim, 1);
+        ConvertShort(&image->xsize, 1);
+        ConvertShort(&image->ysize, 1);
+        ConvertShort(&image->zsize, 1);
     }
 
     image->tmp = (unsigned char *)malloc(image->xsize*256);