Index: /branches/eam_branches/ohana.20160226/src/libdvo/include/libdvo_astro.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/include/libdvo_astro.h	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/include/libdvo_astro.h	(revision 39409)
@@ -68,6 +68,6 @@
   AstromOffsetMap **map;
    int *imageIDtoTableSeq;
-  int MaxImageID;
-  int MaxTableID;
+  unsigned int MaxImageID;
+  unsigned int MaxTableID;
 } AstromOffsetTable;
 
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapIO.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapIO.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapIO.c	(revision 39409)
@@ -148,5 +148,6 @@
 AstromOffsetTable *AstromOffsetMapToTable(AstromOffsetMap_Disk_6x6 *map_disk, off_t Nmap) {
 
-  int i, j, k;
+  unsigned int i;
+  int j, k;
 
   AstromOffsetTable *table = NULL;
@@ -157,9 +158,9 @@
 
   // find the max value of imageID
-  int MaxTableID = 0;
-  int MaxImageID = 0;
+  unsigned int MaxTableID = 0;
+  unsigned int MaxImageID = 0;
   for (i = 0; i < Nmap; i++) {
-    MaxTableID = MAX(map_disk[i].tableID, MaxTableID);
-    MaxImageID = MAX(map_disk[i].imageID, MaxImageID);
+    MaxTableID = MAX(MaxTableID, map_disk[i].tableID);
+    MaxImageID = MAX(MaxImageID, map_disk[i].imageID);
   }
   table->MaxTableID = MaxTableID;
@@ -312,27 +313,34 @@
 int AstromOffsetTableSetIDs (AstromOffsetTable *table) {
 
-  int i;
-
   // find the max value of imageID
-  int MaxTableID = 0;
-  int MaxImageID = 0;
-  for (i = 0; i < table->Nmap; i++) {
-    MaxTableID = MAX(table->map[i][0].tableID, MaxTableID);
-    MaxImageID = MAX(table->map[i][0].imageID, MaxImageID);
-  }
-  table->MaxTableID = MaxTableID;
-  table->MaxImageID = MaxImageID;
+  unsigned int MaxTableID = 0;
+  unsigned int MaxImageID = 0;
+  {
+    int j;
+    for (j = 0; j < table->Nmap; j++) {
+      MaxTableID = MAX(MaxTableID, table->map[j][0].tableID);
+      MaxImageID = MAX(MaxImageID, table->map[j][0].imageID);
+    }
+    table->MaxTableID = MaxTableID;
+    table->MaxImageID = MaxImageID;
+  }
 
   // generate the index and init values to -1
-  ALLOCATE (table->imageIDtoTableSeq, int, MaxImageID + 1);
-  for (i = 0; i <= MaxImageID; i++) {
-    table->imageIDtoTableSeq[i] = -1;
+  {
+    unsigned int i;
+    ALLOCATE (table->imageIDtoTableSeq, int, MaxImageID + 1);
+    for (i = 0; i <= MaxImageID; i++) {
+      table->imageIDtoTableSeq[i] = -1;
+    }
   }
 
   // assign the ID values
-  for (i = 0; i < table->Nmap; i++) {
-    int ImageID = table->map[i][0].imageID;
-    myAssert (table->imageIDtoTableSeq[ImageID] == -1, "oops, duplicate image IDs");
-    table->imageIDtoTableSeq[ImageID] = i;
+  { 
+    int j;
+    for (j = 0; j < table->Nmap; j++) {
+      int ImageID = table->map[j][0].imageID;
+      myAssert (table->imageIDtoTableSeq[ImageID] == -1, "oops, duplicate image IDs");
+      table->imageIDtoTableSeq[ImageID] = j;
+    }
   }
   return TRUE;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapUtils.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapUtils.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapUtils.c	(revision 39409)
@@ -11,6 +11,7 @@
   off_t i;
   for (i = 0; i < Nimages; i++) {
-    int imageID = images[i].imageID;
-    if (imageID < 0) continue;
+    if (images[i].imageID < 0) continue;
+
+    unsigned int imageID = images[i].imageID;
     if (imageID > table->MaxImageID) continue;
     
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_chipcoords.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_chipcoords.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_chipcoords.c	(revision 39409)
@@ -1,5 +1,5 @@
 # include <dvo.h>
 
-int dvo_match_image (Image *image, int Nimage, unsigned int T, short int S) {
+int dvo_match_image (Image *image, int Nimage, int T, short int S) {
 
   int N, Nlo, Nhi, N1, N2;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_mef.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_mef.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_mef.c	(revision 39409)
@@ -17,9 +17,9 @@
      it is not defined for a legacy database, we can generate them using the existing index values.
      If it is missing, give a warning and recommend the user upgrade the DB */
-  if (!gfits_scan (&catalog[0].header, "OBJID",    "%d", 1, &catalog[0].objID)) {
+  if (!gfits_scan (&catalog[0].header, "OBJID",    "%u", 1, &catalog[0].objID)) {
     if (VERBOSE) fprintf (stderr, "WARNING: OBJID is not set for %s: upgrade for full feature set\n", catalog[0].filename);
     catalog[0].objID = 0;
   }
-  if (!gfits_scan (&catalog[0].header, "CATID",    "%d", 1, &catalog[0].catID)) {
+  if (!gfits_scan (&catalog[0].header, "CATID",    "%u", 1, &catalog[0].catID)) {
     if (VERBOSE) fprintf (stderr, "WARNING: CATID is not set for %s: upgrade for full feature set\n", catalog[0].filename);
     catalog[0].catID = 0;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_raw.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_raw.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_catalog_raw.c	(revision 39409)
@@ -29,9 +29,9 @@
      it is not defined for a legacy database, we can generate them using the existing index values.
      If it is missing, give a warning and recommend the user upgrade the DB */
-  if (!gfits_scan (&catalog[0].header, "OBJID",    "%d", 1, &catalog[0].objID)) {
+  if (!gfits_scan (&catalog[0].header, "OBJID",    "%u", 1, &catalog[0].objID)) {
     if (VERBOSE) fprintf (stderr, "WARNING: OBJID is not set for this database: upgrade for full feature set\n");
     catalog[0].objID = 0;
   }
-  if (!gfits_scan (&catalog[0].header, "CATID",    "%d", 1, &catalog[0].catID)) {
+  if (!gfits_scan (&catalog[0].header, "CATID",    "%u", 1, &catalog[0].catID)) {
     if (VERBOSE) fprintf (stderr, "WARNING: CATID is not set for this database: upgrade for full feature set\n");
     catalog[0].catID = 0;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert.c	(revision 39409)
@@ -320,4 +320,5 @@
 
 Missing *FtableToMissing (FTable *ftable, Average *average, off_t *Nmissing, DVOCatFormat *format, char nativeBytes) {
+  OHANA_UNUSED_PARAM(average);
 
   Missing *missing;
@@ -397,4 +398,5 @@
 
 SecFilt *FtableToSecFilt (FTable *ftable, Average *average, off_t *Nsecfilt, DVOCatFormat *format, char nativeBytes) {
+  OHANA_UNUSED_PARAM(average);
 
   SecFilt *secfilt;
@@ -509,4 +511,5 @@
 
 Lensing *FtableToLensing (FTable *ftable, Average *average, off_t *Nlensing, DVOCatFormat *format, char nativeBytes) {
+  OHANA_UNUSED_PARAM(average);
 
   Lensing *lensing;
@@ -652,4 +655,5 @@
 
 Lensobj *FtableToLensobj (FTable *ftable, Average *average, off_t *Nlensobj, DVOCatFormat *format, char nativeBytes) {
+  OHANA_UNUSED_PARAM(average);
 
   Lensobj *lensobj;
@@ -769,4 +773,5 @@
 
 StarPar *FtableToStarPar (FTable *ftable, Average *average, off_t *Nstarpar, DVOCatFormat *format, char nativeBytes) {
+  OHANA_UNUSED_PARAM(average);
 
   StarPar *starpar;
@@ -874,4 +879,5 @@
 
 GalPhot *FtableToGalPhot (FTable *ftable, Average *average, off_t *Ngalphot, DVOCatFormat *format, char nativeBytes) {
+  OHANA_UNUSED_PARAM(average);
 
   GalPhot *galphot;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_DEV_1.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_DEV_1.c	(revision 39409)
@@ -100,4 +100,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_DEV_1_ToInternal (Average_PS1_DEV_1 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -138,4 +139,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_DEV_1 *AverageInternalTo_PS1_DEV_1 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_DEV_2.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_DEV_2.c	(revision 39409)
@@ -97,4 +97,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_DEV_2_ToInternal (Average_PS1_DEV_2 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -133,4 +134,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_DEV_2 *AverageInternalTo_PS1_DEV_2 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_REF.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_REF.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_REF.c	(revision 39409)
@@ -55,4 +55,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_REF_ToInternal (Average_PS1_REF *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -80,4 +81,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_REF *AverageInternalTo_PS1_REF (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_SIM.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_SIM.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_SIM.c	(revision 39409)
@@ -4,4 +4,5 @@
 
 Measure *Measure_PS1_SIM_ToInternal (Average *ave, Measure_PS1_SIM *in, off_t Nvalues) {
+  OHANA_UNUSED_PARAM(ave);
 
   off_t i;
@@ -51,4 +52,5 @@
 
 Measure_PS1_SIM *MeasureInternalTo_PS1_SIM (Average *ave, Measure *in, off_t Nvalues) {
+  OHANA_UNUSED_PARAM(ave);
 
   off_t i;
@@ -97,4 +99,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_SIM_ToInternal (Average_PS1_SIM *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -143,4 +146,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_SIM *AverageInternalTo_PS1_SIM (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V1.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V1.c	(revision 39409)
@@ -115,4 +115,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_V1_ToInternal (Average_PS1_V1 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -152,4 +153,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_V1 *AverageInternalTo_PS1_V1 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V2.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V2.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V2.c	(revision 39409)
@@ -116,4 +116,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_V2_ToInternal (Average_PS1_V2 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -157,4 +158,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_V2 *AverageInternalTo_PS1_V2 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V3.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V3.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V3.c	(revision 39409)
@@ -116,4 +116,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_V3_ToInternal (Average_PS1_V3 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -159,4 +160,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_V3 *AverageInternalTo_PS1_V3 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V4.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V4.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V4.c	(revision 39409)
@@ -134,4 +134,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_V4_ToInternal (Average_PS1_V4 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -180,4 +181,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_V4 *AverageInternalTo_PS1_V4 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V5.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_PS1_V5.c	(revision 39409)
@@ -4,4 +4,5 @@
 
 Measure *Measure_PS1_V5_ToInternal (Average *ave, Measure_PS1_V5 *in, off_t Nvalues) {
+  OHANA_UNUSED_PARAM(ave);
 
   off_t i;
@@ -79,4 +80,5 @@
 
 Measure_PS1_V5 *MeasureInternalTo_PS1_V5 (Average *ave, Measure *in, off_t Nvalues) {
+  OHANA_UNUSED_PARAM(ave);
 
   off_t i;
@@ -153,4 +155,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_PS1_V5_ToInternal (Average_PS1_V5 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -225,4 +228,5 @@
 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used
 Average_PS1_V5 *AverageInternalTo_PS1_V5 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -1640,4 +1644,5 @@
 
 Measure *Measure_PS1_V5alt_ToInternal (Average *ave, Measure_PS1_V5alt *in, off_t Nvalues) {
+  OHANA_UNUSED_PARAM(ave);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c	(revision 39409)
@@ -106,4 +106,5 @@
 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_Panstarrs_DEV_0_ToInternal (Average_Panstarrs_DEV_0 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -143,4 +144,5 @@
 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
 Average_Panstarrs_DEV_0 *AverageInternalTo_Panstarrs_DEV_0 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c	(revision 39409)
@@ -106,4 +106,5 @@
 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
 Average *Average_Panstarrs_DEV_1_ToInternal (Average_Panstarrs_DEV_1 *in, off_t Nvalues, SecFilt **primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
@@ -143,4 +144,5 @@
 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used
 Average_Panstarrs_DEV_1 *AverageInternalTo_Panstarrs_DEV_1 (Average *in, off_t Nvalues, SecFilt *primary) {
+  OHANA_UNUSED_PARAM(primary);
 
   off_t i;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_photcode_ops.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_photcode_ops.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_photcode_ops.c	(revision 39409)
@@ -467,4 +467,5 @@
 /***/
 float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return NAN;
@@ -572,4 +573,5 @@
 
 float PhotCalErr (Measure *measure, dvoMagClassType class) {
+  OHANA_UNUSED_PARAM(class);
 
   float dMcal = measure[0].dMcal;
@@ -578,4 +580,5 @@
 
 float PhotAveErr (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return NAN;
@@ -640,4 +643,6 @@
 
 float PhotZeroPoint (Measure *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   int Np;
@@ -710,4 +715,5 @@
 
 float PhotMstdev (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return NAN;
@@ -757,4 +763,5 @@
 // return the number of detections in this filter (gpc1)
 int PhotNcode (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return 0;
@@ -768,4 +775,5 @@
 // return the number of detections in this filter (gpc1)
 int PhotSecfiltFlags (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return 0;
@@ -778,4 +786,5 @@
 
 int PhotNphot (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return 0;
@@ -824,4 +833,5 @@
 
 float PhotAveFluxPSF (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -836,4 +846,5 @@
 
 float PhotAvedFluxPSF (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -848,4 +859,5 @@
 
 float PhotAveFluxKron (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -860,4 +872,5 @@
 
 float PhotAvedFluxKron (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -872,4 +885,5 @@
 
 float PhotMmin (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -884,4 +898,5 @@
 
 float PhotMmax (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -896,4 +911,5 @@
 
 float PhotUCdist (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -921,4 +937,5 @@
 // Xm is now (2014.07.03) stored as the chisq except in dvo formats which use as short
 float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -1188,4 +1205,5 @@
 /***/
 float PhotFluxAve (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return NAN;
@@ -1248,4 +1266,5 @@
 
 float PhotFluxAveErr (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return NAN;
@@ -1610,4 +1629,5 @@
 /***/
 float PhotAveTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) {
+  OHANA_UNUSED_PARAM(average);
 
   if (code == NULL) return NAN;
@@ -1746,4 +1766,5 @@
 
 float PhotdMTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -1759,4 +1780,5 @@
 // Xm is now (2014.07.03) stored as the chisq except in dvo formats which use as short
 float PhotXmTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
 
   int Ns;
@@ -1853,45 +1875,45 @@
 }
 
-LENSFIELD(X11_sm_obj);
-LENSFIELD(X12_sm_obj);
-LENSFIELD(X22_sm_obj);
-LENSFIELD(E1_sm_obj);
-LENSFIELD(E2_sm_obj);
-
-LENSFIELD(X11_sh_obj);
-LENSFIELD(X12_sh_obj);
-LENSFIELD(X22_sh_obj);
-LENSFIELD(E1_sh_obj);
-LENSFIELD(E2_sh_obj);
-
-LENSFIELD(X11_sm_psf);
-LENSFIELD(X12_sm_psf);
-LENSFIELD(X22_sm_psf);
-LENSFIELD(E1_sm_psf);
-LENSFIELD(E2_sm_psf);
-
-LENSFIELD(X11_sh_psf);
-LENSFIELD(X12_sh_psf);
-LENSFIELD(X22_sh_psf);
-LENSFIELD(E1_sh_psf);
-LENSFIELD(E2_sh_psf);
-
-LENSFIELD( F_ApR5);
-LENSFIELD(dF_ApR5);
-LENSFIELD(sF_ApR5);
-LENSFIELD(fF_ApR5);
-
-LENSFIELD( F_ApR6);
-LENSFIELD(dF_ApR6);
-LENSFIELD(sF_ApR6);
-LENSFIELD(fF_ApR6);
-
-LENSFIELD( F_ApR7);
-LENSFIELD(dF_ApR7);
-LENSFIELD(sF_ApR7);
-LENSFIELD(fF_ApR7);
-
-LENSFIELD(E1);
-LENSFIELD(E2);
+LENSFIELD(X11_sm_obj)
+LENSFIELD(X12_sm_obj)
+LENSFIELD(X22_sm_obj)
+LENSFIELD(E1_sm_obj)
+LENSFIELD(E2_sm_obj)
+
+LENSFIELD(X11_sh_obj)
+LENSFIELD(X12_sh_obj)
+LENSFIELD(X22_sh_obj)
+LENSFIELD(E1_sh_obj)
+LENSFIELD(E2_sh_obj)
+
+LENSFIELD(X11_sm_psf)
+LENSFIELD(X12_sm_psf)
+LENSFIELD(X22_sm_psf)
+LENSFIELD(E1_sm_psf)
+LENSFIELD(E2_sm_psf)
+
+LENSFIELD(X11_sh_psf)
+LENSFIELD(X12_sh_psf)
+LENSFIELD(X22_sh_psf)
+LENSFIELD(E1_sh_psf)
+LENSFIELD(E2_sh_psf)
+
+LENSFIELD( F_ApR5)
+LENSFIELD(dF_ApR5)
+LENSFIELD(sF_ApR5)
+LENSFIELD(fF_ApR5)
+
+LENSFIELD( F_ApR6)
+LENSFIELD(dF_ApR6)
+LENSFIELD(sF_ApR6)
+LENSFIELD(fF_ApR6)
+
+LENSFIELD( F_ApR7)
+LENSFIELD(dF_ApR7)
+LENSFIELD(sF_ApR7)
+LENSFIELD(fF_ApR7)
+
+LENSFIELD(E1)
+LENSFIELD(E2)
 
 # if (1)
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvosorts.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvosorts.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvosorts.c	(revision 39409)
@@ -76,4 +76,5 @@
 /* sort a coordinate pair (X,Y) and the associated index (S) */
 void sort_coords_indexonly (double *X, double *Y, off_t *S, off_t N) {
+  OHANA_UNUSED_PARAM(Y);
   
 # define SWAPFUNC(A,B){ off_t itmp; \
Index: /branches/eam_branches/ohana.20160226/src/libfits/extern/gzip.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/extern/gzip.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/extern/gzip.c	(revision 39409)
@@ -122,5 +122,5 @@
 
   z_stream stream;
-  int i, err;
+  int err;
   
   stream.next_in = (Bytef*)source;
@@ -140,4 +140,5 @@
   if (EXTRA_VERBOSE) {
     fprintf (stderr, "inp cmp: ");
+    unsigned long int i;
     for (i = 0; i < sourceLen; i++) {
       fprintf (stderr, "0x%02hhx ", source[i]);
@@ -165,4 +166,5 @@
   if (EXTRA_VERBOSE) {
     fprintf (stderr, "out cmp: ");
+    unsigned long int i;
     for (i = 0; i < stream.total_out; i++) {
       fprintf (stderr, "0x%02hhx ", dest[i]);
@@ -182,5 +184,5 @@
 
   z_stream stream;
-  int i, err;
+  int err;
   
   stream.next_in = (Bytef*)source;
@@ -200,4 +202,5 @@
   if (EXTRA_VERBOSE) {
     fprintf (stderr, "inp unc: ");
+    unsigned long int i;
     for (i = 0; i < sourceLen; i++) {
       fprintf (stderr, "0x%02hhx ", source[i]);
@@ -226,4 +229,5 @@
   if (EXTRA_VERBOSE) {
     fprintf (stderr, "out unc: ");
+    unsigned long int i;
     for (i = 0; i < stream.total_out; i++) {
       fprintf (stderr, "0x%02hhx ", dest[i]);
Index: /branches/eam_branches/ohana.20160226/src/libfits/header/F_write_H.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/header/F_write_H.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/header/F_write_H.c	(revision 39409)
@@ -25,5 +25,5 @@
     myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory");
     myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory");
-    myAssert (myBlock->size >= header[0].datasize, "overflow");
+    myAssert (myBlock->size >= (size_t) header[0].datasize, "overflow");
   }
 # endif
Index: /branches/eam_branches/ohana.20160226/src/libfits/include/gfitsio.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/include/gfitsio.h	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/include/gfitsio.h	(revision 39409)
@@ -193,23 +193,23 @@
 
 int     gfits_uncompress_image 	       PROTO((Header *header, Matrix *matrix, FTable *ftable));
-int     gfits_uncompress_data  	       PROTO((char *zdata, int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, int *Nout, int Nout_alloc, int out_pixsize));
-int     gfits_distribute_data  	       PROTO((Matrix *matrix, char *data, int Ndata, int bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero));
-
-int     gfits_compress_data  	       PROTO((char *zdata, int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata, int Nraw, int raw_pixsize, int Nx, int Ny));
-int     gfits_compress_image 	       PROTO((Header *header, Matrix *matrix, FTable *ftable, int *Ztile, char *zcmptype));
-int     gfits_collect_data   	       PROTO((Matrix *matrix, char *raw, int Nraw, int raw_pixsize, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero));
+int     gfits_uncompress_data  	       PROTO((char *zdata, unsigned long int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, unsigned long int *Nout, unsigned long int Nout_alloc, int out_pixsize));
+int     gfits_distribute_data  	       PROTO((Matrix *matrix, char *data, unsigned long int Ndata, int bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero));
+
+int     gfits_compress_data  	       PROTO((char *zdata, unsigned long int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata, unsigned long int Nraw, int raw_pixsize, int Nx, int Ny));
+int     gfits_compress_image 	       PROTO((Header *header, Matrix *matrix, FTable *ftable, unsigned long int *Ztile, char *zcmptype));
+int     gfits_collect_data   	       PROTO((Matrix *matrix, char *raw, unsigned long int Nraw, int raw_pixsize, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero));
 
 int     gfits_copy_keywords_compress   PROTO((Header *srchead, Header *tgthead));
 int     gfits_swap_raw   	       PROTO((Matrix *matrix));
 
-off_t   gfits_tile_size                PROTO((Matrix *matrix, int *otile, int *ztile));
-int 	gfits_imtile_maxsize           PROTO((Matrix *matrix, int *ztile));
-int 	gfits_imtile_count             PROTO((Matrix *matrix, int *ztile, int *ntile));
+off_t   gfits_tile_size                PROTO((Matrix *matrix, int *otile, unsigned long int *ztile));
+int 	gfits_imtile_maxsize           PROTO((Matrix *matrix, unsigned long int *ztile));
+int 	gfits_imtile_count             PROTO((Matrix *matrix, unsigned long int *ztile, int *ntile));
 int 	gfits_imtile_start             PROTO((Matrix *matrix, int *otile));
-int 	gfits_imtile_next              PROTO((Matrix *matrix, int *ztile, int *ntile, int *otile));
+int 	gfits_imtile_next              PROTO((Matrix *matrix, unsigned long int *ztile, int *ntile, int *otile));
 
 int     gfits_extension_is_compressed_image  PROTO((Header *header));
 int     gfits_extension_is_compressed_table  PROTO((Header *header));
-int     gfits_byteswap_zdata   	        PROTO((char *zdata, int Nzdata, int pixsize));
+int     gfits_byteswap_zdata   	        PROTO((char *zdata, off_t Nzdata, int pixsize));
 int     gfits_compressed_data_pixsize   PROTO((char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions));
 int     gfits_uncompressed_data_pixsize PROTO((char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions));
@@ -279,5 +279,5 @@
 int     gfits_write_Theader            PROTO((char *filename, Header *header));
 
-int     gfits_compress_table           PROTO((FTable *srctable, FTable *tgttable, int ztilelen, char *zcmptype));
+int     gfits_compress_table           PROTO((FTable *srctable, FTable *tgttable, unsigned long int ztilelen, char *zcmptype));
 int     gfits_uncompress_table         PROTO((FTable *srctable, FTable *tgttable));
 
Index: /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_M.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_M.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_M.c	(revision 39409)
@@ -4,5 +4,5 @@
 # define VERBOSE_DUMP 0
 
-int gfits_collect_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero);
+int gfits_collect_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero);
 
 // the user needs to specify the various compression options:
@@ -23,5 +23,5 @@
 # define ESCAPE { fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); goto escape; }
 
-int gfits_compress_image (Header *header, Matrix *matrix, FTable *ftable, int *Ztile, char *zcmptype) {
+int gfits_compress_image (Header *header, Matrix *matrix, FTable *ftable, unsigned long int *Ztile, char *zcmptype) {
 
   int i;
@@ -33,5 +33,5 @@
   char *zdata = NULL;
 
-  int *ztile = Ztile;
+  unsigned long int *ztile = Ztile;
 
   Header *theader = ftable->header;
@@ -41,5 +41,5 @@
   // determine the number of tiles (from ztile[] and image size)
   if (!ztile) {
-    ALLOCATE (ztile, int, matrix->Naxes);
+    ALLOCATE (ztile, unsigned long int, matrix->Naxes);
     ztile[0] = matrix->Naxis[0];
     for (i = 1; i < matrix->Naxes; i++) ztile[i] = 1;
@@ -99,5 +99,5 @@
   for (i = 0; i < header->Naxes; i++) {
     snprintf (keyword, 10, "ZTILE%d", i + 1);
-    if (!gfits_modify (theader, keyword, "%d", 1, ztile[i])) ESCAPE;
+    if (!gfits_modify (theader, keyword, "%lu", 1, ztile[i])) ESCAPE;
   }
 
@@ -157,5 +157,5 @@
 
   // size (in pixels) of the largest tile
-  int max_tile_size = gfits_imtile_maxsize (matrix, ztile);
+  unsigned long int max_tile_size = gfits_imtile_maxsize (matrix, ztile);
 
   // size of a pixel in the raw pixel buffer (before compression)
@@ -179,5 +179,5 @@
 
   // allocate the buffer for compression work
-  int Nzdata_alloc = raw_pixsize*max_tile_size + 100;
+  unsigned long int Nzdata_alloc = raw_pixsize*max_tile_size + 100;
   ALLOCATE (raw,   char, raw_pixsize*max_tile_size);
   ALLOCATE (zdata, char, Nzdata_alloc);
@@ -191,5 +191,5 @@
 
     // size of the current tile in pixels
-    int Nraw = gfits_tile_size (matrix, otile, ztile);
+    unsigned long int Nraw = gfits_tile_size (matrix, otile, ztile);
 
     // copy the raw pixels from their native matrix locations to the temporary output buffer
@@ -216,5 +216,5 @@
       if (!gfits_byteswap_zdata (raw, Nraw * raw_pixsize, raw_pixsize)) ESCAPE;
     }
-    int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression
+    unsigned long int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression
 
     if (VERBOSE_DUMP && (i == 0)) {
@@ -223,5 +223,5 @@
       for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", raw[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
-      fprintf (stderr, "Nzdata: %d -> ", Nzdata);
+      fprintf (stderr, "Nzdata: %lu -> ", Nzdata);
     }
 
@@ -231,5 +231,5 @@
     if (VERBOSE_DUMP && (i == 0)) {
       int k;
-      fprintf (stderr, "%d\n", Nzdata);
+      fprintf (stderr, "%lu\n", Nzdata);
       fprintf (stderr, "cmp SWP: "); 
       for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
@@ -290,9 +290,14 @@
 
 int gfits_copy_keywords_compress (Header *srchead, Header *tgthead) {
-
+  OHANA_UNUSED_PARAM(tgthead);
+  OHANA_UNUSED_PARAM(srchead);
+
+# if (0)
   int i;
 
   for (i = 0; i < srchead->datasize; i += FT_LINE_LENGTH) {
   }
+# endif
+
   return TRUE;
 }
@@ -303,12 +308,12 @@
 // * ztile gives the size of the i-th dimension of the current tile
 // * raw_bitpix defines the size and type of the raw buffer
-int gfits_collect_data (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero) {
-
-  int i, j, start, offset, coord, Nline;
-  int *counter = NULL;
-  int *Ztile = NULL;
-
-  ALLOCATE (counter, int, matrix->Naxes); // counter for current row in tile to copy
-  ALLOCATE (Ztile, int, matrix->Naxes); // true sizes of this tile (in pixels)
+int gfits_collect_data (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) {
+
+  int i, k, start, offset, coord, Nline;
+  unsigned int *counter = NULL;
+  unsigned long int *Ztile = NULL;
+
+  ALLOCATE (counter, unsigned int, matrix->Naxes); // counter for current row in tile to copy
+  ALLOCATE (Ztile, unsigned long int, matrix->Naxes); // true sizes of this tile (in pixels)
   
   for (i = 0; i < matrix->Naxes; i++) {
@@ -343,4 +348,5 @@
   // this macro is used at the inner switch to run the actual loop
 # define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE, INTYPE) {			\
+    unsigned long int j;						\
     TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
@@ -356,4 +362,5 @@
   // this macro is used at the inner switch to run the actual loop
 # define SCALE_AND_DIST_INT(OTYPE, OSIZE) {				\
+    unsigned long int j;						\
     OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
@@ -370,4 +377,5 @@
   // this macro is used at the inner switch to run the actual loop
 # define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) {				\
+    unsigned long int j;						\
     OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
@@ -419,13 +427,13 @@
 
     // update the counters, carrying to the next dimension if needed
-    for (j = 1; j < matrix->Naxes; j++) {
-      counter[j] ++;
-      if (counter[j] == Ztile[j]) {
-	counter[j] = 0;
+    for (k = 1; k < matrix->Naxes; k++) {
+      counter[k] ++;
+      if (counter[k] == Ztile[k]) {
+	counter[k] = 0;
       } else {
 	break;
       }
     }
-    if (j == matrix->Naxes) assert (i == Nline - 1); // we should be done here...
+    if (k == matrix->Naxes) assert (i == Nline - 1); // we should be done here...
 
     // Naxes = 3
@@ -435,6 +443,6 @@
     // determine the offset of the next line relative to the start position
     offset = counter[matrix->Naxes - 1];
-    for (j = matrix->Naxes - 2; j >= 0; j--) {
-      offset = offset*matrix->Naxis[j] + counter[j];
+    for (k = matrix->Naxes - 2; k >= 0; k--) {
+      offset = offset*matrix->Naxis[k] + counter[k];
     }      
   }
@@ -453,24 +461,29 @@
 // * ztile gives the size of the i-th dimension of the current tile
 // * raw_bitpix defines the size and type of the raw buffer
-int gfits_collect_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero) {
-
-  int i, j, k;
-  int *counter = NULL;
-  int *Ztile = NULL;
-
-  ALLOCATE (counter, int, matrix->Naxes); // counter for current row in tile to copy
-  ALLOCATE (Ztile, int, matrix->Naxes); // true sizes of this tile (in pixels)
+int gfits_collect_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) {
+  OHANA_UNUSED_PARAM(oblank);
+  OHANA_UNUSED_PARAM(zblank);
+  OHANA_UNUSED_PARAM(zzero);
+  OHANA_UNUSED_PARAM(zscale);
+
+  unsigned long int i, j;
+  unsigned int *counter = NULL;
+  unsigned long int *Ztile = NULL;
+
+  ALLOCATE (counter, unsigned int, matrix->Naxes); // counter for current row in tile to copy
+  ALLOCATE (Ztile, unsigned long int, matrix->Naxes); // true sizes of this tile (in pixels)
   
-  for (i = 0; i < matrix->Naxes; i++) {
-    counter[i] = 0;
-    Ztile[i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]);
+  int k;
+  for (k = 0; k < matrix->Naxes; k++) {
+    counter[k] = 0;
+    Ztile[k] = MIN ((matrix->Naxis[k] - otile[k]*ztile[k]), ztile[k]);
   }
 
   // number of lines in the tile (in pixels)
-  int Nline = 1;
-  int Npix = matrix->Naxis[0];
-  for (i = 1; i < matrix->Naxes; i++) {
-    Nline *= Ztile[i];
-    Npix  *= matrix->Naxis[i];
+  unsigned long int Nline = 1;
+  unsigned long int Npix = matrix->Naxis[0];
+  for (k = 1; k < matrix->Naxes; k++) {
+    Nline *= Ztile[k];
+    Npix  *= matrix->Naxis[k];
   }
 
@@ -482,7 +495,7 @@
   // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...));
   int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];
-  for (i = matrix->Naxes - 2; i >= 0; i--) {
-    int coord = otile[i]*ztile[i];
-    start = start*matrix->Naxis[i] + coord;
+  for (k = matrix->Naxes - 2; k >= 0; k--) {
+    unsigned long int coord = otile[k]*ztile[k];
+    start = start*matrix->Naxis[k] + coord;
   }
   
@@ -519,13 +532,14 @@
 
       // update the counters, carrying to the next dimension if needed
-      for (j = 1; j < matrix->Naxes; j++) {
-	counter[j] ++;
-	if (counter[j] == Ztile[j]) {
-	  counter[j] = 0;
+      int axis;
+      for (axis = 1; axis < matrix->Naxes; axis++) {
+	counter[axis] ++;
+	if (counter[axis] == Ztile[axis]) {
+	  counter[axis] = 0;
 	} else {
 	  break;
 	}
       }
-      if (j == matrix->Naxes) assert (i == Nline - 1); // we should be done here...
+      if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here...
 
       // Naxes = 3
@@ -535,6 +549,6 @@
       // determine the offset of the next line relative to the start position
       offset = counter[matrix->Naxes - 1];
-      for (j = matrix->Naxes - 2; j >= 0; j--) {
-	offset = offset*matrix->Naxis[j] + counter[j];
+      for (axis = matrix->Naxes - 2; axis >= 0; axis--) {
+	offset = offset*matrix->Naxis[axis] + counter[axis];
       }      
     }
Index: /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_data.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_data.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_data.c	(revision 39409)
@@ -2,30 +2,5 @@
 # include <gfitsio.h>
 # include <zlib.h>
-
-/* functions defined in ricecomp.c */
-int fits_rcomp(int a[], int nx,	unsigned char *c, int clen, int nblock);
-int fits_rcomp_short(short a[], int nx, unsigned char *c, int clen, int nblock);
-int fits_rcomp_byte(char a[], int nx, unsigned char *c, int clen, int nblock);
-int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock);
-int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock);
-int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock);
-
-/* functions defined in fits_hcompress.c */
-# define LONGLONG long long
-int fits_hcompress(int *a, int ny, int nx, int scale, char *output, long *nbytes, int *status);
-int fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, long *nbytes, int *status);
-
-/* functions defined in fits_hdeccompress.c */
-int fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, int *scale, int *status);
-int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, int *scale, int *status);
-
-/* functions defined in pliocomp.c */
-int pl_p2li (int *pxsrc, int xs, short *lldst, int npix);
-int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix);
-
-/* functions defined in gzip.c */
-int gfits_gz_stripheader (unsigned char *data, int *ndata);
-int gfits_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
-int gfits_compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
+# include <gfits_compress.h>
 
 # define ESCAPE(RET) { fprintf (stderr, "gzip error in %s @ %s:%d\n", __func__, __FILE__, __LINE__); return (RET); }
@@ -33,10 +8,6 @@
 // XXX I'm putting Nx and Ny on the argument list -- only used by hcompress
 // with a little work, these could go on the option list
-int gfits_compress_data (char *zdata, int *Nzdata, char *cmptype, 
-			 char **optname, char **optvalue, int Nopt, 
-			 char *rawdata, int Nrawpix, int rawpix_size,
-			 int Nx, int Ny) {
+int gfits_compress_data (char *zdata, unsigned long int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata, unsigned long int Nrawpix, int rawpix_size, int Nx, int Ny) {
 
-  int Nout;
   int status;
 
@@ -68,4 +39,5 @@
 
   if (!strcasecmp(cmptype, "RICE_1") || !strcasecmp(cmptype, "RICE_ONE")) {
+    long int Nout;
     int i, blocksize;
     // look for the BLOCKSIZE
@@ -85,6 +57,4 @@
     // fprintf (stderr, "%d comp bytes; %d uncomp 'pixels', totals: %d %d\n", Nzdata, Npix, Ninsum, Noutsum);
 
-    int k;
-
     switch (rawpix_size) {
       case 4:
@@ -98,5 +68,6 @@
 
 	if (0) {
-	  fprintf (stderr, "Nout: %d, Nrawpix: %d\n", Nout, Nrawpix);
+	  long int k;
+	  fprintf (stderr, "Nout: %lu, Nrawpix: %lu\n", Nout, Nrawpix);
 	  fprintf (stderr, "cmp inp: "); 
 	  for (k = 0; k < Nout; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 2) fprintf (stderr, " "); } 
@@ -119,9 +90,9 @@
       return (FALSE);
     }
-    if (Nout > *Nzdata) {
-      fprintf (stderr, "buffer overrun! %d out, %d available\n", Nout, *Nzdata);
+    if (Nout > (long int) *Nzdata) {
+      fprintf (stderr, "buffer overrun! %ld out, %lu available\n", Nout, *Nzdata);
       return FALSE;
     }
-    *Nzdata = Nout;
+    *Nzdata = (unsigned long int) Nout;
     return TRUE;
   }
@@ -129,5 +100,5 @@
   if (!strcasecmp(cmptype, "PLIO_1")) {
     // note the fortan starting point: zdata is decremented at start
-    Nout = pl_p2li ((int *) rawdata, 1, (short *) zdata, Nrawpix);
+    int Nout = pl_p2li ((int *) rawdata, 1, (short *) zdata, Nrawpix);
     *Nzdata = Nout;
     if (!Nout) return (FALSE);
Index: /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_utils.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_utils.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_compress_utils.c	(revision 39409)
@@ -17,5 +17,5 @@
 
 typedef struct {
-  int *ztile; // max size of a tile (edge tiles may be smaller)
+  unsigned long int *ztile; // max size of a tile (edge tiles may be smaller)
   int *otile; // counter for current tile (eg, for (2,3,0) otile[0] = 2, otile[1] = 3, otile[2] = 0)
   int *ntile; // number of tiles in dimension [i]
@@ -23,5 +23,6 @@
 
 // advance the otile counter. 
-int gfits_imtile_next (Matrix *matrix, int *ztile, int *ntile, int *otile) {
+int gfits_imtile_next (Matrix *matrix, unsigned long int *ztile, int *ntile, int *otile) {
+  OHANA_UNUSED_PARAM(ztile);
 
   int i;
@@ -53,5 +54,5 @@
 
 // how many tiles needed for this image (given ztile[])
-int gfits_imtile_count (Matrix *matrix, int *ztile, int *ntile) {
+int gfits_imtile_count (Matrix *matrix, unsigned long int *ztile, int *ntile) {
 
   int i;
@@ -67,9 +68,9 @@
 
 // how many tiles needed for this image (given ztile[])
-int gfits_imtile_maxsize (Matrix *matrix, int *ztile) {
+int gfits_imtile_maxsize (Matrix *matrix, unsigned long int *ztile) {
 
   int i;
 
-  int max_tile_size = 1;
+  unsigned long int max_tile_size = 1;
   for (i = 0; i < matrix->Naxes; i++) {
     max_tile_size *= ztile[i];
@@ -80,5 +81,5 @@
 
 // true sizes of this tile (in pixels)
-off_t gfits_tile_size (Matrix *matrix, int *otile, int *ztile) {
+off_t gfits_tile_size (Matrix *matrix, int *otile, unsigned long int *ztile) {
 
   off_t i, Npixels, Ndimen;
@@ -93,5 +94,5 @@
 }
 
-int gfits_byteswap_zdata (char *zdata, int Nzdata, int pixsize) {
+int gfits_byteswap_zdata (char *zdata, off_t Nzdata, int pixsize) {
 
 # define DOSWAP(A,B) { char tmp = A; A = B; B = tmp; }
@@ -99,5 +100,5 @@
 # ifdef BYTE_SWAP
 
-  int i;
+  off_t i;
 
   // fprintf (stderr, "swapping %d bytes in pix of size %d bytes...\n", Nzdata, pixsize);
Index: /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_convert_format.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_convert_format.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_convert_format.c	(revision 39409)
@@ -19,5 +19,5 @@
   in  = (inMode  *) matrix[0].buffer;			\
   for (i = 0; i < Npixels; i++, out++, in++)		\
-    if (*in == inBlank) {				\
+    if (*in == (inMode) inBlank) {			\
       *out = (MY_NAN);					\
     } else {						\
@@ -32,5 +32,5 @@
   in  = (inMode  *) matrix[0].buffer;		\
   for (i = 0; i < Npixels; i++, out++, in++)	\
-    if (*in == inBlank) {			\
+    if (*in == (inMode) inBlank) {			\
       *out = (MY_NAN);				\
     } else {					\
@@ -45,5 +45,5 @@
   in  = (inMode  *)matrix[0].buffer + Npixels - 1;	\
   for (i = 0; i < Npixels; i++, out--, in--)		\
-    if (*in == inBlank) {				\
+    if (*in == (inMode) inBlank) {				\
       *out = (MY_NAN);					\
     } else {						\
Index: /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_uncompress_M.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_uncompress_M.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_uncompress_M.c	(revision 39409)
@@ -4,43 +4,45 @@
 # define VERBOSE_DUMP 0
 
-int gfits_distribute_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero);
-
-# define ESCAPE { \
-  fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); \
-  if (ztile != NULL) free (ztile); \
-  if (optname != NULL) { \
-    for (j = 0; j < Noptions; j++) { \
-      free (optname[j]); \
-      free (optvalue[j]); \
-    } \
-    free (optname); \
-    free (optvalue); \
-  } \
-  if (out != NULL) free (out); \
-  if (otile != NULL) free (otile); \
-  if (ntile != NULL) free (ntile); \
-  return (FALSE); }
-
-# define MOD_KEYWORD(ZNAME,NAME,TYPE,IN,OUT) { \
+int gfits_distribute_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero);
+
+# define ESCAPE {							\
+    fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__);	\
+    if (ztile != NULL) free (ztile);					\
+    if (optname != NULL) {						\
+      int opt;								\
+      for (opt = 0; opt < Noptions; opt++) {				\
+	free (optname[opt]);						\
+	free (optvalue[opt]);						\
+      }									\
+      free (optname);							\
+      free (optvalue);							\
+    }									\
+    if (out != NULL) free (out);					\
+    if (otile != NULL) free (otile);					\
+    if (ntile != NULL) free (ntile);					\
+    return (FALSE); }
+
+# define MOD_KEYWORD(ZNAME,NAME,TYPE,IN,OUT) {	   \
     if (gfits_scan (header, ZNAME, TYPE, 1, IN)) { \
-      gfits_modify (header, NAME, TYPE, 1, OUT); \
-    } \
+      gfits_modify (header, NAME, TYPE, 1, OUT);   \
+    }						   \
     gfits_delete (header, ZNAME, 1); }
 
-# define MOD_KEYWORD_ALT(ZNAME,NAME,TYPE,IN,OUT) { \
+# define MOD_KEYWORD_ALT(ZNAME,NAME,TYPE,IN,OUT) {     \
     if (gfits_scan_alt (header, ZNAME, TYPE, 1, IN)) { \
-      gfits_modify_alt (header, NAME, TYPE, 1, OUT); \
-    } \
+      gfits_modify_alt (header, NAME, TYPE, 1, OUT);   \
+    }						       \
     gfits_delete (header, ZNAME, 1); }
 
-# define MOD_KEYWORD_REQUIRED(ZNAME,NAME,TYPE,IN,OUT) { \
-  if (!gfits_scan (header, ZNAME, TYPE, 1, IN)) ESCAPE; \
-  gfits_delete (header, ZNAME, 1); \
-  gfits_modify (header, NAME, TYPE, 1, OUT); }
+# define MOD_KEYWORD_REQUIRED(ZNAME,NAME,TYPE,IN,OUT) {		\
+    if (!gfits_scan (header, ZNAME, TYPE, 1, IN)) ESCAPE;	\
+    gfits_delete (header, ZNAME, 1);				\
+    gfits_modify (header, NAME, TYPE, 1, OUT); }
 
 int gfits_uncompress_image (Header *header, Matrix *matrix, FTable *ftable) {
 
+  int status, zimage;
   off_t Nzdata, Nzrows, zcol;
-  int i, j, status, zimage, Nout, max_tile_size;
+  unsigned long int max_tile_size;
   char cmptype[80];
   char zaxis[10], naxis[10], key[10], word[81], exttype[81], checksum[81], datasum[81];
@@ -49,5 +51,5 @@
   float zscale, zzero;
 
-  int *ztile = NULL;
+  unsigned long int *ztile = NULL;
   int *otile = NULL;
   int *ntile = NULL;
@@ -77,8 +79,9 @@
   MOD_KEYWORD_REQUIRED ("ZNAXIS",  "NAXIS",  "%d", &header->Naxes,  header->Naxes);
 
-  for (i = 0; i < header->Naxes; i++) {
-    snprintf (zaxis, 10, "ZNAXIS%d", i + 1);
-    snprintf (naxis, 10, "NAXIS%d", i + 1);
-    MOD_KEYWORD_REQUIRED (zaxis,  naxis,  OFF_T_FMT,  &header->Naxis[i],  header->Naxis[i]);
+  int axis;
+  for (axis = 0; axis < header->Naxes; axis++) {
+    snprintf (zaxis, 10, "ZNAXIS%d", axis + 1);
+    snprintf (naxis, 10, "NAXIS%d", axis + 1);
+    MOD_KEYWORD_REQUIRED (zaxis,  naxis,  OFF_T_FMT,  &header->Naxis[axis],  header->Naxis[axis]);
   }    
 
@@ -86,15 +89,15 @@
   // the actual tile size may be smaller at the edge of a dimension.  if the ZTILEn
   // entries are not found, default to [Nx,1,1,...]
-  ALLOCATE (ztile, int, header->Naxes);
-  if (!gfits_scan (header, "ZTILE1", "%d", 1, &ztile[0])) {
+  ALLOCATE (ztile, unsigned long int, header->Naxes);
+  if (!gfits_scan (header, "ZTILE1", "%lu", 1, &ztile[0])) {
     ztile[0] = header->Naxis[0];
-    for (i = 1; i < header->Naxes; i++) {
-      ztile[i] = 1;
+    for (axis = 1; axis < header->Naxes; axis++) {
+      ztile[axis] = 1;
     }
   } else {
     gfits_delete (header, "ZTILE1", 1);
-    for (i = 1; i < header->Naxes; i++) {
-      snprintf (key, 10, "ZTILE%d", i + 1);
-      if (!gfits_scan (header, key, "%d", 1, &ztile[i])) ESCAPE;
+    for (axis = 1; axis < header->Naxes; axis++) {
+      snprintf (key, 10, "ZTILE%d", axis + 1);
+      if (!gfits_scan (header, key, "%lu", 1, &ztile[axis])) ESCAPE;
       gfits_delete (header, key, 1);
     }
@@ -199,10 +202,11 @@
   // find the COMPRESSED_DATA column (format should be 1PB, 1PI, 1PJ)
   // is it required that this be the only column?
-  for (i = 1; TRUE; i++) {
-    snprintf (key, 10, "TTYPE%d", i);
+  int colnum;
+  for (colnum = 1; TRUE; colnum++) {
+    snprintf (key, 10, "TTYPE%d", colnum);
     if (!gfits_scan (ftable->header, key, "%s", 1, word)) ESCAPE;
     if (!strcmp (word, "COMPRESSED_DATA")) break;
   }
-  zcol = i;
+  zcol = colnum;
 
   if (!gfits_varlength_column_define (ftable, &zdef, zcol)) ESCAPE;
@@ -220,12 +224,12 @@
   ALLOCATE (ntile, int, matrix->Naxes);
   max_tile_size = 1;
-  for (i = 0; i < matrix->Naxes; i++) {
-    otile[i] = 0;
-    ntile[i] = (matrix->Naxis[i] % ztile[i]) ? (matrix->Naxis[i] / ztile[i] + 1) : (matrix->Naxis[i] / ztile[i]);
-    max_tile_size *= ztile[i];
-
-    // ztile[i] is the default (or max) tile size in the i-th dimension
-    // ntile[i] is the number of tiles in the i-th dimension
-    // otile[i] is the current output tile counter in the i-th dimension
+  for (axis = 0; axis < matrix->Naxes; axis++) {
+    otile[axis] = 0;
+    ntile[axis] = (matrix->Naxis[axis] % ztile[axis]) ? (matrix->Naxis[axis] / ztile[axis] + 1) : (matrix->Naxis[axis] / ztile[axis]);
+    max_tile_size *= ztile[axis];
+
+    // ztile[axis] is the default (or max) tile size in the i-th dimension
+    // ntile[axis] is the number of tiles in the i-th dimension
+    // otile[axis] is the current output tile counter in the i-th dimension
   }
 
@@ -254,5 +258,5 @@
   // fprintf (stderr, "raw_pixsize: %d, cmp_pixsize: %d, tile_pixsize: %d, raw_bitpix: %d\n", raw_pixsize, cmp_pixsize, tile_pixsize, raw_bitpix);
 
-  int Nout_alloc = raw_pixsize*max_tile_size;
+  unsigned long int Nout_alloc = raw_pixsize*max_tile_size;
   ALLOCATE (out, char, Nout_alloc);
 
@@ -271,5 +275,5 @@
 
     // expected output size for this tile
-    Nout = raw_pixsize*gfits_tile_size (matrix, otile, ztile);
+    unsigned long Nout = raw_pixsize*gfits_tile_size (matrix, otile, ztile);
 
     zdata = gfits_varlength_column_pointer (ftable, &zdef, row, &Nzdata);
@@ -297,5 +301,5 @@
       for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
-      fprintf (stderr, "Nout  : %d -> ", Nout);
+      fprintf (stderr, "Nout  : %lu -> ", Nout);
     }
     
@@ -307,5 +311,5 @@
     if (VERBOSE_DUMP && (row == 0)) {
       int k;
-      fprintf (stderr, "%d\n", Nout);
+      fprintf (stderr, "%lu\n", Nout);
       fprintf (stderr, "unc swp: "); 
       for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", out[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
@@ -315,5 +319,5 @@
     if (!strcasecmp(cmptype, "GZIP_1")) {
       // Nout is number of pixels
-      if (!gfits_byteswap_zdata (out, Nout * raw_pixsize, raw_pixsize)) ESCAPE;
+      if (!gfits_byteswap_zdata (out, (off_t) (Nout * raw_pixsize), raw_pixsize)) ESCAPE;
     }
     
@@ -340,8 +344,8 @@
 
     // update the tile counters, carrying to the next dimension if needed
-    for (j = 0; j < matrix->Naxes; j++) {
-      otile[j] ++;
-      if (otile[j] == ntile[j]) {
-	otile[j] = 0;
+    for (axis = 0; axis < matrix->Naxes; axis++) {
+      otile[axis] ++;
+      if (otile[axis] == ntile[axis]) {
+	otile[axis] = 0;
       } else {
 	break;
@@ -352,7 +356,8 @@
   FREE (ztile);
   if (optname != NULL) {
-    for (j = 0; j < Noptions; j++) {
-      FREE (optname[j]);
-      FREE (optvalue[j]);
+    int opt;
+    for (opt = 0; opt < Noptions; opt++) {
+      FREE (optname[opt]);
+      FREE (optvalue[opt]);
     }
     FREE (optname);
@@ -366,24 +371,24 @@
 
 // bitpix is the input data size/type
-int gfits_distribute_data (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero) {
-
-  int i, j;
-  int *counter = NULL;
-  int *Ztile = NULL;
-
-  ALLOCATE (counter, int, matrix->Naxes);
-  ALLOCATE (Ztile, int, matrix->Naxes);
+int gfits_distribute_data (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) {
+
+  int axis;
+  unsigned int *counter = NULL;
+  unsigned long int *Ztile = NULL;
+
+  ALLOCATE (counter, unsigned int, matrix->Naxes);
+  ALLOCATE (Ztile, unsigned long int, matrix->Naxes);
 
   // counter for current row in tile to copy
   // true sizes of this tile (in pixels)
-  for (i = 0; i < matrix->Naxes; i++) {
-    counter[i] = 0;
-    Ztile[i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]);
+  for (axis = 0; axis < matrix->Naxes; axis++) {
+    counter[axis] = 0;
+    Ztile[axis] = MIN ((matrix->Naxis[axis] - otile[axis]*ztile[axis]), ztile[axis]);
   }
 
   // number of lines in the tile (in pixels)
-  int Nline = 1;
-  for (i = 1; i < matrix->Naxes; i++) {
-    Nline *= Ztile[i];
+  unsigned long int Nline = 1;
+  for (axis = 1; axis < matrix->Naxes; axis++) {
+    Nline *= Ztile[axis];
   }
 
@@ -394,16 +399,17 @@
   // start = otile[0]*ztile[0] + otile[1]*ztile[1]*Naxis[0] + otile[2]*ztile[2]*Naxis[0]*Naxis[1] + ...;
   // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...));
-  int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];
-  for (i = matrix->Naxes - 2; i >= 0; i--) {
-    int coord = otile[i]*ztile[i];
-    start = start*matrix->Naxis[i] + coord;
+  unsigned long int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];
+  for (axis = matrix->Naxes - 2; axis >= 0; axis--) {
+    unsigned long int coord = otile[axis]*ztile[axis];
+    start = start*matrix->Naxis[axis] + coord;
   }
   
   // pixel offset in output array relative to tile start
-  int offset = 0;
+  unsigned long int offset = 0;
 
   int directCopy = (zzero == 0.0) && (zscale == 1.0);
 
 # define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE) {				\
+    unsigned long j;							\
     TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
@@ -418,4 +424,5 @@
   // this macro is used at the inner switch to run the actual loop
 # define SCALE_AND_DIST_INT(OTYPE, OSIZE) {				\
+    unsigned long j;							\
     OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
@@ -432,4 +439,5 @@
   // this macro is used at the inner switch to run the actual loop
 # define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) {				\
+    unsigned long j;							\
     OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
@@ -461,5 +469,5 @@
       case   8: SCALE_AND_DIST_INT   (char,   1); break; \
       case  16: SCALE_AND_DIST_INT   (short,  2); break; \
-      case  32: SCALE_AND_DIST_INT (int,    4); break; \
+      case  32: SCALE_AND_DIST_INT   (int,    4); break; \
       case -32: SCALE_AND_DIST_FLOAT (float,  4); break; \
       case -64: SCALE_AND_DIST_FLOAT (double, 8); break; \
@@ -468,4 +476,5 @@
 
   // loop over lines in the tile
+  unsigned long int i;
   for (i = 0; i < Nline; i++) {
     switch (raw_bitpix) {
@@ -479,13 +488,13 @@
 
     // update the counters, carrying to the next dimension if needed
-    for (j = 1; j < matrix->Naxes; j++) {
-      counter[j] ++;
-      if (counter[j] == Ztile[j]) {
-	counter[j] = 0;
+    for (axis = 1; axis < matrix->Naxes; axis++) {
+      counter[axis] ++;
+      if (counter[axis] == Ztile[axis]) {
+	counter[axis] = 0;
       } else {
 	break;
       }
     }
-    if (j == matrix->Naxes) assert (i == Nline - 1); // we should be done here...
+    if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here...
 
     // Naxes = 3
@@ -495,6 +504,6 @@
     // determine the offset of the next line relative to the start position
     offset = counter[matrix->Naxes - 1];
-    for (j = matrix->Naxes - 2; j >= 0; j--) {
-      offset = offset*matrix->Naxis[j] + counter[j];
+    for (axis = matrix->Naxes - 2; axis >= 0; axis--) {
+      offset = offset*matrix->Naxis[axis] + counter[axis];
     }      
   }
@@ -506,26 +515,30 @@
 
 // bitpix is the input data size/type
-int gfits_distribute_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero) {
-
-  int i, j, k;
-  int *counter = NULL;
-  int *Ztile = NULL;
-
-  ALLOCATE (counter, int, matrix->Naxes);
-  ALLOCATE (Ztile, int, matrix->Naxes);
+int gfits_distribute_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) {
+  OHANA_UNUSED_PARAM(oblank);
+  OHANA_UNUSED_PARAM(zblank);
+  OHANA_UNUSED_PARAM(zzero);
+  OHANA_UNUSED_PARAM(zscale);
+
+  int axis;
+  unsigned int *counter = NULL;
+  unsigned long int *Ztile = NULL;
+
+  ALLOCATE (counter, unsigned int, matrix->Naxes);
+  ALLOCATE (Ztile, unsigned long int, matrix->Naxes);
 
   // counter for current row in tile to copy
   // true sizes of this tile (in pixels)
-  for (i = 0; i < matrix->Naxes; i++) {
-    counter[i] = 0;
-    Ztile[i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]);
+  for (axis = 0; axis < matrix->Naxes; axis++) {
+    counter[axis] = 0;
+    Ztile[axis] = MIN ((matrix->Naxis[axis] - otile[axis]*ztile[axis]), ztile[axis]);
   }
 
   // number of lines in the tile (in pixels)
-  int Nline = 1;
-  int Npix = matrix->Naxis[0];
-  for (i = 1; i < matrix->Naxes; i++) {
-    Nline *= Ztile[i];
-    Npix  *= matrix->Naxis[i];
+  unsigned long int Nline = 1;
+  unsigned long int Npix = matrix->Naxis[0];
+  for (axis = 1; axis < matrix->Naxes; axis++) {
+    Nline *= Ztile[axis];
+    Npix  *= matrix->Naxis[axis];
   }
 
@@ -536,8 +549,8 @@
   // start = otile[0]*ztile[0] + otile[1]*ztile[1]*Naxis[0] + otile[2]*ztile[2]*Naxis[0]*Naxis[1] + ...;
   // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...));
-  int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];
-  for (i = matrix->Naxes - 2; i >= 0; i--) {
-    int coord = otile[i]*ztile[i];
-    start = start*matrix->Naxis[i] + coord;
+  unsigned long int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];
+  for (axis = matrix->Naxes - 2; axis >= 0; axis--) {
+    unsigned long int coord = otile[axis]*ztile[axis];
+    start = start*matrix->Naxis[axis] + coord;
   }
   
@@ -553,8 +566,10 @@
 
   // pixel offset in output array relative to tile start
-  int offset = 0;
+  unsigned long int offset = 0;
 
   static int pass = 0;
+  int k;
   for (k = 0; k < size; k++) {
+    unsigned long int i;
     for (i = 0; i < Nline; i++) {
 # ifdef BYTE_SWAP      
@@ -564,4 +579,5 @@
 # endif
       char *rawptr = &raw[i*Ztile[0] + k*Nraw];	
+      unsigned long j;
       for (j = 0; j < Ztile[0]; j++, srcptr += size, rawptr ++) {		
 	if (FALSE && (i == 0) && (j < 4) && (pass == 0)) {
@@ -574,13 +590,13 @@
 
       // update the counters, carrying to the next dimension if needed
-      for (j = 1; j < matrix->Naxes; j++) {
-	counter[j] ++;
-	if (counter[j] == Ztile[j]) {
-	  counter[j] = 0;
+      for (axis = 1; axis < matrix->Naxes; axis++) {
+	counter[axis] ++;
+	if (counter[axis] == Ztile[axis]) {
+	  counter[axis] = 0;
 	} else {
 	  break;
 	}
       }
-      if (j == matrix->Naxes) assert (i == Nline - 1); // we should be done here...
+      if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here...
 
       // Naxes = 3
@@ -590,6 +606,6 @@
       // determine the offset of the next line relative to the start position
       offset = counter[matrix->Naxes - 1];
-      for (j = matrix->Naxes - 2; j >= 0; j--) {
-	offset = offset*matrix->Naxis[j] + counter[j];
+      for (axis = matrix->Naxes - 2; axis >= 0; axis--) {
+	offset = offset*matrix->Naxis[axis] + counter[axis];
       }      
     }
Index: /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_uncompress_data.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_uncompress_data.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/matrix/F_uncompress_data.c	(revision 39409)
@@ -2,31 +2,9 @@
 # include <gfitsio.h>
 # include <zlib.h>
-
-/* functions defined in ricecomp.c */
-int fits_rcomp(int a[], int nx,	unsigned char *c, int clen, int nblock);
-int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock);
-int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock);
-int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock);
-
-/* functions defined in fits_hcompress.c */
-# define LONGLONG long long
-int fits_hcompress(int *a, int ny, int nx, int scale, char *output, long *nbytes, int *status);
-int fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, long *nbytes, int *status);
-
-/* functions defined in fits_hdeccompress.c */
-int fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, int *scale, int *status);
-int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, int *scale, int *status);
-
-/* functions defined in pliocomp.c */
-int pl_p2li (int *pxsrc, int xs, short *lldst, int npix);
-int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix);
-
-/* functions defined in gzip.c */
-int gfits_gz_stripheader (unsigned char *data, int *ndata);
-int gfits_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
+# include <gfits_compress.h>
 
 # define ESCAPE(RET) { fprintf (stderr, "gzip error in %s @ %s:%d\n", __func__, __FILE__, __LINE__); return (RET); }
 
-int gfits_uncompress_data (char *zdata, int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, int *Nout, int Nout_alloc, int out_pixsize) {
+int gfits_uncompress_data (char *zdata, unsigned long Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, unsigned long int *Nout, unsigned long int Nout_alloc, int out_pixsize) {
 
   int status;
@@ -78,6 +56,5 @@
 
     int status = FALSE;
-    int Npix = *Nout / out_pixsize;
-    int k;
+    unsigned long int Npix = *Nout / out_pixsize;
 
     switch (out_pixsize) {
@@ -88,5 +65,6 @@
       case 2:
 	if (0) {
-	  fprintf (stderr, "Nout: %d, Nrawpix: %d\n", Nzdata, Npix);
+	  unsigned long int k;
+	  fprintf (stderr, "Nout: %lu, Nrawpix: %lu\n", Nzdata, Npix);
 	  fprintf (stderr, "cmp out: "); 
 	  for (k = 0; k < Nzdata; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); } 
@@ -112,7 +90,8 @@
   
   if (!strcasecmp(cmptype, "PLIO_1")) {
+    int Ntru = *Nout;
     int Npix;
-    Npix = pl_l2pi ((short *) zdata, 1, (int *) outdata, *Nout);
-    if (Npix != *Nout) {
+    Npix = pl_l2pi ((short *) zdata, 1, (int *) outdata, Ntru);
+    if (Npix != Ntru) {
       fprintf (stderr, "error in plio decompression\n");
       return (FALSE);
@@ -122,4 +101,5 @@
 
   if (!strcasecmp(cmptype, "HCOMPRESS_1")) {
+    unsigned long int Ntru = *Nout;
     int Nx, Ny, scale;
     status = 0;
@@ -132,5 +112,6 @@
     // fprintf (stderr, "decompression yields image %d x %d (scale: %d)\n", Nx, Ny, scale);
     
-    if (Nx * Ny != *Nout) {
+    unsigned long Npix = Nx * Ny;
+    if (Npix != Ntru) {
       fprintf (stderr, "error in hdecompress: mismatched output size\n");
       return (FALSE);
Index: /branches/eam_branches/ohana.20160226/src/libfits/table/F_compress_T.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/table/F_compress_T.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/table/F_compress_T.c	(revision 39409)
@@ -23,6 +23,6 @@
 # define ESCAPE { fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); goto escape; }
 
-int gfits_collect_table_data (FTable *table, TableField *field, char *raw, int row_start, int Nrows);
-int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start, int Nrows);
+int gfits_collect_table_data (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows);
+int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows);
 
 static float timeSum1 = 0.0;
@@ -51,7 +51,5 @@
 }
 
-int gfits_compress_table (FTable *srctable, FTable *tgttable, int ztilelen, char *zcmptype) {
-
-  int i, j;
+int gfits_compress_table (FTable *srctable, FTable *tgttable, unsigned long int ztilelen, char *zcmptype) {
 
   char keyword[81];
@@ -69,5 +67,5 @@
   gettimeofday (&startTimer, (void *) NULL);
 
-  int Ntile, ztilelast;
+  unsigned long int Ntile, ztilelast;
   if (!ztilelen) ztilelen = srcheader->Naxis[1];
 
@@ -104,26 +102,28 @@
 
   ALLOCATE_ZERO (fields, TableField, Nfields);
-  for (i = 0; i < Nfields; i++) {
-    snprintf (keyword, 80, "TTYPE%d", i+1);
-    if (!gfits_scan (srcheader, keyword, "%s", 1, fields[i].ttype)) ESCAPE;
-    if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[i].ttype_cmt)) ESCAPE;
+
+  int field;
+  for (field = 0; field < Nfields; field++) {
+    snprintf (keyword, 80, "TTYPE%d", field+1);
+    if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].ttype)) ESCAPE;
+    if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].ttype_cmt)) ESCAPE;
 
     // TUNIT is not mandatory
-    snprintf (keyword, 80, "TUNIT%d", i+1);
-    if (!gfits_scan (srcheader, keyword, "%s", 1, fields[i].tunit)) {
-      fields[i].tunit[0] = 0;
+    snprintf (keyword, 80, "TUNIT%d", field+1);
+    if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].tunit)) {
+      fields[field].tunit[0] = 0;
     } else {
-      if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[i].tunit_cmt)) ESCAPE;
+      if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].tunit_cmt)) ESCAPE;
     }
     
-    snprintf (keyword, 80, "TFORM%d", i+1);
-    if (!gfits_scan (srcheader, keyword, "%s", 1, fields[i].tformat)) ESCAPE;
-    if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[i].tformat_cmt)) ESCAPE;
+    snprintf (keyword, 80, "TFORM%d", field+1);
+    if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].tformat)) ESCAPE;
+    if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].tformat_cmt)) ESCAPE;
 
     // for now we set all fields to the requested type.  since I do not yet know the column data types I cannot yet assign automatic cmptypes
-    strcpy (fields[i].zctype, zcmptype);
+    strcpy (fields[field].zctype, zcmptype);
 
     // by using "P" format, we are limited to 32bit pointers (2GB heap)
-    if (!gfits_define_bintable_column (tgtheader, "1QB(0)", fields[i].ttype, fields[i].ttype_cmt, fields[i].tunit, 1.0, 0.0)) ESCAPE;
+    if (!gfits_define_bintable_column (tgtheader, "1QB(0)", fields[field].ttype, fields[field].ttype_cmt, fields[field].tunit, 1.0, 0.0)) ESCAPE;
   }    
 
@@ -137,6 +137,6 @@
   char *tmpbuffer = NULL;
   ALLOCATE_ZERO (tmpbuffer, char, 16*Ntile); // need space for Ntile entries, each of width 16 bytes (2 long)
-  for (i = 0; i < Nfields; i++) {
-    if (!gfits_set_bintable_column (tgtheader, tgttable, fields[i].ttype, tmpbuffer, Ntile)) ESCAPE;
+  for (field = 0; field < Nfields; field++) {
+    if (!gfits_set_bintable_column (tgtheader, tgttable, fields[field].ttype, tmpbuffer, Ntile)) ESCAPE;
   }
   free (tmpbuffer);
@@ -146,5 +146,5 @@
 
   // define compression-specific keywords, update header as needed.
-  if (!gfits_modify (tgtheader, "ZTILELEN", "%d", 1, ztilelen)) ESCAPE;
+  if (!gfits_modify (tgtheader, "ZTILELEN", "%lud", 1, ztilelen)) ESCAPE;
 
   if (!gfits_modify (tgtheader, "ZNAXIS1", OFF_T_FMT, 1, srcheader->Naxis[0])) ESCAPE;
@@ -163,27 +163,27 @@
   int offset = 0; // bytes from first column of first field to the current field (accumulate to set)
 
-  for (i = 0; i < Nfields; i++) {
-    snprintf (keyword, 81, "ZFORM%d", i+1);
-    if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[i].tformat)) ESCAPE;
-    if (!gfits_varlength_column_define (tgttable, &fields[i].zdef, i+1)) ESCAPE;
-    if (!gfits_bintable_format (fields[i].tformat, fields[i].datatype, &fields[i].Nvalues, &fields[i].pixsize)) ESCAPE; // 
-    fields[i].rowsize = fields[i].Nvalues*fields[i].pixsize;
-    max_width = MAX(max_width, fields[i].rowsize);
-
-    if (!strcasecmp (fields[i].zctype, "AUTO")) {
-      if (!strcmp (fields[i].datatype, "short") ||
-	  !strcmp (fields[i].datatype, "float") || 
-	  !strcmp (fields[i].datatype, "double")|| 
-	  !strcmp (fields[i].datatype, "int64_t")) {
-	strcpy (fields[i].zctype, "GZIP_2");
+  for (field = 0; field < Nfields; field++) {
+    snprintf (keyword, 81, "ZFORM%d", field+1);
+    if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[field].tformat)) ESCAPE;
+    if (!gfits_varlength_column_define (tgttable, &fields[field].zdef, field+1)) ESCAPE;
+    if (!gfits_bintable_format (fields[field].tformat, fields[field].datatype, &fields[field].Nvalues, &fields[field].pixsize)) ESCAPE; // 
+    fields[field].rowsize = fields[field].Nvalues*fields[field].pixsize;
+    max_width = MAX(max_width, fields[field].rowsize);
+
+    if (!strcasecmp (fields[field].zctype, "AUTO")) {
+      if (!strcmp (fields[field].datatype, "short") ||
+	  !strcmp (fields[field].datatype, "float") || 
+	  !strcmp (fields[field].datatype, "double")|| 
+	  !strcmp (fields[field].datatype, "int64_t")) {
+	strcpy (fields[field].zctype, "GZIP_2");
 	goto got_cmptype;
       }
-      if (!strcmp (fields[i].datatype, "int")) {
-	strcpy (fields[i].zctype, "RICE_1");
+      if (!strcmp (fields[field].datatype, "int")) {
+	strcpy (fields[field].zctype, "RICE_1");
 	goto got_cmptype;
       }
-      if (!strcmp (fields[i].datatype, "byte") ||
-	  !strcmp (fields[i].datatype, "char")) {
-	strcpy (fields[i].zctype, "GZIP_1");
+      if (!strcmp (fields[field].datatype, "byte") ||
+	  !strcmp (fields[field].datatype, "char")) {
+	strcpy (fields[field].zctype, "GZIP_1");
 	goto got_cmptype;
       }
@@ -193,25 +193,25 @@
 
     // OVERRIDE: RICE can only be used on integer fields
-    if (!strcasecmp (fields[i].zctype, "RICE_1") || !strcasecmp (fields[i].zctype, "RICE_ONE")) {
-      if (!strcmp (fields[i].datatype, "float") || !strcmp (fields[i].datatype, "double") || !strcmp (fields[i].datatype, "int64_t")) {
-	strcpy (fields[i].zctype, "GZIP_2");
+    if (!strcasecmp (fields[field].zctype, "RICE_1") || !strcasecmp (fields[field].zctype, "RICE_ONE")) {
+      if (!strcmp (fields[field].datatype, "float") || !strcmp (fields[field].datatype, "double") || !strcmp (fields[field].datatype, "int64_t")) {
+	strcpy (fields[field].zctype, "GZIP_2");
       }
     }
 
     // OVERRIDE: GZIP_2 invalid for B (use GZIP_1)
-    if (!strcasecmp (fields[i].zctype, "GZIP_2") && !strcmp (fields[i].datatype, "byte")) {
-      strcpy (fields[i].zctype, "GZIP_1");
+    if (!strcasecmp (fields[field].zctype, "GZIP_2") && !strcmp (fields[field].datatype, "byte")) {
+      strcpy (fields[field].zctype, "GZIP_1");
     }
 
     // compression type per column (XXX for now we are just using zcmptype, as set above)
-    snprintf (keyword, 81, "ZCTYP%d", i+1);
-    if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[i].zctype)) ESCAPE;
-
-    fields[i].offset = offset;
-    offset += fields[i].rowsize;
+    snprintf (keyword, 81, "ZCTYP%d", field+1);
+    if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[field].zctype)) ESCAPE;
+
+    fields[field].offset = offset;
+    offset += fields[field].rowsize;
   }
 
   // allocate the intermediate storage buffers
-  int Nzdata_alloc = 2*max_width*ztilelen + 100;
+  unsigned long int Nzdata_alloc = 2*max_width*ztilelen + 100;
   ALLOCATE (raw,   char, max_width*ztilelen);
   ALLOCATE (zdata, char, Nzdata_alloc);
@@ -229,20 +229,21 @@
   // compress the data : copy into a tile, compress the tile, then add to the output table
   // each tile -> 1 row of the output table
-  for (i = 0; i < Ntile; i++) {
-
-    for (j = 0; j < Nfields; j++) {
-
-      gettimeofday (&startTimer, (void *) NULL);
-
-      int Nrows = (i == Ntile - 1) ? ztilelast : ztilelen;
-      int row_start = i*ztilelen; 
+  unsigned long int tile;
+  for (tile = 0; tile < Ntile; tile++) {
+
+    for (field = 0; field < Nfields; field++) {
+
+      gettimeofday (&startTimer, (void *) NULL);
+
+      unsigned long int Nrows = (tile == Ntile - 1) ? ztilelast : ztilelen;
+      unsigned long int row_start = tile*ztilelen; 
       // ^- first row for this tile & field
       // NOTE: assumes each tile has the same length, ex the last (true for now)
 
       // copy the raw pixels from their native matrix locations to the temporary output buffer
-      if (!strcasecmp(fields[j].zctype, "GZIP_2") || !strcasecmp(fields[j].zctype, "NONE_2")) {
-	if (!gfits_collect_table_gzp2 (srctable, &fields[j], raw, row_start, Nrows)) ESCAPE;
+      if (!strcasecmp(fields[field].zctype, "GZIP_2") || !strcasecmp(fields[field].zctype, "NONE_2")) {
+	if (!gfits_collect_table_gzp2 (srctable, &fields[field], raw, row_start, Nrows)) ESCAPE;
       } else {
-	if (!gfits_collect_table_data (srctable, &fields[j], raw, row_start, Nrows)) ESCAPE;
+	if (!gfits_collect_table_data (srctable, &fields[field], raw, row_start, Nrows)) ESCAPE;
       }
       
@@ -256,7 +257,7 @@
   
       if (VERBOSE_DUMP) {
-	int k;
+	unsigned long int k;
 	fprintf (stderr, "c1: ");
-	for (k = 0; k < Nrows*fields[j].Nvalues*fields[j].pixsize; k++) {
+	for (k = 0; k < Nrows*fields[field].Nvalues*fields[field].pixsize; k++) {
 	  fprintf (stderr, "%02hhx", raw[k]);
 	  if (k % 2) fprintf (stderr, " ");
@@ -269,7 +270,7 @@
       // optname, optvalue = NULL, Noptions = 0
       
-      int Nraw = Nrows*fields[j].Nvalues; // number of pixels
-      if (!strcasecmp(fields[j].zctype, "GZIP_1")) {
-	if (!gfits_byteswap_zdata (raw, Nraw * fields[j].pixsize, fields[j].pixsize)) ESCAPE;
+      unsigned long int Nraw = Nrows*fields[field].Nvalues; // number of pixels
+      if (!strcasecmp(fields[field].zctype, "GZIP_1")) {
+	if (!gfits_byteswap_zdata (raw, Nraw * fields[field].pixsize, fields[field].pixsize)) ESCAPE;
       }
 
@@ -281,7 +282,7 @@
   
       if (VERBOSE_DUMP) {
-	int k;
+	unsigned long int k;
 	fprintf (stderr, "c2: ");
-	for (k = 0; k < Nrows*fields[j].Nvalues*fields[j].pixsize; k++) {
+	for (k = 0; k < Nrows*fields[field].Nvalues*fields[field].pixsize; k++) {
 	  fprintf (stderr, "%02hhx", raw[k]);
 	  if (k % 2) fprintf (stderr, " ");
@@ -291,6 +292,6 @@
       }
 
-      int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression
-      if (!gfits_compress_data (zdata, &Nzdata, fields[j].zctype, NULL, NULL, 0, raw, Nraw, fields[j].pixsize, 0, 0)) ESCAPE;
+      unsigned long int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression
+      if (!gfits_compress_data (zdata, &Nzdata, fields[field].zctype, NULL, NULL, 0, raw, Nraw, fields[field].pixsize, 0, 0)) ESCAPE;
       
       // XXX TIMER 2c
@@ -301,5 +302,5 @@
   
       if (VERBOSE_DUMP) {
-	int k;
+	unsigned long int k;
 	fprintf (stderr, "c3: ");
 	for (k = 0; k < Nzdata; k++) {
@@ -311,10 +312,10 @@
       }
 
-      if (strcasecmp(fields[j].zctype, "NONE_2") && // NONE and NONE_1 not swapped?
-	  strcasecmp(fields[j].zctype, "GZIP_1") &&
-	  strcasecmp(fields[j].zctype, "GZIP_2") && 
-	  strcasecmp(fields[j].zctype, "RICE_1") && 
-	  strcasecmp(fields[j].zctype, "RICE_ONE")) {
-	if (!gfits_byteswap_zdata (zdata, Nzdata, fields[j].pixsize)) ESCAPE;
+      if (strcasecmp(fields[field].zctype, "NONE_2") && // NONE and NONE_1 not swapped?
+	  strcasecmp(fields[field].zctype, "GZIP_1") &&
+	  strcasecmp(fields[field].zctype, "GZIP_2") && 
+	  strcasecmp(fields[field].zctype, "RICE_1") && 
+	  strcasecmp(fields[field].zctype, "RICE_ONE")) {
+	if (!gfits_byteswap_zdata (zdata, Nzdata, fields[field].pixsize)) ESCAPE;
       }
 
@@ -326,5 +327,5 @@
   
       if (VERBOSE_DUMP) {
-	int k;
+	unsigned long int k;
 	fprintf (stderr, "c4: ");
 	for (k = 0; k < Nzdata; k++) {
@@ -336,5 +337,5 @@
       }
 
-      if (!gfits_varlength_column_add_data (tgttable, zdata, Nzdata, i, &fields[j].zdef)) ESCAPE;
+      if (!gfits_varlength_column_add_data (tgttable, zdata, Nzdata, field, &fields[field].zdef)) ESCAPE;
       // XXX TIMER 2e
       gettimeofday (&stopTimer, (void *) NULL); 
@@ -347,6 +348,6 @@
   if (OHANA_MEMCHECK) ohana_memcheck (TRUE);
 
-  for (i = 0; i < Nfields; i++) {
-    if (!gfits_varlength_column_finish (tgttable, &fields[i].zdef)) ESCAPE;
+  for (field = 0; field < Nfields; field++) {
+    if (!gfits_varlength_column_finish (tgttable, &fields[field].zdef)) ESCAPE;
   }
 
@@ -375,7 +376,7 @@
 // raw_pixsize is the bytes / pixel for the input matrix
 // place the raw image bytes for the current tile into the tile buffer
-int gfits_collect_table_data (FTable *table, TableField *field, char *raw, int row_start, int Nrows) {
-
-  off_t i;
+int gfits_collect_table_data (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) {
+
+  unsigned long int i;
 
   // we are copying NN rows into the column which starts at XX and has MM bytes per row
@@ -399,7 +400,7 @@
 }
 
-int gfits_collect_table_data_alt (FTable *table, TableField *field, char *raw, int row_start, int Nrows) {
-
-  off_t i;
+int gfits_collect_table_data_alt (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) {
+
+  unsigned long int i;
 
   // we are copying NN rows of the column which starts at XX and has MM bytes per row
@@ -420,7 +421,7 @@
 }
 
-int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start, int Nrows) {
-
-  off_t i, j, k;
+int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) {
+
+  off_t j, k;
 
   // we are copying NN rows into the column which starts at XX and has MM bytes per row
@@ -439,4 +440,5 @@
     char *tblptr_start = &table->buffer[Nx*row_start + offset + k];
 # endif
+    unsigned long int i;
     for (i = 0; i < Nrows; i++, tblptr_start += Nx) {
       char *tblptr = tblptr_start;
@@ -449,7 +451,7 @@
 }
 
-int gfits_collect_table_gzp2_alt (FTable *table, TableField *field, char *raw, int row_start, int Nrows) {
-
-  off_t i, j, k;
+int gfits_collect_table_gzp2_alt (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) {
+
+  off_t j, k;
 
   // we are copying NN rows into the column which starts at XX and has MM bytes per row
@@ -458,6 +460,7 @@
 
   for (k = 0; k < field->pixsize; k++) {
+    unsigned long int i;
     for (i = 0; i < Nrows; i++) {
-      int row = row_start + i;
+      unsigned long int row = row_start + i;
       char *rawptr = &raw[i*field->Nvalues + k*Nrows*field->Nvalues];
 # ifdef BYTE_SWAP      
@@ -468,5 +471,6 @@
       for (j = 0; j < field->Nvalues; j++, tblptr += field->pixsize, rawptr++) {
 	*rawptr = *tblptr;
-	myAssert (rawptr - raw < Nrows*field->Nvalues*field->pixsize, "oops");
+	myAssert (rawptr >= raw, "oops");
+	myAssert ((unsigned long int)(rawptr - raw) < Nrows*field->Nvalues*field->pixsize, "oops");
 	myAssert (tblptr - table->buffer < table->header->Naxis[0]*table->header->Naxis[1], "oops");
       }
Index: /branches/eam_branches/ohana.20160226/src/libfits/table/F_uncompress_T.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/table/F_uncompress_T.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/table/F_uncompress_T.c	(revision 39409)
@@ -22,4 +22,7 @@
   }
   fprintf (stderr, "\n");
+# else
+  OHANA_UNUSED_PARAM(table);
+  OHANA_UNUSED_PARAM(message);
 # endif
   return TRUE;
@@ -44,4 +47,7 @@
   }
   fprintf (stderr, "\n");
+# else
+  OHANA_UNUSED_PARAM(table);
+  OHANA_UNUSED_PARAM(message);
 # endif
   return TRUE;
@@ -266,10 +272,10 @@
       gettimeofday (&startTimer, (void *) NULL);
   
-      int Nrows = (row == Ntile - 1) ? ztilelast : ztilelen;
-      int Nraw = Nrows*fields[i].Nvalues*fields[i].pixsize; // expected number of bytes
+      unsigned long int Nrows = (row == Ntile - 1) ? ztilelast : ztilelen;
+      unsigned long int Nraw = Nrows*fields[i].Nvalues*fields[i].pixsize; // expected number of bytes
       if (!gfits_uncompress_data (zdata, Nzdata, fields[i].zctype, NULL, NULL, 0, raw, &Nraw, Nraw_alloc, fields[i].pixsize)) ESCAPE;
 
       if (VERBOSE_DUMP) {
-	int k;
+	unsigned long int k;
 	fprintf (stderr, "u2: ");
 	for (k = 0; k < Nraw*fields[i].pixsize; k++) {
@@ -299,5 +305,5 @@
   
       if (VERBOSE_DUMP) {
-	int k;
+	unsigned long int k;
 	fprintf (stderr, "u1: ");
 	for (k = 0; k < Nraw*fields[i].pixsize; k++) {
Index: /branches/eam_branches/ohana.20160226/src/libfits/table/F_write_T.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/table/F_write_T.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/table/F_write_T.c	(revision 39409)
@@ -27,5 +27,5 @@
     myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory");
     myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory");
-    myAssert (myBlock->size >= table[0].datasize, "overflow");
+    myAssert (myBlock->size >= (size_t) table[0].datasize, "overflow");
   }
 # endif
Index: /branches/eam_branches/ohana.20160226/src/libfits/table/F_write_TH.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libfits/table/F_write_TH.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libfits/table/F_write_TH.c	(revision 39409)
@@ -27,5 +27,5 @@
     myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory");
     myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory");
-    myAssert (myBlock->size >= header[0].datasize, "overflow");
+    myAssert (myBlock->size >= (size_t) header[0].datasize, "overflow");
   }
 # endif
Index: /branches/eam_branches/ohana.20160226/src/libohana/include/ohana.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libohana/include/ohana.h	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libohana/include/ohana.h	(revision 39409)
@@ -400,5 +400,5 @@
 int     write_fmt              PROTO((int fd, char *format, ...)) OHANA_FORMAT(printf, 2, 3);
 
-char   **isolate_elements      PROTO((int argc, char **argv, int *nstack));
+char   **isolate_elements      PROTO((unsigned int argc, char **argv, unsigned int *nstack));
 
 // functions used to manage "last error message"
Index: /branches/eam_branches/ohana.20160226/src/libohana/src/Fread.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libohana/src/Fread.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libohana/src/Fread.c	(revision 39409)
@@ -44,6 +44,13 @@
 
 static int ByteSwap (char *ptr, off_t size, off_t nitems, char *type) {
+  OHANA_UNUSED_PARAM(size);
 
-# ifdef BYTE_SWAP
+# ifndef BYTE_SWAP
+  OHANA_UNUSED_PARAM(ptr);
+  OHANA_UNUSED_PARAM(nitems);
+  OHANA_UNUSED_PARAM(type);
+  return (TRUE);
+
+# else
 
   off_t i;
@@ -108,8 +115,4 @@
   return (FALSE);
 
-# else
-
-  return (TRUE);
-
 # endif 
 
Index: /branches/eam_branches/ohana.20160226/src/libohana/src/config.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libohana/src/config.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libohana/src/config.c	(revision 39409)
@@ -43,5 +43,5 @@
   uid_t uid;
   gid_t gid;
-  int i, N, NDEF, status;
+  int unsigned i, N, NDEF, status;
   
   /* first look for -C CONFIG variable */
Index: /branches/eam_branches/ohana.20160226/src/libohana/src/gaussj.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libohana/src/gaussj.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libohana/src/gaussj.c	(revision 39409)
@@ -20,4 +20,5 @@
 // numerical precision, I am raising an error if |growth| > 1e8
 int dgaussjordan_pivot (double **A, double **B, int N, int M, double MIN_PIVOT) {
+  OHANA_UNUSED_PARAM(MIN_PIVOT);
 
   int *colIndex;
Index: /branches/eam_branches/ohana.20160226/src/libohana/src/isolate_elements.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libohana/src/isolate_elements.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libohana/src/isolate_elements.c	(revision 39409)
@@ -1,19 +1,17 @@
-// # include "opihi.h"
-//
-#include "ohana.h"
+# include "ohana.h"
 
 /* local private functions */
-char **InsertValue (char **myOutput, int *Nout, int *Nchar, int *NCHAR, char c);
-char **EndOfString (char **myOutput, int *Nout, int *Nchar, int *NOUT, int *NCHAR);
+char **InsertValue (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NCHAR, char c);
+char **EndOfString (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NOUT, unsigned int *NCHAR);
 int IsAnOp (char *c);
 int IsTwoOp (char *c);
 
-char **isolate_elements (int Nin, char **in, int *nout) {
+char **isolate_elements (unsigned int Nin, char **in, unsigned int *nout) {
   
   /* local private static variables */
-  int NCHAR, Nchar, Nout, NOUT;
+  unsigned int NCHAR, Nchar, Nout, NOUT;
   char **myOutput;
 
-  int i, j, minus, negate, plus, posate, OpStat, SciNotation;
+  unsigned int i, j, minus, negate, plus, posate, OpStat, SciNotation;
 
   NOUT = Nin;
@@ -142,5 +140,5 @@
 }
 
-char **InsertValue (char **myOutput, int *Nout, int *Nchar, int *NCHAR, char c) {
+char **InsertValue (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NCHAR, char c) {
   myOutput[*Nout][*Nchar] = c;
   (*Nchar) ++;
@@ -153,5 +151,5 @@
 }
 
-char **EndOfString (char **myOutput, int *Nout, int *Nchar, int *NOUT, int *NCHAR) {
+char **EndOfString (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NOUT, unsigned int *NCHAR) {
   if ((*Nchar) > 0) {
     myOutput[*Nout][*Nchar] = 0;
Index: /branches/eam_branches/ohana.20160226/src/libohana/src/ohana_allocate.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libohana/src/ohana_allocate.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/libohana/src/ohana_allocate.c	(revision 39409)
@@ -17,4 +17,7 @@
 # define TRUE 1
 # define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
+
+// a no-op to mark unused parameters in a function
+# define OHANA_UNUSED_PARAM(x)(void)(x)
 
 static OhanaMemblock *lastBlock = NULL;
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/UpdateObjects.c	(revision 39408)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/UpdateObjects.c	(revision 39409)
@@ -257,6 +257,7 @@
     }
 
+    // if we have fitted (and accepted) a parallax model, get the best pm fit and chisq
+    // given the set of points (mask is respected)
     if (average[0].flags & ID_OBJ_USE_PAR) {
-      // get the best pm fit and chisq given the set of points (mask is respected)
       if (!FitPM_Basic (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) {
 	average[0].flags |= ID_OBJ_BAD_PM;
