From 1ac059d0b7ab18c3723336f6e2ac8012732a5570 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 10 Mar 2009 15:19:50 +0100 Subject: Fixes for some compile warnings Mostly comparisons between signed and unsigned integers --- src/account-server/dalstorage.cpp | 2 +- src/chat-server/post.cpp | 6 ++++-- src/common/transaction.hpp | 2 +- src/utils/stringfilter.cpp | 8 +++++--- 4 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp index eac9f409..086487f3 100644 --- a/src/account-server/dalstorage.cpp +++ b/src/account-server/dalstorage.cpp @@ -1688,7 +1688,7 @@ std::vector DALStorage::getTransactions(time_t date) << date; dal::RecordSet const &rec = mDb->execSql(sql.str()); - for (int i = 0; i < rec.rows(); ++i) + for (unsigned int i = 0; i < rec.rows(); ++i) { Transaction trans; trans.mCharacterId = toUint(rec(i, 1)); diff --git a/src/chat-server/post.cpp b/src/chat-server/post.cpp index e3f4c4f0..ba829c02 100644 --- a/src/chat-server/post.cpp +++ b/src/chat-server/post.cpp @@ -62,7 +62,8 @@ std::string Letter::getContents() bool Letter::addAttachment(InventoryItem item) { - if (mAttachments.size() > Configuration::getValue("mail_maxAttachments", 3)) + unsigned int max = Configuration::getValue("mail_maxAttachments", 3); + if (mAttachments.size() > max) { return false; } @@ -102,7 +103,8 @@ Post::~Post() bool Post::addLetter(Letter *letter) { - if (mLetters.size() > Configuration::getValue("mail_maxLetters", 10)) + unsigned int max = Configuration::getValue("mail_maxLetters", 10); + if (mLetters.size() > max) { return false; } diff --git a/src/common/transaction.hpp b/src/common/transaction.hpp index 21a00de8..3cdb4d58 100644 --- a/src/common/transaction.hpp +++ b/src/common/transaction.hpp @@ -61,7 +61,7 @@ enum TRANS_TRADE_MONEY, TRANS_TRADE_ITEM, TRANS_ATTR_INCREASE, - TRANS_ATTR_DECREASE, + TRANS_ATTR_DECREASE }; #endif diff --git a/src/utils/stringfilter.cpp b/src/utils/stringfilter.cpp index 93be8b3e..1e2eaa54 100644 --- a/src/utils/stringfilter.cpp +++ b/src/utils/stringfilter.cpp @@ -103,9 +103,11 @@ bool StringFilter::filterContent(const std::string& text) bool StringFilter::isEmailValid(const std::string& email) { - // Testing Email validity - if ((email.length() < Configuration::getValue("account_minEmailLength", 7)) || - (email.length() > Configuration::getValue("account_maxEmailLength", 128))) + unsigned int min = Configuration::getValue("account_minEmailLength", 7); + unsigned int max = Configuration::getValue("account_maxEmailLength", 128); + + // Testing email validity + if (email.length() < min || email.length() > max) { return false; } -- cgit v1.2.3-60-g2f50