Skip to content

Commit

Permalink
Enable Trusty support for lunar-devel (#1236)
Browse files Browse the repository at this point in the history
* Enabling use of previous LZ4 compression method on older Ubuntu distros

* Fixing minor version number for LZ4 compression method change

* Fixing version and macro name

* Changing LZ4 compression method change version to 1.7.1
  • Loading branch information
ayrton04 authored and dirk-thomas committed Nov 17, 2017
1 parent 04961fe commit 35d1e0d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion utilities/roslz4/src/lz4s.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
#define DEBUG(...)
#endif

// Make sure the LZ4 library has the function we need
// Note that the later versions of LZ4 contain a different macro that does this version math, but the earlier
// versions lack it.
#define LZ4_VERSION (LZ4_VERSION_MAJOR * 100 * 100 + LZ4_VERSION_MINOR * 100 + LZ4_VERSION_RELEASE)
#if LZ4_VERSION >= 10701
#define LZ4_COMPRESS_DEFAULT LZ4_compress_default
#else
#define LZ4_COMPRESS_DEFAULT LZ4_compress_limitedOutput
#endif

// magic numbers
const uint32_t kMagicNumber = 0x184D2204;
const uint32_t kEndOfStream = 0x00000000;
Expand Down Expand Up @@ -181,7 +191,7 @@ int bufferToOutput(roslz4_stream *str) {
state->buffer_offset, str->output_left);

// Shrink output by 1 to detect if data is not compressible
uint32_t comp_size = LZ4_compress_default(state->buffer,
uint32_t comp_size = LZ4_COMPRESS_DEFAULT(state->buffer,
str->output_next + 4,
(int) state->buffer_offset,
(int) uncomp_size - 1);
Expand Down

0 comments on commit 35d1e0d

Please sign in to comment.