Index: /trunk/psModules/src/pmFlatField.c
===================================================================
--- /trunk/psModules/src/pmFlatField.c	(revision 1852)
+++ /trunk/psModules/src/pmFlatField.c	(revision 1853)
@@ -18,6 +18,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-22 23:58:20 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-23 01:33:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -53,5 +53,5 @@
     // Check for nulls
     if (in == NULL) {
-        return false;
+        return true;       // Readout may not have data in it
     } else if(flat==NULL) {
         psErrorMsg(PS_ERRORNAME_DOMAIN "pmFlatField", PS_ERR_BAD_PARAMETER_NULL, true,
Index: /trunk/psModules/src/pmMaskBadPixels.c
===================================================================
--- /trunk/psModules/src/pmMaskBadPixels.c	(revision 1852)
+++ /trunk/psModules/src/pmMaskBadPixels.c	(revision 1853)
@@ -19,6 +19,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-20 20:36:46 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-23 01:33:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,4 +33,5 @@
 
 #include "pmMaskBadPixels.h"
+#include "pmMaskBadPixelsErrors.h"
 
 bool pmMaskBadPixels(psReadout *in, const psImage *mask, unsigned int maskVal, float sat,
@@ -57,8 +58,8 @@
     // Check for nulls
     if (in == NULL) {
-        psError(__func__, " : Line %d - Null not allowed for input readout", __LINE__);
-        return false;
+        return true;   // Readout may not have data in it
     } else if(mask==NULL) {
-        psError(__func__, " : Line %d - Null not allowed for mask", __LINE__);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_NULL_MASK_IMAGE);
         return false;
     }
@@ -66,5 +67,6 @@
     inImage = in->image;
     if (inImage == NULL) {
-        psError(__func__, " : Line %d - Null not allowed for input image", __LINE__);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_NULL_INPUT_IMAGE);
         return false;
     } else if(inMask == NULL) {
@@ -74,19 +76,13 @@
 
     // Check input image and its mask are not larger than mask
-    if(inImage->numRows > mask->numRows) {
-        psError(__func__, " : Line %d - Input image exceeds mask image in number of rows. (%d vs %d).",
-                __LINE__, inImage->numRows, mask->numRows);
+    if(inImage->numRows>mask->numRows || inImage->numCols > mask->numCols) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_SIZE, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_SIZE_INPUT_IMAGE,
+                   inImage->numRows, inImage->numCols, mask->numRows, mask->numCols);
         return false;
-    } else if(inImage->numCols > mask->numCols) {
-        psError(__func__, " : Line %d - Input image exceeds mask image in number of columns. (%d vs %d).",
-                __LINE__, inImage->numCols, mask->numCols);
-        return false;
-    } else if(inMask->numRows > mask->numRows) {
-        psError(__func__, " : Line %d - Input image mask exceeds mask image in number of rows. (%d vs %d).",
-                __LINE__, inImage->numRows, mask->numRows);
-        return false;
-    } else if(inMask->numCols > mask->numCols) {
-        psError(__func__, " : Line %d - Input image mask exceeds mask image in number of columns. (%d vs %d).",
-                __LINE__, inImage->numCols, mask->numCols);
+    } else if(inMask->numRows>mask->numRows || inMask->numCols>mask->numCols) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_SIZE, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_SIZE_MASK_IMAGE,
+                   inImage->numRows, inImage->numCols, mask->numRows, mask->numCols);
         return false;
     }
@@ -97,27 +93,18 @@
 
     // Check that offsets are within image limits
-    if(totOffRow > mask->numRows-1) {
-        psError(__func__, " : Line %d - Initial row offset exceeds that of mask image. (%d vs %d).",
-                __LINE__, totOffRow, mask->numRows);
+    if(totOffRow>=mask->numRows || totOffCol>=mask->numCols) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_SIZE, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_OFFSET_MASK_IMAGE,
+                   totOffRow, totOffCol, mask->numRows, mask->numCols);
         return false;
-    } else if(totOffCol > mask->numCols-1) {
-        psError(__func__, " : Line %d - Initial column offset exceeds that of mask image. (%d vs %d).",
-                __LINE__, totOffCol, mask->numCols);
+    } else if(totOffRow>=inImage->numRows || totOffCol>=inImage->numCols) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_SIZE, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_OFFSET_INPUT_IMAGE,
+                   totOffRow, totOffCol, inImage->numRows, inImage->numCols);
         return false;
-    } else if(totOffRow > inImage->numRows-1) {
-        psError(__func__, " : Line %d - Initial row offset exceeds that of input image. (%d vs %d).",
-                __LINE__, totOffRow, inImage->numRows);
-        return false;
-    } else if(totOffCol > inImage->numCols-1) {
-        psError(__func__, " : Line %d - Initial column offset exceeds that of input image. (%d vs %d).",
-                __LINE__, totOffCol, inImage->numCols);
-        return false;
-    } else if(totOffRow > inMask->numRows-1) {
-        psError(__func__, " : Line %d - Initial row offset exceeds that of input image mask. (%d vs %d).",
-                __LINE__, totOffRow, inMask->numRows);
-        return false;
-    } else if(totOffCol > inMask->numCols-1) {
-        psError(__func__, " : Line %d - Initial column offset exceeds that of input image mask. (%d vs %d).",
-                __LINE__, totOffCol, inMask->numCols);
+    } else if(totOffRow>=inMask->numRows || totOffCol>=inMask->numCols) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_SIZE, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_OFFSET_INPUT_IMAGE_MASK,
+                   totOffRow, totOffCol, inMask->numRows, inMask->numCols);
         return false;
     }
@@ -127,9 +114,12 @@
     maskType = mask->type.type;
     if(PS_IS_PSELEMTYPE_COMPLEX(inType)) {
-        psError(__func__, " : Line %d - Complex types not allowed for input image. Type: %d", __LINE__,
-                inType);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_TYPE_INPUT_IMAGE,
+                   inType);
         return false;
     } else if(maskType!=PS_TYPE_MASK) {
-        psError(__func__, " : Line %d - Mask must be PS_TYPE_MASK type. Type: %d", __LINE__, maskType);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_TYPE_MASK_IMAGE,
+                   maskType);
         return false;
     }
@@ -183,5 +173,7 @@
         PM_BAD_PIXELS(F64);
     default:
-        psError(__func__, "Unsupported image datatype. Type: %d", inType);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_TYPE, true,
+                   PS_ERRORTEXT_pmMaskBadPixels_TYPE_UNSUPPORTED,
+                   inType);
     }
 
