Hi,
first a big "Thank You" for PureBasic 5.10 beta 1.
I use UnpackMemory() in my project. PB 5.10 b1 says "UnpackMemory is not a function, array, list, map or macro!".
Is this a bug or is something changed?
Thanks.
ThoPie
[PB 5.10 B1] UnpackMemory
Re: [PB 5.10 B1] UnpackMemory
The whole packer lib has been changed. You need to use:
UseZipPacker() and/or UseLZMAPacker() and/or UseBriefLZPacker() and then Un/CompressMemory(), or the Pack commands (it handle ZIP archive creation and manipulation and 7z archive unpack (no creation).
A small sample to get you started:
UseZipPacker() and/or UseLZMAPacker() and/or UseBriefLZPacker() and then Un/CompressMemory(), or the Pack commands (it handle ZIP archive creation and manipulation and 7z archive unpack (no creation).
A small sample to get you started:
Code: Select all
UseLZMAPacker()
*a = AllocateMemory(10000)
*b = AllocateMemory(100000)
Debug CompressMemory(*a, 10000, *b, 100000)
Debug UncompressMemory(*b, 100000, *a, 10000)
If OpenPack(0, "Test.7z")
Debug "cool !"
If ExaminePack(0)
Debug "ok"
While NextPackEntry(0)
Debug PackEntryName(0)
Debug PackEntryType(0)
Debug PackEntrySize(0)
Debug PackEntrySize(0, 1)
Wend
EndIf
Debug UncompressPackFile(0, "yo_unicode.pdf", "test.pdf")
ClosePack(0)
EndIf
-
- Addict
- Posts: 1516
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: [PB 5.10 B1] UnpackMemory
How to find out required buffer size "*Output" function UncompressMemory()?
Re: [PB 5.10 B1] UnpackMemory
It's not stored in the compressed buffer, so you need to store it yourself somewhere (you can put it in the front of your compressed buffer if you want).
-
- Addict
- Posts: 1516
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: [PB 5.10 B1] UnpackMemory
The experiment showed that when using UseBriefLZPacker(), is stored in the buffer size, not compressed data.Fred wrote:It's not stored in the compressed buffer
Code: Select all
UseBriefLZPacker()
String.s = "CompressMemory+UseBriefLZPacker()"+
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"+
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Debug Hex(StringByteLength(String))
*Out = AllocateMemory($1000)
x=CompressMemory(@String, StringByteLength(String), *Out, $1000)
If x
Debug Hex(PeekL(*Out+8))
ShowMemoryViewer(*Out, x)
EndIf
Re: [PB 5.10 B1] UnpackMemory
You should not rely on that, as it could change. If there is no PB function to retrieve the size, you should not try guessing.