From 720440a9f92cfa64825c95f65df66a8ea078ec52 Mon Sep 17 00:00:00 2001 From: FlavioJS Date: Sat, 24 Jan 2009 19:38:48 +0000 Subject: * Changed the variables of the mapcache structs to fixed size equivalents. (64bit portability issue) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13483 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/map') diff --git a/src/map/map.c b/src/map/map.c index 03b095295..c732e2d55 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -136,16 +136,16 @@ struct charid2nick { // This is the main header found at the very beginning of the map cache struct map_cache_main_header { - unsigned long file_size; - unsigned short map_count; + uint32 file_size; + uint16 map_count; }; // This is the header appended before every compressed map cells info in the map cache struct map_cache_map_info { char name[MAP_NAME_LENGTH]; - short xs; - short ys; - long len; + int16 xs; + int16 ys; + int32 len; }; char map_cache_file[256]="db/map_cache.dat"; @@ -2694,9 +2694,12 @@ int map_readfromcache(struct map_data *m, FILE *fp) unsigned char *buf, *buf2; unsigned long size, xy; + if( info.xs <= 0 || info.ys <= 0 ) + return 0;// invalid + m->xs = info.xs; m->ys = info.ys; - size = info.xs*info.ys; + size = (unsigned long)info.xs*(unsigned long)info.ys; buf = (unsigned char*)aMalloc(info.len); // temp buffer to read the zipped map buf2 = (unsigned char*)aMalloc(size); // temp buffer to unpack the data @@ -2713,7 +2716,7 @@ int map_readfromcache(struct map_data *m, FILE *fp) return 1; } - return 0; + return 0;// not found } int map_addmap(char* mapname) -- cgit v1.2.3-70-g09d2