Index: trunk/psLib/src/image/psImageExtraction.c
===================================================================
--- trunk/psLib/src/image/psImageExtraction.c	(revision 2074)
+++ trunk/psLib/src/image/psImageExtraction.c	(revision 2088)
@@ -9,6 +9,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-13 02:40:13 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-13 22:05:03 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -508,5 +508,5 @@
                      float endCol,
                      float endRow,
-                     float nSamples,
+                     unsigned int nSamples,
                      psImageInterpolateMode mode)
 {
@@ -538,6 +538,7 @@
                    PS_ERRORTEXT_psImage_LINE_NOT_IN_IMAGE,
                    startCol,startRow,endCol,endRow,
-                   numCols,numRows);
-        psFree(out);
+                   numCols-1,numRows-1);
+        psFree(out);
+        return NULL;
     }
 
@@ -548,6 +549,7 @@
                        PS_ERRORTEXT_psImage_IMAGE_MASK_SIZE,
                        mask->numCols,mask->numRows,
-                       numCols, numRows);
+                       numCols-1, numRows);
             psFree(out);
+            return NULL;
         }
         if (mask->type.type != PS_TYPE_MASK) {
@@ -559,4 +561,5 @@
                        typeStr, PS_TYPE_MASK_NAME);
             psFree(out);
+            return NULL;
         }
     }
@@ -574,11 +577,8 @@
     }
 
-    out = psVectorRecycle(out,nSamples,in->type.type);
-
-    float dX = (endCol - startCol) / (nSamples-1);
-    float dY = (endRow - startRow) / (nSamples-1);
-
-    float x = startCol;
-    float y = startRow;
+    out = psVectorRecycle(out, nSamples, in->type.type);
+
+    float dX = (endCol - startCol) / (float)(nSamples-1);
+    float dY = (endRow - startRow) / (float)(nSamples-1);
 
     #define LINEAR_CUT_CASE(TYPE) \
@@ -586,4 +586,6 @@
         ps##TYPE* outData = out->data.TYPE; \
         for (int i = 0; i < nSamples; i++) { \
+            float x = startCol + (float)i*dX; \
+            float y = startRow + (float)i*dY; \
             /* store off the location of the sample. */ \
             if (cutColsData != NULL) { \
@@ -594,6 +596,4 @@
             } \
             outData[i] = psImagePixelInterpolate(in,x,y,mask,maskVal,0,mode); \
-            x += dX; \
-            y += dY; \
         } \
     } \
