igzip: Modify igzip_example to provide example of higher compression levels

Change-Id: Iccd0528ac088e1eec3921aa5fde99769d75e3334
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
Roy Oursler 2017-03-20 14:38:32 -07:00 committed by Greg Tucker
parent bad6569acc
commit be09e56b36

View File

@ -32,6 +32,11 @@
#include "igzip_lib.h"
#define BUF_SIZE 8192
#ifndef LEVEL
# define LEVEL 0
#else
# define LEVEL 1
#endif
struct isal_zstream stream;
@ -62,6 +67,16 @@ int main(int argc, char *argv[])
stream.end_of_stream = 0;
stream.flush = NO_FLUSH;
if (LEVEL == 1) {
stream.level = 1;
stream.level_buf = malloc(ISAL_DEF_LVL1_DEFAULT);
stream.level_buf_size = ISAL_DEF_LVL1_DEFAULT;
if (stream.level_buf == 0) {
printf("Failed to allocate level compression buffer\n");
exit(0);
}
}
do {
stream.avail_in = (uint32_t) fread(inbuf, 1, BUF_SIZE, in);
stream.end_of_stream = feof(in) ? 1 : 0;