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