comparison Core/Images/PngReader.cpp @ 2170:baf8dd89b4e0

improved support for sandboxed environments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Nov 2016 11:45:02 +0100
parents fd5875662670
children 35febe19e874
comparison
equal deleted inserted replaced
2169:d15de5685ad8 2170:baf8dd89b4e0
40 #include <png.h> 40 #include <png.h>
41 #include <string.h> // For memcpy() 41 #include <string.h> // For memcpy()
42 42
43 namespace Orthanc 43 namespace Orthanc
44 { 44 {
45 #if ORTHANC_SANDBOXED == 0
45 namespace 46 namespace
46 { 47 {
47 struct FileRabi 48 struct FileRabi
48 { 49 {
49 FILE* fp_; 50 FILE* fp_;
64 fclose(fp_); 65 fclose(fp_);
65 } 66 }
66 } 67 }
67 }; 68 };
68 } 69 }
70 #endif
69 71
70 72
71 struct PngReader::PngRabi 73 struct PngReader::PngRabi
72 { 74 {
73 png_structp png_; 75 png_structp png_;
205 png_read_image(rabi.png_, &rows[0]); 207 png_read_image(rabi.png_, &rows[0]);
206 208
207 AssignWritable(format, width, height, pitch, &data_[0]); 209 AssignWritable(format, width, height, pitch, &data_[0]);
208 } 210 }
209 211
212
213 #if ORTHANC_SANDBOXED == 0
210 void PngReader::ReadFromFile(const std::string& filename) 214 void PngReader::ReadFromFile(const std::string& filename)
211 { 215 {
212 FileRabi f(filename.c_str()); 216 FileRabi f(filename.c_str());
213 217
214 char header[8]; 218 char header[8];
229 233
230 png_init_io(rabi.png_, f.fp_); 234 png_init_io(rabi.png_, f.fp_);
231 235
232 Read(rabi); 236 Read(rabi);
233 } 237 }
238 #endif
234 239
235 240
236 namespace 241 namespace
237 { 242 {
238 struct MemoryBuffer 243 struct MemoryBuffer