From d6cc1101ae1e3201b1d347b21d5808a85e9bb37d Mon Sep 17 00:00:00 2001 From: Bartosz Wieczorek Date: Fri, 18 Jul 2025 14:19:10 +0200 Subject: [PATCH] Fix vompiler warnings --- PAM/ssh/include/rublon/configuration.hpp | 3 +++ PAM/ssh/include/rublon/utils.hpp | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/PAM/ssh/include/rublon/configuration.hpp b/PAM/ssh/include/rublon/configuration.hpp index 8a2ddb6..4d52ec1 100644 --- a/PAM/ssh/include/rublon/configuration.hpp +++ b/PAM/ssh/include/rublon/configuration.hpp @@ -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); } diff --git a/PAM/ssh/include/rublon/utils.hpp b/PAM/ssh/include/rublon/utils.hpp index 2c1926c..5449116 100755 --- a/PAM/ssh/include/rublon/utils.hpp +++ b/PAM/ssh/include/rublon/utils.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -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()) {