From 160478c63fefed17e7d839c9f8069dd211cbdd7d Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 23 Jul 2020 14:29:20 +0200 Subject: [PATCH 1/7] Test ARM compiler macro --- contrib/giflib/egif_lib_gcc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/giflib/egif_lib_gcc.c b/contrib/giflib/egif_lib_gcc.c index 34cb0dc..0ee551c 100644 --- a/contrib/giflib/egif_lib_gcc.c +++ b/contrib/giflib/egif_lib_gcc.c @@ -113,7 +113,11 @@ EGifOpenFileName(const char *FileName, // TODO: Does this work? FileHandle = open(FileName, O_WRONLY | O_CREAT | O_EXCL #endif + #ifndef __arm__ , S_IREAD | S_IWRITE); + #else + , S_IRUSR | S_IWUSR); + #endif else #ifndef LINUX FileHandle = open(FileName, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY @@ -121,7 +125,11 @@ EGifOpenFileName(const char *FileName, // TODO: Does this work? FileHandle = open(FileName, O_WRONLY | O_CREAT | O_TRUNC #endif + #ifndef __arm__ , S_IREAD | S_IWRITE); + #else + , S_IRUSR | S_IWUSR); + #endif if (FileHandle == -1) { _GifError = E_GIF_ERR_OPEN_FAILED; From 554535e56ca9c58ac520f1b645993296d5524e11 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 23 Jul 2020 15:02:20 +0200 Subject: [PATCH 2/7] Test 2 --- contrib/giflib/egif_lib_gcc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/giflib/egif_lib_gcc.c b/contrib/giflib/egif_lib_gcc.c index 0ee551c..ae7212d 100644 --- a/contrib/giflib/egif_lib_gcc.c +++ b/contrib/giflib/egif_lib_gcc.c @@ -113,7 +113,7 @@ EGifOpenFileName(const char *FileName, // TODO: Does this work? FileHandle = open(FileName, O_WRONLY | O_CREAT | O_EXCL #endif - #ifndef __arm__ + #ifndef S_IREAD , S_IREAD | S_IWRITE); #else , S_IRUSR | S_IWUSR); @@ -125,7 +125,7 @@ EGifOpenFileName(const char *FileName, // TODO: Does this work? FileHandle = open(FileName, O_WRONLY | O_CREAT | O_TRUNC #endif - #ifndef __arm__ + #ifndef S_IREAD , S_IREAD | S_IWRITE); #else , S_IRUSR | S_IWUSR); From 3b6c957a2ccb69db8cb48681f1f5454838d1c5aa Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 23 Jul 2020 15:04:30 +0200 Subject: [PATCH 3/7] Test 3 --- contrib/giflib/egif_lib_gcc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/giflib/egif_lib_gcc.c b/contrib/giflib/egif_lib_gcc.c index ae7212d..ddc5a12 100644 --- a/contrib/giflib/egif_lib_gcc.c +++ b/contrib/giflib/egif_lib_gcc.c @@ -113,7 +113,7 @@ EGifOpenFileName(const char *FileName, // TODO: Does this work? FileHandle = open(FileName, O_WRONLY | O_CREAT | O_EXCL #endif - #ifndef S_IREAD + #ifdef S_IREAD , S_IREAD | S_IWRITE); #else , S_IRUSR | S_IWUSR); @@ -125,7 +125,7 @@ EGifOpenFileName(const char *FileName, // TODO: Does this work? FileHandle = open(FileName, O_WRONLY | O_CREAT | O_TRUNC #endif - #ifndef S_IREAD + #ifdef S_IREAD , S_IREAD | S_IWRITE); #else , S_IRUSR | S_IWUSR); From 4a8fa97c630e963d78d1a123fdb4fc97b17a341b Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 23 Jul 2020 15:48:28 +0200 Subject: [PATCH 4/7] add atomic library (seems to be needed on older ARM devices) --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c08e75..b3d3c79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,7 +149,7 @@ add_executable(precomp ${GIF_SRC} ${BZIP_SRC} ${ZLIB_SRC} ${PACKARI_SRC} ${BRUNSLI_SRC} ${BROTLI_SRC} ${PRECOMP_SRC} ${PRECOMP_HDR}) if (UNIX) - target_link_libraries(precomp Threads::Threads) + target_link_libraries(precomp Threads::Threads atomic) endif() -install(TARGETS precomp DESTINATION bin) \ No newline at end of file +install(TARGETS precomp DESTINATION bin) From 746c68e3d27e8d7db1b8ebd2f5d0cd704f37fbe3 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 23 Jul 2020 16:08:52 +0200 Subject: [PATCH 5/7] Make macOS happy --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3d3c79..c7eb75a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,7 +149,11 @@ add_executable(precomp ${GIF_SRC} ${BZIP_SRC} ${ZLIB_SRC} ${PACKARI_SRC} ${BRUNSLI_SRC} ${BROTLI_SRC} ${PRECOMP_SRC} ${PRECOMP_HDR}) if (UNIX) - target_link_libraries(precomp Threads::Threads atomic) + if (NOT APPLE) + target_link_libraries(precomp Threads::Threads atomic) + else() + target_link_libraries(precomp Threads::Threads) + endif() endif() install(TARGETS precomp DESTINATION bin) From 8289e7752347d6b04b1a556d8fb19830f2a0fa07 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 23 Jul 2020 17:02:04 +0200 Subject: [PATCH 6/7] use signed char (because char defaults to unsigned char on clang ARM) --- contrib/packjpg/packjpg.cpp | 2 +- contrib/packmp3/packmp3.cpp | 46 ++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/contrib/packjpg/packjpg.cpp b/contrib/packjpg/packjpg.cpp index d08b612..9b0807f 100644 --- a/contrib/packjpg/packjpg.cpp +++ b/contrib/packjpg/packjpg.cpp @@ -556,7 +556,7 @@ INTERN unsigned int* scnp = NULL; // scan start positions in hu INTERN int rstc = 0 ; // count of restart markers INTERN int scnc = 0 ; // count of scans INTERN int rsti = 0 ; // restart interval -INTERN char padbit = -1 ; // padbit (for huffman coding) +INTERN signed char padbit = -1 ; // padbit (for huffman coding) INTERN unsigned char* rst_err = NULL; // number of wrong-set RST markers per scan INTERN unsigned char* zdstdata[4] = { NULL }; // zero distribution (# of non-zeroes) lists (for higher 7x7 block) diff --git a/contrib/packmp3/packmp3.cpp b/contrib/packmp3/packmp3.cpp index d70afed..1412404 100644 --- a/contrib/packmp3/packmp3.cpp +++ b/contrib/packmp3/packmp3.cpp @@ -219,29 +219,29 @@ INTERN int g_bitrate = 0; // bit rate - global or zero for vbr global variables: frame analysis info ----------------------------------------------- */ -INTERN char i_mpeg = -1; // mpeg - non changing -INTERN char i_layer = -1; // layer - non changing -INTERN char i_samplerate = -1; // sample rate - non changing -INTERN char i_bitrate = -1; // bit rate - value or -1 (variable) -INTERN char i_protection = -1; // checksum - for all (1), none (0) or some (-1) frames -INTERN char i_padding = -1; // padding - for all (1), none (0) or some (-1) frames -INTERN char i_privbit = -1; // private bit - value or -1 (variable) -INTERN char i_channels = -1; // channel mode - non changing -INTERN char i_stereo_ms = -1; // ms stereo - for all (1), none (0) or some (-1) frames -INTERN char i_stereo_int = -1; // int stereo - for all (1), none (0) or some (-1) frames -INTERN char i_copyright = -1; // copyright bit - value or -1 (variable) -INTERN char i_original = -1; // original bit - value or -1 (variable) -INTERN char i_emphasis = -1; // emphasis - value or -1 (variable) -INTERN char i_padbits = -1; // side info padding bits - value or -1 (variable) -INTERN char i_bit_res = -1; // bit reservoir - is used (1) or not used (0) -INTERN char i_share = -1; // scalefactor sharing - is used (1) or not used (0) -INTERN char i_sblocks = -1; // special blocks - are used (1) or not used (0) -INTERN char i_mixed = -1; // mixed blocks - are used (1) or not used (0) -INTERN char i_preemphasis = -1; // preemphasis - value or -1 (variable) -INTERN char i_coarse = -1; // coarse scalefactors - value or -1 (variable) -INTERN char i_sbgain = -1; // subblock gain - used properly (1), not used (0) or used for non-short (-1) -INTERN char i_aux_h = -1; // auxiliary data handling - none (0), at begin and end (1), between frames (-1) -INTERN char i_sb_diff = -1; // special blocks diffs between ch0 and ch1 - none (0) or some (-1) +INTERN signed char i_mpeg = -1; // mpeg - non changing +INTERN signed char i_layer = -1; // layer - non changing +INTERN signed char i_samplerate = -1; // sample rate - non changing +INTERN signed char i_bitrate = -1; // bit rate - value or -1 (variable) +INTERN signed char i_protection = -1; // checksum - for all (1), none (0) or some (-1) frames +INTERN signed char i_padding = -1; // padding - for all (1), none (0) or some (-1) frames +INTERN signed char i_privbit = -1; // private bit - value or -1 (variable) +INTERN signed char i_channels = -1; // channel mode - non changing +INTERN signed char i_stereo_ms = -1; // ms stereo - for all (1), none (0) or some (-1) frames +INTERN signed char i_stereo_int = -1; // int stereo - for all (1), none (0) or some (-1) frames +INTERN signed char i_copyright = -1; // copyright bit - value or -1 (variable) +INTERN signed char i_original = -1; // original bit - value or -1 (variable) +INTERN signed char i_emphasis = -1; // emphasis - value or -1 (variable) +INTERN signed char i_padbits = -1; // side info padding bits - value or -1 (variable) +INTERN signed char i_bit_res = -1; // bit reservoir - is used (1) or not used (0) +INTERN signed char i_share = -1; // scalefactor sharing - is used (1) or not used (0) +INTERN signed char i_sblocks = -1; // special blocks - are used (1) or not used (0) +INTERN signed char i_mixed = -1; // mixed blocks - are used (1) or not used (0) +INTERN signed char i_preemphasis = -1; // preemphasis - value or -1 (variable) +INTERN signed char i_coarse = -1; // coarse scalefactors - value or -1 (variable) +INTERN signed char i_sbgain = -1; // subblock gain - used properly (1), not used (0) or used for non-short (-1) +INTERN signed char i_aux_h = -1; // auxiliary data handling - none (0), at begin and end (1), between frames (-1) +INTERN signed char i_sb_diff = -1; // special blocks diffs between ch0 and ch1 - none (0) or some (-1) /* ----------------------------------------------- From 2cceeebe06950b33b197f01a0781d17abd3c9253 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 23 Jul 2020 17:06:14 +0200 Subject: [PATCH 7/7] more signed char --- contrib/packmp3/packmp3.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/packmp3/packmp3.cpp b/contrib/packmp3/packmp3.cpp index 1412404..8cf59ad 100644 --- a/contrib/packmp3/packmp3.cpp +++ b/contrib/packmp3/packmp3.cpp @@ -1547,10 +1547,10 @@ INTERN bool read_mp3( void ) int main_data_begin; int main_data_end; - char mpeg = -1; - char layer = -1; - char samples = -1; - char channels = -1; + signed char mpeg = -1; + signed char layer = -1; + signed char samples = -1; + signed char channels = -1; abytewriter* data_writer; mp3Frame* frame = NULL;