Boost logo

Boost-Commit :

From: technews_at_[hidden]
Date: 2008-05-26 15:25:07


Author: turkanis
Date: 2008-05-26 15:25:07 EDT (Mon, 26 May 2008)
New Revision: 45783
URL: http://svn.boost.org/trac/boost/changeset/45783

Log:
added 'x' prefix to several function and type names, to prevent them from being renamed by the preprocessor when Z_PREFIX is defined (fixes #1870)
Text files modified:
   trunk/boost/iostreams/filter/zlib.hpp | 17 +++++++++--------
   trunk/libs/iostreams/src/zlib.cpp | 6 +++---
   2 files changed, 12 insertions(+), 11 deletions(-)

Modified: trunk/boost/iostreams/filter/zlib.hpp
==============================================================================
--- trunk/boost/iostreams/filter/zlib.hpp (original)
+++ trunk/boost/iostreams/filter/zlib.hpp 2008-05-26 15:25:07 EDT (Mon, 26 May 2008)
@@ -47,8 +47,9 @@
 typedef unsigned char byte;
 typedef unsigned long ulong;
 
-typedef void* (*alloc_func)(void*, zlib::uint, zlib::uint);
-typedef void (*free_func)(void*, void*);
+// Prefix 'x' prevents symbols from being redefined when Z_PREFIX is defined
+typedef void* (*xalloc_func)(void*, zlib::uint, zlib::uint);
+typedef void (*xfree_func)(void*, void*);
 
                     // Compression levels
 
@@ -191,8 +192,8 @@
                  char*& dest_begin, char* dest_end );
     void after( const char*& src_begin, char*& dest_begin,
                 bool compress );
- int deflate(int flush);
- int inflate(int flush);
+ int xdeflate(int flush); // Prefix 'x' prevents symbols from being
+ int xinflate(int flush); // redefined when Z_PREFIX is defined
     void reset(bool compress, bool realloc);
 public:
     zlib::ulong crc() const { return crc_; }
@@ -201,8 +202,8 @@
 private:
     void do_init( const zlib_params& p, bool compress,
                   #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
- zlib::alloc_func,
- zlib::free_func,
+ zlib::xalloc_func,
+ zlib::xfree_func,
                   #endif
                   void* derived );
     void* stream_; // Actual type: z_stream*.
@@ -341,7 +342,7 @@
       char*& dest_begin, char* dest_end, bool flush )
 {
     before(src_begin, src_end, dest_begin, dest_end);
- int result = deflate(flush ? zlib::finish : zlib::no_flush);
+ int result = xdeflate(flush ? zlib::finish : zlib::no_flush);
     after(src_begin, dest_begin, true);
     zlib_error::check(result);
     return result != zlib::stream_end;
@@ -374,7 +375,7 @@
       char*& dest_begin, char* dest_end, bool /* flush */ )
 {
     before(src_begin, src_end, dest_begin, dest_end);
- int result = inflate(zlib::sync_flush);
+ int result = xinflate(zlib::sync_flush);
     after(src_begin, dest_begin, false);
     zlib_error::check(result);
     return result != zlib::stream_end;

Modified: trunk/libs/iostreams/src/zlib.cpp
==============================================================================
--- trunk/libs/iostreams/src/zlib.cpp (original)
+++ trunk/libs/iostreams/src/zlib.cpp 2008-05-26 15:25:07 EDT (Mon, 26 May 2008)
@@ -128,12 +128,12 @@
     dest_begin = next_out;
 }
 
-int zlib_base::deflate(int flush)
+int zlib_base::xdeflate(int flush)
 {
     return ::deflate(static_cast<z_stream*>(stream_), flush);
 }
 
-int zlib_base::inflate(int flush)
+int zlib_base::xinflate(int flush)
 {
     return ::inflate(static_cast<z_stream*>(stream_), flush);
 }
@@ -154,7 +154,7 @@
 void zlib_base::do_init
     ( const zlib_params& p, bool compress,
       #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
- zlib::alloc_func /* alloc */, zlib::free_func /* free*/,
+ zlib::xalloc_func /* alloc */, zlib::xfree_func /* free*/,
       #endif
       void* derived )
 {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk