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
90
91
92
93
94
|
From eb9b4c9cf8d8f8ef957fc9d7d2e73a2ea102310d Mon Sep 17 00:00:00 2001
From: Jory Pratt <anarchy@gentoo.org>
Date: Tue, 10 Nov 2020 08:09:27 -0600
Subject: [PATCH 2/5] fix fileemu
---
xbmc/cores/DllLoader/exports/emu_msvcrt.cpp | 15 +++++++++------
xbmc/cores/DllLoader/exports/emu_msvcrt.h | 2 +-
xbmc/cores/DllLoader/exports/wrapper.c | 2 +-
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
index b7585e5..a2b433b 100644
--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
+++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
@@ -38,6 +38,7 @@
#include <fcntl.h>
#include <time.h>
#include <signal.h>
+#include <paths.h>
#ifdef TARGET_POSIX
#include "PlatformDefs.h" // for __stat64
#endif
@@ -1479,7 +1480,7 @@ extern "C"
int ret;
ret = dll_fgetpos64(stream, &tmpPos);
-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(__GLIBC__)
*pos = (fpos_t)tmpPos;
#else
pos->__pos = (off_t)tmpPos.__pos;
@@ -1492,8 +1493,9 @@ extern "C"
CFile* pFile = g_emuFileWrapper.GetFileXbmcByStream(stream);
if (pFile != NULL)
{
-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
- *pos = pFile->GetPosition();
+#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(__GLIBC__)
+ uint64_t *ppos = (uint64_t *) pos;
+ *ppos = pFile->GetPosition();
#else
pos->__pos = pFile->GetPosition();
#endif
@@ -1508,8 +1510,9 @@ extern "C"
int fd = g_emuFileWrapper.GetDescriptorByStream(stream);
if (fd >= 0)
{
-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
- if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0)
+#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(__GLIBC__)
+ const uint64_t *ppos = (const uint64_t *) pos;
+ if (dll_lseeki64(fd, *ppos, SEEK_SET) >= 0)
#else
if (dll_lseeki64(fd, (__off64_t)pos->__pos, SEEK_SET) >= 0)
#endif
@@ -1531,7 +1534,7 @@ extern "C"
if (fd >= 0)
{
fpos64_t tmpPos;
-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(__GLIBC__)
tmpPos= *pos;
#else
tmpPos.__pos = (off64_t)(pos->__pos);
diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.h b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
index 7869dc2..7c59401 100644
--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h
+++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
@@ -17,7 +17,7 @@
#define _onexit_t void*
#endif
-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(__GLIBC__)
typedef off_t __off_t;
typedef int64_t off64_t;
typedef off64_t __off64_t;
diff --git a/xbmc/cores/DllLoader/exports/wrapper.c b/xbmc/cores/DllLoader/exports/wrapper.c
index 33ab343..23a1bcb 100644
--- a/xbmc/cores/DllLoader/exports/wrapper.c
+++ b/xbmc/cores/DllLoader/exports/wrapper.c
@@ -23,7 +23,7 @@
#include <dirent.h>
#include <dlfcn.h>
-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID)
+#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(__GLIBC__)
typedef off_t __off_t;
typedef int64_t off64_t;
typedef off64_t __off64_t;
--
2.26.2
|