Commit c89da63705ebb6a604dda153b7e3f6ed820fc456
1 parent
ddcd483a
Likely fixes for Clang 12 warnings
Showing
2 changed files
with
4 additions
and
3 deletions
threaddata.cpp
| ... | ... | @@ -49,7 +49,8 @@ void ThreadData::start(thread_f f) |
| 49 | 49 | std::ostringstream threadName; |
| 50 | 50 | threadName << "FlashMQ T " << threadnr; |
| 51 | 51 | threadName.flush(); |
| 52 | - const char *c_str = threadName.str().c_str(); | |
| 52 | + std::string name = threadName.str(); | |
| 53 | + const char *c_str = name.c_str(); | |
| 53 | 54 | pthread_setname_np(native, c_str); |
| 54 | 55 | |
| 55 | 56 | cpu_set_t cpuset; | ... | ... |
utils.cpp
| ... | ... | @@ -261,7 +261,7 @@ int64_t currentMSecsSinceEpoch() |
| 261 | 261 | |
| 262 | 262 | std::string getSecureRandomString(const ssize_t len) |
| 263 | 263 | { |
| 264 | - std::vector<char> buf(len); | |
| 264 | + std::vector<unsigned char> buf(len); | |
| 265 | 265 | ssize_t actual_len = getrandom(buf.data(), len, 0); |
| 266 | 266 | |
| 267 | 267 | if (actual_len < 0 || actual_len != len) |
| ... | ... | @@ -273,7 +273,7 @@ std::string getSecureRandomString(const ssize_t len) |
| 273 | 273 | const int possibleCharactersCount = possibleCharacters.length(); |
| 274 | 274 | |
| 275 | 275 | std::string randomString; |
| 276 | - for(const unsigned char &c : buf) | |
| 276 | + for(const unsigned char c : buf) | |
| 277 | 277 | { |
| 278 | 278 | unsigned int index = c % possibleCharactersCount; |
| 279 | 279 | char nextChar = possibleCharacters.at(index); | ... | ... |