This function compresses the input file using the Deflate algorithm and writes the compressed data to the output file.
100 strm.zalloc = Z_NULL;
102 strm.opaque = Z_NULL;
104 char* _bufferIn = (
char*)malloc(_DEFAULT_BLOCK_SIZE);
105 char* _bufferOut = (
char*)malloc(_DEFAULT_BLOCK_SIZE);
107 fseek(_infile, 0, SEEK_END);
108 size_t _total_size = ftell(_infile);
109 fseek(_infile, 0, SEEK_SET);
115 uint32_t _crc32 = crc32(0L, Z_NULL, 0);
119 size_t _total_readed = 0ull;
122 strm.avail_in = _freadb(_bufferIn, 1ull, _DEFAULT_BLOCK_SIZE, _infile);
123 _total_readed += strm.avail_in;
124 _crc32 = crc32(_crc32, _bufferIn, strm.avail_in);
133 flush = feof(_infile) ? Z_FINISH : Z_NO_FLUSH;
134 strm.next_in = _bufferIn;
138 strm.avail_out = _DEFAULT_BLOCK_SIZE;
139 strm.next_out = _bufferOut;
140 ret = deflate(&strm, flush);
141 assert(ret != Z_STREAM_ERROR);
143 have = _DEFAULT_BLOCK_SIZE - strm.avail_out;
144 if (_fwriteb(_bufferOut, 1ull, have, _outfile) != have || ferror(_outfile))
149 }
while (strm.avail_out == 0);
150 assert(strm.avail_in == 0);
152 }
while (flush != Z_FINISH);
@ GPAK_ERROR_DEFLATE_INIT