diff --git a/src/BackgroundThread.cpp b/src/BackgroundThread.cpp index 00637fb..9f224f3 100644 --- a/src/BackgroundThread.cpp +++ b/src/BackgroundThread.cpp @@ -9,7 +9,7 @@ #include "ftp.h" #include "net.h" -BackgroundThread * BackgroundThread::instance = NULL; +BackgroundThread * BackgroundThread::instance = nullptr; BackgroundThread::BackgroundThread(): BackgroundThreadWrapper(BackgroundThread::getPriority()) { DEBUG_FUNCTION_LINE("Create new Server"); @@ -18,7 +18,7 @@ BackgroundThread::BackgroundThread(): BackgroundThreadWrapper(BackgroundThread:: DCFlushRange(&(this->serverSocket), 4); mutex.unlock(); DEBUG_FUNCTION_LINE("handle %d", this->serverSocket); - resumeThread(); + CThread::resumeThread(); } BackgroundThread::~BackgroundThread() { @@ -47,7 +47,7 @@ BOOL BackgroundThread::whileLoop() { DCFlushRange(&(this->serverSocket), 4); mutex.unlock(); } - OSSleepTicks(OSMillisecondsToTicks(16)); } + OSSleepTicks(OSMillisecondsToTicks(16)); return true; } diff --git a/src/main.cpp b/src/main.cpp index fb0386d..1e8bb47 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -60,6 +60,8 @@ ON_APPLICATION_START(args) { ACGetAssignedAddress(&hostIpAddress); + nn::ac::Finalize(); + WHBLogUdpInit(); //!******************************************************************* @@ -67,7 +69,7 @@ ON_APPLICATION_START(args) { //!******************************************************************* DEBUG_FUNCTION_LINE("IOSUHAX_Open"); - int res = IOSUHAX_Open(NULL); + int res = IOSUHAX_Open(nullptr); if(res < 0) { DEBUG_FUNCTION_LINE("IOSUHAX_open failed"); VirtualMountDevice("fs:/"); diff --git a/src/utils/BackgroundThreadWrapper.cpp b/src/utils/BackgroundThreadWrapper.cpp index 91bb7ca..b15e7fb 100644 --- a/src/utils/BackgroundThreadWrapper.cpp +++ b/src/utils/BackgroundThreadWrapper.cpp @@ -1,10 +1,8 @@ #include "BackgroundThreadWrapper.hpp" -#include -#include + #include #include -#include "logger.h" BackgroundThreadWrapper::BackgroundThreadWrapper(int32_t priority): CThread(CThread::eAttributeAffCore2, priority, 0x100000) { } @@ -16,7 +14,7 @@ BackgroundThreadWrapper::~BackgroundThreadWrapper() { } void BackgroundThreadWrapper::executeThread() { - while (1) { + while (true) { if(exitThread) { DEBUG_FUNCTION_LINE("We want to exit"); break; diff --git a/src/utils/BackgroundThreadWrapper.hpp b/src/utils/BackgroundThreadWrapper.hpp index 9477737..bbde285 100644 --- a/src/utils/BackgroundThreadWrapper.hpp +++ b/src/utils/BackgroundThreadWrapper.hpp @@ -6,19 +6,19 @@ class BackgroundThreadWrapper: public CThread { public: - BackgroundThreadWrapper(int32_t priority); - virtual ~BackgroundThreadWrapper(); + explicit BackgroundThreadWrapper(int32_t priority); + ~BackgroundThreadWrapper() override; protected: - BOOL shouldExit() { + [[nodiscard]] BOOL shouldExit() const { return (exitThread == 1); } - void setThreadPriority(int32_t priority) { - this->setThreadPriority(priority); + void setThreadPriority(int32_t priority) override { + CThread::setThreadPriority(priority); } std::recursive_mutex mutex; private: - void executeThread(); + void executeThread() override; /** Called when a connection has be accepted.