2009/3/2 Alok Aggarwal <Alok.Aggarwal at sun.com>:
>
> On Mon, 2 Mar 2009, Juergen Keil wrote:
>> 8 bytes? ?LZMA_PROPS_SIZE is defined as 5:
>>
>> % grep LZMA_PROPS_SIZE usr/src/common/lzma/*.h
>> usr/src/common/lzma/LzmaDec.h:#define LZMA_PROPS_SIZE 5
>> usr/src/common/lzma/LzmaEnc.h:#define LZMA_PROPS_SIZE 5
>
> That should have been 5 bytes for the properties followed
> by 8 bytes of uncompressed segment size.
>
> Here is how the LZMA header looks like (from LZMA SDK 4.62) -
>
> LZMA compressed file format
> ---------------------------
> Offset Size Description
> ?0 ? ? 1 ? Special LZMA properties (lc,lp, pb in encoded form)
> ?1 ? ? 4 ? Dictionary size (little endian)
> ?5 ? ? 8 ? Uncompressed size (little endian). -1 means unknown size
> ?13 ? ? ? ? Compressed data

Ah, ok, so this length at offset 5 is specified by the LZMA format...


>> The 8 byte compressed buffer length between the lzma properties
>> and the lzma compressed data confuses me. ?It was inserted by this
>> piece of code it lofiadm/main.c:
>>
>> ? ? ? ?dstp = (Byte *)dst;
>> ? ? ? ?t = *dstlen;
>> ? ? ? ?for (i = 0; i < 8; i++, t >>= 8) {
>> ? ? ? ? ? ? ? ?dstp[LZMA_SIZE_OFFSET + i] = (Byte)t;
>> ? ? ? ?}

If offset 5 is supposed to encode the uncompressed
data size, shouldn't the above code use

    t = srclen;

instead of

   t = *dstlen;

Reply via email to