Fix vompiler warnings

This commit is contained in:
Bartosz Wieczorek 2025-07-18 14:19:10 +02:00
parent ffb3202320
commit d6cc1101ae
2 changed files with 8 additions and 3 deletions

View File

@ -70,6 +70,9 @@ class ConfigurationReader {
auto posEqual = line.find('=');
std::pmr::string key{line.substr(0, posEqual), &memoryResource};
std::pmr::string value{line.substr(posEqual + 1), &memoryResource};
details::trimInPlace(key);
details::trimInPlace(value);
keyValues[std::move(key)] = std::move(value);
}

View File

@ -1,5 +1,6 @@
#pragma once
#include <cstddef>
#include <rublon/memory.hpp>
#include <rublon/static_string.hpp>
#include <rublon/stdlib.hpp>
@ -119,7 +120,8 @@ void log(LogLevel level, const char * fmt, Ti &&... ti) noexcept {
constexpr auto maxEntryLength = 1000;
std::array< char, maxEntryLength > line;
auto len = snprintf(line.data(), maxEntryLength, fmt, std::forward< Ti >(ti)...);
details::doLog(level, {line.data(), len});
if(len>0)
details::doLog(level, {line.data(), static_cast< std::size_t >(len)});
}
class PrintUser {
@ -210,12 +212,12 @@ namespace details {
void trimInPlace(StrT & s) {
// Remove leading whitespace
size_t start = 0;
while(start < s.size() && isspace(static_cast< unsigned char >(s[start])))
while(start < s.size() && isspace(s[start]))
++start;
// Remove trailing whitespace
size_t end = s.size();
while(end > start && isspace(static_cast< unsigned char >(s[end - 1])))
while(end > start && isspace(s[end - 1]))
--end;
if(start > 0 || end < s.size()) {