summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorPrzemyslaw Skibinski <inikep@gmail.com>2016-12-20 17:05:43 (GMT)
committerPrzemyslaw Skibinski <inikep@gmail.com>2016-12-20 17:05:43 (GMT)
commit2cfef13952c4c7c3d79a9a4748653526d6c85eb0 (patch)
treeb7744b5a3ef7306be0195bd38b4a384630d8052d /programs
parentbb69cdf2583a56c6c703f5b91aae0632912f5a8a (diff)
downloadlz4-2cfef13952c4c7c3d79a9a4748653526d6c85eb0.zip
lz4-2cfef13952c4c7c3d79a9a4748653526d6c85eb0.tar.gz
lz4-2cfef13952c4c7c3d79a9a4748653526d6c85eb0.tar.bz2
executables use platform.h
Diffstat (limited to 'programs')
-rw-r--r--programs/bench.c5
-rw-r--r--programs/lz4cli.c24
-rw-r--r--programs/lz4io.c33
3 files changed, 7 insertions, 55 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