about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--converter/other/pnmtopalm/gen_palm_colormap.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/converter/other/pnmtopalm/gen_palm_colormap.c b/converter/other/pnmtopalm/gen_palm_colormap.c
index 4b65e631..b71854b2 100644
--- a/converter/other/pnmtopalm/gen_palm_colormap.c
+++ b/converter/other/pnmtopalm/gen_palm_colormap.c
@@ -7,18 +7,25 @@
 
 #include "palm.h"
 
-int main( int argc, char **argv ) {
-
-  int i;
-  Color_s current;
-  Colormap default_map = palmcolor_build_default_8bit_colormap ();
-
-  printf("P3\n%d 1\n255\n", default_map->ncolors);
-  for (i = 0;  i < default_map->ncolors;  i++) {
-    current = default_map->color_entries[i];
-    printf ("%d %d %d\n", (current & 0xFF0000) >> 16, (current & 0xFF00) >> 8, (current & 0xFF));
-    /* printf ("%x:  %d %d %d\n", (current & 0xFF000000) >> 24, (current & 0xFF0000) >> 16, (current & 0xFF00) >> 8, (current & 0xFF)); */
-  };
-  return 0;
+int
+main(int     argc,
+     char ** argv) {
+
+    Colormap const defaultMap = palmcolor_build_default_8bit_colormap();
+
+    unsigned int i;
+    
+    printf("P3\n%d 1\n255\n", defaultMap->ncolors);
+
+    for (i = 0; i < defaultMap->ncolors; ++i) {
+        Color_s const current = defaultMap->color_entries[i];
+
+        printf("%u %u %u\n",
+               (unsigned char)(current >> 16),
+               (unsigned char)(current >>  8),
+               (unsigned char)(current >>  0));
+    }
+
+    return 0;
 }