Skip to content

Commit

Permalink
[cmp] update Bled to latest
Browse files Browse the repository at this point in the history
* This mostly updates the ZSTD code to latest and properly removes all debug message.
* Also switch MinGW from gnu99 to gnu11.
  • Loading branch information
pbatard committed Nov 27, 2024
1 parent cef7a5c commit 8f3a9c1
Show file tree
Hide file tree
Showing 49 changed files with 14,322 additions and 2,621 deletions.
3 changes: 3 additions & 0 deletions .vs/bled.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
<ClCompile Include="..\src\bled\xz_dec_bcj.c" />
<ClCompile Include="..\src\bled\xz_dec_lzma2.c" />
<ClCompile Include="..\src\bled\xz_dec_stream.c" />
<ClCompile Include="..\src\bled\zstd_common.c" />
<ClCompile Include="..\src\bled\zstd_ddict.c" />
<ClCompile Include="..\src\bled\zstd_decompress.c" />
<ClCompile Include="..\src\bled\zstd_decompress_block.c" />
<ClCompile Include="..\src\bled\zstd_entropy_common.c" />
Expand All @@ -85,6 +87,7 @@
<ClInclude Include="..\src\bled\xz_private.h" />
<ClInclude Include="..\src\bled\xz_stream.h" />
<ClInclude Include="..\src\bled\zstd.h" />
<ClInclude Include="..\src\bled\zstd_bits.h" />
<ClInclude Include="..\src\bled\zstd_compiler.h" />
<ClInclude Include="..\src\bled\zstd_config.h" />
<ClInclude Include="..\src\bled\zstd_cpu.h" />
Expand Down
9 changes: 9 additions & 0 deletions .vs/bled.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
<ClCompile Include="..\src\bled\zstd_error_private.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\zstd_common.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\zstd_ddict.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\bled\bb_archive.h">
Expand Down Expand Up @@ -188,5 +194,8 @@
<ClInclude Include="..\src\bled\zstd_mem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_bits.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -4725,7 +4725,7 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS="${saved_CFLAGS}"
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_ANSI_STDIO=0 -std=gnu99 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Wno-array-bounds -Werror-implicit-function-declaration -Wbidi-chars=none $nopointersign_cflags"
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_ANSI_STDIO=0 -std=gnu11 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Wno-array-bounds -Werror-implicit-function-declaration -Wbidi-chars=none $nopointersign_cflags"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[nopointersign_cflags="-Wno-pointer-sign"], [nopointersign_cflags=""])
CFLAGS="${saved_CFLAGS}"

AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_ANSI_STDIO=0 -std=gnu99 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Wno-array-bounds -Werror-implicit-function-declaration -Wbidi-chars=none $nopointersign_cflags"
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_ANSI_STDIO=0 -std=gnu11 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Wno-array-bounds -Werror-implicit-function-declaration -Wbidi-chars=none $nopointersign_cflags"

AC_SUBST([VISIBILITY_CFLAGS])
AC_SUBST([AM_CFLAGS])
Expand Down
3 changes: 2 additions & 1 deletion src/bled/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ libbled_a_SOURCES = bled.c crc32.c data_align.c data_extract_all.c data_skip.c d
decompress_unzstd.c decompress_vtsi.c filter_accept_all.c filter_accept_list.c filter_accept_reject_list.c \
find_list_entry.c fse_decompress.c header_list.c header_skip.c header_verbose_list.c huf_decompress.c \
init_handle.c open_transformer.c seek_by_jump.c seek_by_read.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c \
xxhash.c zstd_decompress.c zstd_decompress_block.c zstd_entropy_common.c zstd_error_private.c
xxhash.c zstd_common.c zstd_decompress.c zstd_decompress_block.c zstd_ddict.c zstd_entropy_common.c \
zstd_error_private.c
libbled_a_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/.. -Wno-undef -Wno-strict-aliasing
17 changes: 16 additions & 1 deletion src/bled/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ am_libbled_a_OBJECTS = libbled_a-bled.$(OBJEXT) \
libbled_a-xz_dec_bcj.$(OBJEXT) \
libbled_a-xz_dec_lzma2.$(OBJEXT) \
libbled_a-xz_dec_stream.$(OBJEXT) libbled_a-xxhash.$(OBJEXT) \
libbled_a-zstd_common.$(OBJEXT) \
libbled_a-zstd_decompress.$(OBJEXT) \
libbled_a-zstd_decompress_block.$(OBJEXT) \
libbled_a-zstd_ddict.$(OBJEXT) \
libbled_a-zstd_entropy_common.$(OBJEXT) \
libbled_a-zstd_error_private.$(OBJEXT)
libbled_a_OBJECTS = $(am_libbled_a_OBJECTS)
Expand Down Expand Up @@ -279,7 +281,8 @@ libbled_a_SOURCES = bled.c crc32.c data_align.c data_extract_all.c data_skip.c d
decompress_unzstd.c decompress_vtsi.c filter_accept_all.c filter_accept_list.c filter_accept_reject_list.c \
find_list_entry.c fse_decompress.c header_list.c header_skip.c header_verbose_list.c huf_decompress.c \
init_handle.c open_transformer.c seek_by_jump.c seek_by_read.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c \
xxhash.c zstd_decompress.c zstd_decompress_block.c zstd_entropy_common.c zstd_error_private.c
xxhash.c zstd_common.c zstd_decompress.c zstd_decompress_block.c zstd_ddict.c zstd_entropy_common.c \
zstd_error_private.c

libbled_a_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/.. -Wno-undef -Wno-strict-aliasing
all: all-am
Expand Down Expand Up @@ -517,6 +520,12 @@ libbled_a-xxhash.o: xxhash.c
libbled_a-xxhash.obj: xxhash.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-xxhash.obj `if test -f 'xxhash.c'; then $(CYGPATH_W) 'xxhash.c'; else $(CYGPATH_W) '$(srcdir)/xxhash.c'; fi`

libbled_a-zstd_common.o: zstd_common.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_common.o `test -f 'zstd_common.c' || echo '$(srcdir)/'`zstd_common.c

libbled_a-zstd_common.obj: zstd_common.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_common.obj `if test -f 'zstd_common.c'; then $(CYGPATH_W) 'zstd_common.c'; else $(CYGPATH_W) '$(srcdir)/zstd_common.c'; fi`

libbled_a-zstd_decompress.o: zstd_decompress.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_decompress.o `test -f 'zstd_decompress.c' || echo '$(srcdir)/'`zstd_decompress.c

Expand All @@ -529,6 +538,12 @@ libbled_a-zstd_decompress_block.o: zstd_decompress_block.c
libbled_a-zstd_decompress_block.obj: zstd_decompress_block.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_decompress_block.obj `if test -f 'zstd_decompress_block.c'; then $(CYGPATH_W) 'zstd_decompress_block.c'; else $(CYGPATH_W) '$(srcdir)/zstd_decompress_block.c'; fi`

libbled_a-zstd_ddict.o: zstd_ddict.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_ddict.o `test -f 'zstd_ddict.c' || echo '$(srcdir)/'`zstd_ddict.c

libbled_a-zstd_ddict.obj: zstd_ddict.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_ddict.obj `if test -f 'zstd_ddict.c'; then $(CYGPATH_W) 'zstd_ddict.c'; else $(CYGPATH_W) '$(srcdir)/zstd_ddict.c'; fi`

libbled_a-zstd_entropy_common.o: zstd_entropy_common.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_entropy_common.o `test -f 'zstd_entropy_common.c' || echo '$(srcdir)/'`zstd_entropy_common.c

Expand Down
1 change: 0 additions & 1 deletion src/bled/data_align.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/

#include "libbb.h"
#include "bb_archive.h"

Expand Down
1 change: 0 additions & 1 deletion src/bled/data_skip.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/

#include "libbb.h"
#include "bb_archive.h"

Expand Down
2 changes: 1 addition & 1 deletion src/bled/decompress_bunzip2.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static int get_next_block(bunzip_data *bd)
uint32_t *dbuf;
unsigned origPtr, t;
unsigned dbufCount, runPos;
unsigned runCnt = 0; // runCnt; /* for compiler */
unsigned runCnt = 0; /* for compiler */

dbuf = bd->dbuf;
selectors = bd->selectors;
Expand Down
1 change: 0 additions & 1 deletion src/bled/decompress_gunzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,6 @@ unpack_gz_stream(transformer_state_t *xstate)
return -1;
}
to_read = -1;
// bytebuffer_max = 0x8000;
bytebuffer = xmalloc(bytebuffer_max);
if (bytebuffer == NULL) {
bb_error_msg("alloc error");
Expand Down
2 changes: 0 additions & 2 deletions src/bled/decompress_unzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# define dbg(...) ((void)0)
#endif

#define xread safe_read

enum {
#if BB_BIG_ENDIAN
ZIP_FILEHEADER_MAGIC = 0x504b0304,
Expand Down
6 changes: 0 additions & 6 deletions src/bled/decompress_unzstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
#include "zstd_deps.h"
#include "zstd_internal.h"

ZSTD_customMem ZSTD_defaultCMem = { ZSTD_customMalloc, ZSTD_customFree, NULL };

ZSTDLIB_API const char* ZSTD_getErrorName(size_t code) {
return ERR_getErrorName(code);
}

ALWAYS_INLINE static size_t roundupsize(size_t size, size_t align)
{
return (size + align - 1U) & ~(align - 1);
Expand Down
1 change: 0 additions & 1 deletion src/bled/filter_accept_all.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/

#include "libbb.h"
#include "bb_archive.h"

Expand Down
1 change: 0 additions & 1 deletion src/bled/filter_accept_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/

#include "libbb.h"
#include "bb_archive.h"

Expand Down
1 change: 0 additions & 1 deletion src/bled/find_list_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/

//#include <fnmatch.h>
#include "libbb.h"
#include "bb_archive.h"

Expand Down
Loading

0 comments on commit 8f3a9c1

Please sign in to comment.