Important: The information in this document is obsolete and should not be used for new development.
UnpackBits
You can use theUnpackBitsprocedure 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
PackBitsto 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
TheUnpackBitsprocedure decompressessrcBytesbytes of data beginning at the location specified by thesrcPtrparameter and stores it at the location specified by thedstPtrparameter. It then modifies thesrcPtranddstPtrvariables 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,
UnpackBitsdoes not move relocatable blocks. Thus, you can call it at interrupt time.SPECIAL CONSIDERATIONS
BecauseUnpackBitschanges the values of thesrcPtranddstPtrparameters, you should pass toUnpackBitsonly copies of pointers to the source and destination buffers. This allows you to access the beginning of the source and destination buffers afterUnpackBitsreturns. Also, if the source or destination buffer is stored in an unlocked, relocatable block, this technique preventsUnpackBitsfrom changing the value of a master pointer, which would make the original handle invalid.SEE ALSO
For an example of the use of theUnpackBitsprocedure, see Listing 3-4 on page 3-21.