1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
Fixes taken from netpbm
--- lib/rle_global.c
+++ lib/rle_global.c
@@ -76,7 +76,7 @@ rle_hdr rle_dflt_hdr = {
8, /* cmaplen (log2 of length of color map) */
NULL, /* pointer to color map */
NULL, /* pointer to comment strings */
- stdout, /* output file */
+ NULL, /* output file -- must be set dynamically */
{ 7 }, /* RGB channels only */
0L, /* Can't free name and file fields. */
"Urt", /* Default "program name". */
--- lib/rle_hdr.c
+++ lib/rle_hdr.c
@@ -269,6 +273,9 @@
{
rle_hdr *ret_hdr;
+ rle_dflt_hdr.rle_file = stdout;
+ /* The rest of rle_dflt_hdr is set by the loader's data initialization */
+
if ( the_hdr == &rle_dflt_hdr )
return the_hdr;
--- lib/dither.c
+++ lib/dither.c
@@ -38,10 +38,10 @@ void make_square();
#endif
static int magic4x4[4][4] = {
- 0, 14, 3, 13,
- 11, 5, 8, 6,
- 12, 2, 15, 1,
- 7, 9, 4, 10
+{ 0, 14, 3, 13},
+{ 11, 5, 8, 6},
+{ 12, 2, 15, 1},
+{ 7, 9, 4, 10}
};
/* basic dithering macro */
--- lib/rle_open_f.c
+++ lib/rle_open_f.c
@@ -9,7 +9,11 @@
*/
#include "rle_config.h"
+#define _XOPEN_SOURCE /* Make sure fdopen() is in stdio.h */
+
#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
#ifndef NO_OPEN_PIPES
/* Need to have a SIGCLD signal catcher. */
@@ -260,7 +260,6 @@
int pipefd[2];
int i;
char *argv[4];
- extern int errno;
/* Check args. */
if ( *mode != 'r' && *mode != 'w' )
--- lib/rle_getcom.c
+++ lib/rle_getcom.c
@@ -53,11 +53,12 @@
{
for ( ; *n != '\0' && *n != '=' && *n == *v; n++, v++ )
;
- if (*n == '\0' || *n == '=')
+ if (*n == '\0' || *n == '=') {
if ( *v == '\0' )
return v;
else if ( *v == '=' )
return ++v;
+ }
return NULL;
}
--- lib/scanargs.c
+++ lib/scanargs.c
@@ -128,10 +130,10 @@
va_list argl;
{
- register check; /* check counter to be sure all argvs
+ int check; /* check counter to be sure all argvs
are processed */
register CONST_DECL char *cp;
- register cnt;
+ int cnt;
int optarg = 0; /* where optional args start */
int nopt = 0;
char tmpflg, /* temp flag */
@@ -375,11 +377,12 @@
if ( optarg > 0 ) /* end optional args? */
{
/* Eat the arg, too, if necessary */
- if ( list_cnt == 0 )
+ if ( list_cnt == 0 ) {
if ( typchr == 's' )
(void)va_arg( argl, char * );
else
(void)va_arg( argl, ptr );
+ }
break;
}
else
@@ -567,7 +570,7 @@
* Do conversion for n and N types
*/
tmpflg = typchr;
- if (typchr == 'n' || typchr == 'N' )
+ if (typchr == 'n' || typchr == 'N' ) {
if (*argp != '0')
tmpflg = 'd';
else if (*(argp+1) == 'x' ||
@@ -578,6 +581,7 @@
}
else
tmpflg = 'o';
+ }
if (typchr == 'N')
tmpflg = toupper( tmpflg );
--- lib/inv_cmap.c
+++ lib/inv_cmap.c
@@ -42,7 +42,7 @@
static long cbinc, cginc, crinc;
static unsigned long *gdp, *rdp, *cdp;
static unsigned char *grgbp, *rrgbp, *crgbp;
-static gstride, rstride;
+static long gstride, rstride;
static long x, xsqr, colormax;
static int cindex;
#ifdef INSTRUMENT_IT
--- lib/rle_getrow.c
+++ lib/rle_getrow.c
@@ -351,7 +351,7 @@
bzero( (char *)scanline[-1] + the_hdr->xmin,
the_hdr->xmax - the_hdr->xmin + 1 );
for ( nc = 0; nc < the_hdr->ncolors; nc++ )
- if ( RLE_BIT( *the_hdr, nc ) )
+ if ( RLE_BIT( *the_hdr, nc ) ) {
/* Unless bg color given explicitly, use 0. */
if ( the_hdr->background != 2 || the_hdr->bg_color[nc] == 0 )
bzero( (char *)scanline[nc] + the_hdr->xmin,
@@ -360,6 +360,7 @@
bfill( (char *)scanline[nc] + the_hdr->xmin,
the_hdr->xmax - the_hdr->xmin + 1,
the_hdr->bg_color[nc] );
+ }
}
/* If skipping, then just return */
@@ -367,7 +368,7 @@
{
the_hdr->priv.get.vert_skip--;
the_hdr->priv.get.scan_y++;
- if ( the_hdr->priv.get.vert_skip > 0 )
+ if ( the_hdr->priv.get.vert_skip > 0 ) {
if ( the_hdr->priv.get.scan_y >= the_hdr->ymax )
{
int y = the_hdr->priv.get.scan_y;
@@ -377,6 +378,7 @@
}
else
return the_hdr->priv.get.scan_y;
+ }
}
/* If EOF has been encountered, return also */
@@ -457,11 +459,12 @@
else
nc = DATUM(inst);
nc++;
- if ( debug_f )
+ if ( debug_f ) {
if ( RLE_BIT( *the_hdr, channel ) )
fprintf( stderr, "Pixel data %d (to %d):", nc, scan_x+nc );
else
fprintf( stderr, "Pixel data %d (to %d)\n", nc, scan_x+nc);
+ }
if ( RLE_BIT( *the_hdr, channel ) )
{
/* Don't fill past end of scanline! */
--- lib/rle_putcom.c
+++ lib/rle_putcom.c
@@ -53,11 +53,12 @@
{
for ( ; *n != '\0' && *n != '=' && *n == *v; n++, v++ )
;
- if (*n == '\0' || *n == '=')
+ if (*n == '\0' || *n == '=') {
if ( *v == '\0' )
return v;
else if ( *v == '=' )
return ++v;
+ }
return NULL;
}
|