Index: trunk/psModules/src/camera/pmFPACopy.c
===================================================================
--- trunk/psModules/src/camera/pmFPACopy.c	(revision 14647)
+++ trunk/psModules/src/camera/pmFPACopy.c	(revision 14884)
@@ -211,17 +211,17 @@
         if (mdok && trimsec && !psRegionIsNaN(*trimsec)) {
             *trimsec = psImageBinningSetRuffRegion(binning, *trimsec);
-	    // force integer pixels : truncate x0, roundup x1:
-	    trimsec->x0 = (int)trimsec->x0;
-	    if (trimsec->x1 > (int)trimsec->x1) {
-		trimsec->x1 = (int)trimsec->x1 + 1;
-	    } else {
-		trimsec->x1 = (int)trimsec->x1;
-	    }		
-	    trimsec->y0 = (int)trimsec->y0;
-	    if (trimsec->y1 > (int)trimsec->y1) {
-		trimsec->y1 = (int)trimsec->y1 + 1;
-	    } else {
-		trimsec->y1 = (int)trimsec->y1;
-	    }		
+            // force integer pixels : truncate x0, roundup x1:
+            trimsec->x0 = (int)trimsec->x0;
+            if (trimsec->x1 > (int)trimsec->x1) {
+                trimsec->x1 = (int)trimsec->x1 + 1;
+            } else {
+                trimsec->x1 = (int)trimsec->x1;
+            }
+            trimsec->y0 = (int)trimsec->y0;
+            if (trimsec->y1 > (int)trimsec->y1) {
+                trimsec->y1 = (int)trimsec->y1 + 1;
+            } else {
+                trimsec->y1 = (int)trimsec->y1;
+            }
         }
         psList *biassecs = psMetadataLookupPtr(&mdok, target->concepts, "CELL.BIASSEC"); // The bias sections
@@ -232,17 +232,17 @@
                 if (!psRegionIsNaN(*biassec)) {
                     *biassec = psImageBinningSetRuffRegion(binning, *biassec);
-		    // force integer pixels : truncate x0, roundup x1:
-		    biassec->x0 = (int)biassec->x0;
-		    if (biassec->x1 > (int)biassec->x1) {
-			biassec->x1 = (int)biassec->x1 + 1;
-		    } else {
-			biassec->x1 = (int)biassec->x1;
-		    }		
-		    biassec->y0 = (int)biassec->y0;
-		    if (biassec->y1 > (int)biassec->y1) {
-			biassec->y1 = (int)biassec->y1 + 1;
-		    } else {
-			biassec->y1 = (int)biassec->y1;
-		    }		
+                    // force integer pixels : truncate x0, roundup x1:
+                    biassec->x0 = (int)biassec->x0;
+                    if (biassec->x1 > (int)biassec->x1) {
+                        biassec->x1 = (int)biassec->x1 + 1;
+                    } else {
+                        biassec->x1 = (int)biassec->x1;
+                    }
+                    biassec->y0 = (int)biassec->y0;
+                    if (biassec->y1 > (int)biassec->y1) {
+                        biassec->y1 = (int)biassec->y1 + 1;
+                    } else {
+                        biassec->y1 = (int)biassec->y1;
+                    }
                 }
             }
@@ -393,18 +393,18 @@
         pmCell *sourceCell = sourceCells->data[i]; // The sources cell
         const char *cellName = psMetadataLookupStr(NULL, sourceCell->concepts, "CELL.NAME"); // Name of cell
-	// XXX are there other concepts I need to copy first?
-	pmCell *targetCell = pmCellAlloc (targetChip, cellName);
-	int xParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.XPARITY"); // Target x parity
-	psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.XPARITY", PS_META_REPLACE, "", xParityTarget);
-	int yParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.YPARITY"); // Target y parity
-	psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.YPARITY", PS_META_REPLACE, "", yParityTarget);
-	if (!cellCopy(targetCell, sourceCell, true, 1, 1)) {
-	    psError(PS_ERR_BAD_PARAMETER_VALUE, false, "failed to duplicate chip\n");
-	    return NULL;
-	}
-	// update the attributes
-	targetCell->file_exists = sourceCell->file_exists;
-	targetCell->data_exists = sourceCell->data_exists;
-	targetCell->process     = sourceCell->process;
+        // XXX are there other concepts I need to copy first?
+        pmCell *targetCell = pmCellAlloc (targetChip, cellName);
+        int xParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.XPARITY"); // Target x parity
+        psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.XPARITY", PS_META_REPLACE, "", xParityTarget);
+        int yParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.YPARITY"); // Target y parity
+        psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.YPARITY", PS_META_REPLACE, "", yParityTarget);
+        if (!cellCopy(targetCell, sourceCell, true, 1, 1)) {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "failed to duplicate chip\n");
+            return NULL;
+        }
+        // update the attributes
+        targetCell->file_exists = sourceCell->file_exists;
+        targetCell->data_exists = sourceCell->data_exists;
+        targetCell->process     = sourceCell->process;
     }
 
@@ -467,4 +467,8 @@
     PS_ASSERT_PTR_NON_NULL(target, false);
     PS_ASSERT_PTR_NON_NULL(source, false);
+    if (target == source) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy FPA onto itself.");
+        return false;
+    }
     return fpaCopy(target, source, true, 1, 1);
 }
@@ -474,4 +478,8 @@
     PS_ASSERT_PTR_NON_NULL(target, false);
     PS_ASSERT_PTR_NON_NULL(source, false);
+    if (target == source) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy chip onto itself.");
+        return false;
+    }
     return chipCopy(target, source, true, 1, 1);
 }
@@ -481,4 +489,8 @@
     PS_ASSERT_PTR_NON_NULL(target, false);
     PS_ASSERT_PTR_NON_NULL(source, false);
+    if (target == source) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy cell onto itself.");
+        return false;
+    }
     return cellCopy(target, source, true, 1, 1);
 }
@@ -491,4 +503,8 @@
     PS_ASSERT_INT_POSITIVE(xBin, false);
     PS_ASSERT_INT_POSITIVE(yBin, false);
+    if (target == source) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy FPA onto itself.");
+        return false;
+    }
     return fpaCopy(target, source, false, xBin, yBin);
 }
@@ -500,4 +516,8 @@
     PS_ASSERT_INT_POSITIVE(xBin, false);
     PS_ASSERT_INT_POSITIVE(yBin, false);
+    if (target == source) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy chip onto itself.");
+        return false;
+    }
     return chipCopy(target, source, false, xBin, yBin);
 }
@@ -509,4 +529,8 @@
     PS_ASSERT_INT_POSITIVE(xBin, false);
     PS_ASSERT_INT_POSITIVE(yBin, false);
+    if (target == source) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Can't copy cell onto itself.");
+        return false;
+    }
     return cellCopy(target, source, false, xBin, yBin);
 }
