Skip to content

Commit

Permalink
Added non-GNU gcc checks for macOS gcc. Thanks @JL2210
Browse files Browse the repository at this point in the history
  • Loading branch information
lpla committed May 15, 2020
1 parent dce46cf commit 1c3dc34
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions code/util/gather.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ void allocbank(void)
++allocated;
}

#ifdef __STDC__
int comp(const void *a, const void *b) {
return indexes[*(int *)a] - indexes[*(int *)b];
}
#endif

int main(int argc,char **argv) {
int file;
Expand Down Expand Up @@ -275,6 +277,11 @@ int main(int argc,char **argv) {
if(ins[i])
dump(i,rootname);
int sorted[MAXRESOURCES];
#ifndef __STDC__
int comp(const void *a, const void *b) {
return indexes[*(int *)a] - indexes[*(int *)b];
}
#endif
for(i=0;i<filenum;++i) sorted[i]=i;
qsort(sorted, filenum, sizeof(*sorted), comp);
for(i=0;i<filenum;++i) {
Expand Down
6 changes: 6 additions & 0 deletions code/util/gbswd.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ void helptext(char *name) {
exit(-1);
}

#ifdef __STDC__
void be32(char *p, int v) {p[3] = v;p[2] = v>>8;p[1] = v>>16;p[0] = v>>24;}
void le32(char *p, int v) {p[0] = v;p[1] = v>>8;p[2] = v>>16;p[3] = v>>24;}
#endif

int main(int argc,char **argv) {
int file;
Expand Down Expand Up @@ -278,6 +280,10 @@ int main(int argc,char **argv) {
printf("Couldn't create %s\n",outname);
return 3;
}
#ifndef __STDC__
void be32(char *p, int v) {p[3] = v;p[2] = v>>8;p[1] = v>>16;p[0] = v>>24;}
void le32(char *p, int v) {p[0] = v;p[1] = v>>8;p[2] = v>>16;p[3] = v>>24;}
#endif
ocount=0;
if(!chunk2k) {
res=docompress(inputdata,inputlen);
Expand Down

0 comments on commit 1c3dc34

Please sign in to comment.