pkgsrc/multimedia/libmp4v2/patches/patch-am
christos 707615c61c PR/46089: David Shao: Don't use f{g,s}etpos because there is no portable
way of extracting the offset from them, which is all that is needed in
this case. Just use fseeko/ftello.
2012-02-24 18:36:48 +00:00

32 lines
873 B
Text

$NetBSD: patch-am,v 1.1 2012/02/24 18:36:48 christos Exp $
--- lib/mp4v2/mp4file_io.cpp.orig 2007-04-30 16:29:28.000000000 -0400
+++ lib/mp4v2/mp4file_io.cpp 2012-02-24 13:04:54.000000000 -0500
@@ -34,13 +34,11 @@
}
return fpos;
} else {
- fpos_t fpos;
- if (fgetpos(pFile, &fpos) < 0) {
+ u_int64_t fpos = ftello(pFile);
+ if (fpos == (u_int64_t)-1) {
throw new MP4Error(errno, "MP4GetPosition");
}
- uint64_t ret;
- FPOS_TO_VAR(fpos, uint64_t, ret);
- return ret;
+ return fpos;
}
} else {
return m_memoryBufferPosition;
@@ -56,9 +54,7 @@
throw new MP4Error("setting position via Virtual I/O", "MP4SetPosition");
}
} else {
- fpos_t fpos;
- VAR_TO_FPOS(fpos, pos);
- if (fsetpos(pFile, &fpos) < 0) {
+ if (fseeko(pFile, pos, SEEK_SET) < 0) {
throw new MP4Error(errno, "MP4SetPosition");
}
}