diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-06-28 23:07:55 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2019-06-28 23:07:55 +0000 |
commit | 11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32 (patch) | |
tree | 7c40f096dd973943ef563ec87b2a68d8205db4fb /editor/ppmcolormask.c | |
parent | 89c6ec14eb7514630aea5abc4b90b51d1473d33a (diff) | |
download | netpbm-mirror-11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32.tar.gz netpbm-mirror-11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32.tar.xz netpbm-mirror-11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32.zip |
Promote Stable to Super_stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3640 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/ppmcolormask.c')
-rw-r--r-- | editor/ppmcolormask.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/editor/ppmcolormask.c b/editor/ppmcolormask.c index 0d7a214c..5ef8d1c1 100644 --- a/editor/ppmcolormask.c +++ b/editor/ppmcolormask.c @@ -9,6 +9,7 @@ Contributed to the public domain by its author. =========================================================================*/ +#define _XOPEN_SOURCE 500 /* Make sure strdup() is in string.h */ #define _BSD_SOURCE /* Make sure strdup() is in <string.h> */ #include <assert.h> #include <string.h> @@ -59,7 +60,7 @@ parseColorOpt(const char * const colorOpt, colorCount = 0; /* initial value */ while (!eol && colorCount < ARRAY_SIZE(cmdlineP->maskColor)) { const char * token; - token = strsepN(&cursor, ","); + token = pm_strsep(&cursor, ","); if (token) { if (strneq(token, "bk:", 3)) { cmdlineP->maskColor[colorCount].matchType = MATCH_BK; @@ -108,7 +109,7 @@ parseCommandLine(int argc, char ** argv, opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ opt.allowNegNum = FALSE; /* We may have parms that are negative numbers */ - optParseOptions3(&argc, argv, opt, sizeof(opt), 0); + pm_optParseOptions3(&argc, argv, opt, sizeof(opt), 0); /* Uses and sets argc, argv, and all of *cmdlineP. */ if (colorSpec) @@ -221,7 +222,12 @@ main(int argc, char *argv[]) { int col; ppm_readppmrow(ifP, inputRow, cols, maxval, format); for (col = 0; col < cols; ++col) { - if (colorIsInSet(inputRow[col], maxval, cmdline)) { + pixel thisColor; + /* Color of this pixel with same maxval as used in + 'cmdline' + */ + PPM_DEPTH(thisColor, inputRow[col], maxval, PPM_MAXMAXVAL); + if (colorIsInSet(thisColor, PPM_MAXMAXVAL, cmdline)) { maskRow[col] = PBM_BLACK; ++numPixelsMasked; } else |