PureZIP_UnpackMemory
Posted: Tue Sep 27, 2011 5:41 pm
Hi,
I'm trying to compress an image I have encoded using Base64 (saved to a database), then uncompress it at a later date. Modifying the PureZIP_PackMemory example... lets just say that I don't know a lot about assigning strings to memory address'
In the following example, the top REMed out string works, but the larger string only produces +++++
Thank you for any insite, your expertise is appreciated:
I'm trying to compress an image I have encoded using Base64 (saved to a database), then uncompress it at a later date. Modifying the PureZIP_PackMemory example... lets just say that I don't know a lot about assigning strings to memory address'
In the following example, the top REMed out string works, but the larger string only produces +++++
Thank you for any insite, your expertise is appreciated:
Code: Select all
;PackData.s = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
;size reduced for readability
PackData.s = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoCw4"
SourceLength = Len(PackData)
Debug SourceLength
Debug PackData
*SourceMemoryID = AllocateMemory(SourceLength)
PokeS(*SourceMemoryID, PackData, SourceLength)
DestinationLength = SourceLength + (SourceLength * 0.01) + 12
*DestinationMemoryID = AllocateMemory(DestinationLength)
PureZIP_PackMemory(*SourceMemoryID, SourceLength, *DestinationMemoryID, @DestinationLength)
PackTest.s = Space(DestinationLength)
PackTest = PeekS(*DestinationMemoryID, @DestinationLength)
Debug Len(PackTest)
Debug PackTest
FreeMemory(*SourceMemoryID)
FreeMemory(*DestinationMemoryID)
*SourceMemoryID = AllocateMemory(SourceLength)
PokeS(*SourceMemoryID, PackTest, SourceLength)
DestinationLength = SourceLength + (SourceLength * 0.01) + 12
*DestinationMemoryID = AllocateMemory(DestinationLength)
PureZIP_UnpackMemory(*SourceMemoryID, SourceLength, *DestinationMemoryID, @DestinationLength)
UnpackTest.s = Space(DestinationLength)
UnpackTest = PeekS(*DestinationMemoryID, @DestinationLength)
Debug Len(UnpackTest)
Debug UnpackTest
FreeMemory(*SourceMemoryID)
FreeMemory(*DestinationMemoryID)