diff options
author | Haru <haru@dotalux.com> | 2013-12-10 19:48:55 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-17 01:11:33 +0100 |
commit | 15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48 (patch) | |
tree | c5dd5b25003f8c21381c7a2e1f010dba71e40b90 /src/map/pc_groups.c | |
parent | a23d072a66d2569ba13921522be3c82ae9aad576 (diff) | |
download | hercules-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/pc_groups.c')
-rw-r--r-- | src/map/pc_groups.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/map/pc_groups.c b/src/map/pc_groups.c index f95878e97..59dd951c7 100644 --- a/src/map/pc_groups.c +++ b/src/map/pc_groups.c @@ -131,7 +131,7 @@ static void read_config(void) { iter = db_iterator(pcg->db); for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) { config_setting_t *commands = group_settings->commands, *permissions = group_settings->permissions; - int count = 0, i; + int count = 0; // Make sure there is "commands" group if (commands == NULL) @@ -209,15 +209,15 @@ static void read_config(void) { // Copy settings (commands/permissions) that are not defined yet if (inherited_group->commands != NULL) { - int i = 0, commands_count = config_setting_length(inherited_group->commands); - for (i = 0; i < commands_count; ++i) - config_setting_copy(commands, config_setting_get_elem(inherited_group->commands, i)); + int k = 0, commands_count = config_setting_length(inherited_group->commands); + for (k = 0; k < commands_count; ++k) + config_setting_copy(commands, config_setting_get_elem(inherited_group->commands, k)); } if (inherited_group->permissions != NULL) { - int i = 0, permissions_count = config_setting_length(inherited_group->permissions); - for (i = 0; i < permissions_count; ++i) - config_setting_copy(permissions, config_setting_get_elem(inherited_group->permissions, i)); + int k = 0, permissions_count = config_setting_length(inherited_group->permissions); + for (k = 0; k < permissions_count; ++k) + config_setting_copy(permissions, config_setting_get_elem(inherited_group->permissions, k)); } ++done; // copied commands and permissions from one of inherited groups @@ -241,7 +241,7 @@ static void read_config(void) { iter = db_iterator(pcg->db); for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) { config_setting_t *permissions = group_settings->permissions; - int i, count = config_setting_length(permissions); + int count = config_setting_length(permissions); for (i = 0; i < count; ++i) { config_setting_t *perm = config_setting_get_elem(permissions, i); @@ -261,20 +261,20 @@ static void read_config(void) { // Fetch all groups and relevant config setting and send them // to atcommand->load_group() for processing. if (group_count > 0) { - int i = 0; - GroupSettings **groups = NULL; + GroupSettings **pc_groups = NULL; config_setting_t **commands = NULL; - CREATE(groups, GroupSettings*, group_count); + CREATE(pc_groups, GroupSettings*, group_count); CREATE(commands, config_setting_t*, group_count); + i = 0; iter = db_iterator(pcg->db); for (group_settings = dbi_first(iter); dbi_exists(iter); group_settings = dbi_next(iter)) { - groups[i] = group_settings; + pc_groups[i] = group_settings; commands[i] = group_settings->commands; i++; } - atcommand->load_groups(groups, commands, group_count); + atcommand->load_groups(pc_groups, commands, group_count); dbi_destroy(iter); - aFree(groups); + aFree(pc_groups); aFree(commands); } } |