Move libc overloads in myfile.h
to rtengine::
(fixes #6324)
This commit is contained in:
parent
35e6a0e40c
commit
2e0137d542
@ -670,7 +670,7 @@ std::uint32_t _byteswap_ulong(std::uint32_t x)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct LibRaw_abstract_datastream {
|
struct LibRaw_abstract_datastream {
|
||||||
IMFILE* ifp;
|
rtengine::IMFILE* ifp;
|
||||||
|
|
||||||
void lock()
|
void lock()
|
||||||
{
|
{
|
||||||
|
@ -1963,7 +1963,7 @@ void CLASS phase_one_load_raw_c()
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int len[2], pred[2];
|
int len[2], pred[2];
|
||||||
IMFILE ifpthr = *ifp;
|
rtengine::IMFILE ifpthr = *ifp;
|
||||||
ifpthr.plistener = nullptr;
|
ifpthr.plistener = nullptr;
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
@ -3317,7 +3317,7 @@ void CLASS sony_arw2_load_raw()
|
|||||||
{
|
{
|
||||||
uchar *data = new (std::nothrow) uchar[raw_width + 1];
|
uchar *data = new (std::nothrow) uchar[raw_width + 1];
|
||||||
merror(data, "sony_arw2_load_raw()");
|
merror(data, "sony_arw2_load_raw()");
|
||||||
IMFILE ifpthr = *ifp;
|
rtengine::IMFILE ifpthr = *ifp;
|
||||||
int pos = ifpthr.pos;
|
int pos = ifpthr.pos;
|
||||||
ushort pix[16];
|
ushort pix[16];
|
||||||
|
|
||||||
@ -6331,7 +6331,7 @@ int CLASS parse_tiff_ifd (int base)
|
|||||||
unsigned sony_curve[] = { 0,0,0,0,0,4095 };
|
unsigned sony_curve[] = { 0,0,0,0,0,4095 };
|
||||||
unsigned *buf, sony_offset=0, sony_length=0, sony_key=0;
|
unsigned *buf, sony_offset=0, sony_length=0, sony_key=0;
|
||||||
struct jhead jh;
|
struct jhead jh;
|
||||||
/*RT*/ IMFILE *sfp;
|
/*RT*/ rtengine::IMFILE *sfp;
|
||||||
/*RT*/ int pana_raw = 0;
|
/*RT*/ int pana_raw = 0;
|
||||||
|
|
||||||
if (tiff_nifds >= sizeof tiff_ifd / sizeof tiff_ifd[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);
|
fread (buf, sony_length, 1, ifp);
|
||||||
sony_decrypt (buf, sony_length/4, 1, sony_key);
|
sony_decrypt (buf, sony_length/4, 1, sony_key);
|
||||||
sfp = ifp;
|
sfp = ifp;
|
||||||
/*RT*/ ifp = fopen (buf, sony_length);
|
/*RT*/ ifp = rtengine::fopen (buf, sony_length);
|
||||||
// if ((ifp = tmpfile())) {
|
// if ((ifp = tmpfile())) {
|
||||||
// fwrite (buf, sony_length, 1, ifp);
|
// fwrite (buf, sony_length, 1, ifp);
|
||||||
// fseek (ifp, 0, SEEK_SET);
|
// fseek (ifp, 0, SEEK_SET);
|
||||||
@ -7203,7 +7203,7 @@ void CLASS parse_external_jpeg()
|
|||||||
{
|
{
|
||||||
const char *file, *ext;
|
const char *file, *ext;
|
||||||
char *jname, *jfile, *jext;
|
char *jname, *jfile, *jext;
|
||||||
/*RT*/ IMFILE *save=ifp;
|
/*RT*/ rtengine::IMFILE *save=ifp;
|
||||||
|
|
||||||
ext = strrchr (ifname, '.');
|
ext = strrchr (ifname, '.');
|
||||||
file = strrchr (ifname, '/');
|
file = strrchr (ifname, '/');
|
||||||
@ -7231,7 +7231,7 @@ void CLASS parse_external_jpeg()
|
|||||||
*jext = '0';
|
*jext = '0';
|
||||||
}
|
}
|
||||||
if (strcmp (jname, ifname)) {
|
if (strcmp (jname, ifname)) {
|
||||||
/*RT*/ if ((ifp = fopen (jname))) {
|
/*RT*/ if ((ifp = rtengine::fopen (jname))) {
|
||||||
// if ((ifp = fopen (jname, "rb"))) {
|
// if ((ifp = fopen (jname, "rb"))) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
|
fprintf (stderr,_("Reading metadata from %s ...\n"), jname);
|
||||||
|
@ -73,7 +73,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
int exif_base, ciff_base, ciff_len;
|
int exif_base, ciff_base, ciff_len;
|
||||||
IMFILE *ifp;
|
rtengine::IMFILE *ifp;
|
||||||
FILE *ofp;
|
FILE *ofp;
|
||||||
short order;
|
short order;
|
||||||
const char *ifname;
|
const char *ifname;
|
||||||
@ -125,7 +125,7 @@ protected:
|
|||||||
int cur_buf_size; // buffer size
|
int cur_buf_size; // buffer size
|
||||||
uchar *cur_buf; // currently read block
|
uchar *cur_buf; // currently read block
|
||||||
int fillbytes; // Counter to add extra byte for block size N*16
|
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_even[3][41]; // tables of gradients
|
||||||
struct int_pair grad_odd[3][41];
|
struct int_pair grad_odd[3][41];
|
||||||
ushort *linealloc;
|
ushort *linealloc;
|
||||||
@ -278,7 +278,7 @@ void parse_redcine();
|
|||||||
class getbithuff_t
|
class getbithuff_t
|
||||||
{
|
{
|
||||||
public:
|
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);
|
unsigned operator()(int nbits, ushort *huff);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -288,7 +288,7 @@ private:
|
|||||||
DCraw *parent;
|
DCraw *parent;
|
||||||
unsigned bitbuf;
|
unsigned bitbuf;
|
||||||
int vbits, reset;
|
int vbits, reset;
|
||||||
IMFILE *&ifp;
|
rtengine::IMFILE *&ifp;
|
||||||
unsigned &zero_after_ff;
|
unsigned &zero_after_ff;
|
||||||
};
|
};
|
||||||
getbithuff_t getbithuff;
|
getbithuff_t getbithuff;
|
||||||
@ -296,7 +296,7 @@ getbithuff_t getbithuff;
|
|||||||
class nikbithuff_t
|
class nikbithuff_t
|
||||||
{
|
{
|
||||||
public:
|
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;};
|
void operator()() {bitbuf = vbits = 0;};
|
||||||
unsigned operator()(int nbits, ushort *huff);
|
unsigned operator()(int nbits, ushort *huff);
|
||||||
unsigned errorCount() { return errors; }
|
unsigned errorCount() { return errors; }
|
||||||
@ -309,7 +309,7 @@ private:
|
|||||||
}
|
}
|
||||||
unsigned bitbuf, errors;
|
unsigned bitbuf, errors;
|
||||||
int vbits;
|
int vbits;
|
||||||
IMFILE *&ifp;
|
rtengine::IMFILE *&ifp;
|
||||||
};
|
};
|
||||||
nikbithuff_t nikbithuff;
|
nikbithuff_t nikbithuff;
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ void parse_qt (int end);
|
|||||||
// ph1_bithuff(int nbits, ushort *huff);
|
// ph1_bithuff(int nbits, ushort *huff);
|
||||||
class ph1_bithuff_t {
|
class ph1_bithuff_t {
|
||||||
public:
|
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, ushort *huff);
|
||||||
unsigned operator()(int nbits);
|
unsigned operator()(int nbits);
|
||||||
unsigned operator()();
|
unsigned operator()();
|
||||||
@ -411,7 +411,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
short ℴ
|
short ℴ
|
||||||
IMFILE* const ifp;
|
rtengine::IMFILE* const ifp;
|
||||||
UINT64 bitbuf;
|
UINT64 bitbuf;
|
||||||
int vbits;
|
int vbits;
|
||||||
};
|
};
|
||||||
@ -429,11 +429,11 @@ void nokia_load_raw();
|
|||||||
|
|
||||||
class pana_bits_t{
|
class pana_bits_t{
|
||||||
public:
|
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) {}
|
ifp(i), load_flags(u), vbits(0), encoding(enc) {}
|
||||||
unsigned operator()(int nbits, unsigned *bytes=nullptr);
|
unsigned operator()(int nbits, unsigned *bytes=nullptr);
|
||||||
private:
|
private:
|
||||||
IMFILE *ifp;
|
rtengine::IMFILE *ifp;
|
||||||
unsigned &load_flags;
|
unsigned &load_flags;
|
||||||
uchar buf[0x4000];
|
uchar buf[0x4000];
|
||||||
int vbits;
|
int vbits;
|
||||||
|
@ -540,7 +540,7 @@ std::vector<badPix> *DFManager::getHotPixels ( const std::string &mak, const std
|
|||||||
|
|
||||||
int DFManager::scanBadPixelsFile( Glib::ustring filename )
|
int DFManager::scanBadPixelsFile( Glib::ustring filename )
|
||||||
{
|
{
|
||||||
FILE *file = fopen( filename.c_str(), "r" );
|
FILE *file = ::fopen( filename.c_str(), "r" );
|
||||||
|
|
||||||
if( !file ) {
|
if( !file ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -70,7 +70,7 @@ int munmap(void *start, size_t length)
|
|||||||
|
|
||||||
#ifdef MYFILE_MMAP
|
#ifdef MYFILE_MMAP
|
||||||
|
|
||||||
IMFILE* fopen (const char* fname)
|
rtengine::IMFILE* rtengine::fopen (const char* fname)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
@ -123,13 +123,13 @@ IMFILE* fopen (const char* fname)
|
|||||||
return mf;
|
return mf;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMFILE* gfopen (const char* fname)
|
rtengine::IMFILE* rtengine::gfopen (const char* fname)
|
||||||
{
|
{
|
||||||
return fopen(fname);
|
return fopen(fname);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
IMFILE* fopen (const char* fname)
|
rtengine::IMFILE* rtengine::fopen (const char* fname)
|
||||||
{
|
{
|
||||||
|
|
||||||
FILE* f = g_fopen (fname, "rb");
|
FILE* f = g_fopen (fname, "rb");
|
||||||
@ -152,7 +152,7 @@ IMFILE* fopen (const char* fname)
|
|||||||
return mf;
|
return mf;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMFILE* gfopen (const char* fname)
|
rtengine::IMFILE* rtengine::gfopen (const char* fname)
|
||||||
{
|
{
|
||||||
|
|
||||||
FILE* f = g_fopen (fname, "rb");
|
FILE* f = g_fopen (fname, "rb");
|
||||||
@ -176,7 +176,7 @@ IMFILE* gfopen (const char* fname)
|
|||||||
}
|
}
|
||||||
#endif //MYFILE_MMAP
|
#endif //MYFILE_MMAP
|
||||||
|
|
||||||
IMFILE* fopen (unsigned* buf, int size)
|
rtengine::IMFILE* rtengine::fopen (unsigned* buf, int size)
|
||||||
{
|
{
|
||||||
|
|
||||||
IMFILE* mf = new IMFILE;
|
IMFILE* mf = new IMFILE;
|
||||||
@ -190,7 +190,7 @@ IMFILE* fopen (unsigned* buf, int size)
|
|||||||
return mf;
|
return mf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fclose (IMFILE* f)
|
void rtengine::fclose (IMFILE* f)
|
||||||
{
|
{
|
||||||
#ifdef MYFILE_MMAP
|
#ifdef MYFILE_MMAP
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ void fclose (IMFILE* f)
|
|||||||
delete 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
|
// 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
|
// 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) {
|
if (f->pos >= f->size) {
|
||||||
@ -270,7 +270,7 @@ char* fgets (char* s, int n, IMFILE* f)
|
|||||||
return s;
|
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->plistener = plistener;
|
||||||
f->progress_range = progress_range;
|
f->progress_range = progress_range;
|
||||||
@ -278,7 +278,7 @@ void imfile_set_plistener(IMFILE *f, rtengine::ProgressListener *plistener, doub
|
|||||||
f->progress_current = 0;
|
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) {
|
if (!f->plistener || f->progress_current < f->progress_next) {
|
||||||
return;
|
return;
|
||||||
|
@ -30,8 +30,6 @@ namespace rtengine
|
|||||||
|
|
||||||
class ProgressListener;
|
class ProgressListener;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
struct IMFILE {
|
struct IMFILE {
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t pos;
|
ssize_t pos;
|
||||||
@ -141,3 +139,5 @@ inline unsigned char* fdata(int offset, IMFILE* f)
|
|||||||
|
|
||||||
int fscanf (IMFILE* f, const char* s ...);
|
int fscanf (IMFILE* f, const char* s ...);
|
||||||
char* fgets (char* s, int n, IMFILE* f);
|
char* fgets (char* s, int n, IMFILE* f);
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1965,7 +1965,7 @@ bool Thumbnail::writeImage (const Glib::ustring& fname)
|
|||||||
|
|
||||||
Glib::ustring fullFName = fname + ".rtti";
|
Glib::ustring fullFName = fname + ".rtti";
|
||||||
|
|
||||||
FILE* f = g_fopen (fullFName.c_str (), "wb");
|
FILE* f = ::g_fopen (fullFName.c_str (), "wb");
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
return false;
|
return false;
|
||||||
@ -2008,7 +2008,7 @@ bool Thumbnail::readImage (const Glib::ustring& fname)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* f = g_fopen(fullFName.c_str (), "rb");
|
FILE* f = ::g_fopen(fullFName.c_str (), "rb");
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
return false;
|
return false;
|
||||||
@ -2239,7 +2239,7 @@ bool Thumbnail::writeData (const Glib::ustring& fname)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f = g_fopen (fname.c_str (), "wt");
|
FILE *f = ::g_fopen (fname.c_str (), "wt");
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
if (settings->verbose) {
|
if (settings->verbose) {
|
||||||
@ -2262,7 +2262,7 @@ bool Thumbnail::readEmbProfile (const Glib::ustring& fname)
|
|||||||
embProfile = nullptr;
|
embProfile = nullptr;
|
||||||
embProfileLength = 0;
|
embProfileLength = 0;
|
||||||
|
|
||||||
FILE* f = g_fopen (fname.c_str (), "rb");
|
FILE* f = ::g_fopen (fname.c_str (), "rb");
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
if (!fseek (f, 0, SEEK_END)) {
|
if (!fseek (f, 0, SEEK_END)) {
|
||||||
@ -2290,7 +2290,7 @@ bool Thumbnail::writeEmbProfile (const Glib::ustring& fname)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (embProfileData) {
|
if (embProfileData) {
|
||||||
FILE* f = g_fopen (fname.c_str (), "wb");
|
FILE* f = ::g_fopen (fname.c_str (), "wb");
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
fwrite (embProfileData, 1, embProfileLength, f);
|
fwrite (embProfileData, 1, embProfileLength, f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user