void-packages/srcpkgs/kodi/patches/fix-fileemu.patch

75 lines
3.2 KiB
Diff

--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h 2019-01-30 19:20:09.336910851 +0100
+++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h 2019-01-30 19:20:25.423668836 +0100
@@ -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;
--- a/xbmc/cores/DllLoader/exports/wrapper.c 2019-01-30 19:24:16.396348561 +0100
+++ b/xbmc/cores/DllLoader/exports/wrapper.c 2019-01-30 19:25:38.562176774 +0100
@@ -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;
--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp 2019-01-30 19:29:02.249253971 +0100
+++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp 2019-01-30 19:39:34.911053272 +0100
@@ -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);