Merge pull request #133 from schnaader/master

Merge __linux/__unix usage from master
This commit is contained in:
Christian Schneider 2021-11-22 23:21:44 +01:00 committed by GitHub
commit 16e871b883
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 32 additions and 36 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -31,7 +31,7 @@
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif /* HAVE_FCNTL_H */
#ifndef LINUX
#ifndef __linux
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#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;
}
}

View file

@ -46,7 +46,7 @@
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif /* HAVE_FCNTL_H */
#ifndef LINUX
#ifndef __linux
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#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

View file

@ -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

View file

@ -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

View file

@ -4,11 +4,9 @@
#include <inttypes.h>
#ifdef _MSC_VER
#define HAVE_STDBOOL_H
#endif
#ifdef UNIX
#ifdef __unix
#include <string.h>
#define MYTHREAD_POSIX
#else

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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)

View file

@ -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 <unistd.h>
#endif
#ifndef UNIX
#ifndef __unix
#include <conio.h>
#include <windows.h>
#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);