Skip Menu |

This queue is for tickets about the Compress-LZF CPAN distribution.

Report information
The Basics
Id: 25330
Status: rejected
Priority: 0/
Queue: Compress-LZF

People
Owner: Nobody in particular
Requestors: AGRUNDMA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.71
Fixed in: (no value)



Subject: Perl-generated compressed files not compatible with liblzf
Hi Marc, We're trying to use LZF from Perl -> C. The data is compressed on the Perl side and decompressed by C code using liblzf. However it appears the Perl version prepends a different header that the C code doesn't understand. If there was a way to generate C-compatible files from Perl, it would be helpful.
From: AGRUNDMA [...] cpan.org
FYI, here's the code I'm using to work around this issue at the moment: my $len = length($foo); my $compressed = Compress::LZF::compress($foo); if ( ord( substr $compressed, 0, 1 ) == 0 ) { # The data wasn't able to be compressed my $c_header = "ZV\0" . pack('n', $len); substr $compressed, 0, 1, $c_header; } else { my $csize = length($compressed) - 2; my $c_header = "ZV\1" . pack('n', $csize) . pack('n', $len); substr $compressed, 0, 2, $c_header; }
On Thu Mar 08 21:54:13 2007, AGRUNDMA wrote: Show quoted text
> FYI, here's the code I'm using to work around this issue at the moment:
There is no issue: liblzf does not have a header, applications using it must add their own (for example, to store the length: The C api exposes this but leaves it up to the user of the library to care for this meta-information). The obvious way to make both interoperable is to prepend the same header that compress-lzf does, which is simply the length of the uncompressed data, UTF-8/UTF-X encoded, or 0 if the data could not be compressed (see the xs code for details). If you wrote C code to illustrate this I would be happy to include it somewhere in the documentation.
On Thu Mar 08 21:54:13 2007, AGRUNDMA wrote: Show quoted text
> FYI, here's the code I'm using to work around this issue at the moment:
There is no issue: liblzf does not have a header, applications using it must add their own (for example, to store the length: The C api exposes this but leaves it up to the user of the library to care for this meta-information). The obvious way to make both interoperable is to prepend the same header that compress-lzf does, which is simply the length of the uncompressed data, UTF-8/UTF-X encoded, or 0 if the data could not be compressed (see the xs code for details). If you wrote C code to illustrate this I would be happy to include it somewhere in the documentation.
On Thu Mar 08 21:54:13 2007, AGRUNDMA wrote: Show quoted text
> FYI, here's the code I'm using to work around this issue at the moment:
There is no issue: liblzf does not have a header, applications using it must add their own (for example, to store the length: The C api exposes this but leaves it up to the user of the library to care for this meta-information). The obvious way to make both interoperable is to prepend the same header that compress-lzf does, which is simply the length of the uncompressed data, UTF-8/UTF-X encoded, or 0 if the data could not be compressed (see the xs code for details). If you wrote C code to illustrate this I would be happy to include it somewhere in the documentation.
On Thu Mar 08 21:54:13 2007, AGRUNDMA wrote: Show quoted text
> FYI, here's the code I'm using to work around this issue at the moment:
There is no issue: liblzf does not have a header, applications using it must add their own (for example, to store the length: The C api exposes this but leaves it up to the user of the library to care for this meta-information). The obvious way to make both interoperable is to prepend the same header that compress-lzf does, which is simply the length of the uncompressed data, UTF-8/UTF-X encoded, or 0 if the data could not be compressed (see the xs code for details). If you wrote C code to illustrate this I would be happy to include it somewhere in the documentation.