summaryrefslogtreecommitdiff
path: root/media-gfx/rawtherapee/files/RT_5.8_glibc234.patch
blob: 791183e20d520112e4019bb4a46fbbf586d1b515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
diff -udHrN -- a/RT_5.8_glibc234.patch b/RT_5.8_glibc234.patch
--- a/RT_5.8_glibc234.patch	1970-01-01 01:00:00.000000000 +0100
+++ b/RT_5.8_glibc234.patch	2021-08-04 18:50:22.142646367 +0200
@@ -0,0 +1,334 @@
+diff --git a/rtengine/canon_cr3_decoder.cc b/rtengine/canon_cr3_decoder.cc
+index ddd4b6172..1132b4e01 100644
+--- a/rtengine/canon_cr3_decoder.cc
++++ b/rtengine/canon_cr3_decoder.cc
+@@ -670,7 +670,7 @@ std::uint32_t _byteswap_ulong(std::uint32_t x)
+ #endif
+ 
+ struct LibRaw_abstract_datastream {
+-    IMFILE* ifp;
++    rtengine::IMFILE* ifp;
+ 
+     void lock()
+     {
+diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc
+index ef0b4e8dc..13a6b054a 100644
+--- a/rtengine/dcraw.cc
++++ b/rtengine/dcraw.cc
+@@ -1963,7 +1963,7 @@ void CLASS phase_one_load_raw_c()
+ #endif
+ {
+     int len[2], pred[2];
+-    IMFILE ifpthr = *ifp;
++    rtengine::IMFILE ifpthr = *ifp;
+     ifpthr.plistener = nullptr;
+ 
+ #ifdef _OPENMP
+@@ -3317,7 +3317,7 @@ void CLASS sony_arw2_load_raw()
+ {
+     uchar *data = new (std::nothrow) uchar[raw_width + 1];
+     merror(data, "sony_arw2_load_raw()");
+-    IMFILE ifpthr = *ifp;
++    rtengine::IMFILE ifpthr = *ifp;
+     int pos = ifpthr.pos;
+     ushort pix[16];
+ 
+@@ -6331,7 +6331,7 @@ int CLASS parse_tiff_ifd (int base)
+   unsigned sony_curve[] = { 0,0,0,0,0,4095 };
+   unsigned *buf, sony_offset=0, sony_length=0, sony_key=0;
+   struct jhead jh;
+-/*RT*/  IMFILE *sfp;
++/*RT*/  rtengine::IMFILE *sfp;
+ /*RT*/  int pana_raw = 0;
+ 
+   if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0])
+@@ -6895,7 +6895,7 @@ it under the terms of the one of two licenses as you choose:
+     fread (buf, sony_length, 1, ifp);
+     sony_decrypt (buf, sony_length/4, 1, sony_key);
+     sfp = ifp;
+-/*RT*/ ifp = fopen (buf, sony_length);
++/*RT*/ ifp = rtengine::fopen (buf, sony_length);
+ // if ((ifp = tmpfile())) {
+ // fwrite (buf, sony_length, 1, ifp);
+ // fseek (ifp, 0, SEEK_SET);
+@@ -7203,7 +7203,7 @@ void CLASS parse_external_jpeg()
+ {
+   const char *file, *ext;
+   char *jname, *jfile, *jext;
+-/*RT*/  IMFILE *save=ifp;
++/*RT*/  rtengine::IMFILE *save=ifp;
+ 
+   ext  = strrchr (ifname, '.');
+   file = strrchr (ifname, '/');
+@@ -7231,7 +7231,7 @@ void CLASS parse_external_jpeg()
+       *jext = '0';
+     }
+   if (strcmp (jname, ifname)) {
+-/*RT*/    if ((ifp = fopen (jname))) {
++/*RT*/    if ((ifp = rtengine::fopen (jname))) {
+ //    if ((ifp = fopen (jname, "rb"))) {
+       if (verbose)
+ 	fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
+diff --git a/rtengine/dcraw.h b/rtengine/dcraw.h
+index 10c7b9ba6..bc009e67c 100644
+--- a/rtengine/dcraw.h
++++ b/rtengine/dcraw.h
+@@ -73,7 +73,7 @@ public:
+ 
+ protected:
+     int exif_base, ciff_base, ciff_len;
+-    IMFILE *ifp;
++    rtengine::IMFILE *ifp;
+     FILE *ofp;
+     short order;
+     const char *ifname;
+@@ -125,7 +125,7 @@ protected:
+         int         cur_buf_size;    // buffer size
+         uchar       *cur_buf;        // currently read block
+         int         fillbytes;          // Counter to add extra byte for block size N*16
+-        IMFILE      *input;
++        rtengine::IMFILE      *input;
+         struct int_pair grad_even[3][41];    // tables of gradients
+         struct int_pair grad_odd[3][41];
+         ushort		*linealloc;
+@@ -278,7 +278,7 @@ void parse_redcine();
+ class getbithuff_t
+ {
+ public:
+-   getbithuff_t(DCraw *p,IMFILE *&i, unsigned &z):parent(p),bitbuf(0),vbits(0),reset(0),ifp(i),zero_after_ff(z){}
++   getbithuff_t(DCraw *p,rtengine::IMFILE *&i, unsigned &z):parent(p),bitbuf(0),vbits(0),reset(0),ifp(i),zero_after_ff(z){}
+    unsigned operator()(int nbits, ushort *huff);
+ 
+ private:
+@@ -288,7 +288,7 @@ private:
+    DCraw *parent;
+    unsigned bitbuf;
+    int vbits, reset;
+-   IMFILE *&ifp;
++   rtengine::IMFILE *&ifp;
+    unsigned &zero_after_ff;
+ };
+ getbithuff_t getbithuff;
+@@ -296,7 +296,7 @@ getbithuff_t getbithuff;
+ class nikbithuff_t
+ {
+ public:
+-   explicit nikbithuff_t(IMFILE *&i):bitbuf(0),errors(0),vbits(0),ifp(i){}
++   explicit nikbithuff_t(rtengine::IMFILE *&i):bitbuf(0),errors(0),vbits(0),ifp(i){}
+    void operator()() {bitbuf = vbits = 0;};
+    unsigned operator()(int nbits, ushort *huff);
+    unsigned errorCount() { return errors; }
+@@ -309,7 +309,7 @@ private:
+    }
+    unsigned bitbuf, errors;
+    int vbits;
+-   IMFILE *&ifp;
++   rtengine::IMFILE *&ifp;
+ };
+ nikbithuff_t nikbithuff;
+ 
+@@ -377,7 +377,7 @@ void parse_qt (int end);
+ // ph1_bithuff(int nbits, ushort *huff);
+ class ph1_bithuff_t {
+ public:
+-   ph1_bithuff_t(DCraw *p, IMFILE *i, short &o):order(o),ifp(i),bitbuf(0),vbits(0){}
++   ph1_bithuff_t(DCraw *p, rtengine::IMFILE *i, short &o):order(o),ifp(i),bitbuf(0),vbits(0){}
+    unsigned operator()(int nbits, ushort *huff);
+    unsigned operator()(int nbits);
+    unsigned operator()();
+@@ -411,7 +411,7 @@ private:
+    }
+ 
+    short ℴ
+-   IMFILE* const ifp;
++   rtengine::IMFILE* const ifp;
+    UINT64 bitbuf;
+    int vbits;
+ };
+@@ -429,11 +429,11 @@ void nokia_load_raw();
+ 
+ class pana_bits_t{
+ public:
+-   pana_bits_t(IMFILE *i, unsigned &u, unsigned enc):
++   pana_bits_t(rtengine::IMFILE *i, unsigned &u, unsigned enc):
+     ifp(i), load_flags(u), vbits(0), encoding(enc) {}
+    unsigned operator()(int nbits, unsigned *bytes=nullptr);
+ private:
+-   IMFILE *ifp;
++   rtengine::IMFILE *ifp;
+    unsigned &load_flags;
+    uchar buf[0x4000];
+    int vbits;
+diff --git a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc
+index 7dde668eb..e551c9aad 100644
+--- a/rtengine/dfmanager.cc
++++ b/rtengine/dfmanager.cc
+@@ -540,7 +540,7 @@ std::vector<badPix> *DFManager::getHotPixels ( const std::string &mak, const std
+ 
+ int DFManager::scanBadPixelsFile( Glib::ustring filename )
+ {
+-    FILE *file = fopen( filename.c_str(), "r" );
++    FILE *file = ::fopen( filename.c_str(), "r" );
+ 
+     if( !file ) {
+         return false;
+diff --git a/rtengine/myfile.cc b/rtengine/myfile.cc
+index 842766dcf..2321d18bb 100644
+--- a/rtengine/myfile.cc
++++ b/rtengine/myfile.cc
+@@ -70,7 +70,7 @@ int munmap(void *start, size_t length)
+ 
+ #ifdef MYFILE_MMAP
+ 
+-IMFILE* fopen (const char* fname)
++rtengine::IMFILE* rtengine::fopen (const char* fname)
+ {
+     int fd;
+ 
+@@ -123,13 +123,13 @@ IMFILE* fopen (const char* fname)
+     return mf;
+ }
+ 
+-IMFILE* gfopen (const char* fname)
++rtengine::IMFILE* rtengine::gfopen (const char* fname)
+ {
+     return fopen(fname);
+ }
+ #else
+ 
+-IMFILE* fopen (const char* fname)
++rtengine::IMFILE* rtengine::fopen (const char* fname)
+ {
+ 
+     FILE* f = g_fopen (fname, "rb");
+@@ -152,7 +152,7 @@ IMFILE* fopen (const char* fname)
+     return mf;
+ }
+ 
+-IMFILE* gfopen (const char* fname)
++rtengine::IMFILE* rtengine::gfopen (const char* fname)
+ {
+ 
+     FILE* f = g_fopen (fname, "rb");
+@@ -176,7 +176,7 @@ IMFILE* gfopen (const char* fname)
+ }
+ #endif //MYFILE_MMAP
+ 
+-IMFILE* fopen (unsigned* buf, int size)
++rtengine::IMFILE* rtengine::fopen (unsigned* buf, int size)
+ {
+ 
+     IMFILE* mf = new IMFILE;
+@@ -190,7 +190,7 @@ IMFILE* fopen (unsigned* buf, int size)
+     return mf;
+ }
+ 
+-void fclose (IMFILE* f)
++void rtengine::fclose (IMFILE* f)
+ {
+ #ifdef MYFILE_MMAP
+ 
+@@ -207,7 +207,7 @@ void fclose (IMFILE* f)
+     delete f;
+ }
+ 
+-int fscanf (IMFILE* f, const char* s ...)
++int rtengine::fscanf (IMFILE* f, const char* s ...)
+ {
+     // fscanf not easily wrapped since we have no terminating \0 at end
+     // of file data and vsscanf() won't tell us how many characters that
+@@ -253,7 +253,7 @@ int fscanf (IMFILE* f, const char* s ...)
+ }
+ 
+ 
+-char* fgets (char* s, int n, IMFILE* f)
++char* rtengine::fgets (char* s, int n, IMFILE* f)
+ {
+ 
+     if (f->pos >= f->size) {
+@@ -270,7 +270,7 @@ char* fgets (char* s, int n, IMFILE* f)
+     return s;
+ }
+ 
+-void imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, double progress_range)
++void rtengine::imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, double progress_range)
+ {
+     f->plistener = plistener;
+     f->progress_range = progress_range;
+@@ -278,7 +278,7 @@ void imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, doub
+     f->progress_current = 0;
+ }
+ 
+-void imfile_update_progress(IMFILE *f)
++void rtengine::imfile_update_progress(IMFILE *f)
+ {
+     if (!f->plistener || f->progress_current < f->progress_next) {
+         return;
+diff --git a/rtengine/myfile.h b/rtengine/myfile.h
+index 34b90c525..ae14ce31a 100644
+--- a/rtengine/myfile.h
++++ b/rtengine/myfile.h
+@@ -30,8 +30,6 @@ namespace rtengine
+ 
+ class ProgressListener;
+ 
+-}
+-
+ struct IMFILE {
+     int fd;
+     ssize_t pos;
+@@ -141,3 +139,5 @@ inline unsigned char* fdata(int offset, IMFILE* f)
+ 
+ int fscanf (IMFILE* f, const char* s ...);
+ char* fgets (char* s, int n, IMFILE* f);
++
++}
+diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc
+index 8dc998862..cf500474f 100644
+--- a/rtengine/rtthumbnail.cc
++++ b/rtengine/rtthumbnail.cc
+@@ -1965,7 +1965,7 @@ bool Thumbnail::writeImage (const Glib::ustring& fname)
+ 
+     Glib::ustring fullFName = fname + ".rtti";
+ 
+-    FILE* f = g_fopen (fullFName.c_str (), "wb");
++    FILE* f = ::g_fopen (fullFName.c_str (), "wb");
+ 
+     if (!f) {
+         return false;
+@@ -2008,7 +2008,7 @@ bool Thumbnail::readImage (const Glib::ustring& fname)
+         return false;
+     }
+ 
+-    FILE* f = g_fopen(fullFName.c_str (), "rb");
++    FILE* f = ::g_fopen(fullFName.c_str (), "rb");
+ 
+     if (!f) {
+         return false;
+@@ -2239,7 +2239,7 @@ bool Thumbnail::writeData  (const Glib::ustring& fname)
+         return false;
+     }
+ 
+-    FILE *f = g_fopen (fname.c_str (), "wt");
++    FILE *f = ::g_fopen (fname.c_str (), "wt");
+ 
+     if (!f) {
+         if (settings->verbose) {
+@@ -2262,7 +2262,7 @@ bool Thumbnail::readEmbProfile  (const Glib::ustring& fname)
+     embProfile = nullptr;
+     embProfileLength = 0;
+ 
+-    FILE* f = g_fopen (fname.c_str (), "rb");
++    FILE* f = ::g_fopen (fname.c_str (), "rb");
+ 
+     if (f) {
+         if (!fseek (f, 0, SEEK_END)) {
+@@ -2290,7 +2290,7 @@ bool Thumbnail::writeEmbProfile (const Glib::ustring& fname)
+ {
+ 
+     if (embProfileData) {
+-        FILE* f = g_fopen (fname.c_str (), "wb");
++        FILE* f = ::g_fopen (fname.c_str (), "wb");
+ 
+         if (f) {
+             fwrite (embProfileData, 1, embProfileLength, f);
diff -udHrN -- a/rtengine/canon_cr3_decoder.cc b/rtengine/canon_cr3_decoder.cc
--- a/rtengine/canon_cr3_decoder.cc	2020-02-04 07:39:52.000000000 +0100
+++ b/rtengine/canon_cr3_decoder.cc	2021-08-07 11:43:50.725202017 +0200
@@ -662,7 +662,7 @@
 #endif
 
 struct LibRaw_abstract_datastream {
-    IMFILE* ifp;
+    rtengine::IMFILE* ifp;
 
     void lock()
     {
diff -udHrN -- a/rtengine/dcraw.cc b/rtengine/dcraw.cc
--- a/rtengine/dcraw.cc	2020-02-04 07:39:52.000000000 +0100
+++ b/rtengine/dcraw.cc	2021-08-07 11:43:50.736202141 +0200
@@ -2025,7 +2025,7 @@
 #endif
 {
     int len[2], pred[2];
-    IMFILE ifpthr = *ifp;
+    rtengine::IMFILE ifpthr = *ifp;
     ifpthr.plistener = nullptr;
 
 #ifdef _OPENMP
@@ -3380,7 +3380,7 @@
 {
     uchar *data = new (std::nothrow) uchar[raw_width + 1];
     merror(data, "sony_arw2_load_raw()");
-    IMFILE ifpthr = *ifp;
+    rtengine::IMFILE ifpthr = *ifp;
     int pos = ifpthr.pos;
     ushort pix[16];
 
@@ -6394,7 +6394,7 @@
   unsigned sony_curve[] = { 0,0,0,0,0,4095 };
   unsigned *buf, sony_offset=0, sony_length=0, sony_key=0;
   struct jhead jh;
-/*RT*/  IMFILE *sfp;
+/*RT*/  rtengine::IMFILE *sfp;
 /*RT*/  int pana_raw = 0;
 
   if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[0])
@@ -6958,7 +6958,7 @@
     fread (buf, sony_length, 1, ifp);
     sony_decrypt (buf, sony_length/4, 1, sony_key);
     sfp = ifp;
-/*RT*/ ifp = fopen (buf, sony_length);
+/*RT*/ ifp = rtengine::fopen (buf, sony_length);
 // if ((ifp = tmpfile())) {
 // fwrite (buf, sony_length, 1, ifp);
 // fseek (ifp, 0, SEEK_SET);
@@ -7264,7 +7264,7 @@
 {
   const char *file, *ext;
   char *jname, *jfile, *jext;
-/*RT*/  IMFILE *save=ifp;
+/*RT*/  rtengine::IMFILE *save=ifp;
 
   ext  = strrchr (ifname, '.');
   file = strrchr (ifname, '/');
@@ -7292,7 +7292,7 @@
       *jext = '0';
     }
   if (strcmp (jname, ifname)) {
-/*RT*/    if ((ifp = fopen (jname))) {
+/*RT*/    if ((ifp = rtengine::fopen (jname))) {
 //    if ((ifp = fopen (jname, "rb"))) {
       if (verbose)
 	fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
diff -udHrN -- a/rtengine/dcraw.h b/rtengine/dcraw.h
--- a/rtengine/dcraw.h	2020-02-04 07:39:52.000000000 +0100
+++ b/rtengine/dcraw.h	2021-08-07 11:43:50.737202152 +0200
@@ -73,7 +73,7 @@
 
 protected:
     int exif_base, ciff_base, ciff_len;
-    IMFILE *ifp;
+    rtengine::IMFILE *ifp;
     FILE *ofp;
     short order;
     const char *ifname;
@@ -125,7 +125,7 @@
         int         cur_buf_size;    // buffer size
         uchar       *cur_buf;        // currently read block
         int         fillbytes;          // Counter to add extra byte for block size N*16
-        IMFILE      *input;
+        rtengine::IMFILE      *input;
         struct int_pair grad_even[3][41];    // tables of gradients
         struct int_pair grad_odd[3][41];
         ushort		*linealloc;
@@ -278,7 +278,7 @@
 class getbithuff_t
 {
 public:
-   getbithuff_t(DCraw *p,IMFILE *&i, unsigned &z):parent(p),bitbuf(0),vbits(0),reset(0),ifp(i),zero_after_ff(z){}
+   getbithuff_t(DCraw *p,rtengine::IMFILE *&i, unsigned &z):parent(p),bitbuf(0),vbits(0),reset(0),ifp(i),zero_after_ff(z){}
    unsigned operator()(int nbits, ushort *huff);
 
 private:
@@ -288,7 +288,7 @@
    DCraw *parent;
    unsigned bitbuf;
    int vbits, reset;
-   IMFILE *&ifp;
+   rtengine::IMFILE *&ifp;
    unsigned &zero_after_ff;
 };
 getbithuff_t getbithuff;
@@ -296,7 +296,7 @@
 class nikbithuff_t
 {
 public:
-   explicit nikbithuff_t(IMFILE *&i):bitbuf(0),errors(0),vbits(0),ifp(i){}
+   explicit nikbithuff_t(rtengine::IMFILE *&i):bitbuf(0),errors(0),vbits(0),ifp(i){}
    void operator()() {bitbuf = vbits = 0;};
    unsigned operator()(int nbits, ushort *huff);
    unsigned errorCount() { return errors; }
@@ -309,7 +309,7 @@
    }
    unsigned bitbuf, errors;
    int vbits;
-   IMFILE *&ifp;
+   rtengine::IMFILE *&ifp;
 };
 nikbithuff_t nikbithuff;
 
@@ -378,7 +378,7 @@
 // ph1_bithuff(int nbits, ushort *huff);
 class ph1_bithuff_t {
 public:
-   ph1_bithuff_t(DCraw *p, IMFILE *i, short &o):order(o),ifp(i),bitbuf(0),vbits(0){}
+   ph1_bithuff_t(DCraw *p, rtengine::IMFILE *i, short &o):order(o),ifp(i),bitbuf(0),vbits(0){}
    unsigned operator()(int nbits, ushort *huff);
    unsigned operator()(int nbits);
    unsigned operator()();
@@ -412,7 +412,7 @@
    }
 
    short &order;
-   IMFILE* const ifp;
+   rtengine::IMFILE* const ifp;
    UINT64 bitbuf;
    int vbits;
 };
@@ -430,11 +430,11 @@
 
 class pana_bits_t{
 public:
-   pana_bits_t(IMFILE *i, unsigned &u, unsigned enc):
+   pana_bits_t(rtengine::IMFILE *i, unsigned &u, unsigned enc):
     ifp(i), load_flags(u), vbits(0), encoding(enc) {}
    unsigned operator()(int nbits, unsigned *bytes=nullptr);
 private:
-   IMFILE *ifp;
+   rtengine::IMFILE *ifp;
    unsigned &load_flags;
    uchar buf[0x4000];
    int vbits;
diff -udHrN -- a/rtengine/dfmanager.cc b/rtengine/dfmanager.cc
--- a/rtengine/dfmanager.cc	2020-02-04 07:39:52.000000000 +0100
+++ b/rtengine/dfmanager.cc	2021-08-07 11:43:50.738202163 +0200
@@ -540,7 +540,7 @@
 
 int DFManager::scanBadPixelsFile( Glib::ustring filename )
 {
-    FILE *file = fopen( filename.c_str(), "r" );
+    FILE *file = ::fopen( filename.c_str(), "r" );
 
     if( !file ) {
         return false;
diff -udHrN -- a/rtengine/myfile.cc b/rtengine/myfile.cc
--- a/rtengine/myfile.cc	2020-02-04 07:39:52.000000000 +0100
+++ b/rtengine/myfile.cc	2021-08-07 11:43:50.738202163 +0200
@@ -70,7 +70,7 @@
 
 #ifdef MYFILE_MMAP
 
-IMFILE* fopen (const char* fname)
+rtengine::IMFILE* rtengine::fopen (const char* fname)
 {
     int fd;
 
@@ -123,13 +123,13 @@
     return mf;
 }
 
-IMFILE* gfopen (const char* fname)
+rtengine::IMFILE* rtengine::gfopen (const char* fname)
 {
     return fopen(fname);
 }
 #else
 
-IMFILE* fopen (const char* fname)
+rtengine::IMFILE* rtengine::fopen (const char* fname)
 {
 
     FILE* f = g_fopen (fname, "rb");
@@ -152,7 +152,7 @@
     return mf;
 }
 
-IMFILE* gfopen (const char* fname)
+rtengine::IMFILE* rtengine::gfopen (const char* fname)
 {
 
     FILE* f = g_fopen (fname, "rb");
@@ -176,7 +176,7 @@
 }
 #endif //MYFILE_MMAP
 
-IMFILE* fopen (unsigned* buf, int size)
+rtengine::IMFILE* rtengine::fopen (unsigned* buf, int size)
 {
 
     IMFILE* mf = new IMFILE;
@@ -190,7 +190,7 @@
     return mf;
 }
 
-void fclose (IMFILE* f)
+void rtengine::fclose (IMFILE* f)
 {
 #ifdef MYFILE_MMAP
 
@@ -207,7 +207,7 @@
     delete f;
 }
 
-int fscanf (IMFILE* f, const char* s ...)
+int rtengine::fscanf (IMFILE* f, const char* s ...)
 {
     // fscanf not easily wrapped since we have no terminating \0 at end
     // of file data and vsscanf() won't tell us how many characters that
@@ -253,7 +253,7 @@
 }
 
 
-char* fgets (char* s, int n, IMFILE* f)
+char* rtengine::fgets (char* s, int n, IMFILE* f)
 {
 
     if (f->pos >= f->size) {
@@ -270,7 +270,7 @@
     return s;
 }
 
-void imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, double progress_range)
+void rtengine::imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, double progress_range)
 {
     f->plistener = plistener;
     f->progress_range = progress_range;
@@ -278,7 +278,7 @@
     f->progress_current = 0;
 }
 
-void imfile_update_progress(IMFILE *f)
+void rtengine::imfile_update_progress(IMFILE *f)
 {
     if (!f->plistener || f->progress_current < f->progress_next) {
         return;
diff -udHrN -- a/rtengine/myfile.h b/rtengine/myfile.h
--- a/rtengine/myfile.h	2020-02-04 07:39:52.000000000 +0100
+++ b/rtengine/myfile.h	2021-08-07 11:43:50.739202175 +0200
@@ -30,8 +30,6 @@
 
 class ProgressListener;
 
-}
-
 struct IMFILE {
     int fd;
     ssize_t pos;
@@ -141,3 +139,5 @@
 
 int fscanf (IMFILE* f, const char* s ...);
 char* fgets (char* s, int n, IMFILE* f);
+
+}
diff -udHrN -- a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc
--- a/rtengine/rtthumbnail.cc	2020-02-04 07:39:52.000000000 +0100
+++ b/rtengine/rtthumbnail.cc	2021-08-07 12:02:02.091503230 +0200
@@ -1922,7 +1922,7 @@
 
     Glib::ustring fullFName = fname + ".rtti";
 
-    FILE* f = g_fopen (fullFName.c_str (), "wb");
+    FILE* f = ::g_fopen (fullFName.c_str (), "wb");
 
     if (!f) {
         return false;
@@ -1965,7 +1965,7 @@
         return false;
     }
 
-    FILE* f = g_fopen(fullFName.c_str (), "rb");
+    FILE* f = ::g_fopen(fullFName.c_str (), "rb");
 
     if (!f) {
         return false;
@@ -2191,7 +2191,7 @@
         return false;
     }
 
-    FILE *f = g_fopen (fname.c_str (), "wt");
+    FILE *f = ::g_fopen (fname.c_str (), "wt");
 
     if (!f) {
         if (settings->verbose) {
@@ -2214,7 +2214,7 @@
     embProfile = nullptr;
     embProfileLength = 0;
 
-    FILE* f = g_fopen (fname.c_str (), "rb");
+    FILE* f = ::g_fopen (fname.c_str (), "rb");
 
     if (f) {
         if (!fseek (f, 0, SEEK_END)) {
@@ -2242,7 +2242,7 @@
 {
 
     if (embProfileData) {
-        FILE* f = g_fopen (fname.c_str (), "wb");
+        FILE* f = ::g_fopen (fname.c_str (), "wb");
 
         if (f) {
             fwrite (embProfileData, 1, embProfileLength, f);
@@ -2257,7 +2257,7 @@
 bool Thumbnail::readAEHistogram  (const Glib::ustring& fname)
 {
 
-    FILE* f = g_fopen(fname.c_str(), "rb");
+    FILE* f = ::g_fopen(fname.c_str(), "rb");
 
     if (!f) {
         aeHistogram.reset();
@@ -2280,7 +2280,7 @@
 {
 
     if (aeHistogram) {
-        FILE* f = g_fopen (fname.c_str (), "wb");
+        FILE* f = ::g_fopen (fname.c_str (), "wb");
 
         if (f) {
             fwrite (&aeHistogram[0], 1, (65536 >> aeHistCompression)*sizeof (aeHistogram[0]), f);