summaryrefslogtreecommitdiff
path: root/main/faac/fix-libc-internals.patch
blob: b28645a6f226ce10add40e5b4dbd4ae0d2edb61b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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;
 }