about summary refs log tree commit diff
path: root/converter/pgm
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-05-27 16:21:40 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-05-27 16:21:40 +0000
commitde0b878012e4cf75a583e02493a8804288c33a87 (patch)
tree7b1c9258a00b887a4ba32b359e9d4cc121d45e69 /converter/pgm
parent56b1436c5f5d2e5e59bac9d0e76bf1e064457a25 (diff)
downloadnetpbm-mirror-de0b878012e4cf75a583e02493a8804288c33a87.tar.gz
netpbm-mirror-de0b878012e4cf75a583e02493a8804288c33a87.tar.xz
netpbm-mirror-de0b878012e4cf75a583e02493a8804288c33a87.zip
fix interpretation of camera type and compression in SBIG header
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2527 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/pgm')
-rw-r--r--converter/pgm/sbigtopgm.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/converter/pgm/sbigtopgm.c b/converter/pgm/sbigtopgm.c
index cd8a05c4..3c223c47 100644
--- a/converter/pgm/sbigtopgm.c
+++ b/converter/pgm/sbigtopgm.c
@@ -175,6 +175,12 @@ readSbigHeader(FILE *              const ifP,
         converse, pixels having values greater than maxval, results in
         an invalid file which may cause problems in programs which
         attempt to process it.
+
+         According to the official specification, the camera type name is the
+         first item in the header, and may or may not start with "ST-".  But
+         this program has historically had an odd method of detecting camera
+         type, which allows any string starting with "ST-" anywhere in the
+         header, and for now we leave that undisturbed.  2015.05.27.
     */
 
     gotCompression = false;  /* initial value */
@@ -192,7 +198,9 @@ readSbigHeader(FILE *              const ifP,
                      (unsigned)(cursor - &buffer[0]));
         }
         *cp = '\0';
-        if (strneq(cursor, "ST-", 3)) {
+        if (strneq(cursor, "ST-", 3) ||
+            (cursor == &buffer[0] && strstr(cursor,"Image") != NULL)) {
+
             char * const ep = strchr(cursor + 3, ' ');
 
             if (ep != NULL) {
@@ -205,8 +213,9 @@ readSbigHeader(FILE *              const ifP,
         looseCanon(cursor);
             /* Convert from standard SBIG to an internal format */
 
-        if (strneq(cursor, "st-", 3)) {
-            sbigHeaderP->isCompressed = (strstr("compressed", cursor) != NULL);
+        if (strneq(cursor, "st-", 3) || cursor == &buffer[0]) {
+            sbigHeaderP->isCompressed =
+                 (strstr(cursor, "compressedimage") != NULL);
             gotCompression = true;
         } else if (strneq(cursor, "height=", 7)) {
             sbigHeaderP->rows = atoi(cursor + 7);