From 657ef5346be9dbe9cde83a9d147753c66c7af801 Mon Sep 17 00:00:00 2001 From: Eduardo Almeida Date: Tue, 27 Sep 2022 14:40:44 +0100 Subject: [PATCH] core (fix #756): Fix CsvReader::GetValueAs() for char --- src/core/helper/csv-reader.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/core/helper/csv-reader.cc b/src/core/helper/csv-reader.cc index 16fdd7560..d3f5131c4 100644 --- a/src/core/helper/csv-reader.cc +++ b/src/core/helper/csv-reader.cc @@ -180,8 +180,8 @@ CsvReader::GetValueAs (std::string input, signed char& value) const std::int16_t tempOutput = 0; tempStream >> tempOutput; - if (tempOutput >= std::numeric_limits::min () - || tempOutput <= std::numeric_limits::max () ) + if (tempOutput >= std::numeric_limits::min () && + tempOutput <= std::numeric_limits::max () ) { value = static_cast (tempOutput); } @@ -240,8 +240,6 @@ CsvReader::GetValueAs (std::string input, std::string& value) const bool CsvReader::GetValueAs (std::string input, unsigned char& value) const { - NS_LOG_FUNCTION (this << input); - typedef unsigned char byte_type; NS_LOG_FUNCTION (this << input); @@ -251,8 +249,8 @@ CsvReader::GetValueAs (std::string input, unsigned char& value) const std::uint16_t tempOutput = 0; tempStream >> tempOutput; - if (tempOutput >= std::numeric_limits::min () - || tempOutput <= std::numeric_limits::max () ) + if (tempOutput >= std::numeric_limits::min () && + tempOutput <= std::numeric_limits::max () ) { value = static_cast (tempOutput); }