Fix some warnings in tests/.

Somehow, the previous code could compile and run correctly, without crashing.
master
Cyp 2012-10-01 16:41:13 +02:00
parent 858664124d
commit 20f3ad9a6e
3 changed files with 6 additions and 5 deletions

View File

@ -24,7 +24,7 @@ int main(int argc, char **argv)
GAMEMAP *map; GAMEMAP *map;
char filename[PATH_MAX], *delim; char filename[PATH_MAX], *delim;
fscanf(fp, "%s\n", &filename); fscanf(fp, "%256s\n", filename);
// Strip "/game.map" // Strip "/game.map"
delim = strrchr(filename, '/'); delim = strrchr(filename, '/');

View File

@ -25,6 +25,7 @@
#include <errno.h> #include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <unistd.h>
#ifndef WIN32 #ifndef WIN32
#include <stdbool.h> #include <stdbool.h>
@ -124,7 +125,7 @@ static void check_pie(const char *input)
for (j = 0; j < points; j++) for (j = 0; j < points; j++)
{ {
double a, b, c; double a, b, c;
num = fscanf(fp, "%f %f %f\n", &a, &b, &c); num = fscanf(fp, "%lf %lf %lf\n", &a, &b, &c);
if (num != 3) if (num != 3)
{ {
fprintf(stderr, "File %s. Bad POINTS entry level %d, number %d.\n", input, level, j); fprintf(stderr, "File %s. Bad POINTS entry level %d, number %d.\n", input, level, j);
@ -198,7 +199,7 @@ static void check_pie(const char *input)
for (k = 0; k < 3; k++) for (k = 0; k < 3; k++)
{ {
double t, u; double t, u;
num = fscanf(fp, "%f %f", &t, &u); num = fscanf(fp, "%lf %lf", &t, &u);
if (num != 2) if (num != 2)
{ {
fprintf(stderr, "File %s. Bad texture coordinate entry level %d, number %d\n", input, level, j); fprintf(stderr, "File %s. Bad texture coordinate entry level %d, number %d\n", input, level, j);
@ -244,7 +245,7 @@ int main(int argc, char **argv)
{ {
char filename[PATH_MAX]; char filename[PATH_MAX];
fscanf(fp, "%s\n", &filename); fscanf(fp, "%256s\n", filename);
printf("Testing model: %s\n", filename); printf("Testing model: %s\n", filename);
strcpy(fullpath, datapath); strcpy(fullpath, datapath);
strcat(fullpath, filename); strcat(fullpath, filename);

View File

@ -21,7 +21,7 @@ int main(int argc, char **argv)
while (!feof(fp)) while (!feof(fp))
{ {
fscanf(fp, "%s\n", &filename); fscanf(fp, "%256s\n", filename);
printf("Testing script: %s\n", filename); printf("Testing script: %s\n", filename);
strcpy(fullpath, datapath); strcpy(fullpath, datapath);
strcat(fullpath, filename); strcat(fullpath, filename);