From 6b693332eb0f89bee2b0162c7945cf29cf9a2dc4 Mon Sep 17 00:00:00 2001 From: David Fairbrother <davidfair@users.noreply.github.com> Date: Wed, 8 Mar 2017 11:13:11 +0000 Subject: [PATCH] Re #19062 accept signed and unsinged char types in comparison --- Framework/DataHandling/src/LoadNexusLogs.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Framework/DataHandling/src/LoadNexusLogs.cpp b/Framework/DataHandling/src/LoadNexusLogs.cpp index 207ad71c3c2..ab58c1eb763 100644 --- a/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -672,7 +672,10 @@ LoadNexusLogs::createTimeSeries(::NeXus::File &file, bool LoadNexusLogs::isControlValue(const char &c, const std::string &propName, Kernel::Logger &log) { // Have to check it falls within range accepted by c style check - if (c <= -1) { + // as the (un)signed nature of char is implementation defined + // we will cast to a signed int which can always hold both + const signed int charValue = c; + if (charValue <= -1 || charValue >= 255) { log.warning("Found an invalid character in property " + propName); // Pretend this is a control value so it is sanitized return true; -- GitLab