# HG changeset patch # User Sebastien Jodogne # Date 1478701911 -3600 # Node ID 8189115c0da57f48d55d55bc4515a1bb17360c7e # Parent 4217644ac904bd58f2cce2f0bce12d621bb93476 sync diff -r 4217644ac904 -r 8189115c0da5 CMakeLists.txt --- a/CMakeLists.txt Wed Nov 09 14:16:28 2016 +0100 +++ b/CMakeLists.txt Wed Nov 09 15:31:51 2016 +0100 @@ -90,6 +90,7 @@ ) add_definitions( + -DORTHANC_ENABLE_PUGIXML=0 -DORTHANC_SQLITE_STANDALONE=1 ) diff -r 4217644ac904 -r 8189115c0da5 Orthanc/Core/DicomFormat/DicomValue.cpp --- a/Orthanc/Core/DicomFormat/DicomValue.cpp Wed Nov 09 14:16:28 2016 +0100 +++ b/Orthanc/Core/DicomFormat/DicomValue.cpp Wed Nov 09 15:31:51 2016 +0100 @@ -81,7 +81,7 @@ } -#if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1 +#if ORTHANC_ENABLE_BASE64 == 1 void DicomValue::FormatDataUriScheme(std::string& target, const std::string& mime) const { diff -r 4217644ac904 -r 8189115c0da5 Orthanc/Core/DicomFormat/DicomValue.h --- a/Orthanc/Core/DicomFormat/DicomValue.h Wed Nov 09 14:16:28 2016 +0100 +++ b/Orthanc/Core/DicomFormat/DicomValue.h Wed Nov 09 15:31:51 2016 +0100 @@ -35,6 +35,11 @@ #include #include +#if !defined(ORTHANC_ENABLE_BASE64) +# error The macro ORTHANC_ENABLE_BASE64 must be defined +#endif + + namespace Orthanc { class DicomValue : public boost::noncopyable @@ -78,7 +83,7 @@ DicomValue* Clone() const; -#if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1 +#if ORTHANC_ENABLE_BASE64 == 1 void FormatDataUriScheme(std::string& target, const std::string& mime) const; diff -r 4217644ac904 -r 8189115c0da5 Orthanc/Core/Logging.h --- a/Orthanc/Core/Logging.h Wed Nov 09 14:16:28 2016 +0100 +++ b/Orthanc/Core/Logging.h Wed Nov 09 15:31:51 2016 +0100 @@ -34,6 +34,10 @@ #include +#if !defined(ORTHANC_ENABLE_LOGGING) +# error The macro ORTHANC_ENABLE_LOGGING must be defined +#endif + namespace Orthanc { namespace Logging diff -r 4217644ac904 -r 8189115c0da5 Orthanc/Core/Toolbox.cpp --- a/Orthanc/Core/Toolbox.cpp Wed Nov 09 14:16:28 2016 +0100 +++ b/Orthanc/Core/Toolbox.cpp Wed Nov 09 15:31:51 2016 +0100 @@ -80,13 +80,13 @@ #include -#if !defined(ORTHANC_ENABLE_MD5) || ORTHANC_ENABLE_MD5 == 1 -#include "../Resources/ThirdParty/md5/md5.h" +#if 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" +#if ORTHANC_ENABLE_BASE64 == 1 +# include "../Resources/ThirdParty/base64/base64.h" #endif @@ -123,7 +123,7 @@ } -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 static bool finish_; static ServerBarrierEvent barrierEvent_; @@ -230,7 +230,7 @@ } -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void Toolbox::ReadFile(std::string& content, const std::string& path) { @@ -259,7 +259,7 @@ #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 bool Toolbox::ReadHeader(std::string& header, const std::string& path, size_t headerSize) @@ -306,7 +306,7 @@ #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void Toolbox::WriteFile(const void* content, size_t size, const std::string& path) @@ -334,7 +334,7 @@ #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void Toolbox::WriteFile(const std::string& content, const std::string& path) { @@ -344,7 +344,7 @@ #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void Toolbox::RemoveFile(const std::string& path) { if (boost::filesystem::exists(path)) @@ -530,7 +530,7 @@ -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 uint64_t Toolbox::GetFileSize(const std::string& path) { try @@ -545,7 +545,7 @@ #endif -#if !defined(ORTHANC_ENABLE_MD5) || ORTHANC_ENABLE_MD5 == 1 +#if ORTHANC_ENABLE_MD5 == 1 static char GetHexadecimalCharacter(uint8_t value) { assert(value < 16); @@ -602,7 +602,7 @@ #endif -#if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1 +#if ORTHANC_ENABLE_BASE64 == 1 void Toolbox::EncodeBase64(std::string& result, const std::string& data) { @@ -696,7 +696,7 @@ return std::string(pathbuf); } -#elif defined(ORTHANC_SANDBOXED) && ORTHANC_SANDBOXED == 1 +#elif ORTHANC_SANDBOXED == 1 // Sandboxed Orthanc, no access to the executable #else @@ -704,7 +704,7 @@ #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 std::string Toolbox::GetPathToExecutable() { boost::filesystem::path p(GetPathToExecutableInternal()); @@ -1178,7 +1178,7 @@ } -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void Toolbox::MakeDirectory(const std::string& path) { if (boost::filesystem::exists(path)) @@ -1199,7 +1199,7 @@ #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 bool Toolbox::IsExistingFile(const std::string& path) { return boost::filesystem::exists(path); @@ -1329,7 +1329,7 @@ #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void Toolbox::ExecuteSystemCommand(const std::string& command, const std::vector& arguments) { @@ -1498,6 +1498,7 @@ } +#if ORTHANC_SANDBOXED == 0 int Toolbox::GetProcessId() { #if defined(_WIN32) @@ -1506,9 +1507,10 @@ return static_cast(getpid()); #endif } +#endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 bool Toolbox::IsRegularFile(const std::string& path) { namespace fs = boost::filesystem; diff -r 4217644ac904 -r 8189115c0da5 Orthanc/Core/Toolbox.h --- a/Orthanc/Core/Toolbox.h Wed Nov 09 14:16:28 2016 +0100 +++ b/Orthanc/Core/Toolbox.h Wed Nov 09 15:31:51 2016 +0100 @@ -39,6 +39,27 @@ #include #include + +#if !defined(ORTHANC_ENABLE_BASE64) +# error The macro ORTHANC_ENABLE_BASE64 must be defined +#endif + +#if !defined(ORTHANC_ENABLE_MD5) +# error The macro ORTHANC_ENABLE_MD5 must be defined +#endif + +#if !defined(ORTHANC_ENABLE_PUGIXML) +# error The macro ORTHANC_ENABLE_PUGIXML must be defined +#endif + +#if !defined(BOOST_HAS_REGEX) +# error The macro BOOST_HAS_REGEX must be defined +#endif + +#if !defined(ORTHANC_SANDBOXED) +# define ORTHANC_SANDBOXED 0 +#endif + namespace Orthanc { typedef std::vector UriComponents; @@ -51,7 +72,7 @@ { void USleep(uint64_t microSeconds); -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 ServerBarrierEvent ServerBarrier(const bool& stopFlag); ServerBarrierEvent ServerBarrier(); @@ -67,29 +88,21 @@ void ToLowerCase(std::string& result, const std::string& source); -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void ReadFile(std::string& content, const std::string& path); -#endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 bool ReadHeader(std::string& header, const std::string& path, size_t headerSize); -#endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 void WriteFile(const std::string& content, const std::string& path); -#endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 void WriteFile(const void* content, size_t size, const std::string& path); -#endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 void RemoveFile(const std::string& path); #endif @@ -108,11 +121,11 @@ std::string FlattenUri(const UriComponents& components, size_t fromLevel = 0); -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 uint64_t GetFileSize(const std::string& path); #endif -#if !defined(ORTHANC_ENABLE_MD5) || ORTHANC_ENABLE_MD5 == 1 +#if ORTHANC_ENABLE_MD5 == 1 void ComputeMD5(std::string& result, const std::string& data); @@ -133,7 +146,7 @@ bool IsSHA1(const std::string& s); -#if !defined(ORTHANC_ENABLE_BASE64) || ORTHANC_ENABLE_BASE64 == 1 +#if ORTHANC_ENABLE_BASE64 == 1 void DecodeBase64(std::string& result, const std::string& data); @@ -151,7 +164,7 @@ const std::string& content); #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 std::string GetPathToExecutable(); std::string GetDirectoryOfExecutable(); @@ -190,11 +203,9 @@ const std::string& source, char separator); -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void MakeDirectory(const std::string& path); -#endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 bool IsExistingFile(const std::string& path); #endif @@ -205,7 +216,7 @@ const std::string& arrayElement = "item"); #endif -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 +#if ORTHANC_SANDBOXED == 0 void ExecuteSystemCommand(const std::string& command, const std::vector& arguments); #endif @@ -218,9 +229,9 @@ bool StartsWith(const std::string& str, const std::string& prefix); +#if ORTHANC_SANDBOXED == 0 int GetProcessId(); -#if !defined(ORTHANC_SANDBOXED) || ORTHANC_SANDBOXED != 1 bool IsRegularFile(const std::string& path); #endif