summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-12-10 19:48:55 +0100
committerHaru <haru@dotalux.com>2013-12-17 01:11:33 +0100
commit15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48 (patch)
treec5dd5b25003f8c21381c7a2e1f010dba71e40b90 /src/map/map.c
parenta23d072a66d2569ba13921522be3c82ae9aad576 (diff)
downloadhercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.gz
hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.bz2
hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.xz
hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.zip
Fixed several compiler warnings
- Warnings detected thanks to Xcode's compiler settings (more strict by default) and clang, warnings mostly but not only related to data sizes on 64 bit systems, that were silenced until now by very lax compiler settings. - This also decreases by a great deal the amount of warnings produced by MSVC in x64 mode (for the adventurous ones who tried that) - Also fixed (or silenced in case of false positives) the potential issues pointed out by the (awesome) clang static analyzer. - Patch co-produced with Ind, I'm merging and committing in his place! Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/map/map.c b/src/map/map.c
index b68a1f6a5..3a018828a 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -2239,7 +2239,7 @@ bool map_addnpc(int16 m,struct npc_data *nd) {
// Stores the spawn data entry in the mob list.
// Returns the index of successful, or -1 if the list was full.
int map_addmobtolist(unsigned short m, struct spawn_data *spawn) {
- size_t i;
+ int i;
ARR_FIND( 0, MAX_MOB_LIST_PER_MAP, i, map->list[m].moblist[i] == NULL );
if( i < MAX_MOB_LIST_PER_MAP ) {
map->list[m].moblist[i] = spawn;
@@ -3684,7 +3684,7 @@ void map_zone_remove(int m) {
unsigned short k;
char empty[1] = "\0";
for(k = 0; k < map->list[m].zone_mf_count; k++) {
- int len = strlen(map->list[m].zone_mf[k]),j;
+ size_t len = strlen(map->list[m].zone_mf[k]),j;
params[0] = '\0';
memcpy(flag, map->list[m].zone_mf[k], MAP_ZONE_MAPFLAG_LENGTH);
for(j = 0; j < len; j++) {
@@ -4236,7 +4236,7 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
} else if (!strcmpi(flag,"adjust_unit_duration")) {
int skill_id, k;
char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH];
- int len = strlen(params);
+ size_t len = strlen(params);
modifier[0] = '\0';
memcpy(skill_name, params, MAP_ZONE_MAPFLAG_LENGTH);
@@ -4254,7 +4254,6 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
} else {
int idx = map->list[m].unit_count;
- k = 0;
ARR_FIND(0, idx, k, map->list[m].units[k]->skill_id == skill_id);
if( k < idx ) {
@@ -4270,7 +4269,7 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
} else if (!strcmpi(flag,"adjust_skill_damage")) {
int skill_id, k;
char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH];
- int len = strlen(params);
+ size_t len = strlen(params);
modifier[0] = '\0';
memcpy(skill_name, params, MAP_ZONE_MAPFLAG_LENGTH);
@@ -4288,7 +4287,6 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
} else {
int idx = map->list[m].skill_count;
- k = 0;
ARR_FIND(0, idx, k, map->list[m].skills[k]->skill_id == skill_id);
if( k < idx ) {
@@ -4414,7 +4412,7 @@ void map_zone_apply(int m, struct map_zone_data *zone, const char* start, const
char flag[MAP_ZONE_MAPFLAG_LENGTH], params[MAP_ZONE_MAPFLAG_LENGTH];
map->list[m].zone = zone;
for(i = 0; i < zone->mapflags_count; i++) {
- int len = strlen(zone->mapflags[i]);
+ size_t len = strlen(zone->mapflags[i]);
int k;
params[0] = '\0';
memcpy(flag, zone->mapflags[i], MAP_ZONE_MAPFLAG_LENGTH);
@@ -4442,7 +4440,7 @@ void map_zone_init(void) {
zone = &map->zone_all;
for(i = 0; i < zone->mapflags_count; i++) {
- int len = strlen(zone->mapflags[i]);
+ size_t len = strlen(zone->mapflags[i]);
params[0] = '\0';
memcpy(flag, zone->mapflags[i], MAP_ZONE_MAPFLAG_LENGTH);
for(k = 0; k < len; k++) {
@@ -4465,7 +4463,7 @@ void map_zone_init(void) {
if( battle_config.pk_mode ) {
zone = &map->zone_pk;
for(i = 0; i < zone->mapflags_count; i++) {
- int len = strlen(zone->mapflags[i]);
+ size_t len = strlen(zone->mapflags[i]);
params[0] = '\0';
memcpy(flag, zone->mapflags[i], MAP_ZONE_MAPFLAG_LENGTH);
for(k = 0; k < len; k++) {