1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Fix: Define *_OFF_T macros according to its size

Add a check for the off_t size and define the SCN_OFF_T and PRI_OFF_T
macros accordingly, to avoid compiler warnings for mismatching sizes.
This commit is contained in:
Marvin Scholz 2021-05-08 17:41:14 +02:00
parent fde473477b
commit 09a14349d5
2 changed files with 11 additions and 4 deletions

View File

@ -134,6 +134,8 @@ AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_CHECK_SIZEOF([off_t])
dnl Checks for required libraries
dnl

View File

@ -21,22 +21,27 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <inttypes.h>
#ifdef HAVE_POLL
#include <poll.h>
#endif
#if SIZEOF_OFF_T >= 8
#define SCN_OFF_T SCNd64
#define PRI_OFF_T PRId64
#else
#define SCN_OFF_T SCNd32
#define PRI_OFF_T PRId32
#endif
#ifndef _WIN32
#include <unistd.h>
#include <sys/time.h>
#include <sys/socket.h>
#define SCN_OFF_T SCNdMAX
#define PRI_OFF_T PRIdMAX
#else
#include <winsock2.h>
#include <windows.h>
#define SCN_OFF_T "ld"
#define PRI_OFF_T "ld"
#ifndef S_ISREG
#define S_ISREG(mode) ((mode) & _S_IFREG)
#endif