diff options
-rw-r--r-- | converter/pbm/pbmtoxbm.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c index 2d71fd7b..4c5b19bc 100644 --- a/converter/pbm/pbmtoxbm.c +++ b/converter/pbm/pbmtoxbm.c @@ -35,7 +35,7 @@ enum xbmVersion { X10, X11 }; -struct cmdlineInfo { +struct CmdlineInfo { /* All the information the user supplied in the command line, in a form easy for the program to use. */ @@ -46,8 +46,8 @@ struct cmdlineInfo { static void parseCommandLine(int argc, - char ** argv, - struct cmdlineInfo *cmdlineP ) { + const char ** argv, + struct CmdlineInfo *cmdlineP ) { /*---------------------------------------------------------------------------- Parse program command line described in Unix standard form by argc and argv. Return the information in the options as *cmdlineP. @@ -58,7 +58,7 @@ parseCommandLine(int argc, Note that the strings we return are stored in the storage that was passed to us as the argv array. We also trash *argv. -----------------------------------------------------------------------------*/ - optEntry *option_def; + optEntry * option_def; /* Instructions to pm_optParseOptions3 on how to parse our options. */ optStruct3 opt; @@ -76,7 +76,7 @@ parseCommandLine(int argc, opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ opt.allowNegNum = FALSE; /* We have no parms that are negative numbers */ - pm_optParseOptions3( &argc, argv, opt, sizeof(opt), 0); + pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0); /* Uses and sets argc, argv, and some of *cmdlineP and others. */ if (!nameSpec) @@ -111,6 +111,7 @@ parseCommandLine(int argc, pm_error("Program takes zero or one argument (filename). You " "specified %u", argc-1); } + free(option_def); } @@ -326,8 +327,7 @@ convertRaster(FILE * const ifP, enum xbmVersion const xbmVersion) { unsigned int const bitsPerUnit = xbmVersion == X10 ? 16 : 8; - unsigned int const padright = - ((cols + bitsPerUnit - 1 ) / bitsPerUnit) * bitsPerUnit - cols; + unsigned int const padright = ROUNDUP(cols, bitsPerUnit) - cols; /* Amount of padding to round cols up to the nearest multiple of 8 (if x11) or 16 (if x10). */ @@ -359,15 +359,15 @@ convertRaster(FILE * const ifP, int -main(int argc, - char * argv[]) { +main(int argc, + const char ** argv) { - struct cmdlineInfo cmdline; + struct CmdlineInfo cmdline; FILE * ifP; int rows, cols, format; const char * name; - pbm_init(&argc, argv); + pm_proginit(&argc, argv); parseCommandLine(argc, argv, &cmdline); if (cmdline.name == NULL) @@ -389,3 +389,5 @@ main(int argc, return 0; } + + |