Mesa (mesa_7_6_branch): progs/samples: Byte swap individual members of struct _rawImageRec.

Vinson Lee vlee at kemper.freedesktop.org
Thu Dec 10 15:42:10 PST 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: 1cf60c981091d7a46cb404fd607f85553c427761
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1cf60c981091d7a46cb404fd607f85553c427761

Author: Vinson Lee <vlee at vmware.com>
Date:   Thu Dec 10 15:41:13 2009 -0800

progs/samples: Byte swap individual members of struct _rawImageRec.

---

 progs/samples/rgbtoppm.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/progs/samples/rgbtoppm.c b/progs/samples/rgbtoppm.c
index 56ca5b0..dcb7422 100644
--- a/progs/samples/rgbtoppm.c
+++ b/progs/samples/rgbtoppm.c
@@ -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);



More information about the mesa-commit mailing list