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

Fix compilation warnings #388

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hlindberg
Copy link

This fixes a couple of compilation warnings in contrib/minizip. See the respective commit message for each fix.

Before this, there were two places in contrib/minizip that used
an `#ifdef` with an `||` operator. This resulted in a warning
of unrecognized (and ignored) tokens after the `#ifdef`. While this
worked for all `unix` variants, it would not use that branch for
`__APPLE`. That is bad because a) it won't work on `__APPLE__` and b)
there are warnings from the compilation.

The solution is to use `#if defined(x) || defined(y)` since the `if`
supports using an `||` operator.
Before this, a warning for line 495 in minizip.c would be issued
since the variable `fin` may not be initialized.

This fixes the warning by assigning `NULL` to `fin` where it is
introduced.
Before this, there would be a warning of 'implicit declaration of
mkdir' for the miniunz.c file on line 131 where it calls `mkdir`.
That is bad because there is a warning.

The fix is to include the appropriate header files as indicated
by `man(2) mkdir`; `sys/stat.h` and `sys/types.h`.

This fix is for unix flavoured systems, but may need to be tweaked
for some flavours.
Before this, there would be a warning for the lines 521 and 529
in contrib/minizip/zip.c. This was caused by the `for` loop on
line 521 not having braces around the body of the `for`, and that
the subsequent statement on line 529 was indented to look like it
was part of the `for` body.

This is now corrected by fixing the bad indentation.

The alternative of placing braces around the `for` body was considered
but that style is not typically used in the zlib codebase.
@Neustradamus
Copy link

Please note that there is https://github.com/nmoinvaz/minizip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants