Skip to content

Commit e07e66c

Browse files
committed
Merge pull request #79 from Cyan4973/dev
Dev
2 parents dc1af5f + 305c325 commit e07e66c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+9036
-2070
lines changed

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@
3232
# ################################################################
3333

3434
# Version number
35-
export VERSION := 0.3.6
35+
export VERSION := 0.4.0
3636

3737
PRGDIR = programs
3838
ZSTDDIR = lib
3939

40-
.PHONY: clean
40+
# Define nul output
41+
ifneq (,$(filter Windows%,$(OS)))
42+
VOID = nul
43+
else
44+
VOID = /dev/null
45+
endif
46+
47+
.PHONY: default all zstdprogram clean install uninstall travis-install test clangtest gpptest armtest usan asan uasan
4148

4249
default: zstdprogram
4350

@@ -49,8 +56,8 @@ zstdprogram:
4956
$(MAKE) -C $(PRGDIR)
5057

5158
clean:
52-
$(MAKE) -C $(ZSTDDIR) $@
53-
$(MAKE) -C $(PRGDIR) $@
59+
@$(MAKE) -C $(ZSTDDIR) $@ > $(VOID)
60+
@$(MAKE) -C $(PRGDIR) $@ > $(VOID)
5461
@echo Cleaning completed
5562

5663

NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v0.4.0
2+
Command line utility is now compatible with high compression levels
3+
Removed zstdhc => merged into zstd
4+
Added : ZBUFF API (see zstd_buffered.h)
5+
Rolling buffer support
6+
17
v0.3.6
28
small blocks params
39

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For a taste of its performance, here are a few benchmark numbers from a number o
1212
|Name | Ratio | C.speed | D.speed |
1313
|-----------------|-------|--------:|--------:|
1414
| | | MB/s | MB/s |
15-
| **zstd 0.3** |**2.858**|**280**| **670** |
15+
| **zstd 0.4** |**2.872**|**280**| **670** |
1616
| [zlib] 1.2.8 -1 | 2.730 | 70 | 300 |
1717
| QuickLZ 1.5.1b6 | 2.237 | 370 | 415 |
1818
| LZO 2.06 | 2.106 | 400 | 580 |

images/CSpeed.png

100755100644
337 Bytes
Loading

images/DSpeed.png

100755100644
-24 Bytes
Loading

lib/Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
#
2929
# You can contact the author at :
30+
# - ZSTD homepage : http://www.zstd.net
3031
# - ZSTD source repository : https://github.com/Cyan4973/zstd
31-
# - Public forum : https://groups.google.com/forum/#!forum/lz4c
3232
# ################################################################
3333

3434
# Version numbers
@@ -63,14 +63,18 @@ else
6363
SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER)
6464
endif
6565

66-
default: libzstd
6766

68-
all: libzstd
67+
.PHONY: default all clean install uninstall
6968

70-
libzstd: zstd.c huff0.c fse.c
69+
default: clean libzstd
70+
71+
all: clean libzstd
72+
73+
libzstd: zstd_compress.c zstd_decompress.c huff0.c fse.c \
74+
legacy/zstd_v01.c legacy/zstd_v02.c legacy/zstd_v03.c
7175
@echo compiling static library
7276
@$(CC) $(FLAGS) -c $^
73-
@$(AR) rcs libzstd.a zstd.o huff0.o fse.o
77+
@$(AR) rcs libzstd.a *.o
7478
@echo compiling dynamic library $(LIBVER)
7579
@$(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
7680
@echo creating versioned links

lib/bitstream.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC)
208208
MEM_writeLEST(bitC->ptr, bitC->bitContainer);
209209
bitC->ptr += nbBytes;
210210
bitC->bitPos &= 7;
211-
bitC->bitContainer >>= nbBytes*8;
211+
bitC->bitContainer >>= nbBytes*8; /* if bitPos >= sizeof(bitContainer)*8 --> undefined behavior */
212212
}
213213

214214
MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)
@@ -218,7 +218,7 @@ MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)
218218
bitC->ptr += nbBytes;
219219
if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
220220
bitC->bitPos &= 7;
221-
bitC->bitContainer >>= nbBytes*8;
221+
bitC->bitContainer >>= nbBytes*8; /* if bitPos >= sizeof(bitContainer)*8 --> undefined behavior */
222222
}
223223

224224
/*! BIT_closeCStream

lib/error.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ extern "C" {
6868

6969
#define ERROR_LIST(ITEM) \
7070
ITEM(PREFIX(No_Error)) ITEM(PREFIX(GENERIC)) \
71-
ITEM(PREFIX(memory_allocation)) \
71+
ITEM(PREFIX(prefix_unknown)) ITEM(PREFIX(frameParameter_unsupported)) ITEM(PREFIX(frameParameter_unsupportedBy32bitsImplementation)) \
72+
ITEM(PREFIX(init_missing)) ITEM(PREFIX(memory_allocation)) \
7273
ITEM(PREFIX(dstSize_tooSmall)) ITEM(PREFIX(srcSize_wrong)) \
73-
ITEM(PREFIX(prefix_unknown)) ITEM(PREFIX(corruption_detected)) \
74+
ITEM(PREFIX(corruption_detected)) \
7475
ITEM(PREFIX(tableLog_tooLarge)) ITEM(PREFIX(maxSymbolValue_tooLarge)) ITEM(PREFIX(maxSymbolValue_tooSmall)) \
7576
ITEM(PREFIX(maxCode))
7677

lib/huff0.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,10 +1495,7 @@ static inline size_t HUF_decodeStreamX6(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* c
14951495
while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p <= pEnd-4))
14961496
HUF_DECODE_SYMBOLX6_0(p, bitDPtr);
14971497

1498-
while (p <= pEnd-4)
1499-
HUF_DECODE_SYMBOLX6_0(p, bitDPtr); /* no need to reload : reached the end of DStream */
1500-
1501-
while (p < pEnd)
1498+
while ((BIT_reloadDStream(bitDPtr) <= BIT_DStream_endOfBuffer) && (p < pEnd))
15021499
p += HUF_decodeLastSymbolsX6(p, (U32)(pEnd-p), bitDPtr, dd, ds, dtLog);
15031500

15041501
return p-pStart;

lib/legacy/zstd_legacy.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
zstd_v02 - decoder for 0.2 format
2+
zstd_legacy - decoder for legacy format
33
Header File
44
Copyright (C) 2015, Yann Collet.
55
@@ -44,13 +44,15 @@ extern "C" {
4444
#include "error.h" /* ERROR */
4545
#include "zstd_v01.h"
4646
#include "zstd_v02.h"
47+
#include "zstd_v03.h"
4748

4849
MEM_STATIC unsigned ZSTD_isLegacy (U32 magicNumberLE)
4950
{
5051
switch(magicNumberLE)
5152
{
5253
case ZSTDv01_magicNumberLE :
53-
case ZSTDv02_magicNumber : return 1;
54+
case ZSTDv02_magicNumber :
55+
case ZSTDv03_magicNumber : return 1;
5456
default : return 0;
5557
}
5658
}
@@ -67,6 +69,8 @@ MEM_STATIC size_t ZSTD_decompressLegacy(
6769
return ZSTDv01_decompress(dst, maxOriginalSize, src, compressedSize);
6870
case ZSTDv02_magicNumber :
6971
return ZSTDv02_decompress(dst, maxOriginalSize, src, compressedSize);
72+
case ZSTDv03_magicNumber :
73+
return ZSTDv03_decompress(dst, maxOriginalSize, src, compressedSize);
7074
default :
7175
return ERROR(prefix_unknown);
7276
}

0 commit comments

Comments
 (0)