Search code examples
c++lzma

LZMA c++ problem with compression of large files


So trying to compress a 22gb file, everything works with files <2~gb I get an error of: SZ_ERRROR_FAIL.

A few breakpoints in, I get this from LzmaEnc.c:2946, because 'p->nowPos64' shows a value of 4294958849

Which I knows is the max value of a 32bit unsigned integer. I'm compiling in x64 so that shouldent be a problem.

Using LZMA 1.9

Something tells me, somewhere in all of this, there is a uint32 being used. That I have to find and replace with a uint64.

Implementation From 7Z SDK

Example Implementation:

int res = SZ_OK;
res = LzmaEncode(
        (unsigned char*)&outBuf[LZMA_PROPS_SIZE + sizeof(DATASIZE)], &destLen,
        (unsigned char*)&inBuf[0], inBuf.size(),
        &props, 
        (unsigned char*)&outBuf[0], &propsSize,
        props.writeEndMark,
        &g_ProgressCallback, &SzAllocForLzma, &SzAllocForLzma);
}

Iv added a new define after reading after reviewing more source code. _LZMA_SYSTEM_SIZE_T; It does not seem to do anything.

Is there a #define i'm missing to get LZMA to work correctly? Documentation is sparce at best.


Solution

  • Plain LMZA from the 7z impl. does NOT support files > 4gb. Must use LMZA2.