Index: trunk/Ohana/src/libfits/matrix/F_load_M.c
===================================================================
--- trunk/Ohana/src/libfits/matrix/F_load_M.c	(revision 16093)
+++ trunk/Ohana/src/libfits/matrix/F_load_M.c	(revision 16139)
@@ -14,6 +14,4 @@
 
   int i, nbytes, Nbytes;
-  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
-  int perpix;
 
   matrix[0].bitpix = header[0].bitpix;
@@ -40,4 +38,8 @@
 
 # ifdef BYTE_SWAP  
+ {
+  int perpix;
+  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
+
   perpix = abs(header[0].bitpix) / 8;
   if (perpix > 1) {
@@ -84,4 +86,5 @@
     }
   }
+ }
 # endif
 
Index: trunk/Ohana/src/libfits/matrix/F_read_portion.c
===================================================================
--- trunk/Ohana/src/libfits/matrix/F_read_portion.c	(revision 16093)
+++ trunk/Ohana/src/libfits/matrix/F_read_portion.c	(revision 16139)
@@ -13,7 +13,5 @@
   FILE *f;
   Header header;
-  int status, i, nbytes, Nbytes, Nrec;
-  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
-  int perpix;
+  int status, nbytes, Nbytes, Nrec;
 
   status = gfits_read_header (filename, &header);
@@ -54,4 +52,8 @@
 
 # ifdef BYTE_SWAP  
+ {
+  int i, perpix;
+  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
+
   perpix = abs(header.bitpix) / 8;
   if (perpix > 1) {
@@ -98,4 +100,5 @@
     }
   }
+ }
 # endif
 
Index: trunk/Ohana/src/libfits/matrix/F_read_segment.c
===================================================================
--- trunk/Ohana/src/libfits/matrix/F_read_segment.c	(revision 16093)
+++ trunk/Ohana/src/libfits/matrix/F_read_segment.c	(revision 16139)
@@ -38,7 +38,5 @@
   int status, i, nbytes, Nbytes, Nskip, NbytesData;
   int wantaxis[FT_MAX_NAXES][2];
-  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
   double tmp;
-  int perpix;
 
   for (i = 0; i < FT_MAX_NAXES; i++) {
@@ -97,4 +95,8 @@
 
 # ifdef BYTE_SWAP  
+ {
+  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
+  int perpix;
+
   perpix = abs(header[0].bitpix) / 8;
   if (perpix > 1) {
@@ -141,4 +143,5 @@
     }
   }
+ }
 # endif
 
Index: trunk/Ohana/src/libfits/matrix/F_write_M.c
===================================================================
--- trunk/Ohana/src/libfits/matrix/F_write_M.c	(revision 16093)
+++ trunk/Ohana/src/libfits/matrix/F_write_M.c	(revision 16139)
@@ -21,7 +21,5 @@
 int gfits_fwrite_matrix (FILE *f, Matrix *matrix) {
 
-  int i, status, nbytes, Nbytes;
-  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
-  int perpix;
+  int status, nbytes, Nbytes;
 
   status = TRUE;
@@ -30,5 +28,5 @@
      if the size is wrong, it probably should simply pad the fwrite statement.
      better policy should be defined (ie, matrix.size always correct blocking?)
- */
+  */
 
   if (matrix[0].size % FT_RECORD_SIZE) 
@@ -39,45 +37,51 @@
   /* this is a bit cumbersome: swap all words, write out file, then swap back... */
 # ifdef BYTE_SWAP  
-  perpix = abs(matrix[0].bitpix) / 8;
-  if (perpix > 1) {
-    byte0 = (unsigned char *) matrix[0].buffer;
-    byte1 = (unsigned char *) matrix[0].buffer + 1;
-    byte2 = (unsigned char *) matrix[0].buffer + 2;
-    byte3 = (unsigned char *) matrix[0].buffer + 3;
-    byte4 = (unsigned char *) matrix[0].buffer + 4;
-    byte5 = (unsigned char *) matrix[0].buffer + 5;
-    byte6 = (unsigned char *) matrix[0].buffer + 6;
-    byte7 = (unsigned char *) matrix[0].buffer + 7;
-    if (perpix == 2) {
-      for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
-	tmp = *byte0;
-	*byte0 = *byte1;
-	*byte1 = tmp;
+  { 
+    int i;
+    unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
+    int perpix;
+
+    perpix = abs(matrix[0].bitpix) / 8;
+    if (perpix > 1) {
+      byte0 = (unsigned char *) matrix[0].buffer;
+      byte1 = (unsigned char *) matrix[0].buffer + 1;
+      byte2 = (unsigned char *) matrix[0].buffer + 2;
+      byte3 = (unsigned char *) matrix[0].buffer + 3;
+      byte4 = (unsigned char *) matrix[0].buffer + 4;
+      byte5 = (unsigned char *) matrix[0].buffer + 5;
+      byte6 = (unsigned char *) matrix[0].buffer + 6;
+      byte7 = (unsigned char *) matrix[0].buffer + 7;
+      if (perpix == 2) {
+	for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
+	  tmp = *byte0;
+	  *byte0 = *byte1;
+	  *byte1 = tmp;
+	}
       }
-    }
-    if (perpix == 4) {
-      for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
-	tmp = *byte0;
-	*byte0 = *byte3;
-	*byte3 = tmp;
-	tmp = *byte1;
-	*byte1 = *byte2;
-	*byte2 = tmp;
+      if (perpix == 4) {
+	for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
+	  tmp = *byte0;
+	  *byte0 = *byte3;
+	  *byte3 = tmp;
+	  tmp = *byte1;
+	  *byte1 = *byte2;
+	  *byte2 = tmp;
+	}
       }
-    }
-    if (perpix == 8) {
-      for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
-	tmp = *byte0;
-	*byte0 = *byte7;
-	*byte7 = tmp;
-	tmp = *byte1;
-	*byte1 = *byte6;
-	*byte6 = tmp;
-	tmp = *byte1;
-	*byte2 = *byte5;
-	*byte5 = tmp;
-	tmp = *byte1;
-	*byte3 = *byte4;
-	*byte4 = tmp;
+      if (perpix == 8) {
+	for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
+	  tmp = *byte0;
+	  *byte0 = *byte7;
+	  *byte7 = tmp;
+	  tmp = *byte1;
+	  *byte1 = *byte6;
+	  *byte6 = tmp;
+	  tmp = *byte1;
+	  *byte2 = *byte5;
+	  *byte5 = tmp;
+	  tmp = *byte1;
+	  *byte3 = *byte4;
+	  *byte4 = tmp;
+	}
       }
     }
@@ -90,46 +94,52 @@
   }
 
-# ifdef BYTE_SWAP  
-  perpix = abs(matrix[0].bitpix) / 8;
-  if (perpix > 1) {
-    byte0 = (unsigned char *) matrix[0].buffer;
-    byte1 = (unsigned char *) matrix[0].buffer + 1;
-    byte2 = (unsigned char *) matrix[0].buffer + 2;
-    byte3 = (unsigned char *) matrix[0].buffer + 3;
-    byte4 = (unsigned char *) matrix[0].buffer + 4;
-    byte5 = (unsigned char *) matrix[0].buffer + 5;
-    byte6 = (unsigned char *) matrix[0].buffer + 6;
-    byte7 = (unsigned char *) matrix[0].buffer + 7;
-    if (perpix == 2) {
-      for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
-	tmp = *byte0;
-	*byte0 = *byte1;
-	*byte1 = tmp;
+# ifdef BYTE_SWAP 
+  {
+    int i;
+    unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
+    int perpix;
+
+    perpix = abs(matrix[0].bitpix) / 8;
+    if (perpix > 1) {
+      byte0 = (unsigned char *) matrix[0].buffer;
+      byte1 = (unsigned char *) matrix[0].buffer + 1;
+      byte2 = (unsigned char *) matrix[0].buffer + 2;
+      byte3 = (unsigned char *) matrix[0].buffer + 3;
+      byte4 = (unsigned char *) matrix[0].buffer + 4;
+      byte5 = (unsigned char *) matrix[0].buffer + 5;
+      byte6 = (unsigned char *) matrix[0].buffer + 6;
+      byte7 = (unsigned char *) matrix[0].buffer + 7;
+      if (perpix == 2) {
+	for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
+	  tmp = *byte0;
+	  *byte0 = *byte1;
+	  *byte1 = tmp;
+	}
       }
-    }
-    if (perpix == 4) {
-      for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
-	tmp = *byte0;
-	*byte0 = *byte3;
-	*byte3 = tmp;
-	tmp = *byte1;
-	*byte1 = *byte2;
-	*byte2 = tmp;
+      if (perpix == 4) {
+	for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
+	  tmp = *byte0;
+	  *byte0 = *byte3;
+	  *byte3 = tmp;
+	  tmp = *byte1;
+	  *byte1 = *byte2;
+	  *byte2 = tmp;
+	}
       }
-    }
-    if (perpix == 8) {
-      for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
-	tmp = *byte0;
-	*byte0 = *byte7;
-	*byte7 = tmp;
-	tmp = *byte1;
-	*byte1 = *byte6;
-	*byte6 = tmp;
-	tmp = *byte1;
-	*byte2 = *byte5;
-	*byte5 = tmp;
-	tmp = *byte1;
-	*byte3 = *byte4;
-	*byte4 = tmp;
+      if (perpix == 8) {
+	for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
+	  tmp = *byte0;
+	  *byte0 = *byte7;
+	  *byte7 = tmp;
+	  tmp = *byte1;
+	  *byte1 = *byte6;
+	  *byte6 = tmp;
+	  tmp = *byte1;
+	  *byte2 = *byte5;
+	  *byte5 = tmp;
+	  tmp = *byte1;
+	  *byte3 = *byte4;
+	  *byte4 = tmp;
+	}
       }
     }
Index: trunk/Ohana/src/libfits/table/F_get_column.c
===================================================================
--- trunk/Ohana/src/libfits/table/F_get_column.c	(revision 16093)
+++ trunk/Ohana/src/libfits/table/F_get_column.c	(revision 16139)
@@ -1,14 +1,17 @@
 # include <ohana.h>
 # include <gfitsio.h>
-# define SWAP_BYTE \
-  tmp = Pin[0]; Pin[0] = Pin[1]; Pin[1] = tmp;
-# define SWAP_WORD \
+# define SWAP_BYTE { \
+  char tmp; \
+  tmp = Pin[0]; Pin[0] = Pin[1]; Pin[1] = tmp; }
+# define SWAP_WORD { \
+  char tmp; \
   tmp = Pin[0]; Pin[0] = Pin[3]; Pin[3] = tmp; \
-  tmp = Pin[1]; Pin[1] = Pin[2]; Pin[2] = tmp;
-# define SWAP_DBLE \
+  tmp = Pin[1]; Pin[1] = Pin[2]; Pin[2] = tmp; }
+# define SWAP_DBLE { \
+  char tmp; \
   tmp = Pin[0]; Pin[0] = Pin[7]; Pin[7] = tmp; \
   tmp = Pin[1]; Pin[1] = Pin[6]; Pin[6] = tmp; \
   tmp = Pin[2]; Pin[2] = Pin[5]; Pin[5] = tmp; \
-  tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp;
+  tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp; }
 
 /***********************/
@@ -43,7 +46,6 @@
   int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb;
   char tlabel[80], field[80], format[80], type[16], tmpline[16];
-  char *Pin, *Pout, *array, tmp;
+  char *Pin, *Pout, *array;
   double Bscale, Bzero;
-  int I;
 
   if (label == (char *) NULL) return (FALSE);
@@ -105,5 +107,4 @@
     for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
 # ifdef BYTE_SWAP
-      I = i*Nbytes;
       SWAP_BYTE;
 # endif
@@ -114,5 +115,4 @@
     for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
 # ifdef BYTE_SWAP
-      I = i*Nbytes;
       SWAP_WORD;
 # endif
@@ -123,5 +123,4 @@
     for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
 # ifdef BYTE_SWAP
-      I = i*Nbytes;
       SWAP_WORD;
 # endif
@@ -132,5 +131,4 @@
     for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
 # ifdef BYTE_SWAP
-      I = i*Nbytes;
       SWAP_DBLE;
 # endif
Index: trunk/Ohana/src/libfits/table/F_set_column.c
===================================================================
--- trunk/Ohana/src/libfits/table/F_set_column.c	(revision 16093)
+++ trunk/Ohana/src/libfits/table/F_set_column.c	(revision 16139)
@@ -1,14 +1,17 @@
 # include <ohana.h>
 # include <gfitsio.h>
-# define SWAP_BYTE \
-  tmp = Pout[0]; Pout[0] = Pout[1]; Pout[1] = tmp;
-# define SWAP_WORD \
+# define SWAP_BYTE { \
+  char tmp; \
+  tmp = Pout[0]; Pout[0] = Pout[1]; Pout[1] = tmp; }
+# define SWAP_WORD { \
+  char tmp; \
   tmp = Pout[0]; Pout[0] = Pout[3]; Pout[3] = tmp; \
-  tmp = Pout[1]; Pout[1] = Pout[2]; Pout[2] = tmp;
-# define SWAP_DBLE \
+  tmp = Pout[1]; Pout[1] = Pout[2]; Pout[2] = tmp; }
+# define SWAP_DBLE { \
+  char tmp; \
   tmp = Pout[0]; Pout[0] = Pout[7]; Pout[7] = tmp; \
   tmp = Pout[1]; Pout[1] = Pout[6]; Pout[6] = tmp; \
   tmp = Pout[2]; Pout[2] = Pout[5]; Pout[5] = tmp; \
-  tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp;
+  tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp; }
 
 /***********************/
@@ -17,7 +20,6 @@
   int i, N, Nfields, Nval, Nbytes, Nx, Ny, nbytes, Nstart, Nv, Nb;
   char tlabel[80], field[80], format[80], type[16], tmpline[16];
-  char *Pin, *Pout, *array, tmp;
+  char *Pin, *Pout, *array;
   double Bscale, Bzero;
-  int I;
 
   if (label == (char *) NULL) return (FALSE);
@@ -82,5 +84,4 @@
       *(short *)Pout = (*(short *)Pin - Bzero) / Bscale;
 # ifdef BYTE_SWAP
-      I = i*Nbytes;
       SWAP_BYTE;
 # endif
@@ -91,5 +92,4 @@
       *(int *)Pout = (*(int *)Pin - Bzero) / Bscale;
 # ifdef BYTE_SWAP
-      I = i*Nbytes;
       SWAP_WORD;
 # endif
@@ -100,5 +100,4 @@
       *(float *)Pout = (*(float *)Pin - Bzero) / Bscale;
 # ifdef BYTE_SWAP
-      I = i*Nbytes;
       SWAP_WORD;
 # endif
@@ -109,5 +108,4 @@
       *(double *)Pout = (*(double *)Pin - Bzero) / Bscale;
 # ifdef BYTE_SWAP
-      I = i*Nbytes;
       SWAP_DBLE;
 # endif
