diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2007-09-26 20:20:52 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2007-09-26 20:20:52 +0000 |
commit | 2087fc45bd38ac1dd3b90789c5bfb94f2dbbad94 (patch) | |
tree | b062862164ab41e78b5efc436330db65cb2887f9 /converter | |
parent | 68256547a054109f09c55e2e913df2dfdd2144ff (diff) | |
download | netpbm-mirror-2087fc45bd38ac1dd3b90789c5bfb94f2dbbad94.tar.gz netpbm-mirror-2087fc45bd38ac1dd3b90789c5bfb94f2dbbad94.tar.xz netpbm-mirror-2087fc45bd38ac1dd3b90789c5bfb94f2dbbad94.zip |
Rebase 'advanced' to 10.40.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@416 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
47 files changed, 242 insertions, 261 deletions
diff --git a/converter/other/Makefile b/converter/other/Makefile index 3b6d8288..976c215a 100644 --- a/converter/other/Makefile +++ b/converter/other/Makefile @@ -221,8 +221,10 @@ install.bin.local: $(PKGDIR)/bin cd $(PKGDIR)/bin ; \ $(SYMLINK) gemtopnm$(EXE) gemtopbm # In October 2001, pnmtojpeg replaced ppmtojpeg +ifneq ($(JPEGLIB),NONE) cd $(PKGDIR)/bin ; \ $(SYMLINK) pnmtojpeg$(EXE) ppmtojpeg +endif # In March 2002, bmptopnm replaced bmptoppm cd $(PKGDIR)/bin ; \ $(SYMLINK) bmptopnm$(EXE) bmptoppm diff --git a/converter/other/fiasco/lib/misc.c b/converter/other/fiasco/lib/misc.c index 02a1314f..12b94e7a 100644 --- a/converter/other/fiasco/lib/misc.c +++ b/converter/other/fiasco/lib/misc.c @@ -432,38 +432,6 @@ Log2 (double x) return log (x) / 0.69314718; } -#ifndef HAVE_STRCASECMP -bool_t -strcaseeq (const char *s1, const char *s2) -/* - * Compare strings 's1' and 's2', ignoring the case of the characters. - * - * Return value: - * TRUE if strings match, else FALSE - */ -{ - bool_t matched; - char *ls1, *ls2, *ptr; - - assert (s1 && s2); - - ls1 = strdup (s1); - ls2 = strdup (s2); - - for (ptr = ls1; *ptr; ptr++) - *ptr = tolower (*ptr); - for (ptr = ls2; *ptr; ptr++) - *ptr = tolower (*ptr); - - matched = streq (ls1, ls2) ? YES : NO; - - Free (ls1); - Free (ls2); - - return matched; -} -#endif /* not HAVE_STRCASECMP */ - real_t variance (const word_t *pixels, unsigned x0, unsigned y0, unsigned width, unsigned height, unsigned cols) diff --git a/converter/other/fiasco/params.c b/converter/other/fiasco/params.c index 3d0a0252..7a302b82 100644 --- a/converter/other/fiasco/params.c +++ b/converter/other/fiasco/params.c @@ -15,7 +15,8 @@ * $State: Exp $ */ -#define _BSD_SOURCE 1 /* Make sure strdup() is in string.h */ +#define _BSD_SOURCE 1 + /* Make sure strdup() is in string.h and strcaseeq() is in nstring.h */ #define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ #include "config.h" diff --git a/converter/other/giftopnm.c b/converter/other/giftopnm.c index 0e261da4..a79a0bbe 100644 --- a/converter/other/giftopnm.c +++ b/converter/other/giftopnm.c @@ -1336,7 +1336,7 @@ readGifHeader(FILE * const gifFile, struct gifScreen * const gifScreenP) { if (verbose) pm_message("GIF format version is '%s'", version); - if ((!STREQ(version, "87a")) && (!STREQ(version, "89a"))) + if ((!streq(version, "87a")) && (!streq(version, "89a"))) pm_error("bad version number, not '87a' or '89a'" ); if (! ReadOK(gifFile,buf,7)) @@ -1658,7 +1658,7 @@ main(int argc, char **argv) { else alpha_file = pm_openw(cmdline.alpha_filename); - if (alpha_file && STREQ(cmdline.alpha_filename, "-")) + if (alpha_file && streq(cmdline.alpha_filename, "-")) imageout_file = NULL; else imageout_file = stdout; diff --git a/converter/other/hdifftopam.c b/converter/other/hdifftopam.c index 0f1a5ca3..48282526 100644 --- a/converter/other/hdifftopam.c +++ b/converter/other/hdifftopam.c @@ -106,7 +106,7 @@ main(int argc, char *argv[]) { if (diffpam.format != PAM_FORMAT) pm_error("Input must be a PAM file, not PNM"); - else if (!STREQ(diffpam.tuple_type, "hdiff")) + else if (!streq(diffpam.tuple_type, "hdiff")) pm_error("Input tuple type is '%s'. Must be 'hdiff'", diffpam.tuple_type); diff --git a/converter/other/jpegtopnm.c b/converter/other/jpegtopnm.c index 180ef3d4..4679d497 100644 --- a/converter/other/jpegtopnm.c +++ b/converter/other/jpegtopnm.c @@ -240,11 +240,11 @@ parseCommandLine(int const argc, if (!dctvalSpec) cmdlineP->dct_method = JDCT_DEFAULT; else { - if (STREQ(dctval, "int")) + if (streq(dctval, "int")) cmdlineP->dct_method = JDCT_ISLOW; - else if (STREQ(dctval, "fast")) + else if (streq(dctval, "fast")) cmdlineP->dct_method = JDCT_IFAST; - else if (STREQ(dctval, "float")) + else if (streq(dctval, "float")) cmdlineP->dct_method = JDCT_FLOAT; else pm_error("Invalid value for the --dct option: '%s'.", dctval); } @@ -952,7 +952,7 @@ main(int argc, char **argv) { parseCommandLine(argc, argv, &cmdline); - if (cmdline.exif_filespec && STREQ(cmdline.exif_filespec, "-")) + if (cmdline.exif_filespec && streq(cmdline.exif_filespec, "-")) /* He's got exif going to stdout, so there can be no image output */ ofP = NULL; else diff --git a/converter/other/pamtogif.c b/converter/other/pamtogif.c index 68a445c6..edaf0695 100644 --- a/converter/other/pamtogif.c +++ b/converter/other/pamtogif.c @@ -91,11 +91,11 @@ pamAlphaPlane(struct pam * const pamP) { unsigned int alphaPlane; - if (STREQ(pamP->tuple_type, "RGB_ALPHA")) + if (streq(pamP->tuple_type, "RGB_ALPHA")) alphaPlane = 3; - else if (STREQ(pamP->tuple_type, "GRAYSCALE_ALPHA")) + else if (streq(pamP->tuple_type, "GRAYSCALE_ALPHA")) alphaPlane = 2; - else if (STREQ(pamP->tuple_type, "BLACKANDWHITE_ALPHA")) + else if (streq(pamP->tuple_type, "BLACKANDWHITE_ALPHA")) alphaPlane = 2; else alphaPlane = 0; diff --git a/converter/other/pamtouil.c b/converter/other/pamtouil.c index b9ddc749..58f57eef 100644 --- a/converter/other/pamtouil.c +++ b/converter/other/pamtouil.c @@ -95,10 +95,10 @@ parseCommandLine(int argc, char ** argv, /* Remove trailing "_icon" */ barPos = strrchr(cmdlineP->outname, '_'); - if (STREQ(barPos, "_icon")) + if (streq(barPos, "_icon")) *barPos = '\0'; } else { - if (STREQ(cmdlineP->inputFilespec, "-")) + if (streq(cmdlineP->inputFilespec, "-")) cmdlineP->outname = strdup("noname"); else { char * dotPos; @@ -237,7 +237,7 @@ genCmap(struct pam * const pamP, nameAlreadyInCmap = FALSE; /* initial assumption */ for (j = 0; j < colorIndex; ++j) { if (cmap[j].rgbname != NULL && - STREQ(colorname, cmap[j].rgbname) && + streq(colorname, cmap[j].rgbname) && cmap[j].transparent == transparent) { nameAlreadyInCmap = TRUE; indexOfName = j; diff --git a/converter/other/pnmtopclxl.c b/converter/other/pnmtopclxl.c index fe4833d8..7ba64210 100644 --- a/converter/other/pnmtopclxl.c +++ b/converter/other/pnmtopclxl.c @@ -153,7 +153,7 @@ parseCommandLine(int argc, char ** argv, bool found; int i; for (i = 0, found=FALSE; xlPaperFormats[i].name && !found; ++i) { - if (STREQ(xlPaperFormats[i].name, formatOpt)) { + if (streq(xlPaperFormats[i].name, formatOpt)) { found = TRUE; cmdlineP->format = xlPaperFormats[i].xl_nr; } diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c index 83860ffa..b339a1fe 100644 --- a/converter/other/pnmtopng.c +++ b/converter/other/pnmtopng.c @@ -52,8 +52,6 @@ because xels were only 24 bits. Now they're 96. */ -#define GRR_GRAY_PALETTE_FIX - #ifndef PNMTOPNG_WARNING_LEVEL # define PNMTOPNG_WARNING_LEVEL 0 /* use 0 for backward compatibility, */ #endif /* 2 for warnings (1 == error) */ @@ -464,7 +462,7 @@ parseCommandLine(int argc, char ** argv, } if (cmdlineP->zlibCompression.methodSpec) { - if (STREQ(compMethod, "deflated")) + if (streq(compMethod, "deflated")) cmdlineP->zlibCompression.method = Z_DEFLATED; else pm_error("The only valid value for -method is 'deflated'. " @@ -472,9 +470,9 @@ parseCommandLine(int argc, char ** argv, } if (cmdlineP->zlibCompression.strategySpec) { - if (STREQ(compStrategy, "huffman_only")) + if (streq(compStrategy, "huffman_only")) cmdlineP->zlibCompression.strategy = Z_HUFFMAN_ONLY; - else if (STREQ(compStrategy, "filtered")) + else if (streq(compStrategy, "filtered")) cmdlineP->zlibCompression.strategy = Z_FILTERED; else pm_error("Valid values for -strategy are 'huffman_only' and " diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c index 5b12cee9..410fa0b9 100644 --- a/converter/other/pnmtops.c +++ b/converter/other/pnmtops.c @@ -1295,7 +1295,7 @@ main(int argc, char * argv[]) { ifp = pm_openr(cmdline.inputFileName); - if (STREQ(cmdline.inputFileName, "-")) + if (streq(cmdline.inputFileName, "-")) name = strdup("noname"); else name = basebasename(cmdline.inputFileName); diff --git a/converter/other/pnmtotiffcmyk.c b/converter/other/pnmtotiffcmyk.c index 0fda6b08..9b5f25d4 100644 --- a/converter/other/pnmtotiffcmyk.c +++ b/converter/other/pnmtotiffcmyk.c @@ -794,7 +794,7 @@ standardOpt( Conv *conv, Root *r, int *argn, int argc, char **argv ) { } /* handle the special case of -1 (no removal) */ if ( oldn == *argn && pm_keymatch( argv[*argn], "-gammap", 7 ) && - *argn + 1 < argc && STREQ(argv[*argn + 1], "-1") ) { + *argn + 1 < argc && streq(argv[*argn + 1], "-1") ) { p->remove = 0 ; *argn = (*argn) + 2 ; } diff --git a/converter/other/pnmtoxwd.c b/converter/other/pnmtoxwd.c index 32fb8a7b..d0625b0b 100644 --- a/converter/other/pnmtoxwd.c +++ b/converter/other/pnmtoxwd.c @@ -471,7 +471,7 @@ main(int argc, char * argv[]) { } } - if (STREQ(cmdline.inputFilespec, "-")) + if (streq(cmdline.inputFilespec, "-")) dumpname = "stdin"; else { if (strlen(cmdline.inputFilespec) > XWDVAL_MAX - sizeof(h11) - 1) diff --git a/converter/other/pstopnm.c b/converter/other/pstopnm.c index a31c3f64..f99478db 100644 --- a/converter/other/pstopnm.c +++ b/converter/other/pstopnm.c @@ -196,8 +196,9 @@ parseCommandLine(int argc, char ** argv, static void -add_ps_to_filespec(const char orig_filespec[], char ** const new_filespec_p, - const int verbose) { +addPsToFilespec(char const orig_filespec[], + const char ** const new_filespec_p, + bool const verbose) { /*---------------------------------------------------------------------------- If orig_filespec[] does not name an existing file, but the same name with ".ps" added to the end does, return the name with the .ps @@ -288,13 +289,13 @@ computeSizeResBlind(unsigned int const xmax, static void -compute_size_res(struct cmdlineInfo const cmdline, - enum orientation const orientation, - struct box const bordered_box, - unsigned int * const xsizeP, - unsigned int * const ysizeP, - unsigned int * const xresP, - unsigned int * const yresP) { +computeSizeRes(struct cmdlineInfo const cmdline, + enum orientation const orientation, + struct box const bordered_box, + unsigned int * const xsizeP, + unsigned int * const ysizeP, + unsigned int * const xresP, + unsigned int * const yresP) { /*---------------------------------------------------------------------------- Figure out how big the output image should be (return as *xsizeP and *ysizeP) and what output device resolution Ghostscript @@ -353,7 +354,8 @@ compute_size_res(struct cmdlineInfo const cmdline, enum postscript_language {COMMON_POSTSCRIPT, ENCAPSULATED_POSTSCRIPT}; static enum postscript_language -language_declaration(const char input_filespec[], int const verbose) { +languageDeclaration(char const input_filespec[], + bool const verbose) { /*---------------------------------------------------------------------------- Return the Postscript language in which the file declares it is written. (Except that if the file is on Standard Input or doesn't validly declare @@ -361,7 +363,7 @@ language_declaration(const char input_filespec[], int const verbose) { -----------------------------------------------------------------------------*/ enum postscript_language language; - if (STREQ(input_filespec, "-")) + if (streq(input_filespec, "-")) /* Can't read stdin, because we need it to remain positioned for the Ghostscript interpreter to read it. */ @@ -395,9 +397,9 @@ language_declaration(const char input_filespec[], int const verbose) { static struct box -compute_box_to_extract(struct box const cmdline_extract_box, - char const input_filespec[], - bool const verbose) { +computeBoxToExtract(struct box const cmdline_extract_box, + char const input_filespec[], + bool const verbose) { struct box retval; @@ -410,7 +412,7 @@ compute_box_to_extract(struct box const cmdline_extract_box, */ struct box ps_bb; /* Box described by %%BoundingBox stmt in input */ - if (STREQ(input_filespec, "-")) + if (streq(input_filespec, "-")) /* Can't read stdin, because we need it to remain positioned for the Ghostscript interpreter to read it. */ @@ -466,8 +468,8 @@ compute_box_to_extract(struct box const cmdline_extract_box, static enum orientation -compute_orientation(struct cmdlineInfo const cmdline, - struct box const extract_box) { +computeOrientation(struct cmdlineInfo const cmdline, + struct box const extract_box) { enum orientation retval; unsigned int const input_width = extract_box.urx - extract_box.llx; @@ -511,9 +513,10 @@ compute_orientation(struct cmdlineInfo const cmdline, static struct box -add_borders(const struct box input_box, - const float xborder_scale, float yborder_scale, - const int verbose) { +addBorders(struct box const input_box, + float const xborder_scale, + float const yborder_scale, + bool const verbose) { /*---------------------------------------------------------------------------- Return a box which is 'input_box' plus some borders. @@ -543,9 +546,12 @@ add_borders(const struct box input_box, static const char * -compute_pstrans(const struct box box, const enum orientation orientation, - const int xsize, const int ysize, - const int xres, const int yres) { +computePstrans(struct box const box, + enum orientation const orientation, + int const xsize, + int const ysize, + int const xres, + int const yres) { const char * retval; @@ -570,13 +576,13 @@ compute_pstrans(const struct box box, const enum orientation orientation, static const char * -compute_outfile_arg(const struct cmdlineInfo cmdline) { +computeOutfileArg(struct cmdlineInfo const cmdline) { const char *retval; /* malloc'ed */ if (cmdline.goto_stdout) retval = strdup("-"); - else if (STREQ(cmdline.input_filespec, "-")) + else if (streq(cmdline.input_filespec, "-")) retval = strdup("-"); else { char * basename; @@ -584,7 +590,7 @@ compute_outfile_arg(const struct cmdlineInfo cmdline) { basename = strdup(cmdline.input_filespec); if (strlen(basename) > 3 && - STREQ(basename+strlen(basename)-3, ".ps")) + streq(basename+strlen(basename)-3, ".ps")) /* The input filespec ends in ".ps". Chop it off. */ basename[strlen(basename)-3] = '\0'; @@ -605,7 +611,8 @@ compute_outfile_arg(const struct cmdlineInfo cmdline) { static const char * -compute_gs_device(const int format_type, const int forceplain) { +computeGsDevice(int const format_type, + bool const forceplain) { const char * basetype; const char * retval; @@ -673,19 +680,22 @@ findGhostscriptProg(const char ** const retvalP) { static void -execGhostscript(int const inputPipeFd, - const char ghostscript_device[], - const char outfile_arg[], - int const xsize, int const ysize, - int const xres, int const yres, - const char input_filespec[], int const verbose) { +execGhostscript(int const inputPipeFd, + char const ghostscript_device[], + char const outfile_arg[], + int const xsize, + int const ysize, + int const xres, + int const yres, + char const input_filespec[], + bool const verbose) { - const char *arg0; - const char *ghostscriptProg; - const char *deviceopt; - const char *outfileopt; - const char *gopt; - const char *ropt; + const char * arg0; + const char * ghostscriptProg; + const char * deviceopt; + const char * outfileopt; + const char * gopt; + const char * ropt; int rc; findGhostscriptProg(&ghostscriptProg); @@ -723,15 +733,17 @@ execGhostscript(int const inputPipeFd, - static void -execute_ghostscript(const char pstrans[], const char ghostscript_device[], - const char outfile_arg[], - const int xsize, const int ysize, - const int xres, const int yres, - const char input_filespec[], - const enum postscript_language language, - const int verbose) { +executeGhostscript(char const pstrans[], + char const ghostscript_device[], + char const outfile_arg[], + int const xsize, + int const ysize, + int const xres, + int const yres, + char const input_filespec[], + enum postscript_language const language, + bool const verbose) { int gs_exit; /* wait4 exit code from Ghostscript */ FILE *gs; /* Pipe to Ghostscript's standard input */ @@ -835,10 +847,10 @@ execute_ghostscript(const char pstrans[], const char ghostscript_device[], int -main(int argc, char **argv) { +main(int argc, char ** argv) { struct cmdlineInfo cmdline; - char *input_filespec; /* malloc'ed */ + const char * input_filespec; /* malloc'ed */ /* The file specification of our Postscript input file */ unsigned int xres, yres; /* Resolution in pixels per inch */ unsigned int xsize, ysize; /* output image size in pixels */ @@ -851,43 +863,42 @@ main(int argc, char **argv) { enum postscript_language language; enum orientation orientation; - const char *ghostscript_device; - const char *outfile_arg; - const char *pstrans; + const char * ghostscript_device; + const char * outfile_arg; + const char * pstrans; pnm_init(&argc, argv); parseCommandLine(argc, argv, &cmdline); - add_ps_to_filespec(cmdline.input_filespec, &input_filespec, - cmdline.verbose); + addPsToFilespec(cmdline.input_filespec, &input_filespec, cmdline.verbose); - extract_box = compute_box_to_extract(cmdline.extract_box, input_filespec, - cmdline.verbose); + extract_box = computeBoxToExtract(cmdline.extract_box, input_filespec, + cmdline.verbose); - language = language_declaration(input_filespec, cmdline.verbose); + language = languageDeclaration(input_filespec, cmdline.verbose); - orientation = compute_orientation(cmdline, extract_box); + orientation = computeOrientation(cmdline, extract_box); - bordered_box = add_borders(extract_box, cmdline.xborder, cmdline.yborder, - cmdline.verbose); + bordered_box = addBorders(extract_box, cmdline.xborder, cmdline.yborder, + cmdline.verbose); - compute_size_res(cmdline, orientation, bordered_box, - &xsize, &ysize, &xres, &yres); + computeSizeRes(cmdline, orientation, bordered_box, + &xsize, &ysize, &xres, &yres); - pstrans = compute_pstrans(bordered_box, orientation, - xsize, ysize, xres, yres); + pstrans = computePstrans(bordered_box, orientation, + xsize, ysize, xres, yres); - outfile_arg = compute_outfile_arg(cmdline); + outfile_arg = computeOutfileArg(cmdline); ghostscript_device = - compute_gs_device(cmdline.format_type, cmdline.forceplain); + computeGsDevice(cmdline.format_type, cmdline.forceplain); pm_message("Writing %s file", ghostscript_device); - execute_ghostscript(pstrans, ghostscript_device, outfile_arg, - xsize, ysize, xres, yres, input_filespec, - language, cmdline.verbose); + executeGhostscript(pstrans, ghostscript_device, outfile_arg, + xsize, ysize, xres, yres, input_filespec, + language, cmdline.verbose); strfree(ghostscript_device); strfree(outfile_arg); diff --git a/converter/other/rletopnm.c b/converter/other/rletopnm.c index aaa86388..f98ea8a8 100644 --- a/converter/other/rletopnm.c +++ b/converter/other/rletopnm.c @@ -124,7 +124,7 @@ parseCommandLine(int argc, char ** argv, if (argc - 1 == 0) cmdlineP->input_filename = NULL; /* he wants stdin */ else if (argc - 1 == 1) { - if (STREQ(argv[1], "-")) + if (streq(argv[1], "-")) cmdlineP->input_filename = NULL; /* he wants stdin */ else cmdlineP->input_filename = strdup(argv[1]); @@ -133,7 +133,7 @@ parseCommandLine(int argc, char ** argv, "is the input file specification"); if (cmdlineP->alpha_filename && - STREQ(cmdlineP->alpha_filename, "-")) + streq(cmdlineP->alpha_filename, "-")) cmdlineP->alpha_stdout = TRUE; else cmdlineP->alpha_stdout = FALSE; diff --git a/converter/other/tiff.c b/converter/other/tiff.c index a498571b..90d50710 100644 --- a/converter/other/tiff.c +++ b/converter/other/tiff.c @@ -6,6 +6,8 @@ ============================================================================*/ +#define _BSD_SOURCE /* Make sure strcaseeq() is in nstring.h */ + #include <string.h> #ifdef VMS @@ -40,7 +42,7 @@ number(const char * const value, /* It's not a numeric string, so it must be an enumerated value name */ unsigned int i; for (i = 0; tagvallist[i].name; ++i) { - if (STRCASEEQ(value, tagvallist[i].name)) + if (strcaseeq(value, tagvallist[i].name)) return tagvallist[i].value; } pm_error("'%s' is neither a number nor a valid value name", value); @@ -460,7 +462,7 @@ tagDefFind(const char * const name) { for (i = 0; i < ARRAY_SIZE(tagDefinitions) && tagDefinitions[i].name; ++i) { - if (STRCASEEQ(tagDefinitions[i].name, name)) + if (strcaseeq(tagDefinitions[i].name, name)) return &tagDefinitions[i]; } diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c index 5969a49a..ce17b7e1 100644 --- a/converter/other/tifftopnm.c +++ b/converter/other/tifftopnm.c @@ -138,7 +138,7 @@ parseCommandLine(int argc, char ** argv, "is the input file name"); if (alphaSpec) { - if (STREQ(cmdlineP->alphaFilename, "-")) + if (streq(cmdlineP->alphaFilename, "-")) cmdlineP->alphaStdout = TRUE; else cmdlineP->alphaStdout = FALSE; @@ -1024,7 +1024,7 @@ main(int argc, char * argv[]) { parseCommandLine(argc, argv, &cmdline); - if (!STREQ(cmdline.inputFilename, "-")) { + if (!streq(cmdline.inputFilename, "-")) { tif = TIFFOpen(cmdline.inputFilename, "r"); if (tif == NULL) pm_error("error opening TIFF file %s", cmdline.inputFilename); diff --git a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c index 357db323..59dab002 100644 --- a/converter/other/xwdtopnm.c +++ b/converter/other/xwdtopnm.c @@ -134,7 +134,7 @@ parseCommandLine(int argc, char ** argv, if (argc - 1 == 0) cmdlineP->inputFilename = NULL; /* he wants stdin */ else if (argc - 1 == 1) { - if (STREQ(argv[1], "-")) + if (streq(argv[1], "-")) cmdlineP->inputFilename = NULL; /* he wants stdin */ else cmdlineP->inputFilename = strdup(argv[1]); diff --git a/converter/pbm/atktopbm.c b/converter/pbm/atktopbm.c index c4a81808..62664999 100644 --- a/converter/pbm/atktopbm.c +++ b/converter/pbm/atktopbm.c @@ -273,7 +273,7 @@ ReadATKRaster(FILE * const file, /* read the keyword */ fscanf(file, " %5s", keyword); - if (!STREQ(keyword, "bits")) + if (!streq(keyword, "bits")) pm_error ("keyword is not 'bits'!"); fscanf(file, " %d %d %d ", &objectid, &width, &height); diff --git a/converter/pbm/g3topbm.c b/converter/pbm/g3topbm.c index 1eefee96..261b6c39 100644 --- a/converter/pbm/g3topbm.c +++ b/converter/pbm/g3topbm.c @@ -18,6 +18,8 @@ contributing their work to the public domain. ===========================================================================*/ +#define _BSD_SOURCE /* Make nstring.h define strcaseeq() */ + #include "pbm.h" #include "shhopt.h" #include "nstring.h" @@ -100,15 +102,15 @@ parseCommandLine(int argc, char ** const argv, if (cmdlineP->expectedLineSize < 1) pm_error("-width must be at least 1"); } else if (paper_sizeSpec) { - if (STRCASEEQ(paperSize, "A6")) + if (strcaseeq(paperSize, "A6")) cmdlineP->expectedLineSize = 864; - else if (STRCASEEQ(paperSize, "A5")) + else if (strcaseeq(paperSize, "A5")) cmdlineP->expectedLineSize = 1216; - else if (STRCASEEQ(paperSize, "A4")) + else if (strcaseeq(paperSize, "A4")) cmdlineP->expectedLineSize = 1728; - else if (STRCASEEQ(paperSize, "B4")) + else if (strcaseeq(paperSize, "B4")) cmdlineP->expectedLineSize = 2048; - else if (STRCASEEQ(paperSize, "A3")) + else if (strcaseeq(paperSize, "A3")) cmdlineP->expectedLineSize = 2432; else pm_error("Unrecognized value for -paper_size '%s'. " diff --git a/converter/pbm/icontopbm.c b/converter/pbm/icontopbm.c index d6dba8ae..a0d1bd2b 100644 --- a/converter/pbm/icontopbm.c +++ b/converter/pbm/icontopbm.c @@ -46,35 +46,35 @@ ReadIconFile(FILE * const file, } variable[i] = '\0'; - if ( STREQ( variable, "*/" )&& gotsome ) + if ( streq( variable, "*/" )&& gotsome ) break; if ( fscanf( file, "%d", &value ) != 1 ) continue; - if ( STREQ( variable, "Width" ) ) + if ( streq( variable, "Width" ) ) { *widthP = value; gotsome = 1; } - else if ( STREQ( variable, "Height" ) ) + else if ( streq( variable, "Height" ) ) { *heightP = value; gotsome = 1; } - else if ( STREQ( variable, "Depth" ) ) + else if ( streq( variable, "Depth" ) ) { if ( value != 1 ) pm_error( "invalid depth" ); gotsome = 1; } - else if ( STREQ( variable, "Format_version" ) ) + else if ( streq( variable, "Format_version" ) ) { if ( value != 1 ) pm_error( "invalid Format_version" ); gotsome = 1; } - else if ( STREQ( variable, "Valid_bits_per_item" ) ) + else if ( streq( variable, "Valid_bits_per_item" ) ) { if ( value != 16 ) pm_error( "invalid Valid_bits_per_item" ); diff --git a/converter/pbm/mrftopbm.c b/converter/pbm/mrftopbm.c index 696fe839..9cf93d47 100644 --- a/converter/pbm/mrftopbm.c +++ b/converter/pbm/mrftopbm.c @@ -176,7 +176,7 @@ main(int argc, char *argv[]) { expandAll = FALSE; /* initial assumption */ - if (argc-1 >= 1 && STREQ(argv[1], "-a")) { + if (argc-1 >= 1 && streq(argv[1], "-a")) { expandAll = TRUE; argc--,argv++; } diff --git a/converter/pbm/pbmto4425.c b/converter/pbm/pbmto4425.c index 605b12d5..1d97ac6a 100644 --- a/converter/pbm/pbmto4425.c +++ b/converter/pbm/pbmto4425.c @@ -145,7 +145,7 @@ main(int argc, char * argv[]) { pbmfile = argv[argn]; } - if(STREQ(pbmfile, "-")) + if(streq(pbmfile, "-")) { pbmfp = stdin; } diff --git a/converter/pbm/pbmtoatk.c b/converter/pbm/pbmtoatk.c index de7adf63..dd829776 100644 --- a/converter/pbm/pbmtoatk.c +++ b/converter/pbm/pbmtoatk.c @@ -137,7 +137,7 @@ main(int argc, char *argv[]) { else if (argc-1 == 1) { ifd = pm_openr( argv[1] ); strcpy(name, argv[1]); - if (STREQ( name, "-")) + if (streq( name, "-")) strcpy(name, "noname"); if ((cp = strchr(name, '.')) != 0) diff --git a/converter/pbm/pbmtoln03.c b/converter/pbm/pbmtoln03.c index 07c8629f..f7cf53c7 100644 --- a/converter/pbm/pbmtoln03.c +++ b/converter/pbm/pbmtoln03.c @@ -219,13 +219,8 @@ main (int argc, char **argv) { if( argn != argc ) pm_usage(usage); - - /* Initialize pbm file */ pbm_readpbminit (input, &width, &height, &format) ; - if (format != PBM_FORMAT && format != RPBM_FORMAT) - pm_error ("input not in PBM format") ; - /* * In explanation of the sequence below: * <ESC>[!p DECSTR soft terminal reset diff --git a/converter/pbm/pbmtolps.c b/converter/pbm/pbmtolps.c index 13a14e2b..5adef4c8 100644 --- a/converter/pbm/pbmtolps.c +++ b/converter/pbm/pbmtolps.c @@ -112,7 +112,7 @@ main(int argc, char ** argv) { pbm_init(&argc, argv); i = 1; - if (i < argc && STREQ(argv[i], "-dpi")) { + if (i < argc && streq(argv[i], "-dpi")) { if (i == argc - 1) pm_usage(usage); sscanf(argv[i + 1], "%f", &dpi); diff --git a/converter/pbm/pbmtonokia.c b/converter/pbm/pbmtonokia.c index 58d0ec5b..ebcd813d 100644 --- a/converter/pbm/pbmtonokia.c +++ b/converter/pbm/pbmtonokia.c @@ -4,7 +4,7 @@ Copyright information is at end of file. */ -#define _BSD_SOURCE /* Make sure strcasecmp() is in string.h */ +#define _BSD_SOURCE /* Make sure strcaseeq() is in nstring.h */ #include <string.h> #include <assert.h> @@ -96,17 +96,17 @@ parseCommandLine(int argc, char ** argv, /* Uses and sets argc, argv, and some of *cmdlineP and others. */ if (fmtSpec) { - if (STRCASEEQ(fmtOpt, "HEX_NOL")) + if (strcaseeq(fmtOpt, "HEX_NOL")) cmdlineP->outputFormat = FMT_HEX_NOL; - else if (STRCASEEQ(fmtOpt, "HEX_NGG")) + else if (strcaseeq(fmtOpt, "HEX_NGG")) cmdlineP->outputFormat = FMT_HEX_NGG; - else if (STRCASEEQ(fmtOpt, "HEX_NPM")) + else if (strcaseeq(fmtOpt, "HEX_NPM")) cmdlineP->outputFormat = FMT_HEX_NPM; - else if (STRCASEEQ(fmtOpt, "NOL")) + else if (strcaseeq(fmtOpt, "NOL")) cmdlineP->outputFormat = FMT_NOL; - else if (STRCASEEQ(fmtOpt, "NGG")) + else if (strcaseeq(fmtOpt, "NGG")) cmdlineP->outputFormat = FMT_NGG; - else if (STRCASEEQ(fmtOpt, "NPM")) + else if (strcaseeq(fmtOpt, "NPM")) cmdlineP->outputFormat = FMT_NPM; else pm_error("-fmt option must be HEX_NGG, HEX_NOL, HEX_NPM, " @@ -153,7 +153,8 @@ freeCmdline(struct cmdlineInfo const cmdline) { static void -checkSize(int cols, int rows){ +validateSize(unsigned int const cols, + unsigned int const rows){ if (cols > 255) pm_error("This program cannot handle files with more than 255 " @@ -469,7 +470,8 @@ main(int argc, ifP = pm_openr(cmdline.inputFileName); bits = pbm_readpbm(ifP, &cols, &rows); pm_close(ifP); - checkSize(cols, rows); + + validateSize(cols, rows); switch (cmdline.outputFormat) { case FMT_HEX_NGG: diff --git a/converter/pbm/pbmtopk.c b/converter/pbm/pbmtopk.c index b84818b1..a9683190 100644 --- a/converter/pbm/pbmtopk.c +++ b/converter/pbm/pbmtopk.c @@ -172,7 +172,7 @@ pbmtopk_add_suffix(char * const name, char *slash = strrchr(name, '/'); char *dot = strrchr(name, '.'); - if ((dot && slash ? dot < slash : !dot) && !STREQ(name, "-")) + if ((dot && slash ? dot < slash : !dot) && !streq(name, "-")) strcat(name, suffix); } diff --git a/converter/pbm/pbmtoxbm.c b/converter/pbm/pbmtoxbm.c index eb45f11b..0051194c 100644 --- a/converter/pbm/pbmtoxbm.c +++ b/converter/pbm/pbmtoxbm.c @@ -130,7 +130,7 @@ generateName(char const filenameArg[], "noname". Also, if the argument is null or ends in a slash, we return "noname". -----------------------------------------------------------------------------*/ - if (STREQ(filenameArg, "-")) + if (streq(filenameArg, "-")) *nameP = strdup("noname"); else { int nameIndex, argIndex; diff --git a/converter/pbm/pbmtozinc.c b/converter/pbm/pbmtozinc.c index d39b71bc..2df39f0d 100644 --- a/converter/pbm/pbmtozinc.c +++ b/converter/pbm/pbmtozinc.c @@ -49,7 +49,7 @@ main(int argc, char * argv[]) { { ifp = pm_openr( argv[1] ); strcpy( name, argv[1] ); - if ( STREQ( name, "-" ) ) + if ( streq( name, "-" ) ) strcpy( name, "noname" ); if ( ( cp = strchr( name, '.' ) ) != 0 ) diff --git a/converter/pbm/pktopbm.c b/converter/pbm/pktopbm.c index 32ed4fde..a3584ee5 100644 --- a/converter/pbm/pktopbm.c +++ b/converter/pbm/pktopbm.c @@ -50,7 +50,7 @@ pktopbm_add_suffix(char * const name, char * const slash = strrchr(name, '/'); char * const dot = strrchr(name, '.'); - if ((dot && slash ? dot < slash : !dot) && !STREQ(name, "-")) + if ((dot && slash ? dot < slash : !dot) && !streq(name, "-")) strcat(name, suffix); } diff --git a/converter/pbm/xbmtopbm.c b/converter/pbm/xbmtopbm.c index 63be16ef..135b79f1 100644 --- a/converter/pbm/xbmtopbm.c +++ b/converter/pbm/xbmtopbm.c @@ -80,10 +80,10 @@ parseWidthHeightLine(const char * const line, type = underscorePos + 1; else type = nameAndType; - if (STREQ(type, "width")) { + if (streq(type, "width")) { *gotWidthP = TRUE; *widthP = value; - } else if (STREQ(type, "height")) { + } else if (streq(type, "height")) { *gotHeightP = TRUE; *heightP = value; } diff --git a/converter/pgm/asciitopgm.c b/converter/pgm/asciitopgm.c index b6b9c9a7..6cc24025 100644 --- a/converter/pgm/asciitopgm.c +++ b/converter/pgm/asciitopgm.c @@ -67,7 +67,7 @@ main( argc, argv ) if ( argv[argn][0] == '-' ) { - if ( STREQ( argv[argn], "-d" ) ) + if ( streq( argv[argn], "-d" ) ) { if ( argc == argn + 1 ) pm_usage( usage ); diff --git a/converter/pgm/hipstopgm.c b/converter/pgm/hipstopgm.c index 826a8511..2f5956e1 100644 --- a/converter/pgm/hipstopgm.c +++ b/converter/pgm/hipstopgm.c @@ -98,7 +98,7 @@ read_hips_header( fd, hP ) { read_line( fd, buf, 5000 ); } - while ( !STREQ( buf, ".\n" ) ); + while ( !streq( buf, ".\n" ) ); } diff --git a/converter/pgm/lispmtopgm.c b/converter/pgm/lispmtopgm.c index 7b98ef00..40dd3fb4 100644 --- a/converter/pgm/lispmtopgm.c +++ b/converter/pgm/lispmtopgm.c @@ -89,7 +89,7 @@ getinit( file, colsP, rowsP, depthP, padrightP ) for ( i = 0; i < sizeof(magic)-1; ++i ) magic[i] = getc( file ); magic[i]='\0'; - if (!STREQ(LISPM_MAGIC, magic)) + if (!streq(LISPM_MAGIC, magic)) pm_error( "bad id string in Lispm file" ); if ( pm_readlittleshort( file, colsP ) == -1 ) diff --git a/converter/pgm/sbigtopgm.c b/converter/pgm/sbigtopgm.c index bb3cb6fe..17e1e01e 100644 --- a/converter/pgm/sbigtopgm.c +++ b/converter/pgm/sbigtopgm.c @@ -140,7 +140,7 @@ int main(argc, argv) cols = atoi(hdr + 6); } else if (strncmp(hdr, "sat_level=", 10) == 0) { maxval = atoi(hdr + 10); - } else if (STREQ(hdr, "end")) { + } else if (streq(hdr, "end")) { break; } hdr = cp + 1; diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c index 5b61401a..079f07ca 100644 --- a/converter/ppm/picttoppm.c +++ b/converter/ppm/picttoppm.c @@ -3995,7 +3995,7 @@ interpret_pict(FILE * const ofP) { if (opcode < 0xa2) { stage = optable[opcode].name; if (verbose) { - if (STREQ(stage, "reserved")) + if (streq(stage, "reserved")) pm_message("reserved opcode=0x%x", opcode); else pm_message("Opcode: %s", optable[opcode].name); diff --git a/converter/ppm/ppmtoarbtxt.c b/converter/ppm/ppmtoarbtxt.c index 774a47c4..eaeff70f 100644 --- a/converter/ppm/ppmtoarbtxt.c +++ b/converter/ppm/ppmtoarbtxt.c @@ -294,20 +294,20 @@ SKL_OBJ **skl; sscanf (objstr,"%s",typstr); /* Check for integer colors */ - if (STREQ(typstr,"ired") ) otyp = IRED; - else if (STREQ(typstr,"igreen")) otyp = IGREEN; - else if (STREQ(typstr,"iblue") ) otyp = IBLUE; - else if (STREQ(typstr,"ilum") ) otyp = ILUM; + if (streq(typstr,"ired") ) otyp = IRED; + else if (streq(typstr,"igreen")) otyp = IGREEN; + else if (streq(typstr,"iblue") ) otyp = IBLUE; + else if (streq(typstr,"ilum") ) otyp = ILUM; /* Check for real colors */ - else if (STREQ(typstr,"fred") ) otyp = FRED; - else if (STREQ(typstr,"fgreen")) otyp = FGREEN; - else if (STREQ(typstr,"fblue") ) otyp = FBLUE; - else if (STREQ(typstr,"flum") ) otyp = FLUM; + else if (streq(typstr,"fred") ) otyp = FRED; + else if (streq(typstr,"fgreen")) otyp = FGREEN; + else if (streq(typstr,"fblue") ) otyp = FBLUE; + else if (streq(typstr,"flum") ) otyp = FLUM; /* Check for integer data */ - else if (STREQ(typstr,"width") ) otyp = WIDTH; - else if (STREQ(typstr,"height")) otyp = HEIGHT; - else if (STREQ(typstr,"posx") ) otyp = POSX; - else if (STREQ(typstr,"posy") ) otyp = POSY; + else if (streq(typstr,"width") ) otyp = WIDTH; + else if (streq(typstr,"height")) otyp = HEIGHT; + else if (streq(typstr,"posx") ) otyp = POSX; + else if (streq(typstr,"posy") ) otyp = POSY; else otyp = BDATA; if ((otyp == IRED) || (otyp == IGREEN) || (otyp == IBLUE) || (otyp == ILUM)) diff --git a/converter/ppm/ppmtompeg/param.c b/converter/ppm/ppmtompeg/param.c index 5ea69ab6..502aee5b 100644 --- a/converter/ppm/ppmtompeg/param.c +++ b/converter/ppm/ppmtompeg/param.c @@ -671,66 +671,66 @@ processParamLine(char const input[], switch(input[0]) { case 'A': - if (STRNEQ(input, "ASPECT_RATIO", 12)) { + if (strneq(input, "ASPECT_RATIO", 12)) { aspectRatio = GetAspectRatio(SkipSpacesTabs(&input[12])); optionSeen[OPTION_ASPECT_RATIO] = TRUE; } break; case 'B': - if (STRNEQ(input, "BQSCALE", 7)) { + if (strneq(input, "BQSCALE", 7)) { SetBQScale(atoi(SkipSpacesTabs(&input[7]))); optionSeen[OPTION_BQSCALE] = TRUE; - } else if (STRNEQ(input, "BASE_FILE_FORMAT", 16)) { + } else if (strneq(input, "BASE_FILE_FORMAT", 16)) { const char * arg = SkipSpacesTabs(&input[16]); SetFileFormat(arg); - if (STRNEQ(arg, "YUV", 3) || STREQ(arg, "Y")) + if (strneq(arg, "YUV", 3) || streq(arg, "Y")) *yuvUsedP = TRUE; optionSeen[OPTION_BASE_FORMAT] = TRUE; - } else if (STRNEQ(input, "BSEARCH_ALG", 11)) { + } else if (strneq(input, "BSEARCH_ALG", 11)) { SetBSearchAlg(SkipSpacesTabs(&input[11])); optionSeen[OPTION_BSEARCH_ALG] = TRUE; - } else if (STRNEQ(input, "BIT_RATE", 8)) { + } else if (strneq(input, "BIT_RATE", 8)) { setBitRate(SkipSpacesTabs(&input[8])); optionSeen[OPTION_BIT_RATE] = TRUE; - } else if (STRNEQ(input, "BUFFER_SIZE", 11)) { + } else if (strneq(input, "BUFFER_SIZE", 11)) { setBufferSize(SkipSpacesTabs(&input[11])); optionSeen[OPTION_BUFFER_SIZE] = TRUE; } break; case 'C': - if (STRNEQ(input, "CDL_FILE", 8)) { + if (strneq(input, "CDL_FILE", 8)) { strcpy(specificsFile, SkipSpacesTabs(&input[8])); specificsOn = TRUE; optionSeen[OPTION_SPECIFICS] = TRUE; - } else if (STRNEQ(input, "CDL_DEFINES", 11)) { + } else if (strneq(input, "CDL_DEFINES", 11)) { strcpy(specificsDefines, SkipSpacesTabs(&input[11])); optionSeen[OPTION_DEFS_SPECIFICS] = TRUE; } break; case 'F': - if (STRNEQ(input, "FRAME_INPUT_DIR", 15)) { + if (strneq(input, "FRAME_INPUT_DIR", 15)) { const char * const arg = SkipSpacesTabs(&input[15]); - if (STRNCASEEQ(arg, "stdin", 5)) + if (strncaseeq(arg, "stdin", 5)) SetStdinInput(frameInputSourceP); strcpy(currentFramePath, arg); - } else if (STRNEQ(input, "FRAME_INPUT", 11)) { + } else if (strneq(input, "FRAME_INPUT", 11)) { ReadInputFileNames(fpointer, "FRAME_END_INPUT", frameInputSourceP->stdinUsed ? NULL : frameInputSourceP); optionSeen[OPTION_FRAME_INPUT] = TRUE; - } else if (STRNEQ(input, "FORCE_I_ALIGN", 13)) { + } else if (strneq(input, "FORCE_I_ALIGN", 13)) { forceIalign = TRUE; - } else if (STRNEQ(input, "FORCE_ENCODE_LAST_FRAME", 23)) { + } else if (strneq(input, "FORCE_ENCODE_LAST_FRAME", 23)) { /* NO-OP. We used to drop trailing B frames by default and you needed this option to change the last frame to I so you could encode all the frames. Now we just do that all the time. Why wouldn't we? */ - } else if (STRNEQ(input, "FRAME_RATE", 10)) { + } else if (strneq(input, "FRAME_RATE", 10)) { frameRate = GetFrameRate(SkipSpacesTabs(&input[10])); frameRateRounded = (int) VidRateNum[frameRate]; if ((frameRate % 3) == 1) @@ -740,21 +740,21 @@ processParamLine(char const input[], break; case 'G': - if (STRNEQ(input, "GOP_SIZE", 8)) { + if (strneq(input, "GOP_SIZE", 8)) { SetGOPSize(atoi(SkipSpacesTabs(&input[8]))); optionSeen[OPTION_GOP] = TRUE; - } else if (STRNEQ(input, "GOP_INPUT_DIR", 13)) { + } else if (strneq(input, "GOP_INPUT_DIR", 13)) { const char * const arg = SkipSpacesTabs(&input[13]); - if (STRNCASEEQ(arg, "stdin", 5)) + if (strncaseeq(arg, "stdin", 5)) SetStdinInput(gopInputSourceP); strcpy(currentGOPPath, arg); - } else if (STRNEQ(input, "GOP_INPUT", 9)) { + } else if (strneq(input, "GOP_INPUT", 9)) { ReadInputFileNames(fpointer, "GOP_END_INPUT", gopInputSourceP->stdinUsed ? NULL : gopInputSourceP); optionSeen[OPTION_GOP_INPUT] = TRUE; - } else if (STRNEQ(input, "GAMMA", 5)) { + } else if (strneq(input, "GAMMA", 5)) { GammaCorrection = TRUE; sscanf(SkipSpacesTabs(&input[5]), "%f", &GammaValue); optionSeen[OPTION_GAMMA] = TRUE; @@ -762,27 +762,27 @@ processParamLine(char const input[], break; case 'I': - if (STRNEQ(input, "IQSCALE", 7)) { + if (strneq(input, "IQSCALE", 7)) { SetIQScale(atoi(SkipSpacesTabs(&input[7]))); optionSeen[OPTION_IQSCALE] = TRUE; - } else if (STRNEQ(input, "INPUT_DIR", 9)) { + } else if (strneq(input, "INPUT_DIR", 9)) { const char * const arg = SkipSpacesTabs(&input[9]); - if (STRNCASEEQ(arg, "stdin", 5)) + if (strncaseeq(arg, "stdin", 5)) SetStdinInput(inputSourceP); strcpy(currentPath, arg); optionSeen[OPTION_INPUT_DIR] = TRUE; - } else if (STRNEQ(input, "INPUT_CONVERT", 13)) { + } else if (strneq(input, "INPUT_CONVERT", 13)) { strcpy(inputConversion, SkipSpacesTabs(&input[13])); optionSeen[OPTION_INPUT_CONVERT] = TRUE; - } else if (STREQ(input, "INPUT")) { + } else if (streq(input, "INPUT")) { ReadInputFileNames(fpointer, "END_INPUT", inputSourceP->stdinUsed ? NULL : inputSourceP); optionSeen[OPTION_INPUT] = TRUE; - } else if (STRNEQ(input, "IO_SERVER_CONVERT", 17)) { + } else if (strneq(input, "IO_SERVER_CONVERT", 17)) { strcpy(ioConversion, SkipSpacesTabs(&input[17])); optionSeen[OPTION_IO_CONVERT] = TRUE; - } else if (STRNEQ(input, "IQTABLE", 7)) { + } else if (strneq(input, "IQTABLE", 7)) { processIqtable(fpointer); optionSeen[OPTION_IQTABLE] = TRUE; @@ -790,12 +790,12 @@ processParamLine(char const input[], break; case 'K': - if (STRNEQ(input, "KEEP_TEMP_FILES", 15)) + if (strneq(input, "KEEP_TEMP_FILES", 15)) keepTempFiles = TRUE; break; case 'N': - if (STRNEQ(input, "NIQTABLE", 8)) { + if (strneq(input, "NIQTABLE", 8)) { readNiqTable(fpointer); optionSeen[OPTION_NIQTABLE] = TRUE; @@ -803,7 +803,7 @@ processParamLine(char const input[], break; case 'O': - if (STRNEQ(input, "OUTPUT", 6)) { + if (strneq(input, "OUTPUT", 6)) { const char * const arg = SkipSpacesTabs(&input[6]); if ( whichGOP == -1 ) strcpy(outputFileName, arg); @@ -815,45 +815,45 @@ processParamLine(char const input[], break; case 'P': - if (STRNEQ(input, "PATTERN", 7)) { + if (strneq(input, "PATTERN", 7)) { SetFramePattern(SkipSpacesTabs(&input[7])); optionSeen[OPTION_PATTERN] = TRUE; - } else if (STRNEQ(input, "PIXEL", 5)) { + } else if (strneq(input, "PIXEL", 5)) { SetPixelSearch(SkipSpacesTabs(&input[5])); optionSeen[OPTION_PIXEL] = TRUE; - } else if (STRNEQ(input, "PQSCALE", 7)) { + } else if (strneq(input, "PQSCALE", 7)) { SetPQScale(atoi(SkipSpacesTabs(&input[7]))); optionSeen[OPTION_PQSCALE] = TRUE; - } else if (STRNEQ(input, "PSEARCH_ALG", 11)) { + } else if (strneq(input, "PSEARCH_ALG", 11)) { SetPSearchAlg(SkipSpacesTabs(&input[11])); optionSeen[OPTION_PSEARCH_ALG] = TRUE; - } else if (STRNEQ(input, "PARALLEL_TEST_FRAMES", 20)) { + } else if (strneq(input, "PARALLEL_TEST_FRAMES", 20)) { SetParallelPerfect(FALSE); parallelTestFrames = atoi(SkipSpacesTabs(&input[20])); - } else if (STRNEQ(input, "PARALLEL_TIME_CHUNKS", 20)) { + } else if (strneq(input, "PARALLEL_TIME_CHUNKS", 20)) { SetParallelPerfect(FALSE); parallelTimeChunks = atoi(SkipSpacesTabs(&input[20])); - } else if (STRNEQ(input, "PARALLEL_CHUNK_TAPER", 20)) { + } else if (strneq(input, "PARALLEL_CHUNK_TAPER", 20)) { SetParallelPerfect(FALSE); parallelTimeChunks = -1; - } else if (STRNEQ(input, "PARALLEL_PERFECT", 16)) { + } else if (strneq(input, "PARALLEL_PERFECT", 16)) { SetParallelPerfect(TRUE); - } else if (STRNEQ(input, "PARALLEL", 8)) { + } else if (strneq(input, "PARALLEL", 8)) { ReadMachineNames(fpointer); optionSeen[OPTION_PARALLEL] = TRUE; } break; case 'R': - if (STRNEQ(input, "RANGE", 5)) { + if (strneq(input, "RANGE", 5)) { processRanges(SkipSpacesTabs(&input[5])); optionSeen[OPTION_RANGE] = TRUE; - } else if (STRNEQ(input, "REFERENCE_FRAME", 15)) { + } else if (strneq(input, "REFERENCE_FRAME", 15)) { SetReferenceFrameType(SkipSpacesTabs(&input[15])); optionSeen[OPTION_REF_FRAME] = TRUE; - } else if (STRNEQ(input, "RSH", 3)) { + } else if (strneq(input, "RSH", 3)) { SetRemoteShell(SkipSpacesTabs(&input[3])); - } else if (STRNEQ(input, "RESIZE", 6)) { + } else if (strneq(input, "RESIZE", 6)) { const char * const arg = SkipSpacesTabs(&input[6]); sscanf(arg, "%dx%d", &outputWidth, &outputHeight); outputWidth &= ~(DCTSIZE * 2 - 1); @@ -863,22 +863,22 @@ processParamLine(char const input[], break; case 'S': - if (STRNEQ(input, "SLICES_PER_FRAME", 16)) { + if (strneq(input, "SLICES_PER_FRAME", 16)) { SetSlicesPerFrame(atoi(SkipSpacesTabs(&input[16]))); optionSeen[OPTION_SPF] = TRUE; - } else if (STRNEQ(input, "SLAVE_CONVERT", 13)) { + } else if (strneq(input, "SLAVE_CONVERT", 13)) { strcpy(slaveConversion, SkipSpacesTabs(&input[13])); optionSeen[OPTION_SLAVE_CONVERT] = TRUE; - } else if (STRNEQ(input, "SPECIFICS_FILE", 14)) { + } else if (strneq(input, "SPECIFICS_FILE", 14)) { strcpy(specificsFile, SkipSpacesTabs(&input[14])); specificsOn = TRUE; optionSeen[OPTION_SPECIFICS] = TRUE; - } else if (STRNEQ(input, "SPECIFICS_DEFINES", 16)) { + } else if (strneq(input, "SPECIFICS_DEFINES", 16)) { strcpy(specificsDefines, SkipSpacesTabs(&input[17])); optionSeen[OPTION_DEFS_SPECIFICS] = TRUE; - } else if (STRNEQ(input, "SEQUENCE_SIZE", 13)) { + } else if (strneq(input, "SEQUENCE_SIZE", 13)) { mult_seq_headers = atoi(SkipSpacesTabs(&input[13])); - } else if (STRNEQ(input, "SIZE", 4)) { + } else if (strneq(input, "SIZE", 4)) { const char * const arg = SkipSpacesTabs(&input[4]); sscanf(arg, "%dx%d", &yuvWidth, &yuvHeight); realWidth = yuvWidth; @@ -889,42 +889,42 @@ processParamLine(char const input[], break; case 'T': - if (STRNEQ(input, "TUNE", 4)) { + if (strneq(input, "TUNE", 4)) { tuneingOn = TRUE; ParseTuneParam(SkipSpacesTabs(&input[4])); } break; case 'U': - if (STRNEQ(input, "USER_DATA", 9)) { + if (strneq(input, "USER_DATA", 9)) { strcpy(userDataFileName, SkipSpacesTabs(&input[9])); optionSeen[OPTION_USER_DATA] = TRUE; } break; case 'W': - if (STRNEQ(input, "WARN_UNDERFLOW", 14)) + if (strneq(input, "WARN_UNDERFLOW", 14)) paramP->warnUnderflow = TRUE; - if (STRNEQ(input, "WARN_OVERFLOW", 13)) + if (strneq(input, "WARN_OVERFLOW", 13)) paramP->warnOverflow = TRUE; break; case 'Y': - if (STRNEQ(input, "YUV_SIZE", 8)) { + if (strneq(input, "YUV_SIZE", 8)) { const char * const arg = SkipSpacesTabs(&input[8]); sscanf(arg, "%dx%d", &yuvWidth, &yuvHeight); realWidth = yuvWidth; realHeight = yuvHeight; Fsize_Validate(&yuvWidth, &yuvHeight); optionSeen[OPTION_YUV_SIZE] = TRUE; - } else if (STRNEQ(input, "Y_SIZE", 6)) { + } else if (strneq(input, "Y_SIZE", 6)) { const char * const arg = SkipSpacesTabs(&input[6]); sscanf(arg, "%dx%d", &yuvWidth, &yuvHeight); realWidth = yuvWidth; realHeight = yuvHeight; Fsize_Validate(&yuvWidth, &yuvHeight); optionSeen[OPTION_YUV_SIZE] = TRUE; - } else if (STRNEQ(input, "YUV_FORMAT", 10)) { + } else if (strneq(input, "YUV_FORMAT", 10)) { strcpy(yuvConversion, SkipSpacesTabs(&input[10])); optionSeen[OPTION_YUV_FORMAT] = TRUE; } diff --git a/converter/ppm/ppmtopj.c b/converter/ppm/ppmtopj.c index 5d449f7a..d116773f 100644 --- a/converter/ppm/ppmtopj.c +++ b/converter/ppm/ppmtopj.c @@ -121,7 +121,7 @@ char *argv[]; { ++argn; for (r = 0; rmode[r] != NULL; r++) - if (STREQ(rmode[r], argv[argn])) + if (streq(rmode[r], argv[argn])) break; if (rmode[r] != NULL) render_mode = r; @@ -131,9 +131,9 @@ char *argv[]; else if ( pm_keymatch(argv[argn],"-back",2) && argn + 1 < argc ) { ++argn; - if (STREQ(argv[argn], "dark")) + if (streq(argv[argn], "dark")) back_scale = C_BACK_SCALE_DARK; - else if (STREQ(argv[argn], "lite")) + else if (streq(argv[argn], "lite")) back_scale = C_BACK_SCALE_LIGHT; else pm_usage(usage); diff --git a/converter/ppm/ppmtoxpm.c b/converter/ppm/ppmtoxpm.c index 853ae711..ae597125 100644 --- a/converter/ppm/ppmtoxpm.c +++ b/converter/ppm/ppmtoxpm.c @@ -138,7 +138,7 @@ parseCommandLine(int argc, char ** argv, /* If output filename not specified, use input filename as default. */ if (nameSpec) cmdlineP->name = nameOpt; - else if (STREQ(cmdlineP->inputFilename, "-")) + else if (streq(cmdlineP->inputFilename, "-")) cmdlineP->name = "noname"; else { static char name[80+1]; diff --git a/converter/ppm/sldtoppm.c b/converter/ppm/sldtoppm.c index e0760448..ad16a649 100644 --- a/converter/ppm/sldtoppm.c +++ b/converter/ppm/sldtoppm.c @@ -194,7 +194,7 @@ slidefind(const char * const sname, /* Read slide library header and verify. */ if ((fread(libent, 32, 1, slfile) != 1) || - (!STREQ((char *)libent, "AutoCAD Slide Library 1.0\015\012\32"))) { + (!streq((char *)libent, "AutoCAD Slide Library 1.0\015\012\32"))) { pm_error("not an AutoCAD slide library file."); } pos = 32; @@ -212,7 +212,7 @@ slidefind(const char * const sname, pos += 36; if (dironly) { pm_message(" %s", libent); - } else if (STREQ((char *)libent, uname)) { + } else if (streq((char *)libent, uname)) { long dpos = (((((libent[35] << 8) | libent[34]) << 8) | libent[33]) << 8) | libent[32]; if ((slfile == stdin) || (fseek(slfile, dpos, 0) == -1)) { @@ -341,7 +341,7 @@ slider(slvecfn slvec, /* Verify that slide format is compatible with this program. */ - if (STREQ(slfrof.slh, slhi.slh)) + if (streq(slfrof.slh, slhi.slh)) pm_error("this is not an AutoCAD slide file."); /* Verify that the number format and file level in the header are diff --git a/converter/ppm/tgatoppm.c b/converter/ppm/tgatoppm.c index 9f2bc4c0..19d8b347 100644 --- a/converter/ppm/tgatoppm.c +++ b/converter/ppm/tgatoppm.c @@ -81,7 +81,7 @@ parseCommandLine(int argc, char ** argv, "is the input file specification"); if (alpha_spec && - STREQ(cmdlineP->alpha_filename, "-")) + streq(cmdlineP->alpha_filename, "-")) cmdlineP->alpha_stdout = 1; else cmdlineP->alpha_stdout = 0; diff --git a/converter/ppm/winicontoppm.c b/converter/ppm/winicontoppm.c index 2d9de567..9a606a93 100644 --- a/converter/ppm/winicontoppm.c +++ b/converter/ppm/winicontoppm.c @@ -572,7 +572,7 @@ trimOutputName(const char inputName[]) * oh, for =~ ... :) */ char * outFile = strdup(inputName); - if (STREQ(outFile + (strlen (outFile) - 4), ".ppm")) { + if (streq(outFile + (strlen (outFile) - 4), ".ppm")) { *(outFile + (strlen (outFile) - 4)) = 0; } return outFile; @@ -828,7 +828,7 @@ main(int argc, char *argv[]) { pm_message("-bestqual doesn't make sense with -allicons. " "Ignoring -bestqual."); - if (STREQ(cmdline.outputFilespec, "-")) + if (streq(cmdline.outputFilespec, "-")) outputFileBase = NULL; else outputFileBase = trimOutputName(cmdline.outputFilespec); diff --git a/converter/ppm/ximtoppm.c b/converter/ppm/ximtoppm.c index 96798707..bb842f02 100644 --- a/converter/ppm/ximtoppm.c +++ b/converter/ppm/ximtoppm.c @@ -65,7 +65,7 @@ parseCommandLine(int argc, char ** argv, "is the input file specification"); if (cmdlineP->alpha_filename && - STREQ(cmdlineP->alpha_filename, "-")) + streq(cmdlineP->alpha_filename, "-")) cmdlineP->alpha_stdout = TRUE; else cmdlineP->alpha_stdout = FALSE; diff --git a/converter/ppm/xpmtoppm.c b/converter/ppm/xpmtoppm.c index 9dddfd83..97be6cc9 100644 --- a/converter/ppm/xpmtoppm.c +++ b/converter/ppm/xpmtoppm.c @@ -104,7 +104,7 @@ parse_command_line(int argc, char ** argv, "is the input file specification"); if (cmdline_p->alpha_filename && - STREQ(cmdline_p->alpha_filename, "-")) + streq(cmdline_p->alpha_filename, "-")) cmdline_p->alpha_stdout = TRUE; else cmdline_p->alpha_stdout = FALSE; @@ -293,7 +293,7 @@ interpretXpm3ColorTableLine(char line[], int const seqNum, number if so) */ for (key = 1; - key <= NKEYS && !STREQ(xpmColorKeys[key - 1], str2); + key <= NKEYS && !streq(xpmColorKeys[key - 1], str2); key++); isKey = (key <= NKEYS); @@ -483,15 +483,15 @@ readXpm1Header(FILE * const stream, int * const widthP, int * const heightP, t1 = str1; else ++t1; - if (STREQ(t1, "format")) + if (streq(t1, "format")) format = v; - else if (STREQ(t1, "width")) + else if (streq(t1, "width")) *widthP = v; - else if (STREQ(t1, "height")) + else if (streq(t1, "height")) *heightP = v; - else if (STREQ(t1, "ncolors")) + else if (streq(t1, "ncolors")) *ncolorsP = v; - else if (STREQ(t1, "pixel")) + else if (streq(t1, "pixel")) *chars_per_pixelP = v; } else if (!strncmp(line, "static char", 11)) { if ((t1 = strrchr(line, '_')) == NULL) diff --git a/converter/ppm/xvminitoppm.c b/converter/ppm/xvminitoppm.c index 8cea1f9d..e5bdac7d 100644 --- a/converter/ppm/xvminitoppm.c +++ b/converter/ppm/xvminitoppm.c @@ -109,16 +109,16 @@ readXvHeader(FILE * const ifP, getline(ifP, buf, sizeof(buf)); - if (!STRNEQ(buf, "P7 332", 6)) + if (!strneq(buf, "P7 332", 6)) pm_error("Input is not a XV thumbnail picture. It does not " "begin with the characters 'P7 332'."); endOfComments = FALSE; while (!endOfComments) { getline(ifP, buf, sizeof(buf)); - if (STRNEQ(buf, "#END_OF_COMMENTS", 16)) + if (strneq(buf, "#END_OF_COMMENTS", 16)) endOfComments = TRUE; - else if (STRNEQ(buf, "#BUILTIN", 8)) + else if (strneq(buf, "#BUILTIN", 8)) pm_error("This program does not know how to " "convert builtin XV thumbnail pictures"); } |