Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 5840)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 5841)
@@ -10,6 +10,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.98 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-12-20 05:20:50 $
+*  @version $Revision: 1.99 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-12-24 00:33:13 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -380,7 +380,10 @@
     PS_ASSERT_PTR_NON_NULL(projection, NULL);
 
-    psF64 phi, theta;
-    psF64 sinDp, cosDp, sinAlpha, cosAlpha, sinDelta, cosDelta;
-    psF64 sinTheta, cosPhiCT, sinPhiCT, zeta;
+    psF64 phi = 0;
+    psF64 theta = 0;
+    psF64 sinTheta = 0;
+    psF64 cosPhiCT = 0;
+    psF64 sinPhiCT = 0;
+    psF64 sinDp, cosDp, sinAlpha, cosAlpha, sinDelta, cosDelta, zeta;
 
     bool zenithal = (projection->type == PS_PROJ_TAN) ||(projection->type == PS_PROJ_SIN);
Index: /trunk/psLib/src/db/psDB.c
===================================================================
--- /trunk/psLib/src/db/psDB.c	(revision 5840)
+++ /trunk/psLib/src/db/psDB.c	(revision 5841)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-01 02:22:09 $
+ *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-12-24 00:33:15 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -1648,5 +1648,5 @@
 static psPtr psDBGetPTypeNaN(psElemType pType)
 {
-    psPtr           myNaN;
+    psPtr           myNaN = NULL;
 
     switch (pType) {
@@ -1703,5 +1703,5 @@
                            psPtr data)
 {
-    bool    isNaN;
+    bool    isNaN = NULL;
 
     switch (pType) {
Index: /trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.c	(revision 5840)
+++ /trunk/psLib/src/imageops/psImageStats.c	(revision 5841)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.85 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-12-14 00:47:27 $
+ *  @version $Revision: 1.86 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-12-24 00:33:17 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 5840)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 5841)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-12-05 22:14:27 $
+ *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-12-24 00:33:18 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -163,43 +163,40 @@
 
 // set actual region based on image parameters:
-// compensate for negative upper limits
-// XXX this is inconsistent: the coordindates should always be in the parent
-//     frame, which means the negative values should subtract from Nx,Ny of
-//     the parent, not the child.  but, we don't carry the dimensions of the
-//     parent in the psImage container.  for now, us the child Nx,Ny
-// force range to be on this subimage
-// XXX EAM : this needs to be changes to use psRegion rather than psRegion*
+// - compensate for negative upper limits
+// - force range to be on this image
+// - saturate on upper and lower limits of image
+// - flip x0,x1 if x0>x1
+// - flip y0,y1 if y0>y1
+// psRegion in refers to coordinates in the
 psRegion psRegionForImage(psImage *image,
                           psRegion in)
 {
 
-    // x0,y0, x1,y1 are in *parent* units
-    //    PS_ASSERT_PTR_NON_NULL(in, NULL);
-    /*
-        if( in == NULL ) {
-            psError(PS_ERR_BAD_PARAMETER_NULL, true, "Unallowable operation.  psRegion in is NULL.");
-            return in;
-        }
-    */    /*    if (out == NULL) {
-        //    out = psRegionAlloc(in->x0, in->x1, in->y0, in->y1);
-            *out = psRegionSet(in->x0, in->x1, in->y0, in->y1);
-            } else {
-            *out = *in;
-            }
-        */    // XXX these are probably wrong (see above)
-    if (in.x1 <= 0) {
-        in.x1 = image->col0 + image->numCols + in.x1;
-    }
-    if (in.y1 <= 0) {
-        in.y1 = image->row0 + image->numRows + in.y1;
-    }
-
-    // force the lower-limits to be on the child
-    in.x0 = PS_MAX(image->col0, in.x0);
-    in.y0 = PS_MAX(image->row0, in.y0);
-
-    // force the upper-limits to be on the child
-    in.x1 = PS_MIN(image->col0 + image->numCols, in.x1);
-    in.y1 = PS_MIN(image->row0 + image->numRows, in.y1);
+    if (image == NULL) {
+        return in;
+    }
+
+    // convert non-positive upper-limits
+    in.x1 = (in.x1 <= 0) ? (image->numCols + in.x1) : in.x1;
+    in.y1 = (in.y1 <= 0) ? (image->numRows + in.y1) : in.y1;
+
+    // force the upper-limits to be on the image
+    in.x1 = PS_MIN(image->numCols, in.x1);
+    in.y1 = PS_MIN(image->numRows, in.y1);
+
+    // force the lower-limits to be on the image
+    in.x0 = PS_MAX(0, in.x0);
+    in.y0 = PS_MAX(0, in.y0);
+    in.x0 = PS_MIN(image->numCols, in.x0);
+    in.y0 = PS_MIN(image->numRows, in.y0);
+
+    // flip start and end if out of order
+    if (in.x0 > in.x1) {
+        PS_SWAP (in.x0, in.x1);
+    }
+    if (in.y0 > in.y1) {
+        PS_SWAP (in.y0, in.y1);
+    }
+
     return (in);
 }
Index: /trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.c	(revision 5840)
+++ /trunk/psLib/src/mathtypes/psVector.c	(revision 5841)
@@ -9,6 +9,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-11-22 19:07:35 $
+*  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-12-24 00:33:18 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -778,5 +778,5 @@
                           psElemType type)
 {
-    psVector *out;
+    psVector *out = NULL;
     switch (type) {
     case PS_TYPE_S8:
Index: /trunk/psLib/src/types/psMetadataConfig.c
===================================================================
--- /trunk/psLib/src/types/psMetadataConfig.c	(revision 5840)
+++ /trunk/psLib/src/types/psMetadataConfig.c	(revision 5841)
@@ -10,6 +10,6 @@
 *  @author Eric Van Alst, MHPCC
 *
-*  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-01 02:22:15 $
+*  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-12-24 00:33:20 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -753,5 +753,5 @@
     p_psParseLevelInfo*  nextLevelInfo = NULL;
     psTime *mTime;
-    psTimeType timeType;
+    psTimeType timeType = PS_TIME_TAI;
 
     // Get the metadata item type
@@ -1294,5 +1294,5 @@
             snprintf(content, MAXSTR, "%s F32  ", item->name);
             strncat(mdString, content, MAXSTR);
-            snprintf(content, MAXSTR, "%f ", item->data.F32);
+            snprintf(content, MAXSTR, "%22.15g ", item->data.F32);
             strncat(mdString, content, MAXSTR);
             if ( strncmp(item->comment,"",2) ) {
@@ -1310,5 +1310,5 @@
             snprintf(content, MAXSTR, "%s F64  ", item->name);
             strncat(mdString, content, MAXSTR);
-            snprintf(content, MAXSTR, "%f ", item->data.F64);
+            snprintf(content, MAXSTR, "%22.15g ", item->data.F64);
             strncat(mdString, content, MAXSTR);
             if ( strncmp(item->comment,"",2) ) {
Index: /trunk/psLib/src/xml/psXML.c
===================================================================
--- /trunk/psLib/src/xml/psXML.c	(revision 5840)
+++ /trunk/psLib/src/xml/psXML.c	(revision 5841)
@@ -10,6 +10,6 @@
 *  @author David Robbins, MHPCC
 *
-*  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-09-26 21:13:28 $
+*  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-12-24 00:33:22 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -48,5 +48,5 @@
 
     psXMLDoc *XML = psXMLDocAlloc();
-    xmlNode *cur_node;
+    xmlNode *cur_node = NULL;
     xmlNode *root = NULL;
     xmlAttr *prop = NULL;
