Index: trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh.c
===================================================================
--- trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh.c	(revision 23924)
+++ trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh.c	(revision 24391)
@@ -200,5 +200,5 @@
 /* Functions that do file operations WITH RETRY: */
 static int write_file(int fd, const void* buf, int len);
-static int read_file(int fd, const void* buf, int len);
+static int read_file(int fd, void* buf, int len);
 static int seek_file(int fd, off_t off); /* Performs lseek(SEEK_SET) */
 static int fh_lock_file(HeaderUnit hu, int fd, fh_mode mode);
@@ -234,4 +234,5 @@
  * this information in debug mode.
  */
+const char* fh_rcs_version(void); /* proto to make gcc happy */
 const char* fh_rcs_version(void) { return rcs_id; }
 
@@ -274,5 +275,5 @@
 
 static void
-null_log(const char* s) { if (s) ; }
+null_log(const char* s) { if (s) return; }
 /*
  * It's also possible to pass a NULL to fh_log_xxx() and rely only on the
@@ -309,5 +310,5 @@
 
 HeaderUnit
-fh_create()
+fh_create(void)
 {
    HeaderUnitStruct* rtn; 
@@ -1941,5 +1942,6 @@
    HeaderUnitStruct* list = FH_HU(hu);
    char writebuf[FH_BLOCK_SIZE];
-   int i = 0, writelen;
+   int i = 0;
+   unsigned int writelen;
    int blocks_left;
    fh_result result;
@@ -2446,5 +2448,5 @@
    else /* byte-swapping case requires a temporary buffer */
    {
-      unsigned char outbuf[32768];
+      unsigned char* outbuf[32768];
 
       while (bytes_left)
@@ -2811,5 +2813,32 @@
    while (len)
    {
-      rtn = write(fd, (char*)buf, len);
+      rtn = write(fd, (const char*)buf, len);
+
+      switch (rtn)
+      {
+	 case -1: if (errno == EINTR || errno == EAGAIN)
+	    continue; /* retry */
+	    return -1; /* permanent failure */
+	 case 0: return count;
+	 default:
+	 {
+	    len -= rtn;
+	    count += rtn;
+	    buf = (const char*)buf + rtn;
+	 }
+      }
+   }
+   return count;
+}
+
+static int
+read_file(int fd, void* buf, int len)
+{
+   int rtn;
+   int count = 0;
+
+   while (len)
+   {
+      rtn = read(fd, (char*)buf, len);
 
       switch (rtn)
@@ -2831,31 +2860,4 @@
 
 static int
-read_file(int fd, const void* buf, int len)
-{
-   int rtn;
-   int count = 0;
-
-   while (len)
-   {
-      rtn = read(fd, (char*)buf, len);
-
-      switch (rtn)
-      {
-	 case -1: if (errno == EINTR || errno == EAGAIN)
-	    continue; /* retry */
-	    return -1; /* permanent failure */
-	 case 0: return count;
-	 default:
-	 {
-	    len -= rtn;
-	    count += rtn;
-	    buf = (char*)buf + rtn;
-	 }
-      }
-   }
-   return count;
-}
-
-static int
 seek_file(int fd, off_t off)
 {
@@ -2969,5 +2971,5 @@
 fh_compare(const void* a, const void* b)
 {
-   double diff = (*((FitsCard**)a))->idx - (*((FitsCard**)b))->idx;
+   double diff = (*((FitsCard* const*)a))->idx - (*((FitsCard* const*)b))->idx;
 
    if (diff < 0) return -1;
Index: trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh_table.c
===================================================================
--- trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh_table.c	(revision 23924)
+++ trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh_table.c	(revision 24391)
@@ -180,8 +180,10 @@
 
    /* Write the format specifiers for each column. */
-   for(i=0; i < table->num_cols; i++)
-   {
+   for (i=0; i < table->num_cols; i++)
+   {
+      int n;
+
       idx = 5.0 + i/10.;
-      int n = i + 1; /* FITS numbering scheme starts from 1. */
+      n = i + 1; /* FITS numbering scheme starts from 1. */
       snprintf(keyword, FH_NAME_SIZE + 1, "TFORM%d", n);
       if((table->cols[i].format == FH_TABLE_FORMAT_FLOAT) ||
@@ -214,8 +216,10 @@
     * nice to have from a self-documenting perspective, isn't strictly
     * necessary to interpret the actual table values. */
-   for(i=0; i < table->num_cols; i++)
-   {
+   for (i=0; i < table->num_cols; i++)
+   {
+      int n;
+
       idx = 7.0 + i/10.;
-      int n = i + 1; /* FITS numbering scheme starts from 1. */
+      n = i + 1; /* FITS numbering scheme starts from 1. */
       snprintf(keyword, FH_NAME_SIZE + 1, "TTYPE%d", n);
       fh_set_str(hu, idx, keyword, table->cols[i].name, 
