mirror of
https://github.com/intel/isa-l.git
synced 2024-12-12 09:23:50 +01:00
igzip: add zlib header init function
Add isal_zlib_hdr_init() function to initialize the isal_zlib_header structure to all 0. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit is contained in:
parent
6ef2abe80e
commit
29d99fce26
@ -1023,6 +1023,14 @@ void isal_gzip_header_init(struct isal_gzip_header *gz_hdr)
|
|||||||
gz_hdr->flags = 0;
|
gz_hdr->flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void isal_zlib_header_init(struct isal_zlib_header *z_hdr)
|
||||||
|
{
|
||||||
|
z_hdr->info = 0;
|
||||||
|
z_hdr->level = 0;
|
||||||
|
z_hdr->dict_id = 0;
|
||||||
|
z_hdr->dict_flag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t isal_write_gzip_header(struct isal_zstream *stream, struct isal_gzip_header *gz_hdr)
|
uint32_t isal_write_gzip_header(struct isal_zstream *stream, struct isal_gzip_header *gz_hdr)
|
||||||
{
|
{
|
||||||
uint32_t flags = 0, hcrc, hdr_size = GZIP_HDR_BASE;
|
uint32_t flags = 0, hcrc, hdr_size = GZIP_HDR_BASE;
|
||||||
|
@ -2195,12 +2195,15 @@ int isal_inflate_stateless(struct inflate_state *state)
|
|||||||
|
|
||||||
if (state->crc_flag == IGZIP_GZIP) {
|
if (state->crc_flag == IGZIP_GZIP) {
|
||||||
struct isal_gzip_header gz_hdr;
|
struct isal_gzip_header gz_hdr;
|
||||||
|
|
||||||
isal_gzip_header_init(&gz_hdr);
|
isal_gzip_header_init(&gz_hdr);
|
||||||
ret = isal_read_gzip_header(state, &gz_hdr);
|
ret = isal_read_gzip_header(state, &gz_hdr);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
} else if (state->crc_flag == IGZIP_ZLIB) {
|
} else if (state->crc_flag == IGZIP_ZLIB) {
|
||||||
struct isal_zlib_header z_hdr = { 0 };
|
struct isal_zlib_header z_hdr;
|
||||||
|
|
||||||
|
isal_zlib_header_init(&z_hdr);
|
||||||
ret = isal_read_zlib_header(state, &z_hdr);
|
ret = isal_read_zlib_header(state, &z_hdr);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@ -2268,6 +2271,7 @@ int isal_inflate(struct inflate_state *state)
|
|||||||
|
|
||||||
if (!state->wrapper_flag && state->crc_flag == IGZIP_GZIP) {
|
if (!state->wrapper_flag && state->crc_flag == IGZIP_GZIP) {
|
||||||
struct isal_gzip_header gz_hdr;
|
struct isal_gzip_header gz_hdr;
|
||||||
|
|
||||||
isal_gzip_header_init(&gz_hdr);
|
isal_gzip_header_init(&gz_hdr);
|
||||||
ret = isal_read_gzip_header(state, &gz_hdr);
|
ret = isal_read_gzip_header(state, &gz_hdr);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -2275,7 +2279,9 @@ int isal_inflate(struct inflate_state *state)
|
|||||||
else if (ret > 0)
|
else if (ret > 0)
|
||||||
return ISAL_DECOMP_OK;
|
return ISAL_DECOMP_OK;
|
||||||
} else if (!state->wrapper_flag && state->crc_flag == IGZIP_ZLIB) {
|
} else if (!state->wrapper_flag && state->crc_flag == IGZIP_ZLIB) {
|
||||||
struct isal_zlib_header z_hdr = { 0 };
|
struct isal_zlib_header z_hdr;
|
||||||
|
|
||||||
|
isal_zlib_header_init(&z_hdr);
|
||||||
ret = isal_read_zlib_header(state, &z_hdr);
|
ret = isal_read_zlib_header(state, &z_hdr);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -856,7 +856,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
printf("zlib wrapper test: ");
|
printf("zlib wrapper test: ");
|
||||||
for (i = 0; i < RANDOMS; i++) {
|
for (i = 0; i < RANDOMS; i++) {
|
||||||
memset(&z_hdr_orig, 0, sizeof(z_hdr_orig));
|
isal_zlib_header_init(&z_hdr_orig);
|
||||||
|
|
||||||
gen_rand_zlib_header(&z_hdr_orig);
|
gen_rand_zlib_header(&z_hdr_orig);
|
||||||
|
|
||||||
|
@ -604,6 +604,13 @@ void isal_deflate_reset(struct isal_zstream *stream);
|
|||||||
*/
|
*/
|
||||||
void isal_gzip_header_init(struct isal_gzip_header *gz_hdr);
|
void isal_gzip_header_init(struct isal_gzip_header *gz_hdr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set zlib header default values
|
||||||
|
*
|
||||||
|
* @param z_hdr: zlib header to initialize.
|
||||||
|
*/
|
||||||
|
void isal_zlib_header_init(struct isal_zlib_header *z_hdr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write gzip header to output stream
|
* @brief Write gzip header to output stream
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user