about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-01-19 03:19:47 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-01-19 03:19:47 +0000
commit4ccc95b66dfd0cd2d38d710c22d3233fc19b37c1 (patch)
treecb6567b3f58091cc24e42c8e69640e0b7f7628cb
parent79d7f8c86667c21fadb51ace724b967bb1bced7a (diff)
downloadnetpbm-mirror-4ccc95b66dfd0cd2d38d710c22d3233fc19b37c1.tar.gz
netpbm-mirror-4ccc95b66dfd0cd2d38d710c22d3233fc19b37c1.tar.xz
netpbm-mirror-4ccc95b66dfd0cd2d38d710c22d3233fc19b37c1.zip
Fix bug from earlier today
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2388 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/pgm/sbigtopgm.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/converter/pgm/sbigtopgm.c b/converter/pgm/sbigtopgm.c
index 43cc08d9..1a677db8 100644
--- a/converter/pgm/sbigtopgm.c
+++ b/converter/pgm/sbigtopgm.c
@@ -1,5 +1,4 @@
 /*
-
     sbigtopgm.c - read a Santa Barbara Instruments Group CCDOPS file
 
     Note: All SBIG CCD astronomical cameras produce 14 bits
@@ -90,9 +89,12 @@ looseCanon(char * const cpArg) {
   Remove all whitespace and make all letters lowercase.
 
   Note that the SBIG Type 3 format specification at www.sbig.com in January
-  2015 says header parameter names are capitalized like 'Height' and the line
-  ends with CRLF.  In such a case, we change the first letter to 'h' and
-  remove the CR.
+  2015 says header parameter names are capitalized like 'Height'; we change
+  that to "height".
+
+  The spec also says the line ends with LF, then CR (yes, really).  Assuming
+  Caller separates lines at LF, that means we see CR at the beginning of all
+  lines but the first.  We remove that.
 -----------------------------------------------------------------------------*/
     char * cp;
     char * op;
@@ -170,9 +172,9 @@ readSbigHeader(FILE *              const ifP,
         attempt to process it.
     */
 
-    gotCompression = false;   /* initial value */
-    gotWidth = false;  /* initial value */
-    gotHeight = false;  /* initial value */
+    gotCompression = false;  /* initial value */
+    gotWidth       = false;  /* initial value */
+    gotHeight      = false;  /* initial value */
 
     sbigHeaderP->maxval = 65535;  /* initial assumption */
     sbigHeaderP->haveCameraType = false;  /* initial assumption */
@@ -195,10 +197,11 @@ readSbigHeader(FILE *              const ifP,
                 *ep = ' ';
             }
         }
+        
         looseCanon(cursor);
             /* Convert from standard SBIG to an internal format */
 
-        if (strneq(cursor, "ST-", 3)) {
+        if (strneq(cursor, "st-", 3)) {
             sbigHeaderP->isCompressed = (strstr("compressed", cursor) != NULL);
             gotCompression = true;
         } else if (strneq(cursor, "height=", 7)) {