diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/guildmanager.cpp | 3 | ||||
-rw-r--r-- | src/net/download.cpp | 9 | ||||
-rw-r--r-- | src/net/ea/guildhandler.cpp | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp index eb56c2fc0..180758cf7 100644 --- a/src/guildmanager.cpp +++ b/src/guildmanager.cpp @@ -431,8 +431,7 @@ bool GuildManager::process(std::string msg) const size_t pos = msg.find(": ", 0); if (pos != std::string::npos) { - const std::string sender_name = ((pos == std::string::npos) - ? "" : msg.substr(0, pos)); + const std::string sender_name = msg.substr(0, pos); if (!guild->getMember(sender_name)) { mTab->chatLog(msg); diff --git a/src/net/download.cpp b/src/net/download.cpp index 838038f7c..32625b181 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -68,6 +68,8 @@ Download::Download(void *ptr, const std::string &url, mError[0] = 0; mOptions.cancel = 0; + mOptions.memoryWrite = 0; + mOptions.checkAdler = true; } Download::~Download() @@ -88,9 +90,16 @@ Download::~Download() */ unsigned long Download::fadler32(FILE *file) { + if (!file) + return 0; + // Obtain file size fseek(file, 0, SEEK_END); long fileSize = ftell(file); + if (fileSize < 0) + { // file size error + return 0; + } rewind(file); // Calculate Adler-32 checksum diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index e9ec8c97d..129ba931d 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -552,11 +552,8 @@ void GuildHandler::processGuildMessage(Net::MessageIn &msg) const size_t pos = chatMsg.find(" : ", 0); if (pos != std::string::npos) { - std::string sender_name = ((pos == std::string::npos) - ? "" : chatMsg.substr(0, pos)); - + std::string sender_name = chatMsg.substr(0, pos); chatMsg.erase(0, pos + 3); - trim(chatMsg); guildTab->chatLog(sender_name, chatMsg); } |