diff options
Diffstat (limited to 'protocols/MinecraftDynmap')
-rw-r--r-- | protocols/MinecraftDynmap/src/chat.cpp | 6 | ||||
-rw-r--r-- | protocols/MinecraftDynmap/src/communication.cpp | 24 | ||||
-rw-r--r-- | protocols/MinecraftDynmap/src/dialogs.cpp | 2 | ||||
-rw-r--r-- | protocols/MinecraftDynmap/src/proto.cpp | 18 |
4 files changed, 25 insertions, 25 deletions
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp index cbaf735acf..044261e740 100644 --- a/protocols/MinecraftDynmap/src/chat.cpp +++ b/protocols/MinecraftDynmap/src/chat.cpp @@ -90,7 +90,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name) ptrW tname(mir_a2u_cp(name, CP_UTF8)); GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN }; - gce.time = DWORD(time(0)); + gce.time = DWORD(time(nullptr)); gce.dwFlags = GCEF_ADDTOLOG; gce.ptszNick = tname; gce.ptszUID = gce.ptszNick; @@ -112,7 +112,7 @@ void MinecraftDynmapProto::DeleteChatContact(const char *name) gce.dwFlags = GCEF_ADDTOLOG; gce.ptszNick = tname; gce.ptszUID = gce.ptszNick; - gce.time = DWORD(time(0)); + gce.time = DWORD(time(nullptr)); gce.bIsMe = (m_nick == name); Chat_Event(&gce); @@ -144,7 +144,7 @@ void MinecraftDynmapProto::SetTopic(const char *topic) ptrW ttopic(mir_a2u_cp(topic, CP_UTF8)); GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC }; - gce.time = ::time(NULL); + gce.time = ::time(nullptr); gce.ptszText = ttopic; Chat_Event( &gce); diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp index 9962317773..620b3f17a1 100644 --- a/protocols/MinecraftDynmap/src/communication.cpp +++ b/protocols/MinecraftDynmap/src/communication.cpp @@ -38,7 +38,7 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st nlhr.timeout = 1000 * ((request_type == MINECRAFTDYNMAP_REQUEST_EVENTS) ? 65 : 20); // Set request type (GET/POST) and eventually also POST data - if (post_data != NULL) { + if (post_data != nullptr) { nlhr.requestType = REQUEST_POST; nlhr.pData = (char*)(*post_data).c_str(); nlhr.dataLength = (int)post_data->length(); @@ -63,7 +63,7 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st switch (request_type) { case MINECRAFTDYNMAP_REQUEST_HOME: - nlhr.nlc = NULL; + nlhr.nlc = nullptr; break; case MINECRAFTDYNMAP_REQUEST_EVENTS: @@ -92,17 +92,17 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st break; case MINECRAFTDYNMAP_REQUEST_EVENTS: - hEventsConnection = pnlhr ? pnlhr->nlc : NULL; + hEventsConnection = pnlhr ? pnlhr->nlc : nullptr; break; default: ReleaseMutex(connection_lock_); - hConnection = pnlhr ? pnlhr->nlc : NULL; + hConnection = pnlhr ? pnlhr->nlc : nullptr; break; } // Check and copy response data - if (pnlhr != NULL) + if (pnlhr != nullptr) { debugLogA("@@@@@ Got response with code %d", pnlhr->resultCode); store_headers(&resp, pnlhr->headers, pnlhr->headersCount); @@ -318,7 +318,7 @@ bool MinecraftDynmapProto::doSendMessage(const std::string &message_text) return handleSuccess(__FUNCTION__); } else if (error == "not-allowed") { - UpdateChat(NULL, Translate("Message was not sent. Probably you are sending them too fast or chat is disabled completely.")); + UpdateChat(nullptr, Translate("Message was not sent. Probably you are sending them too fast or chat is disabled completely.")); } } } @@ -355,7 +355,7 @@ void MinecraftDynmapProto::SignOnWorker(void*) // Load server from database ptrA str(db_get_sa(NULL, m_szModuleName, MINECRAFTDYNMAP_KEY_SERVER)); if (!str || !str[0]) { - MessageBox(NULL, TranslateT("Set server address to connect."), m_tszUserName, MB_OK); + MessageBox(nullptr, TranslateT("Set server address to connect."), m_tszUserName, MB_OK); SetStatus(ID_STATUS_OFFLINE); return; } @@ -372,7 +372,7 @@ void MinecraftDynmapProto::SignOnWorker(void*) m_iStatus = m_iDesiredStatus; ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus); - setDword("LogonTS", (DWORD)time(NULL)); + setDword("LogonTS", (DWORD)time(nullptr)); ClearChat(); OnJoinChat(0, false); @@ -414,18 +414,18 @@ void MinecraftDynmapProto::SignOffWorker(void*) if (hConnection) Netlib_CloseHandle(hConnection); - hConnection = NULL; + hConnection = nullptr; if (hEventsConnection) Netlib_CloseHandle(hEventsConnection); - hEventsConnection = NULL; + hEventsConnection = nullptr; } void MinecraftDynmapProto::EventsLoop(void *) { ScopedLock s(events_loop_lock_); - time_t tim = ::time(NULL); + time_t tim = ::time(nullptr); debugLogA(">>>>> Entering %s[%d]", __FUNCTION__, tim); while (doEvents()) @@ -446,7 +446,7 @@ void MinecraftDynmapProto::EventsLoop(void *) void MinecraftDynmapProto::SendMsgWorker(void *p) { - if (p == NULL) + if (p == nullptr) return; ScopedLock s(send_message_lock_); diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp index 48c8c19eeb..69bad0db70 100644 --- a/protocols/MinecraftDynmap/src/dialogs.cpp +++ b/protocols/MinecraftDynmap/src/dialogs.cpp @@ -42,7 +42,7 @@ HANDLE GetIconHandle(const char* name) { return hIconLibItem[i]; } } - return 0; + return nullptr; } diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 83a05652d2..3aaa6ab022 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -23,14 +23,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t* username) : - PROTO<MinecraftDynmapProto>(proto_name, username), m_interval(0), hConnection(0), hEventsConnection(0), + PROTO<MinecraftDynmapProto>(proto_name, username), m_interval(0), hConnection(nullptr), hEventsConnection(nullptr), m_updateRate(5000), m_nick("") { - this->signon_lock_ = CreateMutex(NULL, FALSE, NULL); - this->send_message_lock_ = CreateMutex(NULL, FALSE, NULL); - this->connection_lock_ = CreateMutex(NULL, FALSE, NULL); - this->events_loop_lock_ = CreateMutex(NULL, FALSE, NULL); - this->events_loop_event_ = CreateEvent(NULL, FALSE, FALSE, NULL); + this->signon_lock_ = CreateMutex(nullptr, FALSE, nullptr); + this->send_message_lock_ = CreateMutex(nullptr, FALSE, nullptr); + this->connection_lock_ = CreateMutex(nullptr, FALSE, nullptr); + this->events_loop_lock_ = CreateMutex(nullptr, FALSE, nullptr); + this->events_loop_event_ = CreateEvent(nullptr, FALSE, FALSE, nullptr); // Group chats CreateProtoService(PS_JOINCHAT, &MinecraftDynmapProto::OnJoinChat); @@ -50,15 +50,15 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t nlu.szSettingsModule = m_szModuleName; nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); - if (m_hNetlibUser == NULL) { + if (m_hNetlibUser == nullptr) { wchar_t error[200]; mir_snwprintf(error, TranslateT("Unable to initialize Netlib for %s."), m_tszUserName); - MessageBox(NULL, error, L"Miranda NG", MB_OK | MB_ICONERROR); + MessageBox(nullptr, error, L"Miranda NG", MB_OK | MB_ICONERROR); } // Client instantiation this->error_count_ = 0; - this->chatHandle_ = NULL; + this->chatHandle_ = nullptr; } MinecraftDynmapProto::~MinecraftDynmapProto() |