summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--programs/bench.c5
-rw-r--r--programs/lz4cli.c24
-rw-r--r--programs/lz4io.c33
-rw-r--r--tests/fullbench.c16
4 files changed, 8 insertions, 70 deletions
diff --git a/programs/bench.c b/programs/bench.c
index 434da8b..f077b42 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -27,10 +27,11 @@
/* *************************************
* Includes
***************************************/
-#include "util.h" /* Compiler options, UTIL_GetFileSize, UTIL_sleep */
+#include "platform.h" /* Compiler options */
+#include "util.h" /* UTIL_GetFileSize, UTIL_sleep */
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */
-#include <stdio.h> /* fprintf, fopen, ftello64 */
+#include <stdio.h> /* fprintf, fopen, ftello */
#include <time.h> /* clock_t, clock, CLOCKS_PER_SEC */
#include "datagen.h" /* RDG_genBuffer */
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 5bd06d9..e552de7 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -39,17 +39,11 @@
/* #define ENABLE_LZ4C_LEGACY_OPTIONS */
-/**************************************
-* Compiler Options
-***************************************/
-/* cf. http://man7.org/linux/man-pages/man7/feature_test_macros.7.html */
-#define _XOPEN_VERSION 600 /* POSIX.2001, for fileno() within <stdio.h> on unix */
-
-
/****************************
* Includes
*****************************/
-#include "util.h" /* Compiler options, UTIL_HAS_CREATEFILELIST */
+#include "platform.h" /* Compiler options, PLATFORM_POSIX_VERSION */
+#include "util.h" /* UTIL_HAS_CREATEFILELIST */
#include <stdio.h> /* fprintf, getchar */
#include <stdlib.h> /* exit, calloc, free */
#include <string.h> /* strcmp, strlen */
@@ -59,20 +53,6 @@
#include "lz4.h" /* LZ4_VERSION_STRING */
-/*-************************************
-* OS-specific Includes
-**************************************/
-#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) || defined(__DJGPP__) /* https://sourceforge.net/p/predef/wiki/OperatingSystems/ */
-# include <unistd.h> /* isatty */
-# define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
-#elif defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
-# include <io.h> /* _isatty */
-# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
-#else
-# define IS_CONSOLE(stdStream) 0
-#endif
-
-
/*****************************
* Constants
******************************/
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 46daaf7..a9e5515 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -33,10 +33,6 @@
/**************************************
* Compiler Options
**************************************/
-#define _LARGE_FILES /* Large file support on 32-bits AIX */
-#define _FILE_OFFSET_BITS 64 /* off_t width */
-#define _LARGEFILE_SOURCE
-
#if defined(__MINGW32__) && !defined(_POSIX_SOURCE)
# define _POSIX_SOURCE 1 /* disable %llu warnings with MinGW on Windows */
#endif
@@ -44,7 +40,8 @@
/*****************************
* Includes
*****************************/
-#include "util.h" /* Compiler options, UTIL_getFileStat */
+#include "platform.h" /* Compiler options */
+#include "util.h" /* UTIL_getFileStat */
#include <stdio.h> /* fprintf, fopen, fread, stdin, stdout, fflush, getchar */
#include <stdlib.h> /* malloc, free */
#include <string.h> /* strcmp, strlen */
@@ -57,32 +54,6 @@
#include "lz4frame.h"
-/******************************
-* OS-specific Includes
-******************************/
-#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32)
-# include <fcntl.h> /* _O_BINARY */
-# include <io.h> /* _setmode, _fileno, _get_osfhandle */
-# if !defined(__DJGPP__)
-# define SET_BINARY_MODE(file) { int unused=_setmode(_fileno(file), _O_BINARY); (void)unused; }
-# include <windows.h> /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */
-# include <winioctl.h> /* FSCTL_SET_SPARSE */
-# define SET_SPARSE_FILE_MODE(file) { DWORD dw; DeviceIoControl((HANDLE) _get_osfhandle(_fileno(file)), FSCTL_SET_SPARSE, 0, 0, 0, 0, &dw, 0); }
-# if defined(_MSC_VER) && (_MSC_VER >= 1400) /* Avoid MSVC fseek()'s 2GiB barrier */
-# define fseek _fseeki64
-# endif
-# else
-# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
-# define SET_SPARSE_FILE_MODE(file)
-# endif
-#else
-# if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(__APPLE__) && defined(__MACH__))
-# define fseek fseeko
-# endif
-# define SET_BINARY_MODE(file)
-# define SET_SPARSE_FILE_MODE(file)
-#endif
-
/*****************************
* Constants
diff --git a/tests/fullbench.c b/tests/fullbench.c
index 7d54492..df6d4fc 100644
--- a/tests/fullbench.c
+++ b/tests/fullbench.c
@@ -23,20 +23,6 @@
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
*/
-/**************************************
-* Compiler Options
-**************************************/
-/* Disable some Visual warning messages */
-#define _CRT_SECURE_NO_WARNINGS
-#define _CRT_SECURE_NO_DEPRECATE /* VS2005 */
-
-/* Unix Large Files support (>4GB) */
-#if (defined(__sun__) && (!defined(__LP64__))) // Sun Solaris 32-bits requires specific definitions
-# define _LARGEFILE_SOURCE
-# define _FILE_OFFSET_BITS 64
-#elif ! defined(__LP64__) // No point defining Large file for 64 bit
-# define _LARGEFILE64_SOURCE
-#endif
// S_ISREG & gettimeofday() are not supported by MSVC
#if defined(_MSC_VER) || defined(_WIN32)
@@ -48,7 +34,7 @@
* Includes
**************************************/
#include <stdlib.h> /* malloc, free */
-#include <stdio.h> /* fprintf, fopen, ftello64 */
+#include <stdio.h> /* fprintf, fopen, ftello */
#include <sys/types.h> /* stat64 */
#include <sys/stat.h> /* stat64 */
#include <string.h> /* strcmp */