pkgsrc/multimedia/libmp4v2/patches/patch-ao
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

28 lines
746 B
Text

$NetBSD: patch-ao,v 1.1 2012/02/24 18:36:48 christos Exp $
--- lib/mp4v2/virtual_io.cpp.orig 2006-10-23 18:26:38.000000000 -0400
+++ lib/mp4v2/virtual_io.cpp 2012-02-24 13:04:41.000000000 -0500
@@ -39,20 +39,16 @@
int FILE_SetPosition(void *user, u_int64_t position)
{
FILE *fp = (FILE *)user;
- fpos_t fpos;
- VAR_TO_FPOS(fpos, position);
- return fsetpos(fp, &fpos);
+ return fseeko(fp, position, SEEK_SET) == -1 ? -1 : 0;
}
int FILE_GetPosition(void *user, u_int64_t *position)
{
FILE *fp = (FILE *)user;
- fpos_t fpos;
- if (fgetpos(fp, &fpos) < 0) {
+ *position = ftello(fp);
+ if (*position == (u_int64_t)-1) {
throw new MP4Error(errno, "MP4GetPosition");
}
-
- FPOS_TO_VAR(fpos, u_int64_t, *position);
return 0;
}