GPAK  1.0.0
A general-purpose archive library

◆ _gpak_compressor_none()

GPAK_API uint32_t _gpak_compressor_none ( gpak_t _pak,
FILE *  _infile,
FILE *  _outfile 
)
Brief Description:\n Performs no compression on the input file.

This function reads data from the input file and writes it directly to the output file without any compression.

Parameters
_pakA pointer to the gpak_t.
_infileA pointer to the input FILE.
_outfileA pointer to the output FILE.
Returns
The number of bytes written to the output file.

Definition at line 42 of file gpak_compressors.c.

43 {
44  char* _bufferIn = (char*)malloc(_DEFAULT_BLOCK_SIZE);
45  size_t _readed = 0ull;
46  uint32_t _crc32 = crc32(0L, Z_NULL, 0);
47 
48  fseek(_infile, 0, SEEK_END);
49  size_t _total_size = ftell(_infile);
50  fseek(_infile, 0, SEEK_SET);
51 
52  size_t bytes_readed = 0ull;
53  do
54  {
55  _readed = _freadb(_bufferIn, 1ull, _DEFAULT_BLOCK_SIZE, _infile);
56  _crc32 = crc32(_crc32, _bufferIn, _readed);
57  bytes_readed += _readed;
58  _gpak_pass_progress(_pak, bytes_readed, _total_size, GPAK_STAGE_COMPRESSION);
59  _fwriteb(_bufferIn, 1ull, _readed, _outfile);
60  } while (_readed);
61 
62  free(_bufferIn);
63 
64  return _crc32;
65 }
@ GPAK_STAGE_COMPRESSION
Definition: gpak_data.h:226