Index: trunk/psModules/src/pmNonLinear.c
===================================================================
--- trunk/psModules/src/pmNonLinear.c	(revision 2481)
+++ trunk/psModules/src/pmNonLinear.c	(revision 2857)
@@ -3,8 +3,8 @@
  *  Provides polynomial or table lookup non-linearity corrections to readouts.
  *
- *  @author George Gusciora, MHPCC
+ *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-25 02:54:45 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-30 22:22:00 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -31,10 +31,10 @@
                                     const psPolynomial1D *coeff)
 {
-    int i;
-    int j;
-
     PS_PTR_CHECK_NULL(in,NULL);
     PS_PTR_CHECK_NULL(in->image, NULL);
     PS_PTR_CHECK_NULL(coeff,NULL);
+
+    psS32 i;
+    psS32 j;
 
     for (i=0;i<(in->image)->numRows;i++) {
@@ -63,19 +63,20 @@
     PS_PTR_CHECK_NULL(outFlux,NULL);
 
-    int i;
-    int j;
-    int tableSize = inFlux->n;
-    int binNum;
+    psS32 i;
+    psS32 j;
+    psS32 tableSize = inFlux->n;
+    psS32 binNum;
     psScalar x;
-    int numPixels = 0;
-    float slope;
+    psS32 numPixels = 0;
+    psF32 slope;
 
     x.type.type = PS_TYPE_F32;
     if (inFlux->n != outFlux->n) {
-        // XXX: psWarning("pmNonLinearityLookup(): input vectors have different size");
         tableSize = PS_MIN(inFlux->n, outFlux->n);
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (%d, %d)\n", inFlux->n, outFlux->n);
     }
     if (inFlux->n < 2) {
-        // XXX: psWarning("pmNonLinearityLookup(): input vector less than 2 elements");
+        psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): input vector less than 2 elements.  Returning in image.");
         return(in);
     }
@@ -96,4 +97,9 @@
 
                 numPixels++;
+            } else if (binNum < -2) {
+                // We get here if there was some other problem.
+                psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): Could not perform p_psVectorBinDisect().  Returning in image.");
+                return(in);
+                numPixels++;
             } else {
                 // Perform linear interpolation.
@@ -106,5 +112,6 @@
     }
     if (numPixels > 0) {
-        // XXX: psWarning("Warning: pmNonLinearityLookup(): %d pixels outside table.", numPixels);
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): %d pixels outside table.", numPixels);
     }
     return(in);
