diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/mailmessage.h | 2 | ||||
-rw-r--r-- | src/gui/windows/mailviewwindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/mailviewwindow.h | 1 | ||||
-rw-r--r-- | src/gui/windows/mailwindow.cpp | 19 | ||||
-rw-r--r-- | src/net/eathena/mail2handler.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/mail2recv.cpp | 9 | ||||
-rw-r--r-- | src/net/eathena/mail2recv.h | 5 | ||||
-rw-r--r-- | src/net/eathena/mailrecv.cpp | 6 | ||||
-rw-r--r-- | src/resources/mailqueue.h | 2 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/throw.cc | 13 | ||||
-rw-r--r-- | src/unittests/utils/stringutils.cc | 4 | ||||
-rw-r--r-- | src/utils/xml/libxml.cpp | 2 |
12 files changed, 30 insertions, 47 deletions
diff --git a/src/gui/mailmessage.h b/src/gui/mailmessage.h index b1940c5e9..f96a6d675 100644 --- a/src/gui/mailmessage.h +++ b/src/gui/mailmessage.h @@ -52,7 +52,7 @@ struct MailMessage final int64_t id; int time; int expireTime; - int money; + int64_t money; MailMessageType::Type type; bool read; }; diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index 03503bfac..3f349ef42 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -20,7 +20,6 @@ #include "gui/windows/mailviewwindow.h" -#include "configuration.h" #include "settings.h" #include "net/mail2handler.h" @@ -40,6 +39,7 @@ #include "utils/delete2.h" #include "utils/gettext.h" +#include "utils/stringutils.h" #include "resources/inventory/inventory.h" @@ -109,7 +109,7 @@ MailViewWindow::MailViewWindow(MailMessage *const message, if (message->money != 0) { // TRANSLATORS: mail view window label - mMoneyLabel = new Label(this, strprintf("%s %d", _("Money:"), + mMoneyLabel = new Label(this, strprintf("%s %" PRId64, _("Money:"), message->money)); placer(0, n++, mMoneyLabel); } @@ -170,7 +170,7 @@ void MailViewWindow::action(const ActionEvent &event) } else { - mailHandler->getAttach(mMessage->id); + mailHandler->getAttach(CAST_S32(mMessage->id)); } } else if (eventId == "money") @@ -239,7 +239,7 @@ void MailViewWindow::removeItems(const int64_t mailId) mMessage->type = static_cast<MailMessageType::Type>( CAST_S32(mMessage->type) ^ CAST_S32(MailMessageType::Item)); updateAttachButton(); - if (mailWindow) + if (mailWindow != nullptr) mailWindow->refreshMailNames(); } @@ -257,13 +257,13 @@ void MailViewWindow::removeMoney(const int64_t mailId) if (mMoneyLabel == nullptr) return; - if (mGetMoneyButton) + if (mGetMoneyButton != nullptr) mGetMoneyButton->setVisible(Visible_false); mMoneyLabel->setCaption(strprintf("%s %d", // TRANSLATORS: mail view window label _("Money:"), 0)); - if (mailWindow) + if (mailWindow != nullptr) mailWindow->refreshMailNames(); } diff --git a/src/gui/windows/mailviewwindow.h b/src/gui/windows/mailviewwindow.h index c3f691629..19585de03 100644 --- a/src/gui/windows/mailviewwindow.h +++ b/src/gui/windows/mailviewwindow.h @@ -26,7 +26,6 @@ #include "listeners/actionlistener.h" class Button; -class Icon; class Inventory; class ItemContainer; class Label; diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp index d22168f6d..254aa2f73 100644 --- a/src/gui/windows/mailwindow.cpp +++ b/src/gui/windows/mailwindow.cpp @@ -146,7 +146,7 @@ void MailWindow::action(const ActionEvent &event) if (mUseMail2) mail2Handler->readMail(mOpenType, mail->id); else - mailHandler->readMessage(mail->id); + mailHandler->readMessage(CAST_S32(mail->id)); } else if (eventId == "delete") { @@ -157,7 +157,7 @@ void MailWindow::action(const ActionEvent &event) if (mUseMail2) mail2Handler->deleteMail(mOpenType, mail->id); else - mailHandler->deleteMessage(mail->id); + mailHandler->deleteMessage(CAST_S32(mail->id)); } else if (eventId == "return") { @@ -175,7 +175,7 @@ void MailWindow::action(const ActionEvent &event) if (sel < 0) return; const MailMessage *const mail = mMessages[sel]; - mailHandler->returnMessage(mail->id); + mailHandler->returnMessage(CAST_S32(mail->id)); } } } @@ -210,12 +210,9 @@ std::string MailWindow::getMailHeader(MailMessage *const message) const header.append(" ").append(message->title); return STD_MOVE(header); } - else - { - return strprintf("%s %s", - message->read ? " " : "U", - message->title.c_str()); - } + return strprintf("%s %s", + message->read ? " " : "U", + message->title.c_str()); } void MailWindow::addMail(MailMessage *const message) @@ -294,7 +291,7 @@ void MailWindow::viewNext(const int64_t id) if (mUseMail2) mail2Handler->readMail(mOpenType, message->id); else - mailHandler->readMessage(message->id); + mailHandler->readMessage(CAST_S32(message->id)); return; } } @@ -322,7 +319,7 @@ void MailWindow::viewPrev(const int64_t id) if (mUseMail2) mail2Handler->readMail(mOpenType, message->id); else - mailHandler->readMessage(message->id); + mailHandler->readMessage(CAST_S32(message->id)); return; } } diff --git a/src/net/eathena/mail2handler.cpp b/src/net/eathena/mail2handler.cpp index c32fde9cf..2b4de04ab 100644 --- a/src/net/eathena/mail2handler.cpp +++ b/src/net/eathena/mail2handler.cpp @@ -30,6 +30,8 @@ #include "utils/checkutils.h" +#include "resources/mailqueue.h" + #include "resources/item/item.h" #include "debug.h" diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp index fdaf34f1d..d3537a48a 100644 --- a/src/net/eathena/mail2recv.cpp +++ b/src/net/eathena/mail2recv.cpp @@ -35,9 +35,10 @@ #include "gui/windows/mailviewwindow.h" #include "gui/windows/mailwindow.h" +#include "net/mail2handler.h" #include "net/messagein.h" -#include "net/eathena/mail2handler.h" +#include "resources/mailqueue.h" #include "resources/inventory/inventory.h" @@ -175,7 +176,7 @@ void Mail2Recv::processRemoveItemResult(Net::MessageIn &msg) if (result == 0) { - Inventory *const inv = PlayerInfo::getInventory(); + const Inventory *const inv = PlayerInfo::getInventory(); if (inv == nullptr) { reportAlways("Player inventory not exists"); @@ -460,7 +461,7 @@ void Mail2Recv::processRequestMoney(Net::MessageIn &msg) case 0: NotifyManager::notify( NotifyTypes::MAIL_GET_MONEY_OK); - if (mailViewWindow) + if (mailViewWindow != nullptr) mailViewWindow->removeMoney(mailId); break; case 1: @@ -489,7 +490,7 @@ void Mail2Recv::processRequestItems(Net::MessageIn &msg) case 0: NotifyManager::notify( NotifyTypes::MAIL_GET_ATTACH_OK); - if (mailViewWindow) + if (mailViewWindow != nullptr) mailViewWindow->removeItems(mailId); break; case 1: diff --git a/src/net/eathena/mail2recv.h b/src/net/eathena/mail2recv.h index dc575b0c8..e23603b8c 100644 --- a/src/net/eathena/mail2recv.h +++ b/src/net/eathena/mail2recv.h @@ -21,10 +21,11 @@ #ifndef NET_EATHENA_MAIL2RECV_H #define NET_EATHENA_MAIL2RECV_H -#include "resources/mailqueue.h" - +#include <string> #include <queue> +struct MailQueue; + namespace Net { class MessageIn; diff --git a/src/net/eathena/mailrecv.cpp b/src/net/eathena/mailrecv.cpp index b51e418a6..de7945a7d 100644 --- a/src/net/eathena/mailrecv.cpp +++ b/src/net/eathena/mailrecv.cpp @@ -120,21 +120,21 @@ void MailRecv::processReadMail(Net::MessageIn &msg) mail->text = msg.readString(sz, "message"); msg.readUInt8("zero"); mail->strTime = timeToStr(mail->time); - if (!mailWindow) + if (mailWindow == nullptr) { reportAlways("Mail window not created"); delete mail; return; } mailWindow->showMessage(mail, itemId != 0 ? 1 : 0); - if (!mailViewWindow) + if (mailViewWindow == nullptr) { reportAlways("Mail view window not created"); return; } Inventory *const inventory = mailViewWindow->getInventory(); - if (!inventory) + if (inventory == nullptr) { reportAlways("Mail view window missing inventory"); return; diff --git a/src/resources/mailqueue.h b/src/resources/mailqueue.h index 6f8fe83ff..52c264ea1 100644 --- a/src/resources/mailqueue.h +++ b/src/resources/mailqueue.h @@ -42,7 +42,7 @@ struct MailQueue final std::string to; std::string title; std::string body; - int money; + int64_t money; MailQueueTypeT type; }; diff --git a/src/unittests/fs/virtfs/throw.cc b/src/unittests/fs/virtfs/throw.cc index e2472f618..91298dfa1 100644 --- a/src/unittests/fs/virtfs/throw.cc +++ b/src/unittests/fs/virtfs/throw.cc @@ -107,11 +107,6 @@ TEST_CASE("throw VirtFs1 exists2", "") TEST_CASE("throw Zip readCompressedFile", "") { logger = new Logger(); - std::string name("data/test/test.zip"); - std::string prefix; - if (Files::existsLocal(name) == false) - prefix = "../"; - SECTION("empty") { REQUIRE_THROWS(VirtFs::ZipReader::readCompressedFile(nullptr)); @@ -123,10 +118,6 @@ TEST_CASE("throw Zip readCompressedFile", "") TEST_CASE("throw Zip readFile", "") { logger = new Logger(); - std::string name("data/test/test.zip"); - std::string prefix; - if (Files::existsLocal(name) == false) - prefix = "../"; SECTION("empty") { @@ -140,11 +131,7 @@ TEST_CASE("throw VirtFs1 unmount", "") { VirtFs::init("."); logger = new Logger(); - std::string name("data/test/test.zip"); - std::string prefix; const std::string sep = dirSeparator; - if (Files::existsLocal(name) == false) - prefix = "../"; SECTION("simple 1") { diff --git a/src/unittests/utils/stringutils.cc b/src/unittests/utils/stringutils.cc index 44bc4d13f..128b07078 100644 --- a/src/unittests/utils/stringutils.cc +++ b/src/unittests/utils/stringutils.cc @@ -1216,8 +1216,6 @@ TEST_CASE("stringuntils decodeLinkText", "") TEST_CASE("stringuntils isDigit", "") { - std::string str; - REQUIRE_FALSE(isDigit("")); REQUIRE(isDigit("1")); REQUIRE(isDigit("123")); @@ -1229,8 +1227,6 @@ TEST_CASE("stringuntils isDigit", "") TEST_CASE("stringuntils findAny", "") { - std::string str; - REQUIRE(findAny("test line", ",", 0) == std::string::npos); REQUIRE(findAny("test line", " ", 0) == 4U); REQUIRE(findAny("test, line", ", ", 0) == 4U); diff --git a/src/utils/xml/libxml.cpp b/src/utils/xml/libxml.cpp index 251f994d5..46c3fbb76 100644 --- a/src/utils/xml/libxml.cpp +++ b/src/utils/xml/libxml.cpp @@ -214,7 +214,7 @@ namespace XML xmlChar *const prop = XmlGetProp(node, name); if (prop != nullptr) { - ret = atof(reinterpret_cast<char*>(prop)); + ret = static_cast<float>(atof(reinterpret_cast<char*>(prop))); xmlFree(prop); } |