diff --git a/src/log_api.c b/src/log_api.c index 1c6abca..e1ec92c 100644 --- a/src/log_api.c +++ b/src/log_api.c @@ -102,7 +102,8 @@ aos_status_t *log_post_logs_from_proto_buf_with_option(const char *endpoint, con apr_table_set(headers, LOG_BODY_RAW_SIZE, apr_itoa(options->pool, org_body_size)); int compress_bound = LZ4_compressBound(org_body_size); char *compress_data = aos_pcalloc(options->pool, compress_bound); - int compressed_size = LZ4_compress(body, compress_data, org_body_size); + int compressed_size = LZ4_compress_default(body, compress_data, org_body_size, compress_bound); + if(compressed_size <= 0) { s = aos_status_create(options->pool); @@ -179,7 +180,7 @@ aos_status_t *log_post_logs_with_sts_token_with_option(aos_pool_t *p, const char apr_table_set(headers, LOG_BODY_RAW_SIZE, apr_itoa(options->pool, org_body_size)); int compress_bound = LZ4_compressBound(org_body_size); char *compress_data = aos_pcalloc(options->pool, compress_bound); - int compressed_size = LZ4_compress(body, compress_data, org_body_size); + int compressed_size = LZ4_compress_default(body, compress_data, org_body_size, compress_bound); if(compressed_size <= 0) { s = aos_status_create(options->pool); diff --git a/src/log_http_cont.c b/src/log_http_cont.c index 97f5b93..2d8d656 100644 --- a/src/log_http_cont.c +++ b/src/log_http_cont.c @@ -32,7 +32,7 @@ log_buf* _compressed_buffer(apr_pool_t* pool,log_buf* before) char *body = before->data; int compress_bound = LZ4_compressBound((int)before->length); char *compress_data = aos_pcalloc(pool, compress_bound); - int compressed_size = LZ4_compress(body, compress_data, (int)before->length); + int compressed_size = LZ4_compress_default(body, compress_data, (int)before->length, compress_bound); log_buf* after = aos_pcalloc(pool, sizeof(log_buf));