44
44
// LZ4 provides a function that will tell you the maximum size of compressed output based on input data via LZ4_compressBound().
45
45
const int max_dst_size = LZ4_compressBound(src_size);
46
46
// We will use that size for our destination boundary when allocating space.
48
48
if (compressed_data == NULL)
49
49
run_screaming("Failed to allocate memory for *compressed_data.", 1);
51
51
// Invoke LZ4_compress_default now with our size values and pointers to our memory locations.
52
52
// Save the return value for error checking.
53
53
const int compressed_data_size = LZ4_compress_default(src, compressed_data, src_size, max_dst_size);