Commit e00c635ef7139927fece424d10409953724a6c10
1 parent
3905cbe2
Fix tests and warnings
Showing
5 changed files
with
27 additions
and
4 deletions
CMakeLists.txt
| @@ -9,6 +9,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) | @@ -9,6 +9,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| 9 | 9 | ||
| 10 | SET(CMAKE_CXX_FLAGS "-rdynamic") | 10 | SET(CMAKE_CXX_FLAGS "-rdynamic") |
| 11 | 11 | ||
| 12 | +add_compile_options(-Wall) | ||
| 13 | + | ||
| 12 | add_executable(FlashMQ | 14 | add_executable(FlashMQ |
| 13 | mainapp.cpp | 15 | mainapp.cpp |
| 14 | main.cpp | 16 | main.cpp |
FlashMQTests/FlashMQTests.pro
| @@ -28,6 +28,16 @@ SOURCES += tst_maintests.cpp \ | @@ -28,6 +28,16 @@ SOURCES += tst_maintests.cpp \ | ||
| 28 | ../authplugin.cpp \ | 28 | ../authplugin.cpp \ |
| 29 | ../session.cpp \ | 29 | ../session.cpp \ |
| 30 | ../configfileparser.cpp \ | 30 | ../configfileparser.cpp \ |
| 31 | + ../sslctxmanager.cpp \ | ||
| 32 | + ../timer.cpp \ | ||
| 33 | + ../iowrapper.cpp \ | ||
| 34 | + ../mosquittoauthoptcompatwrap.cpp \ | ||
| 35 | + ../settings.cpp \ | ||
| 36 | + ../listener.cpp \ | ||
| 37 | + ../unscopedlock.cpp \ | ||
| 38 | + ../scopedsocket.cpp \ | ||
| 39 | + ../bindaddr.cpp \ | ||
| 40 | + ../oneinstancelock.cpp \ | ||
| 31 | mainappthread.cpp \ | 41 | mainappthread.cpp \ |
| 32 | twoclienttestcontext.cpp | 42 | twoclienttestcontext.cpp |
| 33 | 43 | ||
| @@ -49,9 +59,19 @@ HEADERS += \ | @@ -49,9 +59,19 @@ HEADERS += \ | ||
| 49 | ../authplugin.h \ | 59 | ../authplugin.h \ |
| 50 | ../session.h \ | 60 | ../session.h \ |
| 51 | ../configfileparser.h \ | 61 | ../configfileparser.h \ |
| 62 | + ../sslctxmanager.h \ | ||
| 63 | + ../timer.h \ | ||
| 64 | + ../iowrapper.h \ | ||
| 65 | + ../mosquittoauthoptcompatwrap.h \ | ||
| 66 | + ../settings.h \ | ||
| 67 | + ../listener.h \ | ||
| 68 | + ../unscopedlock.h \ | ||
| 69 | + ../scopedsocket.h \ | ||
| 70 | + ../bindaddr.h \ | ||
| 71 | + ../oneinstancelock.h \ | ||
| 52 | mainappthread.h \ | 72 | mainappthread.h \ |
| 53 | twoclienttestcontext.h | 73 | twoclienttestcontext.h |
| 54 | 74 | ||
| 55 | -LIBS += -ldl | 75 | +LIBS += -ldl -lssl -lcrypto |
| 56 | 76 | ||
| 57 | QMAKE_LFLAGS += -rdynamic | 77 | QMAKE_LFLAGS += -rdynamic |
logger.cpp
| @@ -145,4 +145,5 @@ int logSslError(const char *str, size_t len, void *u) | @@ -145,4 +145,5 @@ int logSslError(const char *str, size_t len, void *u) | ||
| 145 | { | 145 | { |
| 146 | Logger *logger = Logger::getInstance(); | 146 | Logger *logger = Logger::getInstance(); |
| 147 | logger->logf(LOG_ERR, str); | 147 | logger->logf(LOG_ERR, str); |
| 148 | + return 0; | ||
| 148 | } | 149 | } |
utils.cpp
| @@ -207,10 +207,10 @@ int64_t currentMSecsSinceEpoch() | @@ -207,10 +207,10 @@ int64_t currentMSecsSinceEpoch() | ||
| 207 | return milliseconds; | 207 | return milliseconds; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | -std::string getSecureRandomString(const size_t len) | 210 | +std::string getSecureRandomString(const ssize_t len) |
| 211 | { | 211 | { |
| 212 | std::vector<char> buf(len); | 212 | std::vector<char> buf(len); |
| 213 | - size_t actual_len = getrandom(buf.data(), len, 0); | 213 | + ssize_t actual_len = getrandom(buf.data(), len, 0); |
| 214 | 214 | ||
| 215 | if (actual_len < 0 || actual_len != len) | 215 | if (actual_len < 0 || actual_len != len) |
| 216 | { | 216 | { |
utils.h
| @@ -45,7 +45,7 @@ void trim(std::string &s); | @@ -45,7 +45,7 @@ void trim(std::string &s); | ||
| 45 | bool startsWith(const std::string &s, const std::string &needle); | 45 | bool startsWith(const std::string &s, const std::string &needle); |
| 46 | 46 | ||
| 47 | int64_t currentMSecsSinceEpoch(); | 47 | int64_t currentMSecsSinceEpoch(); |
| 48 | -std::string getSecureRandomString(const size_t len); | 48 | +std::string getSecureRandomString(const ssize_t len); |
| 49 | std::string str_tolower(std::string s); | 49 | std::string str_tolower(std::string s); |
| 50 | bool stringTruthiness(const std::string &val); | 50 | bool stringTruthiness(const std::string &val); |
| 51 | bool isPowerOfTwo(int val); | 51 | bool isPowerOfTwo(int val); |