From: Yann Collet Date: Mon, 6 Jun 2016 17:52:35 +0000 (+0200) Subject: Added decoding of RLE blocks X-Git-Tag: v0.7.0^2~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d504ae85b6615dbfca90db8f33978a8df44aa33;p=thirdparty%2Fzstd.git Added decoding of RLE blocks --- diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 4630eb8a3..9b7b1886b 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -53,7 +53,7 @@ /*-******************************************************* * Dependencies *********************************************************/ -#include /* memcpy, memmove */ +#include /* memcpy, memmove, memset */ #include /* debug only : printf */ #include "mem.h" /* low level memory routines */ #define XXH_STATIC_LINKING_ONLY /* XXH64_state_t */ @@ -938,6 +938,14 @@ size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, } +size_t ZSTD_generateNxByte(void* dst, size_t dstCapacity, BYTE byte, size_t length) +{ + if (length > dstCapacity) return ERROR(dstSize_tooSmall); + memset(dst, byte, length); + return length; +} + + /*! ZSTD_decompressFrame() : * `dctx` must be properly initialized */ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, @@ -982,7 +990,7 @@ static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, decodedSize = ZSTD_copyRawBlock(op, oend-op, ip, cBlockSize); break; case bt_rle : - return ERROR(GENERIC); /* not yet supported */ + decodedSize = ZSTD_generateNxByte(op, oend-op, *ip, blockProperties.origSize); break; case bt_end : /* end of frame */