Replace obsolete functions
This commit is contained in:
parent
b036eaade6
commit
fd77bad52f
@ -53,8 +53,8 @@ void test_compress(FILE* outFp, FILE* inpFp)
|
|||||||
|
|
||||||
{
|
{
|
||||||
char cmpBuf[LZ4_COMPRESSBOUND(BLOCK_BYTES)];
|
char cmpBuf[LZ4_COMPRESSBOUND(BLOCK_BYTES)];
|
||||||
const int cmpBytes = LZ4_compress_continue(
|
const int cmpBytes = LZ4_compress_safe_continue(
|
||||||
lz4Stream, inpPtr, cmpBuf, inpBytes);
|
lz4Stream, inpPtr, cmpBuf, inpBytes, sizeof(cmpBuf));
|
||||||
if(cmpBytes <= 0) {
|
if(cmpBytes <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ static void test_compress(
|
|||||||
size_t ringBufferBytes)
|
size_t ringBufferBytes)
|
||||||
{
|
{
|
||||||
LZ4_stream_t* const lz4Stream = LZ4_createStream();
|
LZ4_stream_t* const lz4Stream = LZ4_createStream();
|
||||||
char* const cmpBuf = malloc(LZ4_COMPRESSBOUND(messageMaxBytes));
|
const size_t cmpBufBytes = LZ4_COMPRESSBOUND(messageMaxBytes);
|
||||||
|
char* const cmpBuf = malloc(cmpBufBytes);
|
||||||
char* const inpBuf = malloc(ringBufferBytes);
|
char* const inpBuf = malloc(ringBufferBytes);
|
||||||
int inpOffset = 0;
|
int inpOffset = 0;
|
||||||
|
|
||||||
@ -63,8 +64,8 @@ static void test_compress(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
const int cmpBytes = LZ4_compress_continue(
|
const int cmpBytes = LZ4_compress_safe_continue(
|
||||||
lz4Stream, inpPtr, cmpBuf, inpBytes);
|
lz4Stream, inpPtr, cmpBuf, inpBytes, cmpBufBytes);
|
||||||
if (cmpBytes <= 0) break;
|
if (cmpBytes <= 0) break;
|
||||||
write_uint16(outFp, (uint16_t) cmpBytes);
|
write_uint16(outFp, (uint16_t) cmpBytes);
|
||||||
write_bin(outFp, cmpBuf, cmpBytes);
|
write_bin(outFp, cmpBuf, cmpBytes);
|
||||||
|
Loading…
Reference in New Issue
Block a user