Mercurial > hg > orthanc
comparison Core/DicomParsing/FromDcmtkBridge.cpp @ 2513:97a74f0eac7a
loading DICOM dictionaries in sandboxed environments
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 28 Mar 2018 18:02:07 +0200 |
parents | 4dcafa8d6633 |
children | ce2dfba9417c |
comparison
equal
deleted
inserted
replaced
2512:4dcafa8d6633 | 2513:97a74f0eac7a |
---|---|
46 #include "../Logging.h" | 46 #include "../Logging.h" |
47 #include "../Toolbox.h" | 47 #include "../Toolbox.h" |
48 #include "../OrthancException.h" | 48 #include "../OrthancException.h" |
49 | 49 |
50 #if ORTHANC_SANDBOXED == 0 | 50 #if ORTHANC_SANDBOXED == 0 |
51 # include "../SystemToolbox.h" | |
52 # include "../TemporaryFile.h" | 51 # include "../TemporaryFile.h" |
53 #endif | 52 #endif |
54 | 53 |
55 #include <list> | 54 #include <list> |
56 #include <limits> | 55 #include <limits> |
132 EmbeddedResources::FileResourceId resource) | 131 EmbeddedResources::FileResourceId resource) |
133 { | 132 { |
134 std::string content; | 133 std::string content; |
135 EmbeddedResources::GetFileResource(content, resource); | 134 EmbeddedResources::GetFileResource(content, resource); |
136 | 135 |
136 #if ORTHANC_SANDBOXED == 0 | |
137 TemporaryFile tmp; | 137 TemporaryFile tmp; |
138 tmp.Write(content); | 138 tmp.Write(content); |
139 | 139 |
140 if (!dictionary.loadDictionary(tmp.GetPath().c_str())) | 140 if (!dictionary.loadDictionary(tmp.GetPath().c_str())) |
141 { | 141 { |
142 LOG(ERROR) << "Cannot read embedded dictionary. Under Windows, make sure that " | 142 LOG(ERROR) << "Cannot read embedded dictionary. Under Windows, make sure that " |
143 << "your TEMP directory does not contain special characters."; | 143 << "your TEMP directory does not contain special characters."; |
144 throw OrthancException(ErrorCode_InternalError); | 144 throw OrthancException(ErrorCode_InternalError); |
145 } | 145 } |
146 #else | |
147 if (!dictionary.loadFromMemory(content)) | |
148 { | |
149 LOG(ERROR) << "Cannot read embedded dictionary. Under Windows, make sure that " | |
150 << "your TEMP directory does not contain special characters."; | |
151 throw OrthancException(ErrorCode_InternalError); | |
152 } | |
153 #endif | |
146 } | 154 } |
147 | 155 |
148 #else | 156 #else |
149 static void LoadExternalDictionary(DcmDataDictionary& dictionary, | 157 static void LoadExternalDictionary(DcmDataDictionary& dictionary, |
150 const std::string& directory, | 158 const std::string& directory, |