sanitise large file support

This commit is contained in:
Dave Murphy 2018-05-06 14:56:36 +01:00 committed by fincs
parent d2a2a3db26
commit 48d96a7033
2 changed files with 6 additions and 14 deletions

View File

@ -12,6 +12,7 @@ AC_CANONICAL_HOST
AC_PROG_CC
AC_SYS_LARGEFILE
PKG_CHECK_MODULES([LZ4],
[liblz4 >= 1.7.1 liblz4 < 100],

View File

@ -7,8 +7,6 @@
#include <wchar.h>
#endif
#define __USE_LARGEFILE64
#define MAX_SWITCHPATH 0x300
typedef enum {
@ -22,16 +20,9 @@ inline int fseeko64(FILE *__stream, long long __off, int __whence)
{
return _fseeki64(__stream, __off, __whence);
}
#elif __APPLE__ || __CYGWIN__
// OS X file I/O is 64bit
#define fseeko64 fseek
#elif __linux__
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
#else
/* fseeko is guaranteed by POSIX, hopefully the OS made their off_t definition 64-bit;
* known sane on FreeBSD and OpenBSD.
*/
#define fseeko64 fseeko
/* off_t is 64-bit with large file support */
#define fseeko64 fseek
#endif
#ifdef _WIN32
@ -53,12 +44,12 @@ typedef struct _stati64 os_stat64_t;
typedef char oschar_t; /* utf-8 */
typedef DIR osdir_t;
typedef struct dirent osdirent_t;
typedef struct stat64 os_stat64_t;
typedef struct stat os_stat64_t;
#define os_fopen fopen
#define os_opendir opendir
#define os_readdir readdir
#define os_stat stat64
#define os_stat stat
#define os_fclose fclose
#define OS_MODE_READ "rb"
@ -85,4 +76,4 @@ void filepath_os_append(filepath_t *fpath, oschar_t *path);
void filepath_append(filepath_t *fpath, const char *format, ...);
void filepath_append_n(filepath_t *fpath, uint32_t n, const char *format, ...);
void filepath_set(filepath_t *fpath, const char *path);
oschar_t *filepath_get(filepath_t *fpath);
oschar_t *filepath_get(filepath_t *fpath);