changeset 1479:8f28a1cd2354

possibility to disable md5 and base64 support in the toolbox
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 02 Aug 2015 12:20:27 +0200
parents 1011bd6ab00b
children f176ec4467e6
files Core/Toolbox.cpp Core/Toolbox.h
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Sat Aug 01 21:49:20 2015 +0200
+++ b/Core/Toolbox.cpp	Sun Aug 02 12:20:27 2015 +0200
@@ -82,8 +82,15 @@
 
 #include <boost/locale.hpp>
 
+
+#if !defined(ORTHANC_ENABLE_MD5) || ORTHANC_ENABLE_MD5 == 1
 #include "../Resources/ThirdParty/md5/md5.h"
+#endif
+
+
+#if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1
 #include "../Resources/ThirdParty/base64/base64.h"
+#endif
 
 
 #if defined(_MSC_VER) && (_MSC_VER < 1800)
@@ -451,6 +458,7 @@
   }
 
 
+#if !defined(ORTHANC_ENABLE_MD5) || ORTHANC_ENABLE_MD5 == 1
   void Toolbox::ComputeMD5(std::string& result,
                            const std::string& data)
   {
@@ -489,8 +497,10 @@
       result[2 * i + 1] = GetHexadecimalCharacter(actualHash[i] % 16);
     }
   }
+#endif
 
 
+#if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1
   void Toolbox::EncodeBase64(std::string& result, 
                              const std::string& data)
   {
@@ -502,6 +512,8 @@
   {
     result = base64_decode(data);
   }
+#endif
+
 
 
 #if defined(_WIN32)
--- a/Core/Toolbox.h	Sat Aug 01 21:49:20 2015 +0200
+++ b/Core/Toolbox.h	Sun Aug 02 12:20:27 2015 +0200
@@ -90,12 +90,14 @@
 
     uint64_t GetFileSize(const std::string& path);
 
+#if !defined(ORTHANC_ENABLE_MD5) || ORTHANC_ENABLE_MD5 == 1
     void ComputeMD5(std::string& result,
                     const std::string& data);
 
     void ComputeMD5(std::string& result,
                     const void* data,
                     size_t length);
+#endif
 
     void ComputeSHA1(std::string& result,
                      const std::string& data);
@@ -105,11 +107,13 @@
 
     bool IsSHA1(const std::string& s);
 
+#if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1
     void DecodeBase64(std::string& result, 
                       const std::string& data);
 
     void EncodeBase64(std::string& result, 
                       const std::string& data);
+#endif
 
     std::string GetPathToExecutable();