Important: The information in this document is obsolete and should not be used for new development.
UnpackBits
You can use theUnpackBits
procedure to decompress a data buffer containing data compressed byPackBits
.
PROCEDURE UnpackBits (VAR srcPtr, dstPtr: Ptr; dstBytes: Integer);
srcPtr
- On entry, a pointer to the first byte of a buffer of data to be decompressed. On exit, a pointer to the first byte following the compressed data.
dstPtr
- On entry, a pointer to the first byte in which to store decompressed data. On exit, a pointer to the first byte following the decompressed data.
- dstBytes
- The number of bytes of the data before compression. In general, you should either use
PackBits
to compress data structures of a fixed size that you can then pass in this parameter toUnpackBits
, or store with the compressed data the original size of the uncompressed data.DESCRIPTION
TheUnpackBits
procedure decompressessrcBytes
bytes of data beginning at the location specified by thesrcPtr
parameter and stores it at the location specified by thedstPtr
parameter. It then modifies thesrcPtr
anddstPtr
variables to point to the first bytes after the compressed and decompressed data, respectively.Because your application must allocate memory for the source and destination buffers,
UnpackBits
does not move relocatable blocks. Thus, you can call it at interrupt time.SPECIAL CONSIDERATIONS
BecauseUnpackBits
changes the values of thesrcPtr
anddstPtr
parameters, you should pass toUnpackBits
only copies of pointers to the source and destination buffers. This allows you to access the beginning of the source and destination buffers afterUnpackBits
returns. Also, if the source or destination buffer is stored in an unlocked, relocatable block, this technique preventsUnpackBits
from changing the value of a master pointer, which would make the original handle invalid.SEE ALSO
For an example of the use of theUnpackBits
procedure, see Listing 3-4 on page 3-21.