diff Core/Toolbox.cpp @ 1446:8dc80ba768aa

refactoring: IHttpHandler does not use std::string to hold the request body
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Jul 2015 13:16:12 +0200
parents ad94a3583b07
children 8f28a1cd2354
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Wed Jul 01 12:30:19 2015 +0200
+++ b/Core/Toolbox.cpp	Wed Jul 01 13:16:12 2015 +0200
@@ -683,15 +683,16 @@
             digest[4]);
   }
 
-  bool Toolbox::IsSHA1(const std::string& str)
+  bool Toolbox::IsSHA1(const char* str,
+                       size_t size)
   {
-    if (str.size() == 0)
+    if (size == 0)
     {
       return false;
     }
 
-    const char* start = &str[0];
-    const char* end = start + str.size();
+    const char* start = str;
+    const char* end = str + size;
 
     // Trim the beginning of the string
     while (start < end)
@@ -747,6 +748,19 @@
   }
 
 
+  bool Toolbox::IsSHA1(const std::string& s)
+  {
+    if (s.size() == 0)
+    {
+      return false;
+    }
+    else
+    {
+      return IsSHA1(s.c_str(), s.size());
+    }
+  }
+
+
 #if BOOST_HAS_DATE_TIME == 1
   std::string Toolbox::GetNowIsoString()
   {