diff options
Diffstat (limited to 'test/minigzip.c')
-rw-r--r-- | test/minigzip.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/test/minigzip.c b/test/minigzip.c index 8a21ddf..c72356d 100644 --- a/test/minigzip.c +++ b/test/minigzip.c | |||
@@ -149,12 +149,12 @@ static void pwinerror (s) | |||
149 | # include <unistd.h> /* for unlink() */ | 149 | # include <unistd.h> /* for unlink() */ |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | void *myalloc(void *q, unsigned n, unsigned m) { | 152 | static void *myalloc(void *q, unsigned n, unsigned m) { |
153 | (void)q; | 153 | (void)q; |
154 | return calloc(n, m); | 154 | return calloc(n, m); |
155 | } | 155 | } |
156 | 156 | ||
157 | void myfree(void *q, void *p) { | 157 | static void myfree(void *q, void *p) { |
158 | (void)q; | 158 | (void)q; |
159 | free(p); | 159 | free(p); |
160 | } | 160 | } |
@@ -167,7 +167,7 @@ typedef struct gzFile_s { | |||
167 | z_stream strm; | 167 | z_stream strm; |
168 | } *gzFile; | 168 | } *gzFile; |
169 | 169 | ||
170 | gzFile gz_open(const char *path, int fd, const char *mode) { | 170 | static gzFile gz_open(const char *path, int fd, const char *mode) { |
171 | gzFile gz; | 171 | gzFile gz; |
172 | int ret; | 172 | int ret; |
173 | 173 | ||
@@ -201,15 +201,15 @@ gzFile gz_open(const char *path, int fd, const char *mode) { | |||
201 | return gz; | 201 | return gz; |
202 | } | 202 | } |
203 | 203 | ||
204 | gzFile gzopen(const char *path, const char *mode) { | 204 | static gzFile gzopen(const char *path, const char *mode) { |
205 | return gz_open(path, -1, mode); | 205 | return gz_open(path, -1, mode); |
206 | } | 206 | } |
207 | 207 | ||
208 | gzFile gzdopen(int fd, const char *mode) { | 208 | static gzFile gzdopen(int fd, const char *mode) { |
209 | return gz_open(NULL, fd, mode); | 209 | return gz_open(NULL, fd, mode); |
210 | } | 210 | } |
211 | 211 | ||
212 | int gzwrite(gzFile gz, const void *buf, unsigned len) { | 212 | static int gzwrite(gzFile gz, const void *buf, unsigned len) { |
213 | z_stream *strm; | 213 | z_stream *strm; |
214 | unsigned char out[BUFLEN]; | 214 | unsigned char out[BUFLEN]; |
215 | 215 | ||
@@ -227,7 +227,7 @@ int gzwrite(gzFile gz, const void *buf, unsigned len) { | |||
227 | return len; | 227 | return len; |
228 | } | 228 | } |
229 | 229 | ||
230 | int gzread(gzFile gz, void *buf, unsigned len) { | 230 | static int gzread(gzFile gz, void *buf, unsigned len) { |
231 | int ret; | 231 | int ret; |
232 | unsigned got; | 232 | unsigned got; |
233 | unsigned char in[1]; | 233 | unsigned char in[1]; |
@@ -258,7 +258,7 @@ int gzread(gzFile gz, void *buf, unsigned len) { | |||
258 | return len - strm->avail_out; | 258 | return len - strm->avail_out; |
259 | } | 259 | } |
260 | 260 | ||
261 | int gzclose(gzFile gz) { | 261 | static int gzclose(gzFile gz) { |
262 | z_stream *strm; | 262 | z_stream *strm; |
263 | unsigned char out[BUFLEN]; | 263 | unsigned char out[BUFLEN]; |
264 | 264 | ||
@@ -283,7 +283,7 @@ int gzclose(gzFile gz) { | |||
283 | return Z_OK; | 283 | return Z_OK; |
284 | } | 284 | } |
285 | 285 | ||
286 | const char *gzerror(gzFile gz, int *err) { | 286 | static const char *gzerror(gzFile gz, int *err) { |
287 | *err = gz->err; | 287 | *err = gz->err; |
288 | return gz->msg; | 288 | return gz->msg; |
289 | } | 289 | } |
@@ -295,7 +295,7 @@ static char *prog; | |||
295 | /* =========================================================================== | 295 | /* =========================================================================== |
296 | * Display error message and exit | 296 | * Display error message and exit |
297 | */ | 297 | */ |
298 | void error(const char *msg) { | 298 | static void error(const char *msg) { |
299 | fprintf(stderr, "%s: %s\n", prog, msg); | 299 | fprintf(stderr, "%s: %s\n", prog, msg); |
300 | exit(1); | 300 | exit(1); |
301 | } | 301 | } |
@@ -305,7 +305,7 @@ void error(const char *msg) { | |||
305 | /* Try compressing the input file at once using mmap. Return Z_OK if | 305 | /* Try compressing the input file at once using mmap. Return Z_OK if |
306 | * if success, Z_ERRNO otherwise. | 306 | * if success, Z_ERRNO otherwise. |
307 | */ | 307 | */ |
308 | int gz_compress_mmap(FILE *in, gzFile out) { | 308 | static int gz_compress_mmap(FILE *in, gzFile out) { |
309 | int len; | 309 | int len; |
310 | int err; | 310 | int err; |
311 | int ifd = fileno(in); | 311 | int ifd = fileno(in); |
@@ -338,7 +338,7 @@ int gz_compress_mmap(FILE *in, gzFile out) { | |||
338 | * Compress input to output then close both files. | 338 | * Compress input to output then close both files. |
339 | */ | 339 | */ |
340 | 340 | ||
341 | void gz_compress(FILE *in, gzFile out) { | 341 | static void gz_compress(FILE *in, gzFile out) { |
342 | local char buf[BUFLEN]; | 342 | local char buf[BUFLEN]; |
343 | int len; | 343 | int len; |
344 | int err; | 344 | int err; |
@@ -366,7 +366,7 @@ void gz_compress(FILE *in, gzFile out) { | |||
366 | /* =========================================================================== | 366 | /* =========================================================================== |
367 | * Uncompress input to output then close both files. | 367 | * Uncompress input to output then close both files. |
368 | */ | 368 | */ |
369 | void gz_uncompress(gzFile in, FILE *out) { | 369 | static void gz_uncompress(gzFile in, FILE *out) { |
370 | local char buf[BUFLEN]; | 370 | local char buf[BUFLEN]; |
371 | int len; | 371 | int len; |
372 | int err; | 372 | int err; |
@@ -390,7 +390,7 @@ void gz_uncompress(gzFile in, FILE *out) { | |||
390 | * Compress the given file: create a corresponding .gz file and remove the | 390 | * Compress the given file: create a corresponding .gz file and remove the |
391 | * original. | 391 | * original. |
392 | */ | 392 | */ |
393 | void file_compress(char *file, char *mode) { | 393 | static void file_compress(char *file, char *mode) { |
394 | local char outfile[MAX_NAME_LEN]; | 394 | local char outfile[MAX_NAME_LEN]; |
395 | FILE *in; | 395 | FILE *in; |
396 | gzFile out; | 396 | gzFile out; |
@@ -426,7 +426,7 @@ void file_compress(char *file, char *mode) { | |||
426 | /* =========================================================================== | 426 | /* =========================================================================== |
427 | * Uncompress the given file and remove the original. | 427 | * Uncompress the given file and remove the original. |
428 | */ | 428 | */ |
429 | void file_uncompress(char *file) { | 429 | static void file_uncompress(char *file) { |
430 | local char buf[MAX_NAME_LEN]; | 430 | local char buf[MAX_NAME_LEN]; |
431 | char *infile, *outfile; | 431 | char *infile, *outfile; |
432 | FILE *out; | 432 | FILE *out; |