Index: trunk/psModules/src/camera/pmFPAfileDefine.c
===================================================================
--- trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 14596)
+++ trunk/psModules/src/camera/pmFPAfileDefine.c	(revision 14647)
@@ -203,4 +203,5 @@
     }
     file->format = psMemIncrRefCounter(format);
+    file->formatName = psStringCopy(formatName);
 
     if (fpa) {
@@ -351,4 +352,5 @@
     psFree (format);
     file->format = psMemIncrRefCounter(format);
+    file->formatName = psStringCopy(config->formatName);
 
     // adjust the rules to identify these files in the file->names data
@@ -440,5 +442,5 @@
 // save the pmFPAfile on config->files
 // return the pmFPAfile (a view to the one saved on config->files)
-pmFPAfile *pmFPAfileBindFromArgs (bool *success, pmFPAfile *input, const pmConfig *config, const char *filename, const char *argname)
+pmFPAfile *pmFPAfileBindFromArgs (bool *success, pmFPAfile *input, pmConfig *config, const char *filename, const char *argname)
 {
     PS_ASSERT_PTR_NON_NULL(input, NULL);
@@ -511,5 +513,5 @@
 
         if (!format) {
-            format = pmConfigCameraFormatFromHeader((pmConfig*)config, phu, true);
+            format = pmConfigCameraFormatFromHeader(config, phu, true);
             if (!format) {
                 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", realName);
@@ -562,4 +564,5 @@
     psFree(file->format);
     file->format = format;
+    file->formatName = psStringCopy(config->formatName);
 
     if (success) *success = true;
@@ -639,4 +642,5 @@
     psFree (file->format);
     file->format = format;
+    file->formatName = psStringCopy(config->formatName);
 
     // adjust the rules to identify these files in the file->names data
@@ -925,5 +929,5 @@
     pmFPAfile *file = pmFPAfileDefineOutput (config, fpa, filename);
     if (!file) {
-        psErrorStackPrint(stderr, "file %s not defined\n", filename);
+        psError(PS_ERR_UNEXPECTED_NULL, false, "file %s not defined\n", filename);
         return NULL;
     }
@@ -944,9 +948,9 @@
     pmFPAfile *file = pmFPAfileDefineOutput (config, NULL, filename);
     if (!file) {
-        psErrorStackPrint(stderr, "file %s not defined\n", filename);
+        psError(PS_ERR_UNEXPECTED_NULL, false, "file %s not defined\n", filename);
         return NULL;
     }
     if (!file->camera) {
-        psErrorStackPrint(stderr, "file %s does not define a new camera\n", filename);
+        psError(PS_ERR_UNEXPECTED_NULL, false, "file %s does not define a new camera\n", filename);
         return NULL;
     }
@@ -987,5 +991,5 @@
     }
     if (!file) {
-        psErrorStackPrint(stderr, "file %s not defined\n", filename);
+        psError(PS_ERR_UNEXPECTED_NULL, false, "file %s not defined\n", filename);
         return NULL;
     }
@@ -1030,5 +1034,5 @@
     }
     if (!file) {
-        psErrorStackPrint(stderr, "file %s not defined\n", filename);
+        psError(PS_ERR_UNEXPECTED_NULL, false, "file %s not defined\n", filename);
         return NULL;
     }
@@ -1075,5 +1079,5 @@
     }
     if (!file) {
-        psErrorStackPrint(stderr, "file %s not defined\n", filename);
+        psError(PS_ERR_UNEXPECTED_NULL, false, "file %s not defined\n", filename);
         return NULL;
     }
