diff options
-rw-r--r-- | mpq-file.c | 2 | ||||
-rw-r--r-- | mpq-fs.c | 10 | ||||
-rw-r--r-- | recycle.c | 2 | ||||
-rw-r--r-- | stalloc.c | 7 |
4 files changed, 11 insertions, 10 deletions
@@ -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) @@ -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; @@ -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); } @@ -1,4 +1,5 @@ #include <stdlib.h> +#include <string.h> 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; } |