From 1a0714f84748c9f2e41eab95ae1ab3aee174f21b Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 13 Mar 2024 18:34:13 +0000 Subject: cleanup git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4876 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/infotopam.c | 23 ++++++++--------------- 1 file 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", -- cgit 1.4.1