comparison Framework/Oracle/GenericOracleRunner.cpp @ 1116:a08699daf78b broker

ParsedDicomFileCache
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 04 Nov 2019 15:54:35 +0100
parents 3730956f41a5
children a8bf81756839
comparison
equal deleted inserted replaced
1111:3730956f41a5 1116:a08699daf78b
229 static IMessage* Execute(const std::string& root, 229 static IMessage* Execute(const std::string& root,
230 const ParseDicomFileCommand& command) 230 const ParseDicomFileCommand& command)
231 { 231 {
232 std::string path = GetPath(root, command.GetPath()); 232 std::string path = GetPath(root, command.GetPath());
233 233
234 if (!Orthanc::SystemToolbox::IsRegularFile(path))
235 {
236 throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentFile);
237 }
238
239 uint64_t fileSize = Orthanc::SystemToolbox::GetFileSize(path);
240
241 // Check for 32bit systems
242 if (fileSize != static_cast<uint64_t>(static_cast<size_t>(fileSize)))
243 {
244 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory);
245 }
246
234 DcmFileFormat f; 247 DcmFileFormat f;
235 bool ok; 248 bool ok;
236 249
237 if (command.IsPixelDataIncluded()) 250 if (command.IsPixelDataIncluded())
238 { 251 {
255 #endif 268 #endif
256 } 269 }
257 270
258 if (ok) 271 if (ok)
259 { 272 {
260 return new ParseDicomFileCommand::SuccessMessage(command, f); 273 return new ParseDicomFileCommand::SuccessMessage(command, f, static_cast<size_t>(fileSize));
261 } 274 }
262 else 275 else
263 { 276 {
264 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, 277 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat,
265 "Cannot parse file: " + path); 278 "Cannot parse file: " + path);