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

75 lines
3.1 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
@@ -12,7 +12,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
@@ -27,7 +27,7 @@
#endif
#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
#include "XFileUtils.h"
@@ -1480,7 +1481,7 @@
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;
@@ -1493,8 +1494,9 @@
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
@@ -1509,8 +1511,9 @@
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
@@ -1532,7 +1535,7 @@
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);