File tree Expand file tree Collapse file tree 5 files changed +25
-3
lines changed Expand file tree Collapse file tree 5 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -1023,6 +1023,14 @@ void isal_gzip_header_init(struct isal_gzip_header *gz_hdr)
1023
1023
gz_hdr -> flags = 0 ;
1024
1024
}
1025
1025
1026
+ void isal_zlib_header_init (struct isal_zlib_header * z_hdr )
1027
+ {
1028
+ z_hdr -> info = 0 ;
1029
+ z_hdr -> level = 0 ;
1030
+ z_hdr -> dict_id = 0 ;
1031
+ z_hdr -> dict_flag = 0 ;
1032
+ }
1033
+
1026
1034
uint32_t isal_write_gzip_header (struct isal_zstream * stream , struct isal_gzip_header * gz_hdr )
1027
1035
{
1028
1036
uint32_t flags = 0 , hcrc , hdr_size = GZIP_HDR_BASE ;
Original file line number Diff line number Diff line change @@ -2195,12 +2195,15 @@ int isal_inflate_stateless(struct inflate_state *state)
2195
2195
2196
2196
if (state -> crc_flag == IGZIP_GZIP ) {
2197
2197
struct isal_gzip_header gz_hdr ;
2198
+
2198
2199
isal_gzip_header_init (& gz_hdr );
2199
2200
ret = isal_read_gzip_header (state , & gz_hdr );
2200
2201
if (ret )
2201
2202
return ret ;
2202
2203
} else if (state -> crc_flag == IGZIP_ZLIB ) {
2203
- struct isal_zlib_header z_hdr = { 0 };
2204
+ struct isal_zlib_header z_hdr ;
2205
+
2206
+ isal_zlib_header_init (& z_hdr );
2204
2207
ret = isal_read_zlib_header (state , & z_hdr );
2205
2208
if (ret )
2206
2209
return ret ;
@@ -2268,14 +2271,17 @@ int isal_inflate(struct inflate_state *state)
2268
2271
2269
2272
if (!state -> wrapper_flag && state -> crc_flag == IGZIP_GZIP ) {
2270
2273
struct isal_gzip_header gz_hdr ;
2274
+
2271
2275
isal_gzip_header_init (& gz_hdr );
2272
2276
ret = isal_read_gzip_header (state , & gz_hdr );
2273
2277
if (ret < 0 )
2274
2278
return ret ;
2275
2279
else if (ret > 0 )
2276
2280
return ISAL_DECOMP_OK ;
2277
2281
} else if (!state -> wrapper_flag && state -> crc_flag == IGZIP_ZLIB ) {
2278
- struct isal_zlib_header z_hdr = { 0 };
2282
+ struct isal_zlib_header z_hdr ;
2283
+
2284
+ isal_zlib_header_init (& z_hdr );
2279
2285
ret = isal_read_zlib_header (state , & z_hdr );
2280
2286
if (ret < 0 )
2281
2287
return ret ;
Original file line number Diff line number Diff line change @@ -856,7 +856,7 @@ int main(int argc, char *argv[])
856
856
857
857
printf ("zlib wrapper test: " );
858
858
for (i = 0 ; i < RANDOMS ; i ++ ) {
859
- memset (& z_hdr_orig , 0 , sizeof ( z_hdr_orig ) );
859
+ isal_zlib_header_init (& z_hdr_orig );
860
860
861
861
gen_rand_zlib_header (& z_hdr_orig );
862
862
Original file line number Diff line number Diff line change @@ -604,6 +604,13 @@ void isal_deflate_reset(struct isal_zstream *stream);
604
604
*/
605
605
void isal_gzip_header_init (struct isal_gzip_header * gz_hdr );
606
606
607
+ /**
608
+ * @brief Set zlib header default values
609
+ *
610
+ * @param z_hdr: zlib header to initialize.
611
+ */
612
+ void isal_zlib_header_init (struct isal_zlib_header * z_hdr );
613
+
607
614
/**
608
615
* @brief Write gzip header to output stream
609
616
*
Original file line number Diff line number Diff line change @@ -121,3 +121,4 @@ crc64_rocksoft_refl_base @116
121
121
crc64_rocksoft_norm @117
122
122
crc64_rocksoft_refl @118
123
123
ec_init_tables_base @119
124
+ isal_zlib_header_init @120
You can’t perform that action at this time.
0 commit comments