Skip to content

Commit

Permalink
Fix warnings in libtiptoi.c and gameanalyse.c when compiling with gcc…
Browse files Browse the repository at this point in the history
… 5.3.1:

gcc -g -o libtiptoi libtiptoi.c
libtiptoi.c: In function ‘readFile’:
libtiptoi.c:140:22: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
  gme->audioFileTable = &gme->data[gme->audioFileTableOffset];
                      ^
libtiptoi.c:147:17: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
  gme->mainTable = &gme->data[gme->mainTableOffset];
                 ^
libtiptoi.c: In function ‘printInformation’:
libtiptoi.c:493:8: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
    gjt = &gme->data[gme->mainTable->codeTable[i - gme->mainTable->firstOIDCode]+2];
        ^
gcc -g -o gameanalyse gameanalyse.c
gameanalyse.c: In function ‘parse_game’:
gameanalyse.c:447:9: warning: too many arguments for format [-Wformat-extra-args]
  printf("\n", type);
         ^
gameanalyse.c:468:9: warning: too many arguments for format [-Wformat-extra-args]
  printf("\n", type);
         ^
gameanalyse.c:488:9: warning: too many arguments for format [-Wformat-extra-args]
  printf("\n", type);
         ^
gameanalyse.c:662:9: warning: too many arguments for format [-Wformat-extra-args]
  printf("\n", type);
         ^
gameanalyse.c:680:9: warning: too many arguments for format [-Wformat-extra-args]
  printf("\n", type);
         ^
gameanalyse.c:698:9: warning: too many arguments for format [-Wformat-extra-args]
  printf("\n", type);
         ^
gameanalyse.c:716:9: warning: too many arguments for format [-Wformat-extra-args]
  printf("\n", type);
         ^
  • Loading branch information
colinba committed Jun 20, 2016
1 parent 5aef7d0 commit d9dc8e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions gameanalyse.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ void parse_game(FILE * file, int id, uint32_t start, uint32_t end)
}
}

printf("\n", type);
printf("\n");
index = 4;

printf("Typ%03d (%d)OID ", type, count);
Expand All @@ -465,7 +465,7 @@ void parse_game(FILE * file, int id, uint32_t start, uint32_t end)
}
}

printf("\n", type);
printf("\n");
index = 4;

printf("Typ%03d (%d)GID ", type, count);
Expand All @@ -485,7 +485,7 @@ void parse_game(FILE * file, int id, uint32_t start, uint32_t end)
printf("0");
}
}
printf("\n", type);
printf("\n");
return;
}

Expand Down Expand Up @@ -659,7 +659,7 @@ void parse_game(FILE * file, int id, uint32_t start, uint32_t end)
// parse_playlistpointer(file, pointer, start, end);
}
}
printf("\n", type);
printf("\n");

printf("Typ%02d PLY ", type);
for (i = 0; i < ps2; i++) {
Expand All @@ -677,7 +677,7 @@ void parse_game(FILE * file, int id, uint32_t start, uint32_t end)
printf("0");
}
}
printf("\n", type);
printf("\n");

printf("Typ%02d OID ", type);
for (i = 0; i < ps2; i++) {
Expand All @@ -695,7 +695,7 @@ void parse_game(FILE * file, int id, uint32_t start, uint32_t end)
printf("0");
}
}
printf("\n", type);
printf("\n");

printf("Typ%02d GID ", type);
for (i = 0; i < ps2; i++) {
Expand All @@ -713,7 +713,7 @@ void parse_game(FILE * file, int id, uint32_t start, uint32_t end)
printf("0");
}
}
printf("\n", type);
printf("\n");
}

uint32_t firstsub;
Expand Down
6 changes: 3 additions & 3 deletions libtiptoi.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ GME_FILE *readFile(char *filename){
fclose(fp);

gme->audioFileTableOffset = GET_UINT32(GME_AUDIO_FILE_TABLE_OFFSET);
gme->audioFileTable = &gme->data[gme->audioFileTableOffset];
gme->audioFileTable = (GME_AUDIO_FILE_TABLE *)&gme->data[gme->audioFileTableOffset];
gme->audioFileTableEntries = (gme->audioFileTable[0].offset - GET_UINT32(GME_AUDIO_FILE_TABLE_OFFSET)) / 8;
gme->bookCode = GET_UINT32(GME_BOOK_CODE_OFFSET);
gme->xor = getXOR(gme);
gme->checksum = *(uint32_t*)&gme->data[gme->filesize - 4];

gme->mainTableOffset = GET_UINT32(GME_MAIN_FILE_TABLE_OFFSET);
gme->mainTable = &gme->data[gme->mainTableOffset];
gme->mainTable = (GME_MAIN_TABLE *)&gme->data[gme->mainTableOffset];
return gme;
}

Expand Down Expand Up @@ -490,7 +490,7 @@ void printInformation(char *inputfile, FILE *out){
}
fprintf(out, "%02d: %d\n", i, jumpTableOffset);
elements = *(uint16_t*)&gme->data[gme->mainTable->codeTable[i - gme->mainTable->firstOIDCode]];
gjt = &gme->data[gme->mainTable->codeTable[i - gme->mainTable->firstOIDCode]+2];
gjt = (uint32_t *)&gme->data[gme->mainTable->codeTable[i - gme->mainTable->firstOIDCode]+2];
for (j = 0; j < elements-1; j++){
fprintf(out,"\t%02d: %d: ", j, gjt[j]);
hexDump(out,&gme->data[gjt[j]], &gme->data[gjt[j + 1]]);
Expand Down

0 comments on commit d9dc8e0

Please sign in to comment.