From ffe1fca0cc4cac3213c048933314f4f4057e5991 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 17 Feb 2009 02:28:26 +0100 Subject: Fixing various warning / errors. --- mpq-file.c | 2 +- mpq-fs.c | 10 +++++----- recycle.c | 2 +- stalloc.c | 7 ++++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mpq-file.c b/mpq-file.c index 6bd7b43..70b987b 100644 --- a/mpq-file.c +++ b/mpq-file.c @@ -214,7 +214,7 @@ uint32_t mpqlib_read(struct mpq_file_t * mpq_f, void * _buffer, uint32_t size) { return return_size; } -uint32_t mpqlib_seek(struct mpq_file_t * mpq_f, int32_t offset, enum mpqlib_file_seek_t wheel) { +uint32_t mpqlib_seek(struct mpq_file_t * mpq_f, signed long int offset, enum mpqlib_file_seek_t wheel) { switch (wheel) { case MPQLIB_SEEK_SET: if (offset < 0) diff --git a/mpq-fs.c b/mpq-fs.c index 063e522..160fdcd 100644 --- a/mpq-fs.c +++ b/mpq-fs.c @@ -129,6 +129,9 @@ struct mpq_file_t * mpqlib_fs_open(const char * _fname) { return NULL; } +#define FALSE 0 +#define TRUE !FALSE + int mpqlib_fs_filelist(char * buffer) { int r_size = 0, l; char * p = buffer; @@ -137,10 +140,10 @@ int mpqlib_fs_filelist(char * buffer) { return 0; if (hfirst(hash_table)) do { - l = strlen(hkey(hash_table)); + l = strlen((char *)hkey(hash_table)); r_size += l + 1; if (p) { - strcpy(p, hkey(hash_table)); + strcpy(p, (char *)hkey(hash_table)); p += l; *(p++) = '\n'; } @@ -149,9 +152,6 @@ int mpqlib_fs_filelist(char * buffer) { return r_size; } -#define FALSE 0 -#define TRUE !FALSE - void mpqlib_fs_shutdown() { if (!hash_table) return; diff --git a/recycle.c b/recycle.c index 25af503..084854b 100644 --- a/recycle.c +++ b/recycle.c @@ -78,7 +78,7 @@ char *purpose; char *x = (char *)malloc(len); if (!x) { - fprintf(stderr, "malloc of %ld failed for %s\n", + fprintf(stderr, "malloc of %d failed for %s\n", len, purpose); exit(-1); } diff --git a/stalloc.c b/stalloc.c index f8abb22..27e3288 100644 --- a/stalloc.c +++ b/stalloc.c @@ -1,4 +1,5 @@ #include +#include static int nb_pools = 0; static char ** mem_pools = 0; @@ -41,13 +42,13 @@ void * st_alloc(size_t s) { pools_size[pool] += s; - return mem_pools[pool] + pool_size[pool] - s; + return mem_pools[pool] + pools_size[pool] - s; } char * st_strdup(const char * src) { int s = strlen(src) + 1; - char * r = (char *) st_alloc(s) - memcpy(r, src); + char * r = (char *) st_alloc(s); + memcpy(r, src, s); return r; } -- cgit v1.2.3