Fix fseek()
/ftell()
issue
This commit is contained in:
parent
8f82a8362a
commit
03c094a42b
@ -449,9 +449,9 @@ int DCraw::parseCR3(
|
||||
goto fin;
|
||||
}
|
||||
|
||||
const std::int64_t off = ftell(ifp); // FIXME: ftell() returns int
|
||||
const long off = ftell(ifp);
|
||||
parse_gps(oAtomContent);
|
||||
fseek(ifp, off, SEEK_SET); // FIXME: fseek() takes int offset
|
||||
fseek(ifp, off, SEEK_SET);
|
||||
// parse_gps_libraw(oAtomContent);
|
||||
order = q_order;
|
||||
} else if (!strcmp(AtomNameStack, "moovtrakmdiahdlr")) {
|
||||
@ -468,7 +468,7 @@ int DCraw::parseCR3(
|
||||
}
|
||||
} else if (!strcmp(AtomNameStack, "moovtrakmdiaminfstblstsd")) {
|
||||
if (szAtomContent >= 16) {
|
||||
fseek(ifp, 12L, SEEK_CUR);
|
||||
fseek(ifp, 12, SEEK_CUR);
|
||||
lHdr = 8;
|
||||
} else {
|
||||
err = -7;
|
||||
@ -670,7 +670,7 @@ struct LibRaw_abstract_datastream {
|
||||
void unlock()
|
||||
{
|
||||
}
|
||||
void seek(int p, int how)
|
||||
void seek(long p, int how)
|
||||
{
|
||||
fseek(ifp, p, how);
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public:
|
||||
int32_t mdatHdrSize;
|
||||
// Not from header, but from datastream
|
||||
uint32_t MediaSize;
|
||||
INT64 MediaOffset;
|
||||
int64_t MediaOffset;
|
||||
uint32_t MediaType; /* 1 -> /C/RAW, 2-> JPEG */
|
||||
};
|
||||
static constexpr size_t CRXTRACKS_MAXCOUNT = 16;
|
||||
|
@ -56,28 +56,26 @@ IMFILE* fopen (const char* fname);
|
||||
IMFILE* gfopen (const char* fname);
|
||||
IMFILE* fopen (unsigned* buf, int size);
|
||||
void fclose (IMFILE* f);
|
||||
inline int ftell (IMFILE* f)
|
||||
inline long ftell (IMFILE* f)
|
||||
{
|
||||
|
||||
return f->pos;
|
||||
}
|
||||
|
||||
inline int feof (IMFILE* f)
|
||||
{
|
||||
|
||||
return f->eof;
|
||||
}
|
||||
|
||||
inline void fseek (IMFILE* f, int p, int how)
|
||||
inline void fseek (IMFILE* f, long p, int how)
|
||||
{
|
||||
int fpos = f->pos;
|
||||
ssize_t fpos = f->pos;
|
||||
|
||||
if (how == SEEK_SET) {
|
||||
f->pos = p;
|
||||
} else if (how == SEEK_CUR) {
|
||||
f->pos += p;
|
||||
} else if (how == SEEK_END) {
|
||||
if(p <= 0 && -p <= f->size) {
|
||||
if (p <= 0 && -p <= f->size) {
|
||||
f->pos = f->size + p;
|
||||
}
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user