[llvm-commits] CVS: llvm/include/llvm/Support/Compressor.h

Chris Lattner lattner at cs.uiuc.edu
Sat Jan 29 09:16:24 PST 2005



Changes in directory llvm/include/llvm/Support:

Compressor.h updated: 1.4 -> 1.5
---
Log message:

There is no reason to include ostream here, include iosfwd instead.

This file was schizophrenic when it came to representing sizes.  In some
cases it represented them as 'unsigneds', which are not enough for 64-bit
hosts.  In other cases, it represented them as uint64_t's, which are 
inefficient for 32-bit hosts.

This patch unifies all of the sizes to use size_t instead.


---
Diffs of the changes:  (+14 -14)

 Compressor.h |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)


Index: llvm/include/llvm/Support/Compressor.h
diff -u llvm/include/llvm/Support/Compressor.h:1.4 llvm/include/llvm/Support/Compressor.h:1.5
--- llvm/include/llvm/Support/Compressor.h:1.4	Thu Nov 25 13:37:42 2004
+++ llvm/include/llvm/Support/Compressor.h	Sat Jan 29 11:16:07 2005
@@ -15,7 +15,7 @@
 #define LLVM_SUPPORT_COMPRESSOR_H
 
 #include "llvm/Support/DataTypes.h"
-#include <ostream>
+#include <iosfwd>
 
 namespace llvm {
 
@@ -46,9 +46,9 @@
       /// @throws std::string explaining error if a compression error occurs
       /// @returns The size of the output buffer \p out.
       /// @brief Compress memory to a new memory buffer.
-      static uint64_t compressToNewBuffer(
+      static size_t compressToNewBuffer(
         const char* in,           ///< The buffer to be compressed
-        unsigned size,            ///< The size of the buffer to be compressed
+        size_t size,              ///< The size of the buffer to be compressed
         char*&out                 ///< The returned output buffer
       );
 
@@ -59,9 +59,9 @@
       /// compression the caller would *prefer*.
       /// @returns The amount of data written to \p out.
       /// @brief Compress memory to a file.
-      static uint64_t compressToStream(
+      static size_t compressToStream(
         const char*in,            ///< The buffer to be compressed
-        unsigned size,            ///< The size of the buffer to be compressed
+        size_t size,              ///< The size of the buffer to be compressed
         std::ostream& out         ///< The output stream to write data on
       );
 
@@ -70,9 +70,9 @@
       /// by malloc. It is the caller's responsibility to free \p out. 
       /// @returns The size of the output buffer \p out.
       /// @brief Decompress memory to a new memory buffer.
-      static uint64_t decompressToNewBuffer(
+      static size_t decompressToNewBuffer(
         const char *in,           ///< The buffer to be decompressed
-        unsigned size,            ///< Size of the buffer to be decompressed
+        size_t size,              ///< Size of the buffer to be decompressed
         char*&out                 ///< The returned output buffer
       );
 
@@ -82,9 +82,9 @@
       /// this method. 
       /// @returns The amount of data written to \p out.
       /// @brief Decompress memory to a stream.
-      static uint64_t decompressToStream(
+      static size_t decompressToStream(
         const char *in,           ///< The buffer to be decompressed
-        unsigned size,            ///< Size of the buffer to be decompressed
+        size_t size,              ///< Size of the buffer to be decompressed
         std::ostream& out         ///< The stream to write write data on
       );
 
@@ -105,7 +105,7 @@
       /// @returns 0 for success, 1 for failure
       /// @throws nothing
       /// @brief Output callback function type
-      typedef unsigned (OutputDataCallback)(char*& buffer, unsigned& size,
+      typedef size_t (OutputDataCallback)(char*& buffer, size_t& size,
                                             void* context);
 
       /// This function does the compression work. The block of memory starting
@@ -123,9 +123,9 @@
       /// @throws std::string if an error occurs
       /// @returns the total size of the compressed data
       /// @brief Compress a block of memory.
-      static uint64_t compress(
+      static size_t compress(
         const char* in,            ///< The buffer to be compressed
-        unsigned size,             ///< The size of the buffer to be compressed
+        size_t size,               ///< The size of the buffer to be compressed
         OutputDataCallback* cb,    ///< Call back for memory allocation
         void* context = 0          ///< Context for callback
       );
@@ -143,9 +143,9 @@
       /// @throws std::string if an error occurs
       /// @returns the total size of the decompressed data
       /// @brief Decompress a block of memory.
-      static uint64_t decompress(
+      static size_t decompress(
         const char *in,              ///< The buffer to be decompressed
-        unsigned size,               ///< Size of the buffer to be decompressed
+        size_t size,                 ///< Size of the buffer to be decompressed
         OutputDataCallback* cb,      ///< Call back for memory allocation
         void* context = 0            ///< Context for callback
       );






More information about the llvm-commits mailing list