comparison Resources/Orthanc/Core/Images/PngReader.cpp @ 22:b01d46e5a2b3

support for sandboxed environments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Nov 2016 12:08:15 +0100
parents ff1e935768e7
children 7207a407bcd8
comparison
equal deleted inserted replaced
21:20f623762e8e 22:b01d46e5a2b3
32 32
33 #include "../PrecompiledHeaders.h" 33 #include "../PrecompiledHeaders.h"
34 #include "PngReader.h" 34 #include "PngReader.h"
35 35
36 #include "../OrthancException.h" 36 #include "../OrthancException.h"
37 #include "../SystemToolbox.h"
38 #include "../Toolbox.h" 37 #include "../Toolbox.h"
38
39 #if ORTHANC_SANDBOXED == 0
40 # include "../SystemToolbox.h"
41 #endif
39 42
40 #include <png.h> 43 #include <png.h>
41 #include <string.h> // For memcpy() 44 #include <string.h> // For memcpy()
42 45
43 namespace Orthanc 46 namespace Orthanc
44 { 47 {
48 #if ORTHANC_SANDBOXED == 0
45 namespace 49 namespace
46 { 50 {
47 struct FileRabi 51 struct FileRabi
48 { 52 {
49 FILE* fp_; 53 FILE* fp_;
64 fclose(fp_); 68 fclose(fp_);
65 } 69 }
66 } 70 }
67 }; 71 };
68 } 72 }
73 #endif
69 74
70 75
71 struct PngReader::PngRabi 76 struct PngReader::PngRabi
72 { 77 {
73 png_structp png_; 78 png_structp png_;
205 png_read_image(rabi.png_, &rows[0]); 210 png_read_image(rabi.png_, &rows[0]);
206 211
207 AssignWritable(format, width, height, pitch, &data_[0]); 212 AssignWritable(format, width, height, pitch, &data_[0]);
208 } 213 }
209 214
215
216 #if ORTHANC_SANDBOXED == 0
210 void PngReader::ReadFromFile(const std::string& filename) 217 void PngReader::ReadFromFile(const std::string& filename)
211 { 218 {
212 FileRabi f(filename.c_str()); 219 FileRabi f(filename.c_str());
213 220
214 char header[8]; 221 char header[8];
229 236
230 png_init_io(rabi.png_, f.fp_); 237 png_init_io(rabi.png_, f.fp_);
231 238
232 Read(rabi); 239 Read(rabi);
233 } 240 }
241 #endif
234 242
235 243
236 namespace 244 namespace
237 { 245 {
238 struct MemoryBuffer 246 struct MemoryBuffer