summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-01-24 19:38:48 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-01-24 19:38:48 +0000
commit720440a9f92cfa64825c95f65df66a8ea078ec52 (patch)
tree657ab13681589871f3266f3463296af9a9171bb0 /src/map/map.c
parent4bf5fc03a70033962b6f0703780898c97eadf6ec (diff)
downloadhercules-720440a9f92cfa64825c95f65df66a8ea078ec52.tar.gz
hercules-720440a9f92cfa64825c95f65df66a8ea078ec52.tar.bz2
hercules-720440a9f92cfa64825c95f65df66a8ea078ec52.tar.xz
hercules-720440a9f92cfa64825c95f65df66a8ea078ec52.zip
* 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
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c17
1 files changed, 10 insertions, 7 deletions
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)