mem_uncompressΒΆ

mem_uncompress uncompresses a string that was compressed with mem_compress or zlib.

ssString = mem_uncompress(ssStringCompressed)
ssByteString = mem_uncompress(ssByteCompressed, nDestLen)

Return Value

ssString is a scalar string which may contain Null-characters.

ssByteString: If invoked with two parameters, ssByteString contains the zlib compressed data (without the 8 byte header, described in mem_compress).

Parameters

ssStringCompressed

ssStringCompressed is the compressed string (mem_compress).

ssByteCompressed

ssByteCompressed is a zlib compressed string.

nDestLen

nDestLen is the size in bytes of the uncompressed ssByteCompressed string.

Example

see mem_compress.

Invoke with 2 parameters:

def test_mem_compress()
{
   ssData = "Hello World, this is the data to compress";
   c = mem_compress(ssData);

   // Remove 8 byte header
   nbytes = mem_len(c);
   ssCompressed = mem_get(c, 9, nbytes-8);

   ssD= mem_uncompress(ssCompressed, strlen(ssData));
   ssData2 = mem_unpack(ssD);
   if (ssData2 != ssData) {
   error();
   }
}

Comment

This function uses the zlib-Library (http://www.gzip.org/zlib/). Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler.

History

Version Description
R2018.6 New Parameter nDestLen
5.0.0 ???
4.2.0 New

id-290043