* Pnmtopng: -libversion doesn't report level of linked libz. It was a modularity violation and caused build failures on Mac OS X, because Pnmtopng per se doesn't know about libz -- it's used by libpng. * Build: don't fail due to SIGRTMIN, SIGRTMAX being undefined. Changes 10.35.75: * palmtopnm: fix for pixel size 16. * pamscale: fix -reduce. Introduced in 10.27. * configure: default to 'none' for Svgalib if it doesn't appear to be installed (per 'ldconfig'). Ported from 10.38, released March 2007. Changes 10.35.74: * pbmtext: don't crash when font file contains a blank line. Fail cleanly. * ppmtoilbm: fix arithmetic overflow with image dimension represented as 16 bit integer. * pbmpage: fix garbage output. * pnmhistmap: Fix crash with -width. Always broken. * Build: don't fail due to SIGPWR being undefined.
147 lines
6.1 KiB
Text
147 lines
6.1 KiB
Text
$NetBSD: patch-eb,v 1.2 2010/07/13 06:08:23 adam Exp $
|
|
|
|
--- converter/ppm/xpmtoppm.c.orig 2009-12-29 20:46:34.000000000 +0000
|
|
+++ converter/ppm/xpmtoppm.c
|
|
@@ -121,7 +121,7 @@ static bool backup;
|
|
|
|
|
|
static void
|
|
-getline(char * const line,
|
|
+get_line(char * const line,
|
|
size_t const size,
|
|
FILE * const stream) {
|
|
/*----------------------------------------------------------------------------
|
|
@@ -139,7 +139,7 @@ getline(char * const line,
|
|
Exit program if the line doesn't fit in the buffer.
|
|
-----------------------------------------------------------------------------*/
|
|
if (size > sizeof(lastInputLine))
|
|
- pm_error("INTERNAL ERROR: getline() received 'size' parameter "
|
|
+ pm_error("INTERNAL ERROR: get_line() received 'size' parameter "
|
|
"which is out of bounds");
|
|
|
|
if (backup) {
|
|
@@ -355,7 +355,7 @@ readXpm3Header(FILE * const stream, int
|
|
int * const transparentP) {
|
|
/*----------------------------------------------------------------------------
|
|
Read the header of the XPM file on stream 'stream'. Assume the
|
|
- getline() stream is presently positioned to the beginning of the
|
|
+ get_line() stream is presently positioned to the beginning of the
|
|
file and it is a Version 3 XPM file. Leave the stream positioned
|
|
after the header.
|
|
|
|
@@ -386,25 +386,25 @@ readXpm3Header(FILE * const stream, int
|
|
*widthP = *heightP = *ncolorsP = *chars_per_pixelP = -1;
|
|
|
|
/* Read the XPM signature comment */
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
if (strncmp(line, xpm3_signature, strlen(xpm3_signature)) != 0)
|
|
pm_error("Apparent XPM 3 file does not start with '/* XPM */'. "
|
|
"First line is '%s'", xpm3_signature);
|
|
|
|
/* Read the assignment line */
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
if (strncmp(line, "static char", 11) != 0)
|
|
pm_error("Cannot find data structure declaration. Expected a "
|
|
"line starting with 'static char', but found the line "
|
|
"'%s'.", line);
|
|
|
|
/* Read the hints line */
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
/* skip the comment line if any */
|
|
if (!strncmp(line, "/*", 2)) {
|
|
while (!strstr(line, "*/"))
|
|
- getline(line, sizeof(line), stream);
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
}
|
|
if (sscanf(line, "\"%d %d %d %d\",", widthP, heightP,
|
|
ncolorsP, chars_per_pixelP) != 4)
|
|
@@ -438,10 +438,10 @@ readXpm3Header(FILE * const stream, int
|
|
*transparentP = -1; /* initial value */
|
|
|
|
for (seqNum = 0; seqNum < *ncolorsP; seqNum++) {
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
/* skip the comment line if any */
|
|
if (!strncmp(line, "/*", 2))
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
|
|
interpretXpm3ColorTableLine(line, seqNum, *chars_per_pixelP,
|
|
*colorsP, *ptabP, transparentP);
|
|
@@ -456,7 +456,7 @@ readXpm1Header(FILE * const stream, int
|
|
pixel ** const colorsP, int ** const ptabP) {
|
|
/*----------------------------------------------------------------------------
|
|
Read the header of the XPM file on stream 'stream'. Assume the
|
|
- getline() stream is presently positioned to the beginning of the
|
|
+ get_line() stream is presently positioned to the beginning of the
|
|
file and it is a Version 1 XPM file. Leave the stream positioned
|
|
after the header.
|
|
|
|
@@ -476,7 +476,7 @@ readXpm1Header(FILE * const stream, int
|
|
/* Read the initial defines. */
|
|
processedStaticChar = FALSE;
|
|
while (!processedStaticChar) {
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
|
|
if (sscanf(line, "#define %s %d", str1, &v) == 2) {
|
|
char *t1;
|
|
@@ -524,7 +524,7 @@ readXpm1Header(FILE * const stream, int
|
|
/* If there's a monochrome color table, skip it. */
|
|
if (!strncmp(t1, "mono", 4)) {
|
|
for (;;) {
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
if (!strncmp(line, "static char", 11))
|
|
break;
|
|
}
|
|
@@ -547,7 +547,7 @@ readXpm1Header(FILE * const stream, int
|
|
|
|
/* Read color table. */
|
|
for (i = 0; i < *ncolorsP; ++i) {
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
|
|
if ((t1 = strchr(line, '"')) == NULL)
|
|
pm_error("D error scanning color table");
|
|
@@ -583,7 +583,7 @@ readXpm1Header(FILE * const stream, int
|
|
"static char ...").
|
|
*/
|
|
for (;;) {
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
if (strncmp(line, "static char", 11) == 0)
|
|
break;
|
|
}
|
|
@@ -687,7 +687,7 @@ ReadXPMFile(FILE * const stream, int * c
|
|
backup = FALSE;
|
|
|
|
/* Read the header line */
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
backup = TRUE; /* back up so next read reads this line again */
|
|
|
|
rc = sscanf(line, "/* %s */", str1);
|
|
@@ -707,7 +707,7 @@ ReadXPMFile(FILE * const stream, int * c
|
|
pm_error("Could not get %d bytes of memory for image", totalpixels);
|
|
cursor = *dataP;
|
|
maxcursor = *dataP + totalpixels - 1;
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
/* read next line (first line may not always start with comment) */
|
|
while (cursor <= maxcursor) {
|
|
if (strncmp(line, "/*", 2) == 0) {
|
|
@@ -717,7 +717,7 @@ ReadXPMFile(FILE * const stream, int * c
|
|
ncolors, ptab, &cursor, maxcursor);
|
|
}
|
|
if (cursor <= maxcursor)
|
|
- getline(line, sizeof(line), stream);
|
|
+ get_line(line, sizeof(line), stream);
|
|
}
|
|
if (ptab) free(ptab);
|
|
}
|