Index: trunk/psModules/src/camera/pmFPACopy.c
===================================================================
--- trunk/psModules/src/camera/pmFPACopy.c	(revision 7168)
+++ trunk/psModules/src/camera/pmFPACopy.c	(revision 7278)
@@ -24,4 +24,6 @@
                           )
 {
+    assert(source);
+
     psImage *copy = psMemIncrRefCounter(source);
     bool copied = false;                // Have the pixels been copied?
@@ -51,4 +53,8 @@
                      )
 {
+    assert(region);
+    assert(xBin > 0);
+    assert(yBin > 0);
+
     // Want to include the lower bound: 1 binned by 4 --> 0; 3 binned by 4 --> 0; 4 binned by 4 --> 1
     region->x0 = (int)(region->x0 / xBin);
@@ -62,4 +68,6 @@
                      )
 {
+    assert(cell);
+
     if (cell->hdu && cell->hdu->phu) {
         return cell->hdu;
@@ -274,4 +282,6 @@
     assert(target);
     assert(source);
+    assert(xBin > 0);
+    assert(yBin > 0);
 
     psArray *targetCells = target->cells; // The target cells
@@ -300,12 +310,14 @@
 }
 
-static int fpaCopy(pmFPA *target,            // The target FPA
-                   pmFPA *source,            // The source FPA, to be copied
-                   bool pixels,              // Copy the pixels?
-                   int xBin, int yBin        // (Relative) binning factors in x and y
-                  )
+static bool fpaCopy(pmFPA *target,            // The target FPA
+                    pmFPA *source,            // The source FPA, to be copied
+                    bool pixels,              // Copy the pixels?
+                    int xBin, int yBin        // (Relative) binning factors in x and y
+                   )
 {
     assert(target);
     assert(source);
+    assert(xBin > 0);
+    assert(yBin > 0);
 
     psArray *targetChips = target->chips; // The target chips
@@ -338,47 +350,65 @@
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-int pmFPACopy(pmFPA *target,            // The target FPA
-              pmFPA *source             // The source FPA, to be copied
-             )
-{
+bool pmFPACopy(pmFPA *target,            // The target FPA
+               pmFPA *source             // The source FPA, to be copied
+              )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
     return fpaCopy(target, source, true, 1, 1);
 }
 
-int pmChipCopy(pmChip *target,          // The target chip
-               pmChip *source           // The source chip, to be copied
-              )
-{
+bool pmChipCopy(pmChip *target,          // The target chip
+                pmChip *source           // The source chip, to be copied
+               )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
     return chipCopy(target, source, true, 1, 1);
 }
 
-int pmCellCopy(pmCell *target,          // The target cell
-               pmCell *source           // The source cell, to be copied
-              )
-{
+bool pmCellCopy(pmCell *target,          // The target cell
+                pmCell *source           // The source cell, to be copied
+               )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
     return cellCopy(target, source, true, 1, 1);
 }
 
 
-int pmFPACopyStructure(pmFPA *target,   // The target FPA
-                       pmFPA *source,   // The source FPA, to be copied
-                       int xBin, int yBin // Binning factors in x and y
-                      )
-{
-    return fpaCopy(target, source, false, xBin, yBin);
-}
-
-int pmChipCopyStructure(pmChip *target, // The target chip
-                        pmChip *source, // The source chip, to be copied
+bool pmFPACopyStructure(pmFPA *target,   // The target FPA
+                        pmFPA *source,   // The source FPA, to be copied
                         int xBin, int yBin // Binning factors in x and y
                        )
 {
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
+    PS_ASSERT_INT_POSITIVE(xBin, false);
+    PS_ASSERT_INT_POSITIVE(yBin, false);
+    return fpaCopy(target, source, false, xBin, yBin);
+}
+
+bool pmChipCopyStructure(pmChip *target, // The target chip
+                         pmChip *source, // The source chip, to be copied
+                         int xBin, int yBin // Binning factors in x and y
+                        )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
+    PS_ASSERT_INT_POSITIVE(xBin, false);
+    PS_ASSERT_INT_POSITIVE(yBin, false);
     return chipCopy(target, source, false, xBin, yBin);
 }
 
-int pmCellCopyStructure(pmCell *target, // The target cell
-                        pmCell *source, // The source cell, to be copied
-                        int xBin, int yBin // Binning factors in x and y
-                       )
-{
+bool pmCellCopyStructure(pmCell *target, // The target cell
+                         pmCell *source, // The source cell, to be copied
+                         int xBin, int yBin // Binning factors in x and y
+                        )
+{
+    PS_ASSERT_PTR_NON_NULL(target, false);
+    PS_ASSERT_PTR_NON_NULL(source, false);
+    PS_ASSERT_INT_POSITIVE(xBin, false);
+    PS_ASSERT_INT_POSITIVE(yBin, false);
     return cellCopy(target, source, false, xBin, yBin);
 }
