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 incorrect language standard #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0x9fff00
Copy link
Contributor

@0x9fff00 0x9fff00 commented Feb 8, 2020

This project uses POSIX extensions, which causes at least the following warnings and errors when compiling with -std=c11 and -std=c++11 (using GCC 9.2.0 on Arch Linux) since they don't support these extensions:

ipsw.c: In function ‘ipsw_open’:
ipsw.c:85:18: warning: implicit declaration of function ‘strdup’; did you mean ‘strcmp’? [-Wimplicit-function-declaration]
   85 |  archive->path = strdup(ipsw);
      |                  ^~~~~~
      |                  strcmp
ipsw.c:85:16: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   85 |  archive->path = strdup(ipsw);
      |                ^
ipsw.c: In function ‘ipsw_extract_to_file_with_progress’:
ipsw.c:227:24: error: ‘PATH_MAX’ undeclared (first use in this function)
  227 |   char actual_filepath[PATH_MAX+1];
      |                        ^~~~~~~~
ipsw.c:227:24: note: each undeclared identifier is reported only once for each function it appears in
ipsw.c:229:8: warning: implicit declaration of function ‘realpath’ [-Wimplicit-function-declaration]
  229 |   if (!realpath(filepath, actual_filepath)) {
      |        ^~~~~~~~
ipsw.c:249:15: warning: implicit declaration of function ‘fileno’ [-Wimplicit-function-declaration]
  249 |     if (fstat(fileno(fi), &fst) != 0) {
      |               ^~~~~~
ipsw.c: In function ‘ipsw_download_fw’:
ipsw.c:773:13: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  773 |   *ipswfile = strdup(fwlfn);
      |             ^

To fix this, switch to -std=gnu11 and -std=gnu++11.

@0x9fff00
Copy link
Contributor Author

0x9fff00 commented Feb 8, 2020

More specifically, the included idevicerestore uses POSIX extensions, and it doesn't define a standard, so it uses the standard defined by this which is incompatible.

@0x9fff00 0x9fff00 force-pushed the fix-incorrect-language-standard branch from c1e106c to b014224 Compare February 8, 2020 21:17
@Merculous
Copy link

Can vouch, this fixed the missing headers issue I kept having.

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