diff Core/Toolbox.cpp @ 2442:330349d712f9

fix Toolbox::IsAsciiString
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Dec 2017 21:58:09 +0100
parents cad393b41bc3
children 878b59270859
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Tue Dec 05 12:43:28 2017 +0100
+++ b/Core/Toolbox.cpp	Tue Dec 05 21:58:09 2017 +0100
@@ -534,7 +534,7 @@
 
     for (size_t i = 0; i < size; i++, p++)
     {
-      if (*p > 127 || (*p != 0 && iscntrl(*p)))
+      if (*p > 127 || *p == 0 || iscntrl(*p))
       {
         return false;
       }
@@ -544,6 +544,12 @@
   }
 
 
+  bool Toolbox::IsAsciiString(const std::string& s)
+  {
+    return IsAsciiString(s.c_str(), s.size());
+  }
+  
+
   std::string Toolbox::ConvertToAscii(const std::string& source)
   {
     std::string result;