summaryrefslogtreecommitdiff
path: root/src/common/db.h
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/common/db.h
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/common/db.h')
-rw-r--r--src/common/db.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common/db.h b/src/common/db.h
index b9d6af382..5f4478909 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -1121,8 +1121,10 @@ void linkdb_foreach (struct linkdb_node** head, LinkDBFunc func, ...);
#define VECTOR_ENSURE(__vec,__n,__step) \
do{ \
size_t _empty_ = VECTOR_CAPACITY(__vec)-VECTOR_LENGTH(__vec); \
- while( (__n) > _empty_ ) _empty_ += (__step); \
- if( _empty_ != VECTOR_CAPACITY(__vec)-VECTOR_LENGTH(__vec) ) VECTOR_RESIZE(__vec,_empty_+VECTOR_LENGTH(__vec)); \
+ if( (__n) > _empty_ ) { \
+ while( (__n) > _empty_ ) _empty_ += (__step); \
+ VECTOR_RESIZE(__vec,_empty_+VECTOR_LENGTH(__vec)); \
+ } \
}while(0)