diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-10-04 17:29:25 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-10-04 17:29:25 +0000 |
commit | 469c34bdeb7f823e2f3320cd1dbfa19ae1ac6b82 (patch) | |
tree | 12f5450f4c0281dca92bdf7e8d2598c230a8855c /include/llvm/Support/Compressor.h | |
parent | ce4e6ade3eb986978988c5ededc4a001e38a0d81 (diff) |
Add a context for the callback so different compression scenarios can be
distinguished. Tidy up documentation. Thanks, Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/Compressor.h')
-rw-r--r-- | include/llvm/Support/Compressor.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/include/llvm/Support/Compressor.h b/include/llvm/Support/Compressor.h index eea98ebe13..15761a07d6 100644 --- a/include/llvm/Support/Compressor.h +++ b/include/llvm/Support/Compressor.h @@ -14,25 +14,25 @@ #ifndef LLVM_SUPPORT_COMPRESSOR_H #define LLVM_SUPPORT_COMPRESSOR_H -#include <llvm/Support/DataTypes.h> +#include "llvm/Support/DataTypes.h" namespace llvm { /// This class provides an abstraction for compressing a block of memory using /// a standard compression utility such as bzip2 or libz. This interface - /// allos us to abstraction the notion of compression and deal with alternate + /// allows us to abstract the notion of compression and deal with alternate /// compression scheme availability depending on the configured platform. This /// facility will always favor a bzip2 implementation if its available. - /// Otherwise, libz will be used if its available. If neither zlib nor bzip2 + /// Otherwise, libz will be used if it is available. If neither zlib nor bzip2 /// are available, a very simple algorithm provided by the Compressor class - /// will be used The type of compression used can be determined by inspecting + /// will be used. The type of compression used can be determined by inspecting /// the first byte of the compressed output. ASCII values '0', '1', and '2', /// denote the compression type as given in the Algorithm enumeration below. /// The Compressor is intended for use with memory mapped files where the /// entire data block to be compressed or decompressed is available in - /// memory. Output, however, can be gathered in repeated calls to a callback. + /// memory. However, output can be gathered in repeated calls to a callback. /// @since 1.4 - /// @brief An abstraction for memory to memory data compression + /// @brief An abstraction for memory to memory data (de)compression class Compressor { /// @name Types /// @{ @@ -50,7 +50,8 @@ namespace llvm { /// @returns 0 for success, 1 for failure /// @throws nothing /// @brief Output callback function type - typedef unsigned (OutputDataCallback)(char*& buffer, unsigned& size); + typedef unsigned (OutputDataCallback)(char*& buffer, unsigned& size, + void* context); /// @} /// @name Methods @@ -72,7 +73,8 @@ namespace llvm { /// @returns the total size of the compressed data /// @brief Compress a block of memory. static uint64_t compress(char* in, unsigned size, OutputDataCallback* cb, - Algorithm hint = COMP_TYPE_BZIP2); + Algorithm hint = COMP_TYPE_BZIP2, + void* context = 0); /// This function does the decompression work. The block of memory /// starting at \p in and extending for \p size bytes is decompressed. The @@ -88,7 +90,7 @@ namespace llvm { /// @returns the total size of the decompressed data /// @brief Decompress a block of memory. static uint64_t decompress(char *in, unsigned size, - OutputDataCallback* cb); + OutputDataCallback* cb, void* context = 0); /// @} }; |