Index: /branches/eam_branches/ohana.20160226/src/libdvo/include/dvo_util.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/include/dvo_util.h	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/include/dvo_util.h	(revision 39411)
@@ -61,5 +61,5 @@
 // There is no need to release memory pointed to by return value. 
 // It will be freed when dvoConfigFree() is invoked.
-Image *dvoImageByExternID(dvoConfig *dvoConfig, int sourceID, int externID);
+Image *dvoImageByExternID(dvoConfig *dvoConfig, unsigned short sourceID, unsigned int externID);
 
 // Loads the sky table for the database.
@@ -72,5 +72,5 @@
 // return a list of detections from a particular image id
 // Use dvoFree() to free the memory pointed to by results
-off_t dvoGetDetections(SkyList *skylist, int imageID, dvoDetection **results, int *pMaxDetID);
+off_t dvoGetDetections(SkyList *skylist, unsigned int imageID, dvoDetection **results, unsigned int *pMaxDetID);
 
 // free memory returned by various dvo util functions
Index: /branches/eam_branches/ohana.20160226/src/libdvo/include/dvodb.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/include/dvodb.h	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/include/dvodb.h	(revision 39411)
@@ -490,6 +490,6 @@
 double        TimeValue (time_t time, time_t TimeReference, int TimeFormat);
 
-void          image_subset          PROTO((Image *image, off_t Nimage, off_t **Subset, off_t *Nsubset, SkyRegionSelection *selection, unsigned long int tzero, double trange, int TimeSelect));
-off_t         match_image_subset    PROTO((Image *image, off_t *subset, off_t Nsubset, unsigned int T, short int S));
+void          image_subset          PROTO((Image *image, off_t Nimage, off_t **Subset, off_t *Nsubset, SkyRegionSelection *selection, e_time tzero, double trange, int TimeSelect));
+off_t         match_image_subset    PROTO((Image *image, off_t *subset, off_t Nsubset, e_time T, short int S));
 
 // dvo DB field functions
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapUtils.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapUtils.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/AstromOffsetMapUtils.c	(revision 39411)
@@ -11,5 +11,5 @@
   off_t i;
   for (i = 0; i < Nimages; i++) {
-    if (images[i].imageID < 0) continue;
+    // if (images[i].imageID < 0) continue;
 
     unsigned int imageID = images[i].imageID;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/ImageOps.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/ImageOps.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/ImageOps.c	(revision 39411)
@@ -5,5 +5,5 @@
 void image_subset (Image *image, off_t Nimage, off_t **Subset, off_t *Nsubset,
 		   SkyRegionSelection *selection, 
-		   unsigned long int tzero, double trange, int TimeSelect) 
+		   e_time tzero, double trange, int TimeSelect) 
 {
 
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dbExtractImages.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dbExtractImages.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dbExtractImages.c	(revision 39411)
@@ -55,4 +55,5 @@
 /* return image.field based on the selection */
 dbValue dbExtractImages (Image *image, off_t Nimage, off_t N, dbField *field) {
+  OHANA_UNUSED_PARAM(Nimage); // XXX: not sure why this is supplied
 
   double x, y;
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/db_utils.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/db_utils.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/db_utils.c	(revision 39411)
@@ -10,4 +10,7 @@
 // by default, no graphdata 
 int GetGraphdata(Graphdata *graph, int *kapa, char *name) {
+  OHANA_UNUSED_PARAM(graph);
+  OHANA_UNUSED_PARAM(kapa);
+  OHANA_UNUSED_PARAM(name);
     return FALSE;
 }
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_util.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_util.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/dvo_util.c	(revision 39411)
@@ -1,198 +1,192 @@
+#include <dvo_util.h>
+
 // dvo_util.c
 // This file contains a set of functions that provide simple read-only access to a dvo database
 //
-#include <dvo_util.h>
-
-void dvoFree(void *ptr)
-{
-    if (ptr) {
-        FREE(ptr);
-    }
-}
-
-dvoConfig * dvoConfigAlloc()
-{
-    dvoConfig *config;
-
-    ALLOCATE(config, dvoConfig, 1);
-
-    memset(config, 0, sizeof(dvoConfig));
-    return config;
-}
-
-void dvoConfigFree(dvoConfig *dvoConfig)
-{
-    if (dvoConfig) {
-        if (dvoConfig->skyTable) {
-            SkyTableFree(dvoConfig->skyTable);
-        }
-        if (dvoConfig->images) {
-            gfits_db_free(&dvoConfig->imageDB);
-        }
-        FREE(dvoConfig);
-    }
-}
-
-dvoConfig *dvoConfigRead(int *argc, char **argv)
-{
-    dvoConfig *dvoConfig = dvoConfigAlloc();
-    char MasterPhotcodeFile[256];
-
-    char *file = SelectConfigFile(argc, argv, "ptolemy");
-    char *configData = LoadConfigFile(file);
-    if (!configData) {
-        fprintf(stderr, "ERROR: can't find configuration file %s\n", file);
-        if (file) {
-            FREE(file);
-        }
-        exit(3);
-    }
-    FREE (file);
-    file = NULL;
-
-    ScanConfig (configData, "GSCFILE",         "%s", 0, dvoConfig->gscfile);
-    ScanConfig (configData, "CATDIR",          "%s", 0, dvoConfig->catdir);
-    ScanConfig (configData, "CATMODE",         "%s",  0, dvoConfig->catmode);
-    ScanConfig (configData, "CATFORMAT",       "%s",  0, dvoConfig->catformat);
-    ScanConfig (configData, "PHOTCODE_FILE",   "%s",  0, MasterPhotcodeFile);
-    if (!ScanConfig (configData, "SKY_DEPTH",    "%d",  0, &dvoConfig->skyDepth)) {
-        dvoConfig->skyDepth = 2;
-    }
-    if (!ScanConfig (configData, "SKY_TABLE",    "%s",  0, dvoConfig->skyTableFile)) {
-        dvoConfig->skyTableFile[0] = 0;
-    }
-
-    snprintf (dvoConfig->photcodeFile, 256, "%s/Photcodes.dat", dvoConfig->catdir);
-    if (!LoadPhotcodes (dvoConfig->photcodeFile, MasterPhotcodeFile, FALSE)) {
-        fprintf (stderr, "error loading photcode table %s or master file %s\n",
-            dvoConfig->photcodeFile, MasterPhotcodeFile);
-        exit (1);
-    }
-
-    double zero_point;
-    ScanConfig (configData, "ZERO_PT",                "%lf", 0, &zero_point);
-    SetZeroPoint (zero_point);
+
+void dvoFree(void *ptr) {
+  if (ptr) {
+    FREE(ptr);
+  }
+}
+
+dvoConfig *dvoConfigAlloc() {
+  dvoConfig *config;
+
+  ALLOCATE(config, dvoConfig, 1);
+
+  memset(config, 0, sizeof(dvoConfig));
+  return config;
+}
+
+void dvoConfigFree(dvoConfig *dvoConfig) {
+  if (dvoConfig) {
+    if (dvoConfig->skyTable) {
+      SkyTableFree(dvoConfig->skyTable);
+    }
+    if (dvoConfig->images) {
+      gfits_db_free(&dvoConfig->imageDB);
+    }
+    FREE(dvoConfig);
+  }
+}
+
+dvoConfig *dvoConfigRead(int *argc, char **argv) {
+  dvoConfig *dvoConfig = dvoConfigAlloc();
+  char MasterPhotcodeFile[256];
+
+  char *file = SelectConfigFile(argc, argv, "ptolemy");
+  char *configData = LoadConfigFile(file);
+  if (!configData) {
+    fprintf(stderr, "ERROR: can't find configuration file %s\n", file);
+    if (file) {
+      FREE(file);
+    }
+    exit(3);
+  }
+  FREE (file);
+  file = NULL;
+
+  ScanConfig (configData, "GSCFILE",         "%s", 0, dvoConfig->gscfile);
+  ScanConfig (configData, "CATDIR",          "%s", 0, dvoConfig->catdir);
+  ScanConfig (configData, "CATMODE",         "%s",  0, dvoConfig->catmode);
+  ScanConfig (configData, "CATFORMAT",       "%s",  0, dvoConfig->catformat);
+  ScanConfig (configData, "PHOTCODE_FILE",   "%s",  0, MasterPhotcodeFile);
+  if (!ScanConfig (configData, "SKY_DEPTH",    "%d",  0, &dvoConfig->skyDepth)) {
+    dvoConfig->skyDepth = 2;
+  }
+  if (!ScanConfig (configData, "SKY_TABLE",    "%s",  0, dvoConfig->skyTableFile)) {
+    dvoConfig->skyTableFile[0] = 0;
+  }
+
+  snprintf (dvoConfig->photcodeFile, 256, "%s/Photcodes.dat", dvoConfig->catdir);
+  if (!LoadPhotcodes (dvoConfig->photcodeFile, MasterPhotcodeFile, FALSE)) {
+    fprintf (stderr, "error loading photcode table %s or master file %s\n",
+	     dvoConfig->photcodeFile, MasterPhotcodeFile);
+    exit (1);
+  }
+
+  double zero_point;
+  ScanConfig (configData, "ZERO_PT",                "%lf", 0, &zero_point);
+  SetZeroPoint (zero_point);
 
 #if (DVO_UTIL_READ_CAMERA_CONFIG)
-    // at one point I thought reading the camera configuration might be useful
-    // but we didn't need it
-    if (!ScanConfig (configData, "CAMERA_CONFIG", "%s", 0, dvoConfig->cameraConfig)) {
-        fprintf (stderr, "can't find CAMERA_CONFIG in configuration\n");
-        exit (3);
-    }
-    char * cameraConfigData = LoadConfigFile(dvoConfig->cameraConfig);
-    if (!cameraConfigData) {
-        fprintf (stderr, "failed to load %s\n", dvoConfig->cameraConfig);
-        exit (3);
-    }
-
-    ScanConfig (cameraConfigData, "NCCD", "%d", 1, &dvoConfig->nCCD);
+  // at one point I thought reading the camera configuration might be useful
+  // but we didn't need it
+  if (!ScanConfig (configData, "CAMERA_CONFIG", "%s", 0, dvoConfig->cameraConfig)) {
+    fprintf (stderr, "can't find CAMERA_CONFIG in configuration\n");
+    exit (3);
+  }
+  char * cameraConfigData = LoadConfigFile(dvoConfig->cameraConfig);
+  if (!cameraConfigData) {
+    fprintf (stderr, "failed to load %s\n", dvoConfig->cameraConfig);
+    exit (3);
+  }
+
+  ScanConfig (cameraConfigData, "NCCD", "%d", 1, &dvoConfig->nCCD);
 #endif
 
-    return (dvoConfig);
-}
-
-int dvoLoadImages(dvoConfig *dvoConfig)
-{
-    if (dvoConfig->images) {
-        return TRUE;
-    }
-
-    char filename[256];
+  return (dvoConfig);
+}
+
+int dvoLoadImages(dvoConfig *dvoConfig) {
+  if (dvoConfig->images) {
+    return TRUE;
+  }
+
+  char filename[256];
   
-    snprintf (filename, 256, "%s/Images.dat", dvoConfig->catdir);
-
-    gfits_db_init (&dvoConfig->imageDB);
-    dvoConfig->imageDB.lockstate = LCK_SOFT;
-    dvoConfig->imageDB.timeout   = 120.0;
-
-    if (!gfits_db_lock (&dvoConfig->imageDB, filename)) {
-        fprintf (stderr, "error opening image catalog %s (1)\n", filename);
-        return (FALSE);
-    }
-
-    if (dvoConfig->imageDB.dbstate == LCK_EMPTY) {
-        fprintf (stderr, "note: image catalog is empty\n");
-        ALLOCATE (dvoConfig->images, Image, 1);
-        dvoConfig->nImages = 1;
-        return (TRUE);
-    }
-
-    int status = dvo_image_load (&dvoConfig->imageDB, TRUE, FALSE);
-    gfits_db_close (&dvoConfig->imageDB);
-
-    if (!status) {
-        fprintf (stderr, "problem loading image database table\n");
-        return (FALSE);
-    }
-
-    dvoConfig->images = gfits_table_get_Image (&dvoConfig->imageDB.ftable, &dvoConfig->nImages, &dvoConfig->imageDB.scaledValue, &dvoConfig->imageDB.nativeOrder);
-    if (!dvoConfig->images) {
-        fprintf (stderr, "problem loading images\n");
-        return (FALSE);
-    }
-
+  snprintf (filename, 256, "%s/Images.dat", dvoConfig->catdir);
+
+  gfits_db_init (&dvoConfig->imageDB);
+  dvoConfig->imageDB.lockstate = LCK_SOFT;
+  dvoConfig->imageDB.timeout   = 120.0;
+
+  if (!gfits_db_lock (&dvoConfig->imageDB, filename)) {
+    fprintf (stderr, "error opening image catalog %s (1)\n", filename);
+    return (FALSE);
+  }
+
+  if (dvoConfig->imageDB.dbstate == LCK_EMPTY) {
+    fprintf (stderr, "note: image catalog is empty\n");
+    ALLOCATE (dvoConfig->images, Image, 1);
+    dvoConfig->nImages = 1;
     return (TRUE);
-}
-Image *dvoImageByExternID(dvoConfig *dvoConfig, int sourceID, int externID)
-{
-    int i;
+  }
+
+  int status = dvo_image_load (&dvoConfig->imageDB, TRUE, FALSE);
+  gfits_db_close (&dvoConfig->imageDB);
+
+  if (!status) {
+    fprintf (stderr, "problem loading image database table\n");
+    return (FALSE);
+  }
+
+  dvoConfig->images = gfits_table_get_Image (&dvoConfig->imageDB.ftable, &dvoConfig->nImages, &dvoConfig->imageDB.scaledValue, &dvoConfig->imageDB.nativeOrder);
+  if (!dvoConfig->images) {
+    fprintf (stderr, "problem loading images\n");
+    return (FALSE);
+  }
+
+  return (TRUE);
+}
+
+Image *dvoImageByExternID(dvoConfig *dvoConfig, unsigned short sourceID, unsigned int externID) {
+
+  unsigned int i;
     
-    if (!dvoLoadImages(dvoConfig)) return NULL;
-
-    for (i=0; i<dvoConfig->nImages; i++) {
-        Image *image = dvoConfig->images + i;
-        if ((image->externID == externID) && (image->sourceID == sourceID)) {
-            BuildChipMatch(dvoConfig->images, dvoConfig->nImages);
-	    return image;
-        }
-    }
-    fprintf(stderr, "can't find image for %d %d\n", sourceID, externID);
-    return NULL;
-}
-
-SkyTable *dvoLoadSkyTable(dvoConfig *dvoConfig)
-{
-    if (!dvoConfig->skyTable) {
-        char *skyfile = "";
-        dvoConfig->skyTable = SkyTableLoadOptimal(dvoConfig->catdir, skyfile, dvoConfig->gscfile,
-                                                    FALSE, dvoConfig->skyDepth, 0);
-    }
-
-    if (dvoConfig->skyTable == NULL) {
-        fprintf(stderr, "failed to load SkyTable\n");
-        return NULL;
-    }
-
-    SkyTableSetFilenames(dvoConfig->skyTable, dvoConfig->catdir, "cpt");
-
-    return dvoConfig->skyTable;
-}
-
-SkyList *dvoSkyListByExternID(dvoConfig *dvoConfig, int sourceID, int externID, Image **ppImage)
-{
-    Image *image = dvoImageByExternID(dvoConfig, sourceID, externID);
-    if (image == NULL) {
-        // fprintf(stderr, "can't find image for %d %d\n", sourceID, externID);
-        return NULL;
-    }
-
-    if (dvoLoadSkyTable(dvoConfig) == NULL) {
-        fprintf(stderr, "failed to load Sky table\n");
-        return NULL;
-    }
-    SkyList *skylist = SkyListByImage(dvoConfig->skyTable, -1, image);
-    if (!skylist->Nregions) {
-        fprintf(stderr, "failed to find SkyList for image  %d %d\n", sourceID, externID);
-        return NULL;
-    }
-
-    *ppImage = image;
-
-    return skylist;
-}
-
-off_t dvoGetDetections(SkyList *skylist, int imageID, dvoDetection **results, int *pMaxDetID)
-{
+  if (!dvoLoadImages(dvoConfig)) return NULL;
+
+  for (i = 0; i < dvoConfig->nImages; i++) {
+    Image *image = dvoConfig->images + i;
+    if ((image->externID == externID) && (image->sourceID == sourceID)) {
+      BuildChipMatch(dvoConfig->images, dvoConfig->nImages);
+      return image;
+    }
+  }
+  fprintf(stderr, "can't find image for %d %d\n", sourceID, externID);
+  return NULL;
+}
+
+SkyTable *dvoLoadSkyTable(dvoConfig *dvoConfig) {
+  if (!dvoConfig->skyTable) {
+    char *skyfile = "";
+    dvoConfig->skyTable = SkyTableLoadOptimal(dvoConfig->catdir, skyfile, dvoConfig->gscfile,
+					      FALSE, dvoConfig->skyDepth, 0);
+  }
+
+  if (dvoConfig->skyTable == NULL) {
+    fprintf(stderr, "failed to load SkyTable\n");
+    return NULL;
+  }
+
+  SkyTableSetFilenames(dvoConfig->skyTable, dvoConfig->catdir, "cpt");
+
+  return dvoConfig->skyTable;
+}
+
+SkyList *dvoSkyListByExternID(dvoConfig *dvoConfig, int sourceID, int externID, Image **ppImage) {
+  Image *image = dvoImageByExternID(dvoConfig, sourceID, externID);
+  if (image == NULL) {
+    // fprintf(stderr, "can't find image for %d %d\n", sourceID, externID);
+    return NULL;
+  }
+
+  if (dvoLoadSkyTable(dvoConfig) == NULL) {
+    fprintf(stderr, "failed to load Sky table\n");
+    return NULL;
+  }
+  SkyList *skylist = SkyListByImage(dvoConfig->skyTable, -1, image);
+  if (!skylist->Nregions) {
+    fprintf(stderr, "failed to find SkyList for image  %d %d\n", sourceID, externID);
+    return NULL;
+  }
+
+  *ppImage = image;
+
+  return skylist;
+}
+
+off_t dvoGetDetections(SkyList *skylist, unsigned int imageID, dvoDetection **results, unsigned int *pMaxDetID) {
   int GetMeasures = 1;
   int reg;
@@ -204,69 +198,71 @@
   *pMaxDetID = -1;
   for (reg=0; reg< skylist->Nregions; reg++) {
-      /* lock, load, unlock catalog */
-      Catalog catalog;
-
-      dvo_catalog_init (&catalog, TRUE);
-      catalog.filename = skylist->filename[reg];
-      catalog.catflags = GetMeasures ? DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT : DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT;
-      catalog.Nsecfilt = 0;
-
-      // an error exit status here is a significant error
-      if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) {
-          fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename);
-          exit (2);
+    /* lock, load, unlock catalog */
+    Catalog catalog;
+
+    dvo_catalog_init (&catalog, TRUE);
+    catalog.filename = skylist->filename[reg];
+    catalog.catflags = GetMeasures ? DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT : DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT;
+    catalog.Nsecfilt = 0;
+
+    // an error exit status here is a significant error
+    if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) {
+      fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename);
+      exit (2);
+    }
+    dvo_catalog_unlock (&catalog);
+
+    off_t Nmeasure = catalog.Nmeasure;
+
+    off_t i;
+    for (i=0; i< Nmeasure; i++) {
+      Measure *m = catalog.measure + i;
+      if (m->imageID != imageID) {
+	continue;
       }
-      dvo_catalog_unlock (&catalog);
-
-      off_t Nmeasure = catalog.Nmeasure;
-
-      off_t i;
-      for (i=0; i< Nmeasure; i++) {
-        Measure *m = catalog.measure + i;
-        if (m->imageID != imageID) {
-            continue;
-        }
-        Average *a = catalog.average + m->averef;
+      Average *a = catalog.average + m->averef;
         
-        dvoDetection *det = detections + Ndetect;
-
-        det->valid     = 1;
-        det->ave      = *a;
-        det->meas     = *m;
+      dvoDetection *det = detections + Ndetect;
+
+      det->valid     = 1;
+      det->ave      = *a;
+      det->meas     = *m;
 #ifdef notdfe
-        det->objID     = a->objID;
-        det->catID     = m->catID;
-        det->detID     = m->detID;
-        det->pspsObjID = a->extID;
-        det->pspsDetID = m->extID;
+      det->objID     = a->objID;
+      det->catID     = m->catID;
+      det->detID     = m->detID;
+      det->pspsObjID = a->extID;
+      det->pspsDetID = m->extID;
 #endif
         
-        if ((int) det->meas.detID > *pMaxDetID) {
-            *pMaxDetID = det->meas.detID;
-        }
-
-        Ndetect++;
-        CHECK_REALLOCATE(detections, dvoDetection, detectionsArrayLength, Ndetect, 1000);
+      if (det->meas.detID > *pMaxDetID) {
+	*pMaxDetID = det->meas.detID;
       }
 
-      dvo_catalog_free (&catalog);
+      Ndetect++;
+      CHECK_REALLOCATE(detections, dvoDetection, detectionsArrayLength, Ndetect, 1000);
+    }
+
+    dvo_catalog_free (&catalog);
   }
   size_t NInvalidDetID = 0;
   if (Ndetect) {
-      dvoDetection *sorted;
-      ALLOCATE(sorted, dvoDetection, *pMaxDetID + 1);
-
-      memset(sorted, 0, sizeof(dvoDetection) * *pMaxDetID);
-      off_t i;
-      for (i = 0; i < Ndetect; i++) {
-
-          if (detections[i].meas.detID < 0 || detections[i].meas.detID > (*pMaxDetID + 1))
-              NInvalidDetID++;
-          else
-              sorted[detections[i].meas.detID] = detections[i];
-      }
-      *results = sorted;
+    dvoDetection *sorted;
+    ALLOCATE(sorted, dvoDetection, *pMaxDetID + 1);
+
+    memset(sorted, 0, sizeof(dvoDetection) * *pMaxDetID);
+    off_t i;
+    for (i = 0; i < Ndetect; i++) {
+
+      // if (detections[i].meas.detID < 0 || detections[i].meas.detID > (*pMaxDetID + 1))
+
+      if (detections[i].meas.detID > (*pMaxDetID + 1))
+	NInvalidDetID++;
+      else
+	sorted[detections[i].meas.detID] = detections[i];
+    }
+    *results = sorted;
   } else {
-      *results = NULL;
+    *results = NULL;
   }
 
Index: /branches/eam_branches/ohana.20160226/src/libdvo/src/match_image.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libdvo/src/match_image.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libdvo/src/match_image.c	(revision 39411)
@@ -1,5 +1,5 @@
 # include "dvo.h"
 
-off_t match_image (Image *image, off_t Nimage, unsigned int T, short int S) {
+off_t match_image (Image *image, off_t Nimage, e_time T, short int S) {
 
   off_t N, Nlo, Nhi, N1, N2;
@@ -37,5 +37,5 @@
 }
 
-off_t match_image_subset (Image *image, off_t *subset, off_t Nsubset, unsigned int T, short int S) {
+off_t match_image_subset (Image *image, off_t *subset, off_t Nsubset, e_time T, short int S) {
 
   off_t N, Nlo, Nhi, N1, N2;
Index: /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier12.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier12.h	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier12.h	(revision 39411)
@@ -63,5 +63,6 @@
 static unsigned char courier12_31_bits[] = {
 0x00};
-static unsigned char courier12_32_bits[] = {};
+static unsigned char courier12_32_bits[] = {
+0x00};
 static unsigned char courier12_33_bits[] = {
 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x02};
Index: /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier24.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier24.h	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier24.h	(revision 39411)
@@ -63,5 +63,6 @@
 static unsigned char courier24_31_bits[] = {
 0x00};
-static unsigned char courier24_32_bits[] = {};
+static unsigned char courier24_32_bits[] = {
+0x00};
 static unsigned char courier24_33_bits[] = {
 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x07, 
Index: /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier8.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier8.h	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/courier8.h	(revision 39411)
@@ -63,5 +63,6 @@
 static unsigned char courier8_31_bits[] = {
 0x00};
-static unsigned char courier8_32_bits[] = {};
+static unsigned char courier8_32_bits[] = {
+0x00};
 static unsigned char courier8_33_bits[] = {
 0x01, 0x01, 0x01, 0x01};
Index: /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/fixed.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/fixed.h	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/rotfont/fixed.h	(revision 39411)
@@ -62,5 +62,6 @@
 static unsigned char fixed_31_bits[] = {
 0x01};
-static unsigned char fixed_32_bits[] = {};
+static unsigned char fixed_32_bits[] = {
+0x00};
 static unsigned char fixed_33_bits[] = {
 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x01};
Index: /branches/eam_branches/ohana.20160226/src/libkapa/src/DrawRotString.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/src/DrawRotString.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/src/DrawRotString.c	(revision 39411)
@@ -36,5 +36,5 @@
   unsigned char *bitmap;
   char *currentname, basename[64]; 
-  int i, dy, dx, N, X, Y, code, protect;
+  int dy, dx, N, X, Y, code, protect;
   int dX, Xoff, dY, Yoff, YoffBase;
   int currentsize, basesize;
@@ -76,4 +76,5 @@
   YoffBase = Yoff;
   /* draw characters one-by-one */
+  unsigned int i;
   for (i = 0; i < strlen(string); i++) {
     N = (int)(string[i]);
@@ -150,5 +151,5 @@
   int ii, jj, byte_line, byte, bit, flag;
   unsigned long int fore;
-  double i, j, cs, sn, rscale, tmp;
+  double ix, iy, cs, sn, rscale, tmp;
   int X, Y, X0, X1, X2, Y0, Y1, Y2, x0, y0;
 
@@ -212,8 +213,8 @@
   XSetForeground (RotDisplay, RotGC, fore);
   if (scale > 1) {
-    for (i = X1; i <= X2; i+=1) {
-      for (j = Y1; j <= Y2; j+=1) {
-	tmp = rscale*(cs*(i - X0) + sn*(j - Y0)) + x0;  ii = NEARINT (tmp);
-	tmp = rscale*(cs*(j - Y0) - sn*(i - X0)) + y0;  jj = NEARINT (tmp);
+    for (ix = X1; ix <= X2; ix += 1) {
+      for (iy = Y1; iy <= Y2; iy += 1) {
+	tmp = rscale*(cs*(ix - X0) + sn*(iy - Y0)) + x0;  ii = NEARINT (tmp);
+	tmp = rscale*(cs*(iy - Y0) - sn*(ix - X0)) + y0;  jj = NEARINT (tmp);
 	/* fprintf (stderr, "%d %d  %d %d\n", i, j, ii, jj);  */
 	if ((ii < 0) || (ii >= dx) || (jj < 0) || (jj >= dy)) continue;
@@ -221,12 +222,12 @@
 	bit = ii % 8;
 	flag = 0x01 & (bitmap[byte] >> bit);
-	if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + i, y + j);
+	if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + ix, y + iy);
       }
     }
   } else {
-    for (i = X1; i <= X2; i+=scale) {
-      for (j = Y1; j <= Y2; j+=scale) {
-	tmp = rscale*(cs*(i - X0) + sn*(j - Y0)) + x0;  ii = NEARINT (tmp);
-	tmp = rscale*(cs*(j - Y0) - sn*(i - X0)) + y0;  jj = NEARINT (tmp);
+    for (ix = X1; ix <= X2; ix+=scale) {
+      for (iy = Y1; iy <= Y2; iy+=scale) {
+	tmp = rscale*(cs*(ix - X0) + sn*(iy - Y0)) + x0;  ii = NEARINT (tmp);
+	tmp = rscale*(cs*(iy - Y0) - sn*(ix - X0)) + y0;  jj = NEARINT (tmp);
 	/* fprintf (stderr, "%d %d  %d %d\n", i, j, ii, jj);  */
 	if ((ii < 0) || (ii >= dx) || (jj < 0) || (jj >= dy)) continue;
@@ -236,18 +237,18 @@
 	/* fprintf (stderr, "%2d %2d  %3d %3d  %1d  %f  %f\n", i, j, ii, jj, flag,
 	   rscale*(cs*(i - X0) + sn*(j - Y0)) + x0, rscale*(cs*(j - Y0) - sn*(i - X0)) + y0);  */
-	if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + i, y + j);
+	if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + ix, y + iy);
       }
     }
 # if (0)
-    for (i = 0; i < dx; i++) {
-      for (j = 0; j < dy; j++) {
-	tmp = scale*(cs*(i - x0) - sn*(j - y0)) + X0; ii = NEARINT (tmp);
-	tmp = scale*(cs*(j - y0) + sn*(i - x0)) + Y0; jj = NEARINT (tmp);
+    for (ix = 0; ix < dx; ix++) {
+      for (iy = 0; iy < dy; iy++) {
+	tmp = scale*(cs*(ix - x0) - sn*(iy - y0)) + X0; ii = NEARINT (tmp);
+	tmp = scale*(cs*(iy - y0) + sn*(ix - x0)) + Y0; jj = NEARINT (tmp);
 	/* if ((ii < 0) || (ii >= dx) || (jj < 0) || (jj >= dy)) continue; */
-	byte = byte_line * j + (i / 8);
-	bit = i % 8;
+	byte = byte_line * iy + (ix / 8);
+	bit = ix % 8;
 	flag = 0x01 & (bitmap[byte] >> bit);
-	fprintf (stderr, "%2d %2d  %3d %3d  %1d  %f  %f\n", i, j, ii, jj, flag, 
-		 scale*(cs*(i - x0) - sn*(j - y0)) + X0, scale*(cs*(j - y0) + sn*(i - x0)) + Y0); 
+	fprintf (stderr, "%2d %2d  %3d %3d  %1d  %f  %f\n", ix, iy, ii, jj, flag, 
+		 scale*(cs*(ix - x0) - sn*(iy - y0)) + X0, scale*(cs*(iy - y0) + sn*(ix - x0)) + Y0); 
 	if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + ii, y + jj);
       }
Index: /branches/eam_branches/ohana.20160226/src/libkapa/src/KapaOpen.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/src/KapaOpen.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/src/KapaOpen.c	(revision 39411)
@@ -10,5 +10,5 @@
 
 static int Nvalid = 0;
-static int *VALID = NULL;
+static u_int32_t *VALID = NULL;
 
 int KapaLaunchCommand (char *line);
@@ -146,8 +146,8 @@
   if (Nvalid == 0) {
     Nvalid = 1;
-    ALLOCATE (VALID, int, Nvalid);
+    ALLOCATE (VALID, u_int32_t, Nvalid);
   } else {
     Nvalid ++;
-    REALLOCATE (VALID, int, Nvalid);
+    REALLOCATE (VALID, u_int32_t, Nvalid);
   }
 
Index: /branches/eam_branches/ohana.20160226/src/libkapa/src/PSRotFont.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/src/PSRotFont.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/src/PSRotFont.c	(revision 39411)
@@ -7,5 +7,5 @@
 
   char *segment, basename[64], *currentname;
-  int i, N, code, protect;
+  int N, code, protect;
   int dX, dY, Xoff, Yoff, X, Y, Nseg, NSEG, YoffBase;
   double cs, sn, currentscale;
@@ -78,4 +78,6 @@
   YoffBase = 0;
   /* accumulate string segments with common state */
+
+  unsigned int i;
   for (i = 0; i < strlen (string); i++) {
     N = (int)(string[i]);
@@ -198,5 +200,5 @@
 int PSRotStrlen (char *c) {
 
-  int i, N, dX, code;
+  int N, dX, code;
   double currentscale, scale; 
 
@@ -208,4 +210,6 @@
 
   code = FALSE;
+
+  unsigned int i;
   for (i = 0; i < strlen (c); i++) {
     N = (int)(c[i]);
Index: /branches/eam_branches/ohana.20160226/src/libkapa/src/RotFont.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/src/RotFont.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/src/RotFont.c	(revision 39411)
@@ -95,5 +95,5 @@
 int RotStrlen (char *c) {
 
-  int i, N, dX, code;
+  int N, dX, code;
   double scale; 
   
@@ -106,4 +106,6 @@
 
   code = FALSE;
+
+  unsigned int i;
   for (i = 0; i < strlen (c); i++) {
     N = (int)(c[i]);
Index: /branches/eam_branches/ohana.20160226/src/libkapa/src/bDrawRotFont.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/libkapa/src/bDrawRotFont.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/libkapa/src/bDrawRotFont.c	(revision 39411)
@@ -14,5 +14,5 @@
   unsigned char *bitmap;
   char *currentname, basename[64]; 
-  int i, dy, dx, N, X, Y, code, protect;
+  int dy, dx, N, X, Y, code, protect;
   int dX, Xoff, dY, Yoff, YoffBase;
   int currentsize, basesize;
@@ -57,4 +57,6 @@
   YoffBase = Yoff;
   /* draw characters one-by-one */
+
+  unsigned int i;
   for (i = 0; i < strlen(string); i++) {
     N = (int)(string[i]);
@@ -125,4 +127,5 @@
 
 int bDrawRotBitmap (bDrawBuffer *buffer, int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) {
+  OHANA_UNUSED_PARAM(mode);
 
   int ii, jj, byte_line, byte, bit, flag;
Index: /branches/eam_branches/ohana.20160226/src/relastro/include/relastro.h
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/include/relastro.h	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/include/relastro.h	(revision 39411)
@@ -88,6 +88,6 @@
   off_t *NMEASURE;	      // allocated Measures per catalog
   int   *index;		      // lookup table catID -> catalog[i]
-  int   *catIDs;	      // lookup table catID <- catalog[i]
-  int    maxID;		      // max catID value to date
+  unsigned int *catIDs;	      // lookup table catID <- catalog[i]
+  unsigned int  maxID;        // max catID value to date
 } CatalogSplitter;
 
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/BrightCatalog.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/BrightCatalog.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/BrightCatalog.c	(revision 39411)
@@ -798,5 +798,7 @@
   catalogs->maxID = 0;
   ALLOCATE (catalogs->index, int, catalogs->maxID + 1);
-  for (i = 0; i <= catalogs->maxID; i++) catalogs->index[i] = -1;
+
+  unsigned int ID;
+  for (ID = 0; ID <= catalogs->maxID; ID++) catalogs->index[ID] = -1;
 
   catalogs->Nsecfilt = Nsecfilt;
@@ -807,7 +809,7 @@
   ALLOCATE (catalogs->catalog, Catalog, catalogs->NCATALOG);
 
-  ALLOCATE (catalogs->catIDs,   int,   catalogs->NCATALOG);
-  ALLOCATE (catalogs->NAVERAGE, off_t, catalogs->NCATALOG);
-  ALLOCATE (catalogs->NMEASURE, off_t, catalogs->NCATALOG);
+  ALLOCATE (catalogs->catIDs,   unsigned int, catalogs->NCATALOG);
+  ALLOCATE (catalogs->NAVERAGE, off_t,        catalogs->NCATALOG);
+  ALLOCATE (catalogs->NMEASURE, off_t,        catalogs->NCATALOG);
 
   for (i = 0; i < catalogs->NCATALOG; i++) {
@@ -844,5 +846,5 @@
 
   // find the max value of catID in this BrightCatalog
-  int catIDmax = 0;
+  unsigned int catIDmax = 0;
   for (i = 0; i < bcatalog->Naverage; i++) {
     catIDmax = MAX(catIDmax, bcatalog->average[i].catID);
@@ -850,14 +852,16 @@
   // XXX validate the measure ID range here
     
-  int maxIDold = catalogs->maxID;
+  unsigned int maxIDold = catalogs->maxID;
   catalogs->maxID = MAX (maxIDold, catIDmax);
     
   // extend the index array and init
   REALLOCATE (catalogs->index, int, catalogs->maxID + 1);
-  for (i = maxIDold + 1; i <= catalogs->maxID; i++) catalogs->index[i] = -1;
+
+  unsigned int id;
+  for (id = maxIDold + 1; id <= catalogs->maxID; id++) catalogs->index[id] = -1;
 
   // identify the new catID values
   for (i = 0; i < bcatalog->Naverage; i++) {
-    int catID = bcatalog->average[i].catID;
+    unsigned int catID = bcatalog->average[i].catID;
     assert (catID > 0);
     assert (catID < catalogs->maxID + 1);
@@ -881,4 +885,5 @@
 
     if (catalogs->Ncatalog >= catalogs->NCATALOG) {
+      int oldNCATALOG = catalogs->NCATALOG;
       catalogs->NCATALOG += 16;
       // fprintf (stderr, "realloc catalogs->catalog: old: %llx  ", (long long) catalogs->catalog);
@@ -894,8 +899,8 @@
       // fprintf (stderr, "new: %llx  -  %llx\n", (long long) catalogs->NMEASURE, (long long) (catalogs->NMEASURE + sizeof(off_t)*catalogs->NCATALOG));
 
-      REALLOCATE (catalogs->catIDs,   int,   catalogs->NCATALOG);
+      REALLOCATE (catalogs->catIDs, unsigned int, catalogs->NCATALOG);
 
       int j;
-      for (j = catalogs->NCATALOG - 16; j < catalogs->NCATALOG; j++) {
+      for (j = oldNCATALOG; j < catalogs->NCATALOG; j++) {
 	dvo_catalog_init (&catalogs->catalog[j], TRUE);
 	catalogs->catIDs[j] = 0;
@@ -917,5 +922,5 @@
   // assign the averages to the corresponding catalog
   for (i = 0; i < bcatalog->Naverage; i++) {
-    int ID = bcatalog->average[i].catID;
+    unsigned int ID = bcatalog->average[i].catID;
     int Nc = catalogs->index[ID];
     assert (Nc > -1);
@@ -942,5 +947,5 @@
   // XXX what about averef and related links?  Do I need them?
   for (i = 0; i < bcatalog->Nmeasure; i++) {
-    int ID = bcatalog->measure[i].catID;
+    unsigned int ID = bcatalog->measure[i].catID;
     int Nc = catalogs->index[ID];
     assert (Nc > -1);
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/ImageOps.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/ImageOps.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/ImageOps.c	(revision 39411)
@@ -508,4 +508,5 @@
     m = ImageToMeasure[im][i];
     c = ImageToCatalog[im][i];
+    myAssert (c < Ncatalog, "oops");
 
     Measure *measure = &catalog[c].measure[m];
@@ -653,4 +654,5 @@
     m = ImageToMeasure[im][i];
     c = ImageToCatalog[im][i];
+    myAssert (c < Ncatalog, "oops");
 
     MeasureTiny *measure = &catalog[c].measureT[m];
@@ -753,4 +755,5 @@
     m = ImageToMeasure[im][i];
     c = ImageToCatalog[im][i];
+    myAssert (c < Ncatalog, "oops");
 
     MeasureTiny *measure = &catalog[c].measureT[m];
@@ -829,4 +832,5 @@
     m = ImageToMeasure[im][i];
     c = ImageToCatalog[im][i];
+    myAssert (c < Ncatalog, "oops");
 
     // XXX should I use the raw coords or just measure.X,Y -> R,D?
@@ -871,4 +875,5 @@
     m = ImageToMeasure[im][i];
     c = ImageToCatalog[im][i];
+    myAssert (c < Ncatalog, "oops");
 
     MeasureTiny *measure = &catalog[c].measureT[m];
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/MosaicOps.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/MosaicOps.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/MosaicOps.c	(revision 39411)
@@ -274,4 +274,5 @@
 // extend each host image table to include the mosaic 'images' needed by the host
 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage) {
+  OHANA_UNUSED_PARAM(Nimage);
 
   int i;
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/UpdateObjects.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/UpdateObjects.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/UpdateObjects.c	(revision 39411)
@@ -121,4 +121,5 @@
 // be called with just MeasureTiny set and Measure == NULL
 int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int cat, off_t measOff) {
+  OHANA_UNUSED_PARAM(Nsecfilt);
 
   int k;
@@ -552,4 +553,5 @@
 // be called with just MeasureTiny set and Measure == NULL
 int UpdateObjects_Stack (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats) {
+  OHANA_UNUSED_PARAM(Nsecfilt);
 
   int status;
@@ -651,4 +653,5 @@
 
 int UpdateObjects_SelectMeasures (FitStats *fit, Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int isStack, int *stackEntry) {
+  OHANA_UNUSED_PARAM(secfilt);
 
   // I've already allocated fit->points (and fit->sample) with space for fit->NpointsAlloc entries
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/dvo_astrom_ops.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/dvo_astrom_ops.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/dvo_astrom_ops.c	(revision 39411)
@@ -2,5 +2,9 @@
 /* the Measure carries the instantaneous mean position at the epoch t */ 
 
+// average & secfilt no longer used since R and D are now in measure
+
 double getMeanR (MeasureTiny *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   double ra;
@@ -14,4 +18,6 @@
 
 double getMeanD (MeasureTiny *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   double dec;
@@ -25,4 +31,6 @@
 
 int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0;
@@ -34,4 +42,6 @@
 
 int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   // old: measure[0].dD += (dec_fit - average[0].D) * 3600.0;
@@ -43,4 +53,6 @@
 
 double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   double ra;
@@ -54,4 +66,6 @@
 
 double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   double dec;
@@ -65,4 +79,6 @@
 
 int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0;
@@ -74,4 +90,6 @@
 
 int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt) {
+  OHANA_UNUSED_PARAM(average);
+  OHANA_UNUSED_PARAM(secfilt);
 
   // measure[0].dD += (dec_fit - average[0].D) * 3600.0;
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/high_speed_utils.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/high_speed_utils.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/high_speed_utils.c	(revision 39411)
@@ -8,6 +8,4 @@
 #define DEFAULT_WHERE_B  "((flags & 0x01000000) == 0) && ((flags & 0x04000000) && ((y:nphot > 1) || (z:nphot > 1)) &&((y:err < 0.2) || (z:err < 0.2)))"
 
-
-extern char **isolate_elements(int, char **, int *);
 
 int print_error();
@@ -76,5 +74,5 @@
     // parse it into elements of the where condition
     char **cstack = NULL;
-    int Ncstack;
+    unsigned int Ncstack;
     cstack = isolate_elements(nWords, words, &Ncstack);
     free(words);
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/indexCatalogs.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/indexCatalogs.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/indexCatalogs.c	(revision 39411)
@@ -1,8 +1,8 @@
 # include "relastro.h"
 
-static int   catIDmax = 0;
-static int  *catIDseq = NULL;
-static int  *objIDmax = NULL;
-static int **objIDseq = NULL;
+static unsigned int   catIDmax = 0;
+static          int  *catIDseq = NULL;
+static unsigned int  *objIDmax = NULL;
+static          int **objIDseq = NULL;
 
 int indexCatalogs (Catalog *catalog, int Ncatalog) {
@@ -19,15 +19,17 @@
 
   ALLOCATE (catIDseq, int, catIDmax + 1);
-  for (i = 0; i < catIDmax + 1; i++) {
-    catIDseq[i] = -1;
+
+  unsigned int ID;
+  for (ID = 0; ID < catIDmax + 1; ID++) {
+    catIDseq[ID] = -1;
   }
 
   for (i = 0; i < Ncatalog; i++) {
-    int catID = catalog[i].catID;
+    unsigned int catID = catalog[i].catID;
     catIDseq[catID] = i;
   }
   
-  ALLOCATE (objIDmax, int,   Ncatalog);
-  ALLOCATE (objIDseq, int *, Ncatalog);
+  ALLOCATE (objIDmax, unsigned int,   Ncatalog);
+  ALLOCATE (objIDseq,          int *, Ncatalog);
   for (i = 0; i < Ncatalog; i++) {
     objIDmax[i] = 0;
@@ -37,10 +39,10 @@
 
     ALLOCATE (objIDseq[i], int, objIDmax[i] + 1);
-    for (j = 0; j < objIDmax[i] + 1; j++) {
-      objIDseq[i][j] = -1;
+    for (ID = 0; ID < objIDmax[i] + 1; ID++) {
+      objIDseq[i][ID] = -1;
     }
 
     for (j = 0; j < catalog[i].Naverage; j++) {
-      int objID = catalog[i].average[j].objID;
+      unsigned int objID = catalog[i].average[j].objID;
       objIDseq[i][objID] = j;
     }
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/plot_scatter.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/plot_scatter.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/plot_scatter.c	(revision 39411)
@@ -2,4 +2,6 @@
    
 void plot_scatter (Catalog *catalog, int Ncatalog) {
+  OHANA_UNUSED_PARAM(catalog);
+  OHANA_UNUSED_PARAM(Ncatalog);
 
 # if (0)   
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/plotstuff.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/plotstuff.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/plotstuff.c	(revision 39411)
@@ -44,4 +44,5 @@
 
 void JpegPlot (Graphdata *graphmode, int N, char *filename) {
+  OHANA_UNUSED_PARAM(graphmode);
 
   if (Xgraph[N] == 0) return;
@@ -52,4 +53,5 @@
 
 void PSPlot (Graphdata *graphmode, int N, char *filename) {
+  OHANA_UNUSED_PARAM(graphmode);
 
   if (Xgraph[N] == 0) return;
@@ -79,4 +81,5 @@
 
 void PlotVector (int Npts, double *vect, int mode, int N, char *type) {
+  OHANA_UNUSED_PARAM(mode);
 
   float *values;
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/relastro_merge_source.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/relastro_merge_source.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/relastro_merge_source.c	(revision 39411)
@@ -22,10 +22,11 @@
   // load data from each region file, only use bright stars
   for (i = 0; i < sky[0].Nregions; i++) {
-    if (sky[0].regions[i].index == CAT_ID_SRC) {
+    myAssert (sky[0].regions[i].index >= 0, "oops");
+    if ((unsigned int) sky[0].regions[i].index == CAT_ID_SRC) {
       catalog_src.filename = sky[0].filename[i];
       region_src = &sky[0].regions[i];
     }
     // currently, we only accept dst == src...
-    if (sky[0].regions[i].index == CAT_ID_DST) {
+    if ((unsigned int) sky[0].regions[i].index == CAT_ID_DST) {
       catalog_dst.filename = sky[0].filename[i];
       // region_dst = &sky[0].regions[i];
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/share_icrf_obj.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/share_icrf_obj.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/share_icrf_obj.c	(revision 39411)
@@ -99,4 +99,5 @@
     int cat, ave, meas;
     ICRFdata (i, &cat, &ave, &meas);
+    myAssert (cat < Ncatalog, "oops");
 
     Average *average = &catalog[cat].average[ave];
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/share_mean_pos.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/share_mean_pos.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/share_mean_pos.c	(revision 39411)
@@ -107,5 +107,6 @@
 	continue;
     }
-
+    myAssert (catSeq < Ncatalog, "oops");
+    
     catalog[catSeq].average[objSeq].R = meanpos[i].R;
     catalog[catSeq].average[objSeq].D = meanpos[i].D;
Index: /branches/eam_branches/ohana.20160226/src/relastro/src/share_meas_pos.c
===================================================================
--- /branches/eam_branches/ohana.20160226/src/relastro/src/share_meas_pos.c	(revision 39410)
+++ /branches/eam_branches/ohana.20160226/src/relastro/src/share_meas_pos.c	(revision 39411)
@@ -101,4 +101,6 @@
 	continue;
     }
+    myAssert (catSeq < Ncatalog, "oops");
+
     off_t m = catalog[catSeq].average[objSeq].measureOffset;
     for (k = 0; k < catalog[catSeq].average[objSeq].Nmeasure; k++, m++) {
