1 diff --git a/rtengine/canon_cr3_decoder.cc b/rtengine/canon_cr3_decoder.cc
2 index ddd4b6172..1132b4e01 100644
3 --- a/rtengine/canon_cr3_decoder.cc
4 +++ b/rtengine/canon_cr3_decoder.cc
5 @@ -670,7 +670,7 @@ std::uint32_t _byteswap_ulong(std::uint32_t x)
6 #endif
7
8 struct LibRaw_abstract_datastream {
9 - IMFILE* ifp;
10 + rtengine::IMFILE* ifp;
11
12 void lock()
13 {
14 diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc
15 index ef0b4e8dc..13a6b054a 100644
16 --- a/rtengine/dcraw.cc
17 +++ b/rtengine/dcraw.cc
18 @@ -1963,7 +1963,7 @@ void CLASS phase_one_load_raw_c()
19 #endif
20 {
21 int len[2], pred[2];
22 - IMFILE ifpthr = *ifp;
23 + rtengine::IMFILE ifpthr = *ifp;
24 ifpthr.plistener = nullptr;
25
26 #ifdef _OPENMP
27 @@ -3317,7 +3317,7 @@ void CLASS sony_arw2_load_raw()
28 {
29 uchar *data = new (std::nothrow) uchar[raw_width + 1];
30 merror(data, "sony_arw2_load_raw()");
31 - IMFILE ifpthr = *ifp;
32 + rtengine::IMFILE ifpthr = *ifp;
33 int pos = ifpthr.pos;
34 ushort pix[16];
35
36 @@ -6331,7 +6331,7 @@ int CLASS parse_tiff_ifd (int base)
37 unsigned sony_curve[] = { 0,0,0,0,0,4095 };
38 unsigned *buf, sony_offset=0, sony_length=0, sony_key=0;
39 struct jhead jh;
40 -/*RT*/ IMFILE *sfp;
41 +/*RT*/ rtengine::IMFILE *sfp;
42 /*RT*/ int pana_raw = 0;
43
44 if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0])
45 @@ -6895,7 +6895,7 @@ it under the terms of the one of two licenses as you choose:
46 fread (buf, sony_length, 1, ifp);
47 sony_decrypt (buf, sony_length/4, 1, sony_key);
48 sfp = ifp;
49 -/*RT*/ ifp = fopen (buf, sony_length);
50 +/*RT*/ ifp = rtengine::fopen (buf, sony_length);
51 // if ((ifp = tmpfile())) {
52 // fwrite (buf, sony_length, 1, ifp);
53 // fseek (ifp, 0, SEEK_SET);
54 @@ -7203,7 +7203,7 @@ void CLASS parse_external_jpeg()
55 {
56 const char *file, *ext;
57 char *jname, *jfile, *jext;
58 -/*RT*/ IMFILE *save=ifp;
59 +/*RT*/ rtengine::IMFILE *save=ifp;
60
61 ext = strrchr (ifname, '.');
62 file = strrchr (ifname, '/');
63 @@ -7231,7 +7231,7 @@ void CLASS parse_external_jpeg()
64 *jext = '0';
65 }
66 if (strcmp (jname, ifname)) {
67 -/*RT*/ if ((ifp = fopen (jname))) {
68 +/*RT*/ if ((ifp = rtengine::fopen (jname))) {
69 // if ((ifp = fopen (jname, "rb"))) {
70 if (verbose)
71 fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
72 diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h
73 index 10c7b9ba6..bc009e67c 100644
74 --- a/rtengine/dcraw.h
75 +++ b/rtengine/dcraw.h
76 @@ -73,7 +73,7 @@ public:
77
78 protected:
79 int exif_base, ciff_base, ciff_len;
80 - IMFILE *ifp;
81 + rtengine::IMFILE *ifp;
82 FILE *ofp;
83 short order;
84 const char *ifname;
85 @@ -125,7 +125,7 @@ protected:
86 int cur_buf_size; // buffer size
87 uchar *cur_buf; // currently read block
88 int fillbytes; // Counter to add extra byte for block size N*16
89 - IMFILE *input;
90 + rtengine::IMFILE *input;
91 struct int_pair grad_even[3][41]; // tables of gradients
92 struct int_pair grad_odd[3][41];
93 ushort *linealloc;
94 @@ -278,7 +278,7 @@ void parse_redcine();
95 class getbithuff_t
96 {
97 public:
98 - getbithuff_t(DCraw *p,IMFILE *&i, unsigned &z):parent(p),bitbuf(0),vbits(0),reset(0),ifp(i),zero_after_ff(z){}
99 + getbithuff_t(DCraw *p,rtengine::IMFILE *&i, unsigned &z):parent(p),bitbuf(0),vbits(0),reset(0),ifp(i),zero_after_ff(z){}
100 unsigned operator()(int nbits, ushort *huff);
101
102 private:
103 @@ -288,7 +288,7 @@ private:
104 DCraw *parent;
105 unsigned bitbuf;
106 int vbits, reset;
107 - IMFILE *&ifp;
108 + rtengine::IMFILE *&ifp;
109 unsigned &zero_after_ff;
110 };
111 getbithuff_t getbithuff;
112 @@ -296,7 +296,7 @@ getbithuff_t getbithuff;
113 class nikbithuff_t
114 {
115 public:
116 - explicit nikbithuff_t(IMFILE *&i):bitbuf(0),errors(0),vbits(0),ifp(i){}
117 + explicit nikbithuff_t(rtengine::IMFILE *&i):bitbuf(0),errors(0),vbits(0),ifp(i){}
118 void operator()() {bitbuf = vbits = 0;};
119 unsigned operator()(int nbits, ushort *huff);
120 unsigned errorCount() { return errors; }
121 @@ -309,7 +309,7 @@ private:
122 }
123 unsigned bitbuf, errors;
124 int vbits;
125 - IMFILE *&ifp;
126 + rtengine::IMFILE *&ifp;
127 };
128 nikbithuff_t nikbithuff;
129
130 @@ -377,7 +377,7 @@ void parse_qt (int end);
131 // ph1_bithuff(int nbits, ushort *huff);
132 class ph1_bithuff_t {
133 public:
134 - ph1_bithuff_t(DCraw *p, IMFILE *i, short &o):order(o),ifp(i),bitbuf(0),vbits(0){}
135 + ph1_bithuff_t(DCraw *p, rtengine::IMFILE *i, short &o):order(o),ifp(i),bitbuf(0),vbits(0){}
136 unsigned operator()(int nbits, ushort *huff);
137 unsigned operator()(int nbits);
138 unsigned operator()();
139 @@ -411,7 +411,7 @@ private:
140 }
141
142 short ℴ
143 - IMFILE* const ifp;
144 + rtengine::IMFILE* const ifp;
145 UINT64 bitbuf;
146 int vbits;
147 };
148 @@ -429,11 +429,11 @@ void nokia_load_raw();
149
150 class pana_bits_t{
151 public:
152 - pana_bits_t(IMFILE *i, unsigned &u, unsigned enc):
153 + pana_bits_t(rtengine::IMFILE *i, unsigned &u, unsigned enc):
154 ifp(i), load_flags(u), vbits(0), encoding(enc) {}
155 unsigned operator()(int nbits, unsigned *bytes=nullptr);
156 private:
157 - IMFILE *ifp;
158 + rtengine::IMFILE *ifp;
159 unsigned &load_flags;
160 uchar buf[0x4000];
161 int vbits;
162 diff --git a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc
163 index 7dde668eb..e551c9aad 100644
164 --- a/rtengine/dfmanager.cc
165 +++ b/rtengine/dfmanager.cc
166 @@ -540,7 +540,7 @@ std::vector<badPix> *DFManager::getHotPixels ( const std::string &mak, const std
167
168 int DFManager::scanBadPixelsFile( Glib::ustring filename )
169 {
170 - FILE *file = fopen( filename.c_str(), "r" );
171 + FILE *file = ::fopen( filename.c_str(), "r" );
172
173 if( !file ) {
174 return false;
175 diff --git a/rtengine/myfile.cc b/rtengine/myfile.cc
176 index 842766dcf..2321d18bb 100644
177 --- a/rtengine/myfile.cc
178 +++ b/rtengine/myfile.cc
179 @@ -70,7 +70,7 @@ int munmap(void *start, size_t length)
180
181 #ifdef MYFILE_MMAP
182
183 -IMFILE* fopen (const char* fname)
184 +rtengine::IMFILE* rtengine::fopen (const char* fname)
185 {
186 int fd;
187
188 @@ -123,13 +123,13 @@ IMFILE* fopen (const char* fname)
189 return mf;
190 }
191
192 -IMFILE* gfopen (const char* fname)
193 +rtengine::IMFILE* rtengine::gfopen (const char* fname)
194 {
195 return fopen(fname);
196 }
197 #else
198
199 -IMFILE* fopen (const char* fname)
200 +rtengine::IMFILE* rtengine::fopen (const char* fname)
201 {
202
203 FILE* f = g_fopen (fname, "rb");
204 @@ -152,7 +152,7 @@ IMFILE* fopen (const char* fname)
205 return mf;
206 }
207
208 -IMFILE* gfopen (const char* fname)
209 +rtengine::IMFILE* rtengine::gfopen (const char* fname)
210 {
211
212 FILE* f = g_fopen (fname, "rb");
213 @@ -176,7 +176,7 @@ IMFILE* gfopen (const char* fname)
214 }
215 #endif //MYFILE_MMAP
216
217 -IMFILE* fopen (unsigned* buf, int size)
218 +rtengine::IMFILE* rtengine::fopen (unsigned* buf, int size)
219 {
220
221 IMFILE* mf = new IMFILE;
222 @@ -190,7 +190,7 @@ IMFILE* fopen (unsigned* buf, int size)
223 return mf;
224 }
225
226 -void fclose (IMFILE* f)
227 +void rtengine::fclose (IMFILE* f)
228 {
229 #ifdef MYFILE_MMAP
230
231 @@ -207,7 +207,7 @@ void fclose (IMFILE* f)
232 delete f;
233 }
234
235 -int fscanf (IMFILE* f, const char* s ...)
236 +int rtengine::fscanf (IMFILE* f, const char* s ...)
237 {
238 // fscanf not easily wrapped since we have no terminating \0 at end
239 // of file data and vsscanf() won't tell us how many characters that
240 @@ -253,7 +253,7 @@ int fscanf (IMFILE* f, const char* s ...)
241 }
242
243
244 -char* fgets (char* s, int n, IMFILE* f)
245 +char* rtengine::fgets (char* s, int n, IMFILE* f)
246 {
247
248 if (f->pos >= f->size) {
249 @@ -270,7 +270,7 @@ char* fgets (char* s, int n, IMFILE* f)
250 return s;
251 }
252
253 -void imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, double progress_range)
254 +void rtengine::imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, double progress_range)
255 {
256 f->plistener = plistener;
257 f->progress_range = progress_range;
258 @@ -278,7 +278,7 @@ void imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, doub
259 f->progress_current = 0;
260 }
261
262 -void imfile_update_progress(IMFILE *f)
263 +void rtengine::imfile_update_progress(IMFILE *f)
264 {
265 if (!f->plistener || f->progress_current < f->progress_next) {
266 return;
267 diff --git a/rtengine/myfile.h b/rtengine/myfile.h
268 index 34b90c525..ae14ce31a 100644
269 --- a/rtengine/myfile.h
270 +++ b/rtengine/myfile.h
271 @@ -30,8 +30,6 @@ namespace rtengine
272
273 class ProgressListener;
274
275 -}
276 -
277 struct IMFILE {
278 int fd;
279 ssize_t pos;
280 @@ -141,3 +139,5 @@ inline unsigned char* fdata(int offset, IMFILE* f)
281
282 int fscanf (IMFILE* f, const char* s ...);
283 char* fgets (char* s, int n, IMFILE* f);
284 +
285 +}
286 diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc
287 index 8dc998862..cf500474f 100644
288 --- a/rtengine/rtthumbnail.cc
289 +++ b/rtengine/rtthumbnail.cc
290 @@ -1965,7 +1965,7 @@ bool Thumbnail::writeImage (const Glib::ustring& fname)
291
292 Glib::ustring fullFName = fname + ".rtti";
293
294 - FILE* f = g_fopen (fullFName.c_str (), "wb");
295 + FILE* f = ::g_fopen (fullFName.c_str (), "wb");
296
297 if (!f) {
298 return false;
299 @@ -2008,7 +2008,7 @@ bool Thumbnail::readImage (const Glib::ustring& fname)
300 return false;
301 }
302
303 - FILE* f = g_fopen(fullFName.c_str (), "rb");
304 + FILE* f = ::g_fopen(fullFName.c_str (), "rb");
305
306 if (!f) {
307 return false;
308 @@ -2239,7 +2239,7 @@ bool Thumbnail::writeData (const Glib::ustring& fname)
309 return false;
310 }
311
312 - FILE *f = g_fopen (fname.c_str (), "wt");
313 + FILE *f = ::g_fopen (fname.c_str (), "wt");
314
315 if (!f) {
316 if (settings->verbose) {
317 @@ -2262,7 +2262,7 @@ bool Thumbnail::readEmbProfile (const Glib::ustring& fname)
318 embProfile = nullptr;
319 embProfileLength = 0;
320
321 - FILE* f = g_fopen (fname.c_str (), "rb");
322 + FILE* f = ::g_fopen (fname.c_str (), "rb");
323
324 if (f) {
325 if (!fseek (f, 0, SEEK_END)) {
326 @@ -2290,7 +2290,7 @@ bool Thumbnail::writeEmbProfile (const Glib::ustring& fname)
327 {
328
329 if (embProfileData) {
330 - FILE* f = g_fopen (fname.c_str (), "wb");
331 + FILE* f = ::g_fopen (fname.c_str (), "wb");
332
333 if (f) {
334 fwrite (embProfileData, 1, embProfileLength, f);
|