about summary refs log tree commit diff
path: root/converter/other/sgitopnm.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter/other/sgitopnm.c')
-rw-r--r--converter/other/sgitopnm.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/converter/other/sgitopnm.c b/converter/other/sgitopnm.c
index 0d26bb9c..63814fdb 100644
--- a/converter/other/sgitopnm.c
+++ b/converter/other/sgitopnm.c
@@ -16,19 +16,10 @@
 ** 08Feb94: minor bugfix
 ** 29Jul00: added -channel option (smar@reptiles.org)
 */
+#include <unistd.h>
+#include "mallocvar.h"
 #include "pnm.h"
 #include "sgi.h"
-#include "mallocvar.h"
-#ifndef VMS
-#include <unistd.h>
-#endif
-
-/*#define DEBUG*/
-
-#ifndef SEEK_SET
-#define SEEK_SET    0
-#endif
-
 
 /* entry in RLE offset table */
 typedef struct {
@@ -60,6 +51,7 @@ static void       rle_decompress ARGS((ScanElem *src, int srclen, ScanElem *dest
 static short verbose = 0;
 
 
+
 int
 main(argc, argv)
     int argc;
@@ -199,10 +191,6 @@ read_header(ifp, channel)
         pm_message("compression: %d = %s", head->storage, compression_name(head->storage));
         head->name[79] = '\0';  /* just to be safe */
         pm_message("Image name: \"%s\"", head->name);
-#ifdef DEBUG
-        pm_message("bpc: %d    dimension: %d    zsize: %d", head->bpc, head->dimension, head->zsize);
-        pm_message("pixmin: %ld    pixmax: %ld    colormap: %ld", head->pixmin, head->pixmax, head->colormap);
-#endif
     }
 
     return head;
@@ -219,10 +207,6 @@ read_table(ifp, tablen)
 
     MALLOCARRAY_NOFAIL(table, tablen);
 
-#ifdef DEBUG
-    pm_message("reading offset table");
-#endif
-
     for( i = 0; i < tablen; i++ )
         table[i].start = get_big_long(ifp);
     for( i = 0; i < tablen; i++ )
@@ -243,13 +227,9 @@ read_channels(ifp, head, table, func, ochan)
 {
     ScanLine *image;
     ScanElem *temp;
-    int channel, maxchannel, row, sgi_index, i;
+    int channel, maxchannel, sgi_index, i;
     long offset, length;
 
-#ifdef DEBUG
-    pm_message("reading channels");
-#endif
-
     if (ochan < 0) {
         maxchannel = (head->zsize < 3) ? head->zsize : 3;
         MALLOCARRAY_NOFAIL(image, head->ysize * maxchannel);
@@ -261,9 +241,7 @@ read_channels(ifp, head, table, func, ochan)
         MALLOCARRAY_NOFAIL(temp, WORSTCOMPR(head->xsize));
 
     for( channel = 0; channel < maxchannel;  channel++ ) {
-#ifdef DEBUG
-        pm_message("    channel %d", channel);
-#endif
+        unsigned int row;
         for( row = 0; row < head->ysize; row++ ) {
             int iindex;
 
@@ -300,6 +278,7 @@ read_channels(ifp, head, table, func, ochan)
 }
 
 
+
 static void
 image_to_pnm(Header *head, ScanLine *image, xelval maxval, int channel)
 {
@@ -335,6 +314,7 @@ image_to_pnm(Header *head, ScanLine *image, xelval maxval, int channel)
 }
 
 
+
 static void
 rle_decompress(src, srcleft, dest, destleft)
     ScanElem *src;