From 4ccc95b66dfd0cd2d38d710c22d3233fc19b37c1 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Mon, 19 Jan 2015 03:19:47 +0000 Subject: Fix bug from earlier today git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2388 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/pgm/sbigtopgm.c | 19 +++++++++++-------- 1 file 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)) { -- cgit 1.4.1