]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/netpbm-10.26.46-getline.patch
Merge remote-tracking branch 'erik/sendEmail' into core67-merge
[people/teissler/ipfire-2.x.git] / src / patches / netpbm-10.26.46-getline.patch
1 The getline function used in a couple of places in netpbm-free is also
2 defined by POSIX:2008, and so netpbm-free fails to build with newer
3 versions of (e)glibc. Here's a patch to rename it.
4
5 * Rename getline functions to get_line to avoid conflict with POSIX:2008.
6
7 --- netpbm-free-10.0.orig/ppm/xvminitoppm.c
8 +++ netpbm-free-10.0/ppm/xvminitoppm.c
9 @@ -14,7 +14,7 @@
10 #include "ppm.h"
11 #define BUFSIZE 256
12
13 -static void getline ARGS((FILE *fp, char *buf));
14 +static void get_line ARGS((FILE *fp, char *buf));
15
16 int
17 main(argc, argv)
18 @@ -48,18 +48,18 @@
19 i++;
20 }
21
22 - getline(ifp, buf);
23 + get_line(ifp, buf);
24 if( strncmp(buf, "P7 332", 6) != 0 )
25 pm_error("bad magic number - not a XV thumbnail picture");
26
27 while(1) {
28 - getline(ifp, buf);
29 + get_line(ifp, buf);
30 if( strncmp(buf, "#END_OF_COMMENTS", 16)==0 )
31 break;
32 if( strncmp(buf, "#BUILTIN", 8)==0 )
33 pm_error("cannot convert builtin XV thumbnail pictures");
34 }
35 - getline(ifp, buf);
36 + get_line(ifp, buf);
37 if( sscanf(buf, "%d %d %d", &cols, &rows, &maxval) != 3 )
38 pm_error("error parsing dimension info");
39 if( maxval != 255 )
40 @@ -85,7 +85,7 @@
41
42
43 static void
44 -getline(fp, buf)
45 +get_line(fp, buf)
46 FILE *fp;
47 char *buf;
48 {
49 --- netpbm-free-10.0.orig/ppm/xpmtoppm.c
50 +++ netpbm-free-10.0/ppm/xpmtoppm.c
51 @@ -114,7 +114,7 @@
52
53
54 static void
55 -getline(char * const line, int const size, FILE * const stream) {
56 +get_line(char * const line, int const size, FILE * const stream) {
57 /*----------------------------------------------------------------------------
58 Read the next line from the input file 'stream', through the one-line
59 buffer lastInputLine[].
60 @@ -130,7 +130,7 @@
61 Exit program if the line doesn't fit in the buffer.
62 -----------------------------------------------------------------------------*/
63 if (size > MAX_LINE+1)
64 - pm_error("INTERNAL ERROR: getline() received 'size' parameter "
65 + pm_error("INTERNAL ERROR: get_line() received 'size' parameter "
66 "which is out of bounds");
67
68 if (backup) {
69 @@ -346,7 +346,7 @@
70 int * const transparentP) {
71 /*----------------------------------------------------------------------------
72 Read the header of the XPM file on stream 'stream'. Assume the
73 - getline() stream is presently positioned to the beginning of the
74 + get_line() stream is presently positioned to the beginning of the
75 file and it is a Version 3 XPM file. Leave the stream positioned
76 after the header.
77
78 @@ -377,25 +377,25 @@
79 *widthP = *heightP = *ncolorsP = *chars_per_pixelP = -1;
80
81 /* Read the XPM signature comment */
82 - getline(line, sizeof(line), stream);
83 + get_line(line, sizeof(line), stream);
84 if (strncmp(line, xpm3_signature, strlen(xpm3_signature)) != 0)
85 pm_error("Apparent XPM 3 file does not start with '/* XPM */'. "
86 "First line is '%s'", xpm3_signature);
87
88 /* Read the assignment line */
89 - getline(line, sizeof(line), stream);
90 + get_line(line, sizeof(line), stream);
91 if (strncmp(line, "static char", 11) != 0)
92 pm_error("Cannot find data structure declaration. Expected a "
93 "line starting with 'static char', but found the line "
94 "'%s'.", line);
95
96 /* Read the hints line */
97 - getline(line, sizeof(line), stream);
98 + get_line(line, sizeof(line), stream);
99 /* skip the comment line if any */
100 if (!strncmp(line, "/*", 2)) {
101 while (!strstr(line, "*/"))
102 - getline(line, sizeof(line), stream);
103 - getline(line, sizeof(line), stream);
104 + get_line(line, sizeof(line), stream);
105 + get_line(line, sizeof(line), stream);
106 }
107 if (sscanf(line, "\"%d %d %d %d\",", widthP, heightP,
108 ncolorsP, chars_per_pixelP) != 4)
109 @@ -427,10 +427,10 @@
110 *transparentP = -1; /* initial value */
111
112 for (seqNum = 0; seqNum < *ncolorsP; seqNum++) {
113 - getline(line, sizeof(line), stream);
114 + get_line(line, sizeof(line), stream);
115 /* skip the comment line if any */
116 if (!strncmp(line, "/*", 2))
117 - getline(line, sizeof(line), stream);
118 + get_line(line, sizeof(line), stream);
119
120 interpretXpm3ColorTableLine(line, seqNum, *chars_per_pixelP,
121 *colorsP, *ptabP, transparentP);
122 @@ -445,7 +445,7 @@
123 pixel ** const colorsP, int ** const ptabP) {
124 /*----------------------------------------------------------------------------
125 Read the header of the XPM file on stream 'stream'. Assume the
126 - getline() stream is presently positioned to the beginning of the
127 + get_line() stream is presently positioned to the beginning of the
128 file and it is a Version 1 XPM file. Leave the stream positioned
129 after the header.
130
131 @@ -464,7 +464,7 @@
132 /* Read the initial defines. */
133 processedStaticChar = FALSE;
134 while (!processedStaticChar) {
135 - getline(line, sizeof(line), stream);
136 + get_line(line, sizeof(line), stream);
137
138 if (sscanf(line, "#define %s %d", str1, &v) == 2) {
139 char *t1;
140 @@ -512,7 +512,7 @@
141 /* If there's a monochrome color table, skip it. */
142 if (!strncmp(t1, "mono", 4)) {
143 for (;;) {
144 - getline(line, sizeof(line), stream);
145 + get_line(line, sizeof(line), stream);
146 if (!strncmp(line, "static char", 11))
147 break;
148 }
149 @@ -533,7 +533,7 @@
150
151 /* Read color table. */
152 for (i = 0; i < *ncolorsP; ++i) {
153 - getline(line, sizeof(line), stream);
154 + get_line(line, sizeof(line), stream);
155
156 if ((t1 = strchr(line, '"')) == NULL)
157 pm_error("D error scanning color table");
158 @@ -569,7 +569,7 @@
159 "static char ...").
160 */
161 for (;;) {
162 - getline(line, sizeof(line), stream);
163 + get_line(line, sizeof(line), stream);
164 if (strncmp(line, "static char", 11) == 0)
165 break;
166 }
167 @@ -660,7 +660,7 @@
168 backup = FALSE;
169
170 /* Read the header line */
171 - getline(line, sizeof(line), stream);
172 + get_line(line, sizeof(line), stream);
173 backup = TRUE; /* back up so next read reads this line again */
174
175 rc = sscanf(line, "/* %s */", str1);
176 @@ -681,7 +681,7 @@
177 pm_error("Could not get %d bytes of memory for image", totalpixels);
178 cursor = *dataP;
179 maxcursor = *dataP + totalpixels - 1;
180 - getline(line, sizeof(line), stream);
181 + get_line(line, sizeof(line), stream);
182 /* read next line (first line may not always start with comment) */
183 while (cursor <= maxcursor) {
184 if (strncmp(line, "/*", 2) == 0) {
185 @@ -691,7 +691,7 @@
186 ncolors, ptab, &cursor, maxcursor);
187 }
188 if (cursor <= maxcursor)
189 - getline(line, sizeof(line), stream);
190 + get_line(line, sizeof(line), stream);
191 }
192 if (ptab) free(ptab);
193 }
194
195 Thanks,
196
197 --
198 Colin Watson [cjwatson@ubuntu.com]
199
200
201
202