Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gzip_normalize function could modify the return type to void #657

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/minizip/minizip.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ int main(argc,argv)

while ((*p)!='\0')
{
char c=*(p++);;
char c=*(p++);
if ((c=='o') || (c=='O'))
opt_overwrite = 1;
if ((c=='a') || (c=='A'))
Expand Down
3 changes: 1 addition & 2 deletions examples/gzjoin.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@
#define local static

/* exit with an error (return a value to allow use in an expression) */
local int bail(char *why1, char *why2)
local void bail(char *why1, char *why2)
{
fprintf(stderr, "gzjoin error: %s%s, output incomplete\n", why1, why2);
exit(1);
return 0;
}

/* -- simple buffered file input with access to the buffer -- */
Expand Down
10 changes: 4 additions & 6 deletions examples/gznorm.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ local char *aprintf(char *fmt, ...) {
// and assures that gzip_normalize applied a second time will not change the
// input. The pad bits after stored block headers and after the final deflate
// block are all forced to zeros.
local int gzip_normalize(FILE *in, FILE *out, char **err) {
local void gzip_normalize(FILE *in, FILE *out, char **err) {
// initialize the inflate engine to process a gzip member
z_stream strm;
strm.zalloc = Z_NULL;
Expand Down Expand Up @@ -451,7 +451,6 @@ local int gzip_normalize(FILE *in, FILE *out, char **err) {

// All good!
*err = NULL;
return 0;
}

// Normalize the gzip stream on stdin, writing the result to stdout.
Expand All @@ -462,9 +461,8 @@ int main(void) {

// Normalize from stdin to stdout, returning 1 on error, 0 if ok.
char *err;
int ret = gzip_normalize(stdin, stdout, &err);
if (ret)
fprintf(stderr, "gznorm error: %s\n", err);
gzip_normalize(stdin, stdout, &err);
free(err);
return ret;

return 0;
}