# HG changeset patch # User Sebastien Jodogne # Date 1505919747 -7200 # Node ID 5edec967055e6f5530df5a9ca25e85c65205c89e # Parent f0cfacd0c9b85810fa4f8e8938f7e47ea40ff8e2 fix sandboxed builds diff -r f0cfacd0c9b8 -r 5edec967055e Core/Cache/SharedArchive.h --- a/Core/Cache/SharedArchive.h Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Cache/SharedArchive.h Wed Sep 20 17:02:27 2017 +0200 @@ -33,6 +33,14 @@ #pragma once +#if !defined(ORTHANC_SANDBOXED) +# error The macro ORTHANC_SANDBOXED must be defined +#endif + +#if ORTHANC_SANDBOXED == 1 +# error The class SharedArchive cannot be used in sandboxed environments +#endif + #include "LeastRecentlyUsedIndex.h" #include "../IDynamicObject.h" diff -r f0cfacd0c9b8 -r 5edec967055e Core/Endianness.h --- a/Core/Endianness.h Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Endianness.h Wed Sep 20 17:02:27 2017 +0200 @@ -35,10 +35,10 @@ /******************************************************************** - ** LINUX ARCHITECTURES + ** LINUX-LIKE ARCHITECTURES ********************************************************************/ -#if defined(__linux__) +#if defined(__linux__) || defined(__EMSCRIPTEN__) # define ORTHANC_HAS_BUILTIN_BYTE_SWAP 1 # include #endif diff -r f0cfacd0c9b8 -r 5edec967055e Core/Enumerations.cpp --- a/Core/Enumerations.cpp Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Enumerations.cpp Wed Sep 20 17:02:27 2017 +0200 @@ -38,6 +38,7 @@ #include "Toolbox.h" #include "Logging.h" +#include #include #include diff -r f0cfacd0c9b8 -r 5edec967055e Core/FileStorage/FilesystemStorage.h --- a/Core/FileStorage/FilesystemStorage.h Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/FileStorage/FilesystemStorage.h Wed Sep 20 17:02:27 2017 +0200 @@ -33,6 +33,14 @@ #pragma once +#if !defined(ORTHANC_SANDBOXED) +# error The macro ORTHANC_SANDBOXED must be defined +#endif + +#if ORTHANC_SANDBOXED == 1 +# error The class FilesystemStorage cannot be used in sandboxed environments +#endif + #include "IStorageArea.h" #include diff -r f0cfacd0c9b8 -r 5edec967055e Core/FileStorage/StorageAccessor.h --- a/Core/FileStorage/StorageAccessor.h Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/FileStorage/StorageAccessor.h Wed Sep 20 17:02:27 2017 +0200 @@ -33,6 +33,14 @@ #pragma once +#if !defined(ORTHANC_SANDBOXED) +# error The macro ORTHANC_SANDBOXED must be defined +#endif + +#if ORTHANC_SANDBOXED == 1 +# error The class StorageAccessor cannot be used in sandboxed environments +#endif + #if !defined(ORTHANC_ENABLE_CIVETWEB) # error Macro ORTHANC_ENABLE_CIVETWEB must be defined to use this file #endif diff -r f0cfacd0c9b8 -r 5edec967055e Core/Images/Font.cpp --- a/Core/Images/Font.cpp Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Images/Font.cpp Wed Sep 20 17:02:27 2017 +0200 @@ -38,7 +38,10 @@ # error ORTHANC_ENABLE_LOCALE must be defined to use this file #endif -#include "../SystemToolbox.h" +#if ORTHANC_SANDBOXED == 0 +# include "../SystemToolbox.h" +#endif + #include "../Toolbox.h" #include "../OrthancException.h" @@ -138,12 +141,14 @@ } +#if ORTHANC_SANDBOXED == 0 void Font::LoadFromFile(const std::string& path) { std::string font; SystemToolbox::ReadFile(font, path); LoadFromMemory(font); } +#endif static unsigned int MyMin(unsigned int a, diff -r f0cfacd0c9b8 -r 5edec967055e Core/Images/Font.h --- a/Core/Images/Font.h Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Images/Font.h Wed Sep 20 17:02:27 2017 +0200 @@ -84,7 +84,9 @@ void LoadFromMemory(const std::string& font); +#if ORTHANC_SANDBOXED == 0 void LoadFromFile(const std::string& path); +#endif const std::string& GetName() const { diff -r f0cfacd0c9b8 -r 5edec967055e Core/Images/FontRegistry.cpp --- a/Core/Images/FontRegistry.cpp Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Images/FontRegistry.cpp Wed Sep 20 17:02:27 2017 +0200 @@ -57,12 +57,14 @@ } +#if ORTHANC_SANDBOXED == 0 void FontRegistry::AddFromFile(const std::string& path) { std::auto_ptr f(new Font); f->LoadFromFile(path); fonts_.push_back(f.release()); } +#endif #if ORTHANC_HAS_EMBEDDED_RESOURCES == 1 diff -r f0cfacd0c9b8 -r 5edec967055e Core/Images/FontRegistry.h --- a/Core/Images/FontRegistry.h Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Images/FontRegistry.h Wed Sep 20 17:02:27 2017 +0200 @@ -57,7 +57,9 @@ void AddFromMemory(const std::string& font); +#if ORTHANC_SANDBOXED == 0 void AddFromFile(const std::string& path); +#endif #if ORTHANC_HAS_EMBEDDED_RESOURCES == 1 void AddFromResource(EmbeddedResources::FileResourceId resource); diff -r f0cfacd0c9b8 -r 5edec967055e Core/Images/JpegWriter.cpp --- a/Core/Images/JpegWriter.cpp Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Images/JpegWriter.cpp Wed Sep 20 17:02:27 2017 +0200 @@ -162,6 +162,7 @@ #endif +#if ORTHANC_SANDBOXED == 0 void JpegWriter::WriteToMemoryInternal(std::string& jpeg, unsigned int width, unsigned int height, @@ -206,4 +207,5 @@ jpeg.assign(reinterpret_cast(data), size); free(data); } +#endif } diff -r f0cfacd0c9b8 -r 5edec967055e Core/Images/PngWriter.cpp --- a/Core/Images/PngWriter.cpp Wed Sep 20 16:28:27 2017 +0200 +++ b/Core/Images/PngWriter.cpp Wed Sep 20 17:02:27 2017 +0200 @@ -248,6 +248,7 @@ +#if ORTHANC_SANDBOXED == 0 void PngWriter::WriteToMemoryInternal(std::string& png, unsigned int width, unsigned int height, @@ -271,4 +272,5 @@ chunks.Flatten(png); } +#endif } diff -r f0cfacd0c9b8 -r 5edec967055e Resources/CMake/OrthancFrameworkConfiguration.cmake --- a/Resources/CMake/OrthancFrameworkConfiguration.cmake Wed Sep 20 16:28:27 2017 +0200 +++ b/Resources/CMake/OrthancFrameworkConfiguration.cmake Wed Sep 20 17:02:27 2017 +0200 @@ -32,7 +32,6 @@ set(ORTHANC_CORE_SOURCES_INTERNAL ${ORTHANC_ROOT}/Core/Cache/MemoryCache.cpp - ${ORTHANC_ROOT}/Core/Cache/SharedArchive.cpp ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp ${ORTHANC_ROOT}/Core/Compression/DeflateBaseCompressor.cpp ${ORTHANC_ROOT}/Core/Compression/GzipCompressor.cpp @@ -47,8 +46,6 @@ ${ORTHANC_ROOT}/Core/DicomFormat/DicomTag.cpp ${ORTHANC_ROOT}/Core/DicomFormat/DicomValue.cpp ${ORTHANC_ROOT}/Core/Enumerations.cpp - ${ORTHANC_ROOT}/Core/FileStorage/FilesystemStorage.cpp - ${ORTHANC_ROOT}/Core/FileStorage/StorageAccessor.cpp ${ORTHANC_ROOT}/Core/Images/Font.cpp ${ORTHANC_ROOT}/Core/Images/FontRegistry.cpp ${ORTHANC_ROOT}/Core/Images/IImageWriter.cpp @@ -57,14 +54,6 @@ ${ORTHANC_ROOT}/Core/Images/ImageBuffer.cpp ${ORTHANC_ROOT}/Core/Images/ImageProcessing.cpp ${ORTHANC_ROOT}/Core/Logging.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/BagOfTasksProcessor.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/Mutex.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/ReaderWriterLock.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/RunnableWorkersPool.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/Semaphore.cpp - ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp - ${ORTHANC_ROOT}/Core/SystemToolbox.cpp - ${ORTHANC_ROOT}/Core/TemporaryFile.cpp ${ORTHANC_ROOT}/Core/Toolbox.cpp ${ORTHANC_ROOT}/Core/WebServiceParameters.cpp ) @@ -398,8 +387,6 @@ -DORTHANC_DATABASE_VERSION=${ORTHANC_DATABASE_VERSION} -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1 -DORTHANC_ENABLE_BASE64=1 - -DORTHANC_ENABLE_LOGGING=1 - -DORTHANC_ENABLE_LOGGING_PLUGIN=0 -DORTHANC_ENABLE_MD5=1 -DORTHANC_MAXIMUM_TAG_LENGTH=256 -DORTHANC_VERSION="${ORTHANC_VERSION}" @@ -407,9 +394,32 @@ if (ORTHANC_SANDBOXED) - add_definitions(-DORTHANC_SANDBOXED=1) + add_definitions( + -DORTHANC_SANDBOXED=1 + -DORTHANC_ENABLE_LOGGING=0 + -DORTHANC_ENABLE_LOGGING_PLUGIN=0 + ) + else() - add_definitions(-DORTHANC_SANDBOXED=0) + add_definitions( + -DORTHANC_SANDBOXED=0 + -DORTHANC_ENABLE_LOGGING=1 + -DORTHANC_ENABLE_LOGGING_PLUGIN=0 + ) + + list(APPEND ORTHANC_CORE_SOURCES_INTERNAL + ${ORTHANC_ROOT}/Core/Cache/SharedArchive.cpp + ${ORTHANC_ROOT}/Core/FileStorage/FilesystemStorage.cpp + ${ORTHANC_ROOT}/Core/FileStorage/StorageAccessor.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/BagOfTasksProcessor.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/Mutex.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/ReaderWriterLock.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/RunnableWorkersPool.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/Semaphore.cpp + ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp + ${ORTHANC_ROOT}/Core/SystemToolbox.cpp + ${ORTHANC_ROOT}/Core/TemporaryFile.cpp + ) endif()