diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2008-10-27 03:33:30 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2008-10-27 03:33:30 +0000 |
commit | 864409ddce2739a10a2c614773b7e78537f74484 (patch) | |
tree | 6ae0fc1f309c065095c7e3854887a9e7907dd4fb | |
parent | b06d17a000761a14900f9ec22740b7415c8a304c (diff) | |
download | netpbm-mirror-864409ddce2739a10a2c614773b7e78537f74484.tar.gz netpbm-mirror-864409ddce2739a10a2c614773b7e78537f74484.tar.xz netpbm-mirror-864409ddce2739a10a2c614773b7e78537f74484.zip |
Release 10.35.54
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@762 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | Makefile.version | 2 | ||||
-rw-r--r-- | converter/other/pnmtoddif.c | 9 | ||||
-rw-r--r-- | doc/HISTORY | 13 | ||||
-rw-r--r-- | generator/pgmcrater.c | 3 | ||||
-rw-r--r-- | generator/pgmnoise.c | 6 | ||||
-rw-r--r-- | generator/ppmforge.c | 3 | ||||
-rw-r--r-- | lib/libpam.c | 19 |
7 files changed, 33 insertions, 22 deletions
diff --git a/Makefile.version b/Makefile.version index c78140b3..eb4129bb 100644 --- a/Makefile.version +++ b/Makefile.version @@ -1,3 +1,3 @@ NETPBM_MAJOR_RELEASE = 10 NETPBM_MINOR_RELEASE = 35 -NETPBM_POINT_RELEASE = 53 +NETPBM_POINT_RELEASE = 54 diff --git a/converter/other/pnmtoddif.c b/converter/other/pnmtoddif.c index 65152865..962487f2 100644 --- a/converter/other/pnmtoddif.c +++ b/converter/other/pnmtoddif.c @@ -558,17 +558,20 @@ int main(int argc, char *argv[]) break; case PGM_TYPE: { - gray *pixels; - - pixels = (gray *) data; + gray *pixels = pgm_allocrow(cols); for (i = 0; i < rows; i++) { + p = data; pgm_readpgmrow(ifd, pixels, cols, maxval, format); + for (j = 0; j < cols; j++) { + *p++ = (unsigned char) pixels[j]; + } if (fwrite(data,1,ip.bytes_per_line,ofd) != ip.bytes_per_line) { perror("Writing image data\n"); exit(1); } } + pgm_freerow(pixels); } break; case PPM_TYPE: diff --git a/doc/HISTORY b/doc/HISTORY index cece662d..816afbf7 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -4,6 +4,19 @@ Netpbm. CHANGE HISTORY -------------- +08.10.27 BJH Release 10.35.54 + + pnm_createBlackTuple(): fix array bounds violation with + PBM, PGM. + + ppmforge, pgmnoise, pgmcrater: better randomization; + won't produce the same image if you run it twice within + the same second. + + pnmtoddif: fix crash with any PGM input. + + pgmnoise: fix bug: never generates full white pixel. + 08.10.12 BJH Release 10.35.53 pamditherbw: Fix -value other than .5 with -fs . diff --git a/generator/pgmcrater.c b/generator/pgmcrater.c index 1833e604..a48f3de1 100644 --- a/generator/pgmcrater.c +++ b/generator/pgmcrater.c @@ -53,6 +53,7 @@ #include <assert.h> #include <math.h> +#include <unistd.h> #include "pm_c_util.h" #include "pgm.h" @@ -108,7 +109,7 @@ static void initseed() { int i; - i = time(NULL) * 0xF37C; + i = time(NULL) ^ getpid(); srand(i); for (i = 0; i < 7; i++) V rand(); diff --git a/generator/pgmnoise.c b/generator/pgmnoise.c index 3929759b..708d0cd9 100644 --- a/generator/pgmnoise.c +++ b/generator/pgmnoise.c @@ -9,6 +9,8 @@ /* V1.1 16.11.1993 Rewritten to be NetPBM.programming conforming */ /*********************************************************************/ +#include <unistd.h> + #include "pgm.h" /* global variables */ @@ -58,13 +60,13 @@ char *argv[]; /* get time of day to feed the random number generator */ timenow = time(NULL); - srand(timenow); + srand(timenow ^ getpid()); /* create the (gray) noise */ for (i = 0; i < rows; i++) { for (j = 0; j < cols; j++) - destrow[j] = rand() % PGM_MAXMAXVAL; + destrow[j] = rand() % (PGM_MAXMAXVAL+1); /* write out one line of graphic data */ pgm_writepgmrow(stdout, destrow, cols, PGM_MAXMAXVAL, 0); diff --git a/generator/ppmforge.c b/generator/ppmforge.c index 64b1ad79..fcbbc1f1 100644 --- a/generator/ppmforge.c +++ b/generator/ppmforge.c @@ -35,6 +35,7 @@ #include <math.h> #include <assert.h> +#include <unistd.h> #include "pm_c_util.h" #include "ppm.h" @@ -284,7 +285,7 @@ initseed(void) { int i; - i = time(NULL) ^ 0xF37C; + i = time(NULL) ^ getpid(); srand(i); for (i = 0; i < 7; ++i) rand(); diff --git a/lib/libpam.c b/lib/libpam.c index f8d0be6e..656f5361 100644 --- a/lib/libpam.c +++ b/lib/libpam.c @@ -187,21 +187,12 @@ pnm_createBlackTuple(const struct pam * const pamP, Create a "black" tuple. By that we mean a tuple all of whose elements are zero. If it's an RGB, grayscale, or b&w pixel, that means it's black. -----------------------------------------------------------------------------*/ + unsigned int i; + *blackTupleP = pnm_allocpamtuple(pamP); - if (pamP->format == PAM_FORMAT) { - /* In this format, we don't know the meaning of "black", so we - just punt. - */ - int i; - for (i = 0; i < pamP->depth; i++) - (*blackTupleP)[i] = 0; - } else { - xel black_xel; - black_xel = pnm_blackxel(pamP->maxval, pamP->format); - (*blackTupleP)[0] = PPM_GETR(black_xel); - (*blackTupleP)[1] = PPM_GETG(black_xel); - (*blackTupleP)[2] = PPM_GETB(black_xel); - } + + for (i = 0; i < pamP->depth; ++i) + (*blackTupleP)[i] = 0; } |