|
Boost-Commit : |
From: technews_at_[hidden]
Date: 2007-12-29 01:38:59
Author: turkanis
Date: 2007-12-29 01:38:59 EST (Sat, 29 Dec 2007)
New Revision: 42329
URL: http://svn.boost.org/trac/boost/changeset/42329
Log:
improved use of glibc feature test macros; added support for ftruncate
Text files modified:
branches/iostreams_dev/boost/iostreams/detail/config/rtl.hpp | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
Modified: branches/iostreams_dev/boost/iostreams/detail/config/rtl.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/config/rtl.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/config/rtl.hpp 2007-12-29 01:38:59 EST (Sat, 29 Dec 2007)
@@ -36,7 +36,7 @@
#define BOOST_IOSTREAMS_FD_READ BOOST_IOSTREAMS_RTL(read)
#define BOOST_IOSTREAMS_FD_WRITE BOOST_IOSTREAMS_RTL(write)
-// Handle lseek
+// Handle lseek and truncate
#if defined(BOOST_IOSTREAMS_WINDOWS) && !defined(__CYGWIN__)
# if defined(BOOST_MSVC) || defined(__MSVCRT__) // MSVC, MinGW
# define BOOST_IOSTREAMS_FD_SEEK _lseeki64
@@ -46,12 +46,17 @@
# define BOOST_IOSTREAMS_FD_OFFSET long
# endif
#else // Non-windows
-# if defined(_LARGEFILE64_SOURCE) || defined(BOOST_IOSTREAMS_HAS_LSEEK64)
-# define BOOST_IOSTREAMS_FD_SEEK lseek64 // GCC for some 32-bit *nix
-# define BOOST_IOSTREAMS_FD_OFFSET off64_t
+# if defined(_LARGEFILE64_SOURCE) && \
+ (!defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64) || \
+ defined(BOOST_IOSTREAMS_HAS_LSEEK64) \
+ /**/
+# define BOOST_IOSTREAMS_FD_SEEK lseek64 // GCC for some 32-bit *nix
+# define BOOST_IOSTREAMS_FD_TRUNCATE ftruncate64
+# define BOOST_IOSTREAMS_FD_OFFSET off64_t
# else // Cygwin, Darwin, ...
-# define BOOST_IOSTREAMS_FD_SEEK lseek
-# define BOOST_IOSTREAMS_FD_OFFSET off_t
+# define BOOST_IOSTREAMS_FD_SEEK lseek
+# define BOOST_IOSTREAMS_FD_TRUNCATE ftruncate
+# define BOOST_IOSTREAMS_FD_OFFSET off_t
# endif
#endif
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