Commit e00c635ef7139927fece424d10409953724a6c10

Authored by Wiebe Cazemier
1 parent 3905cbe2

Fix tests and warnings

CMakeLists.txt
... ... @@ -9,6 +9,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
9 9  
10 10 SET(CMAKE_CXX_FLAGS "-rdynamic")
11 11  
  12 +add_compile_options(-Wall)
  13 +
12 14 add_executable(FlashMQ
13 15 mainapp.cpp
14 16 main.cpp
... ...
FlashMQTests/FlashMQTests.pro
... ... @@ -28,6 +28,16 @@ SOURCES += tst_maintests.cpp \
28 28 ../authplugin.cpp \
29 29 ../session.cpp \
30 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 41 mainappthread.cpp \
32 42 twoclienttestcontext.cpp
33 43  
... ... @@ -49,9 +59,19 @@ HEADERS += \
49 59 ../authplugin.h \
50 60 ../session.h \
51 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 72 mainappthread.h \
53 73 twoclienttestcontext.h
54 74  
55   -LIBS += -ldl
  75 +LIBS += -ldl -lssl -lcrypto
56 76  
57 77 QMAKE_LFLAGS += -rdynamic
... ...
logger.cpp
... ... @@ -145,4 +145,5 @@ int logSslError(const char *str, size_t len, void *u)
145 145 {
146 146 Logger *logger = Logger::getInstance();
147 147 logger->logf(LOG_ERR, str);
  148 + return 0;
148 149 }
... ...
utils.cpp
... ... @@ -207,10 +207,10 @@ int64_t currentMSecsSinceEpoch()
207 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 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 215 if (actual_len < 0 || actual_len != len)
216 216 {
... ...
... ... @@ -45,7 +45,7 @@ void trim(std::string &amp;s);
45 45 bool startsWith(const std::string &s, const std::string &needle);
46 46  
47 47 int64_t currentMSecsSinceEpoch();
48   -std::string getSecureRandomString(const size_t len);
  48 +std::string getSecureRandomString(const ssize_t len);
49 49 std::string str_tolower(std::string s);
50 50 bool stringTruthiness(const std::string &val);
51 51 bool isPowerOfTwo(int val);
... ...