file/fdsrc: use struct stat64 on android to match stat64()

Fixes android werror failures:

../plugins/elements/gstfdsrc.c:244:25: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
    if (fstat (src->fd, &stat_results) < 0)
                        ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^
../plugins/elements/gstfdsrc.c:560:23: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^

  if (fstat (fd, &stat_results) < 0)
                 ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^

  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
../../../../../android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^
../plugins/elements/gstfilesrc.c:477:23: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
../../../../../android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^
This commit is contained in:
Matthew Waters 2019-08-28 15:19:54 +10:00
parent 5c3ae3893a
commit 43622119bb
3 changed files with 17 additions and 5 deletions

View file

@ -69,10 +69,14 @@
#define off_t guint64
#endif
#define struct_stat struct stat
#if defined(__BIONIC__) /* Android */
#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
#undef fstat
#define fstat fstat64
#undef struct_stat
#define struct_stat struct stat64
#endif
#endif
@ -327,7 +331,7 @@ gst_fd_sink_render (GstBaseSink * bsink, GstBuffer * buffer)
static gboolean
gst_fd_sink_check_fd (GstFdSink * fdsink, int fd, GError ** error)
{
struct stat stat_results;
struct_stat stat_results;
off_t result;
/* see that it is a valid file descriptor */

View file

@ -80,10 +80,14 @@
#include "gstfdsrc.h"
#define struct_stat struct stat
#ifdef __BIONIC__ /* Android */
#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
#undef fstat
#define fstat fstat64
#undef struct_stat
#define struct_stat struct stat64
#endif
#endif
@ -208,7 +212,7 @@ gst_fd_src_dispose (GObject * obj)
static void
gst_fd_src_update_fd (GstFdSrc * src, guint64 size)
{
struct stat stat_results;
struct_stat stat_results;
GST_DEBUG_OBJECT (src, "fdset %p, old_fd %d, new_fd %d", src->fdset, src->fd,
src->new_fd);
@ -544,7 +548,7 @@ static gboolean
gst_fd_src_get_size (GstBaseSrc * bsrc, guint64 * size)
{
GstFdSrc *src = GST_FD_SRC (bsrc);
struct stat stat_results;
struct_stat stat_results;
if (src->size != -1) {
*size = src->size;

View file

@ -65,10 +65,14 @@
# include <unistd.h>
#endif
#define struct_stat struct stat
#ifdef __BIONIC__ /* Android */
#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
#undef fstat
#define fstat fstat64
#undef struct_stat
#define struct_stat struct stat64
#endif
#endif
@ -430,7 +434,7 @@ gst_file_src_is_seekable (GstBaseSrc * basesrc)
static gboolean
gst_file_src_get_size (GstBaseSrc * basesrc, guint64 * size)
{
struct stat stat_results;
struct_stat stat_results;
GstFileSrc *src;
src = GST_FILE_SRC (basesrc);
@ -460,7 +464,7 @@ static gboolean
gst_file_src_start (GstBaseSrc * basesrc)
{
GstFileSrc *src = GST_FILE_SRC (basesrc);
struct stat stat_results;
struct_stat stat_results;
if (src->filename == NULL || src->filename[0] == '\0')
goto no_filename;