Index: trunk/Ohana/src/opihi/cmd.data/dbconnect.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/dbconnect.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/dbconnect.c	(revision 27435)
@@ -47,5 +47,4 @@
     gprint (GP_ERR, "failed to set interactive timout\n");
     gprint (GP_ERR, "%s\n", mysql_error (connection));
-    free (query);
     return (FALSE);
   }
@@ -57,5 +56,4 @@
     gprint (GP_ERR, "failed to set wait timout\n");
     gprint (GP_ERR, "%s\n", mysql_error (connection));
-    free (query);
     return (FALSE);
   }
@@ -71,5 +69,4 @@
     gprint (GP_ERR, "failed to get timout\n");
     gprint (GP_ERR, "%s\n", mysql_error (connection));
-    free (query);
     return (FALSE);
   }
@@ -84,5 +81,4 @@
     gprint (GP_ERR, "failed to get timout\n");
     gprint (GP_ERR, "%s\n", mysql_error (connection));
-    free (query);
     return (FALSE);
   }
Index: trunk/Ohana/src/opihi/cmd.data/extract.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/extract.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/extract.c	(revision 27435)
@@ -70,6 +70,6 @@
     if ((out[0].header.Naxis[1] != Ny) || (out[0].header.Naxis[0] != Nx)) {
       gprint (GP_ERR, "matrix sizes mis-matched\n");
-      gprint (GP_ERR, "%d x %d  vs  %d x %d\n", Nx, Ny, 
-	       out[0].header.Naxis[0], out[0].header.Naxis[1]);
+      gprint (GP_ERR, "%d x %d  vs  %lld x %lld\n", Nx, Ny, 
+	      (long long) out[0].header.Naxis[0], (long long) out[0].header.Naxis[1]);
       return (FALSE);
     }
Index: trunk/Ohana/src/opihi/cmd.data/keyword.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/keyword.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/keyword.c	(revision 27435)
@@ -107,11 +107,11 @@
       }
       ivalue = !strcasecmp (line, "T");
-      gfits_modify (&buf[0].header, argv[2], "%t", 1, ivalue);
+      gfits_modify_alt (&buf[0].header, argv[2], "%t", 1, ivalue);
       return (TRUE);
     case KEYCOMMENT:
-      gfits_modify (&buf[0].header, argv[2], "%C", 1, line);
+      gfits_modify_alt (&buf[0].header, argv[2], "%C", 1, line);
       return (TRUE);
     case COMMENT:
-      gfits_modify (&buf[0].header, argv[2], "%S", 0, line);
+      gfits_modify_alt (&buf[0].header, argv[2], "%S", 0, line);
       return (TRUE);
     }
@@ -135,5 +135,5 @@
 
   if (ascomment) {
-    status = gfits_scan (&buf[0].header, argv[2], "%C", 1, line);
+    status = gfits_scan_alt (&buf[0].header, argv[2], "%C", 1, line);
     if (!status) goto failure;
     if (argc == 4) 
Index: trunk/Ohana/src/opihi/cmd.data/list_header.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/list_header.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/list_header.c	(revision 27435)
@@ -49,5 +49,5 @@
     gfits_modify (&buf[0].header, "BSCALE", "%lf", 1, bscale);
     gfits_modify (&buf[0].header, "BZERO",  "%lf", 1, bzero);
-    gfits_modify (&buf[0].header, "UNSIGN", "%t",  1, unsign);
+    gfits_modify_alt (&buf[0].header, "UNSIGN", "%t",  1, unsign);
     
   } else {
Index: trunk/Ohana/src/opihi/cmd.data/matrix.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/matrix.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/matrix.c	(revision 27435)
@@ -23,7 +23,7 @@
 
     if (bufB[0].matrix.Naxis[0] != bufC[0].matrix.Naxis[1]) {
-      gprint (GP_ERR, "size mis-match in matrices: (%d x %d) * (%d x %d)\n", 
-	      bufB[0].matrix.Naxis[0], bufB[0].matrix.Naxis[1], 
-	      bufC[0].matrix.Naxis[0], bufC[0].matrix.Naxis[1]);
+      gprint (GP_ERR, "size mis-match in matrices: (%lld x %lld) * (%lld x %lld)\n", 
+	      (long long) bufB[0].matrix.Naxis[0], (long long) bufB[0].matrix.Naxis[1], 
+	      (long long) bufC[0].matrix.Naxis[0], (long long) bufC[0].matrix.Naxis[1]);
       return (FALSE);
     }
Index: trunk/Ohana/src/opihi/cmd.data/rd.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/rd.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/rd.c	(revision 27435)
@@ -153,5 +153,5 @@
     buf[0].header.Naxes = 0;
     ALLOCATE (buf[0].matrix.buffer, char, 1);
-    buf[0].matrix.size = 0;
+    buf[0].matrix.datasize = 0;
     buf[0].bitpix = 16;
     buf[0].bzero = 0;
@@ -222,6 +222,6 @@
   buf[0].unsign = buf[0].header.unsign;
 
-  gprint (GP_LOG, "read %d bytes from %s into buffer %s\n", 
-	   buf[0].header.size + buf[0].matrix.size, argv[2], argv[1]);
+  gprint (GP_LOG, "read %lld bytes from %s into buffer %s\n", 
+	  (long long) buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
 
   blank = 0xffff;
Index: trunk/Ohana/src/opihi/cmd.data/rdseg.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/rdseg.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/rdseg.c	(revision 27435)
@@ -62,6 +62,5 @@
   buf[0].bzero  = buf[0].header.bzero;     /* store the original values */
   buf[0].unsign = buf[0].header.unsign;
-  gprint (GP_LOG, "read %d bytes from %s into buffer %s\n", 
-	   buf[0].header.size + buf[0].matrix.size, argv[2], argv[1]);
+  gprint (GP_LOG, "read %lld bytes from %s into buffer %s\n", (long long) buf[0].header.datasize + buf[0].matrix.datasize, argv[2], argv[1]);
 
   gfits_scan (&buf[0].header, "BLANK", "%d", 1, &blank);
Index: trunk/Ohana/src/opihi/cmd.data/read_vectors.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/read_vectors.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/read_vectors.c	(revision 27435)
@@ -57,5 +57,5 @@
     return (FALSE);
   }
-  fseek (f, 0, SEEK_SET);
+  fseeko (f, 0LL, SEEK_SET);
 
   Nvec = (argc - 1) / 2;
@@ -159,5 +159,6 @@
 int read_table_vectors (int argc, char **argv, char *extname) {
 
-  int i, j, k, N, Nbytes, Nextend, Ny, Binary, vecType;
+  off_t Nbytes;
+  int i, j, k, N, Nextend, Ny, Binary, vecType;
   char type[16], ID[80], *CCDKeyword;
   FTable table;
@@ -184,5 +185,5 @@
 
   if (f == NULL) ESCAPE ("file not found");
-  fseek (f, 0, SEEK_SET);
+  fseeko (f, 0LL, SEEK_SET);
   table.header = &header;
 
@@ -193,5 +194,5 @@
     if (!gfits_load_header (f, &header)) ESCAPE ("error reading primary header for file");
     Nbytes = gfits_data_size (&header);
-    fseek (f, Nbytes, SEEK_CUR);
+    fseeko (f, Nbytes, SEEK_CUR);
     gfits_free_header (&header);
 
@@ -200,5 +201,5 @@
       Nbytes = gfits_data_size (&header);
       /* skip the prior data buffers */
-      fseek (f, Nbytes, SEEK_CUR);
+      fseeko (f, Nbytes, SEEK_CUR);
       gfits_free_header (&header);
     }
@@ -215,14 +216,14 @@
 
     while (1) {
-      if (!gfits_load_header (f, &header)) ESCAPE ("extensio not found in file");
+      if (!gfits_load_header (f, &header)) ESCAPE ("extension not found in file");
       Nbytes = gfits_data_size (&header);
 
       if (!gfits_scan (&header, CCDKeyword, "%s", 1, ID)) {
-	fseek (f, Nbytes, SEEK_CUR);
+	fseeko (f, Nbytes, SEEK_CUR);
 	gfits_free_header (&header);
 	continue;
       }
       if (strcmp (ID, extname)) {
-	fseek (f, Nbytes, SEEK_CUR);
+	fseeko (f, Nbytes, SEEK_CUR);
 	gfits_free_header (&header);
 	continue;
Index: trunk/Ohana/src/opihi/cmd.data/rebin.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/rebin.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/rebin.c	(revision 27435)
@@ -63,5 +63,5 @@
     }      
   }
-  if (VERBOSE) gprint (GP_LOG, "rebin %s to %s (%d,%d to %d,%d)\n", argv[1], argv[2], in[0].header.Naxis[0], in[0].header.Naxis[1], nx, ny);
+  if (VERBOSE) gprint (GP_LOG, "rebin %s to %s (%lld,%lld to %d,%d)\n", argv[1], argv[2], (long long) in[0].header.Naxis[0], (long long) in[0].header.Naxis[1], nx, ny);
 
   Nx = in[0].header.Naxis[0];
Index: trunk/Ohana/src/opihi/cmd.data/relocate.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/relocate.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/relocate.c	(revision 27435)
@@ -3,5 +3,4 @@
 int relocate (int argc, char **argv) {
 
-  char *end;
   int x, y;
   int N, kapa;
Index: trunk/Ohana/src/opihi/cmd.data/rotate.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/rotate.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/rotate.c	(revision 27435)
@@ -43,5 +43,5 @@
     gfits_modify (&buf[0].header, "NAXIS1", "%d", 1, NY);
     gfits_modify (&buf[0].header, "NAXIS2", "%d", 1, NX);
-    gfits_print  (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
+    gfits_print_alt (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
     gfits_create_matrix (&buf[0].header, &buf[0].matrix);
     out_buff = (float *)buf[0].matrix.buffer;
@@ -82,5 +82,5 @@
     gfits_modify (&buf[0].header, "NAXIS1", "%d", 1, NY);
     gfits_modify (&buf[0].header, "NAXIS2", "%d", 1, NX);
-    gfits_print  (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
+    gfits_print_alt (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
     gfits_create_matrix (&buf[0].header, &buf[0].matrix);
     out_buff = (float *)buf[0].matrix.buffer;
@@ -120,5 +120,5 @@
 
   if (!strcasecmp (argv[2], "UPSIDE") || (atof (argv[2]) == -180) || (atof (argv[2]) == 180)) {
-    gfits_print  (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
+    gfits_print_alt (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
     gfits_create_matrix (&buf[0].header, &buf[0].matrix);
     out_buff = (float *)buf[0].matrix.buffer;
@@ -155,5 +155,5 @@
 
   if (!strcasecmp (argv[2], "FLIPY")) {
-    gfits_print  (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
+    gfits_print_alt (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
     gfits_create_matrix (&buf[0].header, &buf[0].matrix);
     out_buff = (float *)buf[0].matrix.buffer;
@@ -190,5 +190,5 @@
 
   if (!strcasecmp (argv[2], "FLIPX")) {
-    gfits_print  (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
+    gfits_print_alt (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
     gfits_create_matrix (&buf[0].header, &buf[0].matrix);
     out_buff = (float *)buf[0].matrix.buffer;
@@ -272,5 +272,5 @@
   gfits_modify (&buf[0].header, "NAXIS2", "%d", 1, Ly);
   gfits_create_matrix (&buf[0].header, &buf[0].matrix);
-  gfits_print  (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
+  gfits_print_alt (&buf[0].header, "HISTORY", "%S", 1, "WARNING: rotated image!");
   out_buff = (float *)buf[0].matrix.buffer;
   for (j = 0; j < Ly; j++) {
Index: trunk/Ohana/src/opihi/cmd.data/test/dimendown.sh
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/test/dimendown.sh	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/test/dimendown.sh	(revision 27435)
@@ -42,5 +42,5 @@
  $startmem = $word:1
 
- for i 0 1000
+ for i 0 10000
   dimendown timg val
   dimendown timg xc -x
@@ -53,5 +53,5 @@
  $PASS = 1
 
- if ($endmem - $startmem > 10)
+ if ($endmem - $startmem > 128)
    $PASS = 0
    echo "growth: {$endmem-$startmem}"
Index: trunk/Ohana/src/opihi/cmd.data/test/integrate.sh
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/test/integrate.sh	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/test/integrate.sh	(revision 27435)
@@ -40,5 +40,5 @@
  $PASS = 1
 
- if ($endmem - $startmem > 10)
+ if ($endmem - $startmem > 128)
    $PASS = 0
    echo "growth: {$endmem-$startmem}"
Index: trunk/Ohana/src/opihi/cmd.data/test/interpolate.sh
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/test/interpolate.sh	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/test/interpolate.sh	(revision 27435)
@@ -41,5 +41,5 @@
  $PASS = 1
 
- if ($endmem - $startmem > 10)
+ if ($endmem - $startmem > 128)
    $PASS = 0
    echo "growth: {$endmem-$startmem}"
Index: trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh	(revision 27435)
@@ -136,5 +136,5 @@
  $PASS = 1
 
- if ($endmem - $startmem > 10)
+ if ($endmem - $startmem > 180)
    $PASS = 0
    echo "growth: {$endmem-$startmem}"
Index: trunk/Ohana/src/opihi/cmd.data/wd.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/wd.c	(revision 27185)
+++ trunk/Ohana/src/opihi/cmd.data/wd.c	(revision 27435)
@@ -75,9 +75,9 @@
   /* save the (float) version, write out a temporary buffer */
   temp_matrix = buf[0].matrix;
-  ALLOCATE (temp_matrix.buffer, char, MAX(1, temp_matrix.size));
-  memcpy (temp_matrix.buffer, buf[0].matrix.buffer, temp_matrix.size);
+  ALLOCATE (temp_matrix.buffer, char, MAX(1, temp_matrix.datasize));
+  memcpy (temp_matrix.buffer, buf[0].matrix.buffer, temp_matrix.datasize);
   temp_header = buf[0].header;
-  ALLOCATE (temp_header.buffer, char, MAX(1, temp_header.size));
-  memcpy (temp_header.buffer, buf[0].header.buffer, temp_header.size);
+  ALLOCATE (temp_header.buffer, char, MAX(1, temp_header.datasize));
+  memcpy (temp_header.buffer, buf[0].header.buffer, temp_header.datasize);
 
   if (temp_header.Naxes) {
@@ -88,5 +88,5 @@
     gfits_modify (&temp_header, "BSCALE", "%lf", 1, outScale);
     gfits_modify (&temp_header, "BZERO",  "%lf", 1, outZero);
-    gfits_modify (&temp_header, "UNSIGN", "%t", 1, outUnsign);
+    gfits_modify_alt (&temp_header, "UNSIGN", "%t", 1, outUnsign);
   }
 
@@ -94,4 +94,5 @@
     Header Xhead;
     FILE *f;
+    off_t nbytes;
     int status, Nextend;
 
@@ -109,5 +110,5 @@
     }
 
-    gfits_modify (&Xhead, "EXTEND", "%t", 1, TRUE);
+    gfits_modify_alt (&Xhead, "EXTEND", "%t", 1, TRUE);
 
     Nextend = 0;
@@ -125,7 +126,7 @@
     
     /* position to begining of file to write header */
-    fseek (f, 0, SEEK_SET);
-    status = fwrite (Xhead.buffer, 1, Xhead.size, f);
-    if (status != Xhead.size) {
+    fseeko (f, 0LL, SEEK_SET);
+    nbytes = fwrite (Xhead.buffer, 1, Xhead.datasize, f);
+    if (nbytes != Xhead.datasize) {
       gprint (GP_ERR, "ERROR: failed writing data to image header\n");
       status = FALSE;
@@ -144,8 +145,8 @@
 
     /* position to end of file to write new extend */
-    fseek (f, 0, SEEK_END);
-    status = fwrite (temp_header.buffer, 1, temp_header.size, f);
+    fseeko (f, 0LL, SEEK_END);
+    nbytes = fwrite (temp_header.buffer, 1, temp_header.datasize, f);
     fclose (f);
-    if (status != temp_header.size) {
+    if (nbytes != temp_header.datasize) {
       gprint (GP_ERR, "failed to write file\n");
       status = FALSE;
