diff options
author | Haru <haru@dotalux.com> | 2015-01-20 04:36:08 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-01-20 04:41:33 +0100 |
commit | 4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4 (patch) | |
tree | dab9d12a6a4b95a37598e27e6e86d6047360d61b /src/char/int_storage.c | |
parent | 03709c136ad300be631adfd38dc36c2433bda718 (diff) | |
download | hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.gz hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.bz2 hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.tar.xz hercules-4ae2b9b72dd4fce3d7a7778222d1c39abbb564a4.zip |
Minor fixes and tweaks suggested by cppcheck
- Variable scopes reduced
- Parenthesized ambiguous expressions
- Removed or added NULL checks where (un)necessary
- Corrected format strings
- Fixed typos potentially leading to bugs
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char/int_storage.c')
-rw-r--r-- | src/char/int_storage.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/char/int_storage.c b/src/char/int_storage.c index f2dd4d47a..db49eb46e 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -36,7 +36,6 @@ int inter_storage_tosql(int account_id, struct storage_data* p) int inter_storage_fromsql(int account_id, struct storage_data* p) { StringBuf buf; - struct item* item; char* data; int i; int j; @@ -56,9 +55,8 @@ int inter_storage_fromsql(int account_id, struct storage_data* p) StrBuf->Destroy(&buf); - for( i = 0; i < MAX_STORAGE && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) - { - item = &p->items[i]; + for (i = 0; i < MAX_STORAGE && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i) { + struct item *item = &p->items[i]; SQL->GetData(inter->sql_handle, 0, &data, NULL); item->id = atoi(data); SQL->GetData(inter->sql_handle, 1, &data, NULL); item->nameid = atoi(data); SQL->GetData(inter->sql_handle, 2, &data, NULL); item->amount = atoi(data); @@ -93,7 +91,6 @@ int inter_storage_guild_storage_tosql(int guild_id, struct guild_storage* p) int inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage* p) { StringBuf buf; - struct item* item; char* data; int i; int j; @@ -114,8 +111,8 @@ int inter_storage_guild_storage_fromsql(int guild_id, struct guild_storage* p) StrBuf->Destroy(&buf); - for( i = 0; i < MAX_GUILD_STORAGE && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i ) { - item = &p->items[i]; + for (i = 0; i < MAX_GUILD_STORAGE && SQL_SUCCESS == SQL->NextRow(inter->sql_handle); ++i) { + struct item *item = &p->items[i]; SQL->GetData(inter->sql_handle, 0, &data, NULL); item->id = atoi(data); SQL->GetData(inter->sql_handle, 1, &data, NULL); item->nameid = atoi(data); SQL->GetData(inter->sql_handle, 2, &data, NULL); item->amount = atoi(data); |