modify comment in the LzmaLib.h
A free file archiver for extremely high compression
Brought to you by:
ipavlov
I encountered an error when I used the LzmaCompress API:
1. Did not assign the initial value to the variable destLen;
2. the return value of LzmaCompress was SZ_ERROR_OUTPUT_EOF;
{
...
size_t destLen;
My_STDAPI Res = LzmaCompress(dest,&destLen,src,srcLen,outProps,&outPropsSize,
0,1<<16,3,0,2,32,2);
...
}
But, I found the source code is that:
{
...
LzmaCompress(...)
{
Lzmacode(...)
{
...
LzmaEnc_MemEncode(...)
{
...
outStream.rem = *destLen;
...
}
...
}
}
...
}
SO,I think the destLen is not only an output value, but also an input value.
Yes, it's obvious.
If you provide the output buffer, some function's parameter contains the size of that buffer.
I'll add comment in h file about.
Thanks!
However, the LzmaLib.h file shows that the destLen is just an output value.
In order to solve the error above, I give destLen an initial value and test it again. The result is OK.
{
...
size_t destLen = srcLen;
My_STDAPI Res = LzmaCompress(dest,&destLen,src,srcLen,outProps,&outPropsSize,
0,1<<16,3,0,2,32,2);
...
}
So, I suggest to modify the comment in the LzmaLib.h file , and the destLen have to give an initial value.
Last edit: Bruce Stark 2019-06-27
Look
LzmaUncompressdescription.It has similar parameters.
Yes, that's right.
I have modified it according the
LzmaUncompressdescriptionLast edit: Bruce Stark 2019-06-27