mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -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:
parent
fde473477b
commit
09a14349d5
@ -134,6 +134,8 @@ AC_TYPE_SIZE_T
|
|||||||
AC_TYPE_SSIZE_T
|
AC_TYPE_SSIZE_T
|
||||||
AC_TYPE_UID_T
|
AC_TYPE_UID_T
|
||||||
|
|
||||||
|
AC_CHECK_SIZEOF([off_t])
|
||||||
|
|
||||||
dnl Checks for required libraries
|
dnl Checks for required libraries
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
|
13
src/fserve.c
13
src/fserve.c
@ -21,22 +21,27 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifdef HAVE_POLL
|
#ifdef HAVE_POLL
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#endif
|
#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
|
#ifndef _WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#define SCN_OFF_T SCNdMAX
|
|
||||||
#define PRI_OFF_T PRIdMAX
|
|
||||||
#else
|
#else
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define SCN_OFF_T "ld"
|
|
||||||
#define PRI_OFF_T "ld"
|
|
||||||
#ifndef S_ISREG
|
#ifndef S_ISREG
|
||||||
#define S_ISREG(mode) ((mode) & _S_IFREG)
|
#define S_ISREG(mode) ((mode) & _S_IFREG)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user