aboutsummaryrefslogtreecommitdiffstats
path: root/main/faac/fix-libc-internals.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-10-07 07:29:19 +0000
committerTimo Teräs <timo.teras@iki.fi>2013-10-07 07:29:19 +0000
commit65553514aca702cc7ae6f9208a0728291b648a65 (patch)
tree54b14fd3b676f47795e63029c08e21c62b8dfdde /main/faac/fix-libc-internals.patch
parent8d003bde49f175b86885a1c3c374c15a414fee35 (diff)
downloadaports-65553514aca702cc7ae6f9208a0728291b648a65.tar.bz2
aports-65553514aca702cc7ae6f9208a0728291b648a65.tar.xz
main/faac: patch to not use libc internals (fix musl build)
Diffstat (limited to 'main/faac/fix-libc-internals.patch')
-rw-r--r--main/faac/fix-libc-internals.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/main/faac/fix-libc-internals.patch b/main/faac/fix-libc-internals.patch
new file mode 100644
index 0000000000..b28645a6f2
--- /dev/null
+++ b/main/faac/fix-libc-internals.patch
@@ -0,0 +1,89 @@
+--- faac-1.28.orig/common/mp4v2/mp4file_io.cpp
++++ faac-1.28/common/mp4v2/mp4file_io.cpp
+@@ -34,13 +34,11 @@
+ }
+ return fpos;
+ } else {
+- fpos_t fpos;
+- if (fgetpos(pFile, &fpos) < 0) {
++ off_t off = ftello(pFile);
++ if (off == -1) {
+ throw new MP4Error(errno, "MP4GetPosition");
+ }
+- uint64_t ret;
+- FPOS_TO_VAR(fpos, uint64_t, ret);
+- return ret;
++ return off;
+ }
+ } 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");
+ }
+ }
+--- faac-1.28.orig/common/mp4v2/mp4util.h
++++ faac-1.28/common/mp4v2/mp4util.h
+@@ -23,6 +23,10 @@
+ #define __MP4_UTIL_INCLUDED__
+ #include <assert.h>
+
++#ifndef __STRING
++#define __STRING(x) #x
++#endif
++
+ #ifndef ASSERT
+ #define ASSERT(expr) \
+ if (!(expr)) { \
+--- faac-1.28.orig/common/mp4v2/mpeg4ip.h
++++ faac-1.28/common/mp4v2/mpeg4ip.h
+@@ -153,14 +153,6 @@
+ #define TO_U64(a) (a##LLU)
+ #endif
+
+-#ifdef HAVE_FPOS_T___POS
+-#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)((fpos).__pos)
+-#define VAR_TO_FPOS(fpos, var) (fpos).__pos = (var)
+-#else
+-#define FPOS_TO_VAR(fpos, typed, var) (var) = (typed)(fpos)
+-#define VAR_TO_FPOS(fpos, var) (fpos) = (var)
+-#endif
+-
+ #define FOPEN_READ_BINARY "r"
+ #define FOPEN_WRITE_BINARY "w"
+ #define UINT64_TO_DOUBLE(a) ((double)(a))
+--- faac-1.28.orig/common/mp4v2/virtual_io.cpp
++++ faac-1.28/common/mp4v2/virtual_io.cpp
+@@ -38,21 +38,18 @@
+
+ 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((FILE *) user, position, SEEK_SET);
+ }
+
+ int FILE_GetPosition(void *user, u_int64_t *position)
+ {
+ FILE *fp = (FILE *)user;
+- fpos_t fpos;
+- if (fgetpos(fp, &fpos) < 0) {
++ off_t off;
++ off = ftello(fp);
++ if (off == -1) {
+ throw new MP4Error(errno, "MP4GetPosition");
+ }
+-
+- FPOS_TO_VAR(fpos, u_int64_t, *position);
++ *position = off;
+ return 0;
+ }
+