about summary refs log tree commit diff
path: root/converter
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2024-03-13 18:34:13 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2024-03-13 18:34:13 +0000
commit1a0714f84748c9f2e41eab95ae1ab3aee174f21b (patch)
treeb034485d9b22abcbf7ae058b14226c0eb65bb7c4 /converter
parent95bd6485d665484ef156b65c118e582803466ce4 (diff)
downloadnetpbm-mirror-1a0714f84748c9f2e41eab95ae1ab3aee174f21b.tar.gz
netpbm-mirror-1a0714f84748c9f2e41eab95ae1ab3aee174f21b.tar.xz
netpbm-mirror-1a0714f84748c9f2e41eab95ae1ab3aee174f21b.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4876 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r--converter/other/infotopam.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/converter/other/infotopam.c b/converter/other/infotopam.c
index 72f55483..bb7d2e74 100644
--- a/converter/other/infotopam.c
+++ b/converter/other/infotopam.c
@@ -482,25 +482,18 @@ main(int argc, const char **argv) {
     readIconHeader(info.ifP, &info.width, &info.height, &info.depth,
                    &info.bpwidth);
 
-    /* Skip ahead to next header if converting second icon */
-    if (cmdline.selected) {
-        unsigned int const skipCt =
-            info.height * (((info.width + 15) / 16) * 2) * info.depth;
-
-        int rc;
+    readIconData(info.ifP, info.width, info.height, info.depth, &info.icon);
 
-        rc = fseek(info.ifP, skipCt, SEEK_CUR);
-        if (rc < 0) {
-            pm_error("Failed to skip to next icon input file.  "
-                     "fseek() errno = %d (%s)",
-                     errno, strerror(errno));
-        }
-        /* Read header of second icon */
+    if (cmdline.selected) {
+        /* He wants the second icon, so update info.width, etc.  to be for the
+           second icon.
+        */
         readIconHeader(info.ifP, &info.width, &info.height, &info.depth,
                        &info.bpwidth);
-    }
 
-    readIconData(info.ifP, info.width, info.height, info.depth, &info.icon);
+        readIconData(info.ifP, info.width, info.height, info.depth,
+                     &info.icon);
+    }
 
     if (cmdline.verbose) {
         pm_message("Version %u .info file, %s icon: %uW x %uH x %u deep",