diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aed70e..36770d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,7 @@ else() endif() if (UNIX) - set(CMAKE_C_FLAGS "-DLINUX -DUNIX -DHAVE_STDBOOL_H") set(CMAKE_C_STANDARD 99) - set(CMAKE_CXX_FLAGS "-DUNIX") set(CMAKE_CXX_STANDARD 11) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) diff --git a/contrib/bzip2/Makefile b/contrib/bzip2/Makefile index 7d3ca28..847a1b7 100644 --- a/contrib/bzip2/Makefile +++ b/contrib/bzip2/Makefile @@ -1,5 +1,5 @@ OBJECTS = bzlib.o blocksort.o crctable.o compress.o decompress.o huffman.o randtable.o -CFLAGS = -DLINUX -D_FILE_OFFSET_BITS=64 -m64 -O2 -Wall +CFLAGS = -D_FILE_OFFSET_BITS=64 -m64 -O2 -Wall .PHONY: all all: $(OBJECTS) diff --git a/contrib/bzip2/Makefile.32 b/contrib/bzip2/Makefile.32 index 2784279..8caa7b7 100644 --- a/contrib/bzip2/Makefile.32 +++ b/contrib/bzip2/Makefile.32 @@ -1,5 +1,5 @@ OBJECTS = bzlib.o blocksort.o crctable.o compress.o decompress.o huffman.o randtable.o -CFLAGS = -DLINUX -D_FILE_OFFSET_BITS=64 -O2 -Wall +CFLAGS = -D_FILE_OFFSET_BITS=64 -O2 -Wall .PHONY: all all: $(OBJECTS) diff --git a/contrib/giflib/Makefile b/contrib/giflib/Makefile index 51ec0ac..6bf1fbd 100644 --- a/contrib/giflib/Makefile +++ b/contrib/giflib/Makefile @@ -1,5 +1,5 @@ OBJECTS = gifalloc.o gif_err.o dgif_lib_gcc.o egif_lib_gcc.o -CFLAGS = -DLINUX -D_FILE_OFFSET_BITS=64 -m64 -O2 -Wall +CFLAGS = -D_FILE_OFFSET_BITS=64 -m64 -O2 -Wall .PHONY: all all: $(OBJECTS) diff --git a/contrib/giflib/Makefile.32 b/contrib/giflib/Makefile.32 index 6b2c98e..30ce328 100644 --- a/contrib/giflib/Makefile.32 +++ b/contrib/giflib/Makefile.32 @@ -1,5 +1,5 @@ OBJECTS = gifalloc.o gif_err.o dgif_lib_gcc.o egif_lib_gcc.o -CFLAGS = -DLINUX -D_FILE_OFFSET_BITS=64 -O2 -Wall +CFLAGS = -D_FILE_OFFSET_BITS=64 -O2 -Wall .PHONY: all all: $(OBJECTS) diff --git a/contrib/giflib/dgif_lib_gcc.c b/contrib/giflib/dgif_lib_gcc.c index 2d57afc..7eea2a5 100644 --- a/contrib/giflib/dgif_lib_gcc.c +++ b/contrib/giflib/dgif_lib_gcc.c @@ -31,7 +31,7 @@ #ifdef HAVE_FCNTL_H #include #endif /* HAVE_FCNTL_H */ -#ifndef LINUX +#ifndef __linux #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ @@ -184,7 +184,7 @@ DGifOpenFileName(const char *FileName) { int FileHandle; GifFileType *GifFile; - #ifndef LINUX + #ifndef __linux if ((FileHandle = open(FileName, O_RDONLY | O_BINARY)) == -1) { #else // TODO: Does this work? @@ -1150,4 +1150,4 @@ DGifBufferedInput(GifFileType * GifFile, } return GIF_OK; -} \ No newline at end of file +} diff --git a/contrib/giflib/egif_lib_gcc.c b/contrib/giflib/egif_lib_gcc.c index ddc5a12..56e65f1 100644 --- a/contrib/giflib/egif_lib_gcc.c +++ b/contrib/giflib/egif_lib_gcc.c @@ -46,7 +46,7 @@ #ifdef HAVE_FCNTL_H #include #endif /* HAVE_FCNTL_H */ -#ifndef LINUX +#ifndef __linux #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ @@ -107,7 +107,7 @@ EGifOpenFileName(const char *FileName, GifFileType *GifFile; if (TestExistance) - #ifndef LINUX + #ifndef __linux FileHandle = open(FileName, O_WRONLY | O_CREAT | O_EXCL | O_BINARY #else // TODO: Does this work? @@ -119,7 +119,7 @@ EGifOpenFileName(const char *FileName, , S_IRUSR | S_IWUSR); #endif else - #ifndef LINUX + #ifndef __linux FileHandle = open(FileName, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY #else // TODO: Does this work? @@ -175,7 +175,7 @@ EGifOpenFileHandle(int FileHandle) { return NULL; } - #ifndef LINUX + #ifndef __linux setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */ #endif diff --git a/contrib/liblzma/Makefile b/contrib/liblzma/Makefile index b358ff3..1ee27ef 100644 --- a/contrib/liblzma/Makefile +++ b/contrib/liblzma/Makefile @@ -1,4 +1,4 @@ -CFLAGS = -g -c -std=gnu99 -DHAVE__BOOL -DUNIX -D_FILE_OFFSET_BITS=64 -m64 -O2 -Wno-implicit-function-declaration -pthread +CFLAGS = -g -c -std=gnu99 -DHAVE__BOOL -D_FILE_OFFSET_BITS=64 -m64 -O2 -Wno-implicit-function-declaration -pthread LIBLZMA_INCLUDES = -Iapi/ -Icheck/ -Icommon/ -Idelta/ -Ilz/ -Ilzma/ -Irangecoder/ -Isimple/ LIBLZMA_C = common/tuklib_physmem.c common/tuklib_cpucores.c common/common.c common/block_util.c common/easy_preset.c common/filter_common.c common/hardware_physmem.c common/index.c common/stream_flags_common.c common/vli_size.c common/alone_encoder.c common/block_buffer_encoder.c common/block_encoder.c common/block_header_encoder.c common/easy_buffer_encoder.c common/easy_encoder.c common/easy_encoder_memusage.c common/filter_buffer_encoder.c common/filter_encoder.c common/filter_flags_encoder.c common/index_encoder.c common/stream_buffer_encoder.c common/stream_encoder.c common/stream_flags_encoder.c common/vli_encoder.c common/hardware_cputhreads.c common/outqueue.c common/stream_encoder_mt.c common/alone_decoder.c common/auto_decoder.c common/block_buffer_decoder.c common/block_decoder.c common/block_header_decoder.c common/easy_decoder_memusage.c common/filter_buffer_decoder.c common/filter_decoder.c common/filter_flags_decoder.c common/index_decoder.c common/index_hash.c common/stream_decoder.c common/stream_buffer_decoder.c common/stream_flags_decoder.c common/vli_decoder.c check/check.c check/crc32_table.c check/crc32_fast.c check/crc64_table.c check/crc64_fast.c check/sha256.c lz/lz_encoder.c lz/lz_encoder_mf.c lz/lz_decoder.c lzma/lzma_encoder.c lzma/lzma_encoder_presets.c lzma/lzma_encoder_optimum_fast.c lzma/lzma_encoder_optimum_normal.c lzma/fastpos_table.c lzma/lzma_decoder.c lzma/lzma2_encoder.c lzma/lzma2_decoder.c rangecoder/price_table.c delta/delta_common.c delta/delta_encoder.c delta/delta_decoder.c simple/simple_coder.c simple/simple_encoder.c simple/simple_decoder.c simple/x86.c simple/powerpc.c simple/ia64.c simple/arm.c simple/armthumb.c simple/sparc.c diff --git a/contrib/liblzma/Makefile.32 b/contrib/liblzma/Makefile.32 index 4c76f2c..c9e85b0 100644 --- a/contrib/liblzma/Makefile.32 +++ b/contrib/liblzma/Makefile.32 @@ -1,4 +1,4 @@ -CFLAGS = -g -c -std=gnu99 -DHAVE__BOOL -DUNIX -D_FILE_OFFSET_BITS=64 -O2 -Wno-implicit-function-declaration -pthread +CFLAGS = -g -c -std=gnu99 -DHAVE__BOOL -D_FILE_OFFSET_BITS=64 -O2 -Wno-implicit-function-declaration -pthread LIBLZMA_INCLUDES = -Iapi/ -Icheck/ -Icommon/ -Idelta/ -Ilz/ -Ilzma/ -Irangecoder/ -Isimple/ LIBLZMA_C = common/tuklib_physmem.c common/tuklib_cpucores.c common/common.c common/block_util.c common/easy_preset.c common/filter_common.c common/hardware_physmem.c common/index.c common/stream_flags_common.c common/vli_size.c common/alone_encoder.c common/block_buffer_encoder.c common/block_encoder.c common/block_header_encoder.c common/easy_buffer_encoder.c common/easy_encoder.c common/easy_encoder_memusage.c common/filter_buffer_encoder.c common/filter_encoder.c common/filter_flags_encoder.c common/index_encoder.c common/stream_buffer_encoder.c common/stream_encoder.c common/stream_flags_encoder.c common/vli_encoder.c common/hardware_cputhreads.c common/outqueue.c common/stream_encoder_mt.c common/alone_decoder.c common/auto_decoder.c common/block_buffer_decoder.c common/block_decoder.c common/block_header_decoder.c common/easy_decoder_memusage.c common/filter_buffer_decoder.c common/filter_decoder.c common/filter_flags_decoder.c common/index_decoder.c common/index_hash.c common/stream_decoder.c common/stream_buffer_decoder.c common/stream_flags_decoder.c common/vli_decoder.c check/check.c check/crc32_table.c check/crc32_fast.c check/crc64_table.c check/crc64_fast.c check/sha256.c lz/lz_encoder.c lz/lz_encoder_mf.c lz/lz_decoder.c lzma/lzma_encoder.c lzma/lzma_encoder_presets.c lzma/lzma_encoder_optimum_fast.c lzma/lzma_encoder_optimum_normal.c lzma/fastpos_table.c lzma/lzma_decoder.c lzma/lzma2_encoder.c lzma/lzma2_decoder.c rangecoder/price_table.c delta/delta_common.c delta/delta_encoder.c delta/delta_decoder.c simple/simple_coder.c simple/simple_encoder.c simple/simple_decoder.c simple/x86.c simple/powerpc.c simple/ia64.c simple/arm.c simple/armthumb.c simple/sparc.c diff --git a/contrib/liblzma/common/sysdefs_schnaader.h b/contrib/liblzma/common/sysdefs_schnaader.h index bd5b0b8..7ac3658 100644 --- a/contrib/liblzma/common/sysdefs_schnaader.h +++ b/contrib/liblzma/common/sysdefs_schnaader.h @@ -4,11 +4,9 @@ #include -#ifdef _MSC_VER #define HAVE_STDBOOL_H -#endif -#ifdef UNIX +#ifdef __unix #include #define MYTHREAD_POSIX #else diff --git a/contrib/packjpg/Makefile b/contrib/packjpg/Makefile index 6debe79..7f0473f 100644 --- a/contrib/packjpg/Makefile +++ b/contrib/packjpg/Makefile @@ -1,5 +1,5 @@ OBJECTS = bitops.o aricoder.o packjpg.o -CFLAGS = -m64 -O3 -DUNIX -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fomit-frame-pointer +CFLAGS = -m64 -O3 -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fomit-frame-pointer .PHONY: all all: $(OBJECTS) diff --git a/contrib/packjpg/Makefile.32 b/contrib/packjpg/Makefile.32 index cb06e69..5fa5c03 100644 --- a/contrib/packjpg/Makefile.32 +++ b/contrib/packjpg/Makefile.32 @@ -1,5 +1,5 @@ OBJECTS = bitops.o aricoder.o packjpg.o -CFLAGS = -O3 -DUNIX -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fomit-frame-pointer +CFLAGS = -O3 -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fomit-frame-pointer .PHONY: all all: $(OBJECTS) diff --git a/contrib/packmp3/Makefile b/contrib/packmp3/Makefile index 86b03f5..2066d4b 100644 --- a/contrib/packmp3/Makefile +++ b/contrib/packmp3/Makefile @@ -1,5 +1,5 @@ OBJECTS = huffmp3.o packmp3.o -CFLAGS = -m64 -O3 -DUNIX -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fomit-frame-pointer +CFLAGS = -m64 -O3 -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fomit-frame-pointer .PHONY: all all: $(OBJECTS) diff --git a/contrib/packmp3/Makefile.32 b/contrib/packmp3/Makefile.32 index 45adb27..2fd9c82 100644 --- a/contrib/packmp3/Makefile.32 +++ b/contrib/packmp3/Makefile.32 @@ -1,5 +1,5 @@ OBJECTS = huffmp3.o packmp3.o -CFLAGS = -O3 -DUNIX -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fomit-frame-pointer +CFLAGS = -O3 -DBUILD_LIB -Wall -pedantic -funroll-loops -ffast-math -fomit-frame-pointer .PHONY: all all: $(OBJECTS) diff --git a/contrib/preflate/support/filestream.cpp b/contrib/preflate/support/filestream.cpp index 1246674..43bf21d 100644 --- a/contrib/preflate/support/filestream.cpp +++ b/contrib/preflate/support/filestream.cpp @@ -31,7 +31,7 @@ size_t FileStream::write(const unsigned char* buffer, const size_t size) { } uint64_t FileStream::tell() const { - #ifndef UNIX + #ifndef __unix return _ftelli64(_f); #else return ftello(_f); @@ -39,7 +39,7 @@ uint64_t FileStream::tell() const { } uint64_t FileStream::seek(const uint64_t newPos) { uint64_t oldPos = tell(); - #ifndef UNIX + #ifndef __unix _fseeki64(_f, newPos, SEEK_SET); #else fseeko(_f, newPos, SEEK_SET); diff --git a/contrib/zlib/Makefile b/contrib/zlib/Makefile index 9f21b51..0ef4d6a 100644 --- a/contrib/zlib/Makefile +++ b/contrib/zlib/Makefile @@ -1,5 +1,5 @@ OBJECTS = adler32.o crc32.o zutil.o trees.o inftrees.o inffast.o inflate.o deflate.o -CFLAGS = -m64 -DLINUX -D_FILE_OFFSET_BITS=64 -O2 -Wall +CFLAGS = -m64 -D_FILE_OFFSET_BITS=64 -O2 -Wall .PHONY: all all: $(OBJECTS) diff --git a/contrib/zlib/Makefile.32 b/contrib/zlib/Makefile.32 index 471af0f..782952e 100644 --- a/contrib/zlib/Makefile.32 +++ b/contrib/zlib/Makefile.32 @@ -1,5 +1,5 @@ OBJECTS = adler32.o crc32.o zutil.o trees.o inftrees.o inffast.o inflate.o deflate.o -CFLAGS = -DLINUX -D_FILE_OFFSET_BITS=64 -O2 -Wall +CFLAGS = -D_FILE_OFFSET_BITS=64 -O2 -Wall .PHONY: all all: $(OBJECTS) diff --git a/precomp.cpp b/precomp.cpp index 090bb8b..34f8f5f 100644 --- a/precomp.cpp +++ b/precomp.cpp @@ -24,7 +24,7 @@ #define V_STATE "DEVELOPMENT" //#define V_MSG "USE FOR TESTING ONLY" #define V_MSG "USE AT YOUR OWN RISK!" -#ifdef UNIX +#ifdef __unix #define V_OS "Unix" #else #define V_OS "Windows" @@ -79,7 +79,7 @@ #include #endif -#ifndef UNIX +#ifndef __unix #include #include #define PATH_DELIM '\\' @@ -1264,7 +1264,7 @@ int init(int argc, char* argv[]) { printf("\n"); exit(0); } else { - #ifndef UNIX + #ifndef __unix printf("\n\n"); #else printf("\n"); @@ -5958,7 +5958,7 @@ size_t own_fread(void *ptr, size_t size, size_t count, FILE* stream) { } void seek_64(FILE* f, unsigned long long pos) { - #ifndef UNIX + #ifndef __unix fpos_t fpt_pos = pos; fsetpos(f, &fpt_pos); #else @@ -5967,7 +5967,7 @@ void seek_64(FILE* f, unsigned long long pos) { } unsigned long long tell_64(FILE* f) { - #ifndef UNIX + #ifndef __unix fpos_t fpt_pos; fgetpos(f, &fpt_pos); return fpt_pos; @@ -7793,7 +7793,7 @@ wchar_t* convertCharArrayToLPCWSTR(const char* charArray) #endif long long fileSize64(char* filename) { - #ifndef UNIX + #ifndef __unix unsigned long s1 = 0, s2 = 0; #ifdef _MSC_VER @@ -7823,7 +7823,7 @@ long long fileSize64(char* filename) { long long result=ftello(f); safe_fclose(&f); return result; - #endif // UNIX + #endif // __unix } void init_temp_files() { @@ -8498,7 +8498,7 @@ int auto_detected_thread_count() { // because of the 2 or 3 GiB limit on these systems int lzma_max_memory_default() { int max_memory = 2048; - #ifndef UNIX + #ifndef __unix #ifndef BIT64 max_memory = 1024; #endif @@ -8576,7 +8576,7 @@ void denit_decompress_otf() { // get current time in ms long long get_time_ms() { - #ifndef UNIX + #ifndef __unix return GetTickCount(); #else timeval t; @@ -8603,7 +8603,7 @@ void printf_time(long long t) { } char get_char_with_echo() { - #ifndef UNIX + #ifndef __unix return getche(); #else return fgetc(stdin);