Re: [Boost-bugs] [Boost C++ Libraries] #824: BOOST_IOSTREAMS_HAS_LSEEK64 on Mac OS X

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #824: BOOST_IOSTREAMS_HAS_LSEEK64 on Mac OS X
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-08-19 15:35:59


#824: BOOST_IOSTREAMS_HAS_LSEEK64 on Mac OS X
-------------------+--------------------------------------------------------
  Reporter: gmsb | Owner: bemandawes
      Type: Bugs | Status: new
 Milestone: | Component: iostreams
   Version: None | Severity: Showstopper
Resolution: None | Keywords:
-------------------+--------------------------------------------------------
Changes (by marshall):

  * component: None => iostreams

Old description:

> {{{
> Mac OS X has 64-bit file offsets but uses the standard lseek call rather
> than lseek64.
>
> The following is one fix for file_descriptor::seek() but there's no doubt
> a better way...
>
> Change lines 203 and 218 from:
>
> 203 #ifndef BOOST_IOSTREAMS_HAS_LSEEK64
> 204 if ( off > integer_traits<long>::const_max ||
> 205 off < integer_traits<long>::const_min )
> 206 {
> 207 throw BOOST_IOSTREAMS_FAILURE("bad offset");
> 208 }
> 209 #endif
> 210
> 211 stream_offset result =
> 212 #ifdef BOOST_IOSTREAMS_HAS_LSEEK64
> 213 lseek64
> 214 #else
> 215 lseek
> 216 #endif
> 217 ( pimpl_->fd_,
> 218 #ifdef BOOST_IOSTREAMS_HAS_LSEEK64
> 219 off,
> 220 #else
> 221 static_cast<long>(off),
> 222 #endif
> 223 way == BOOST_IOS::beg ?
> 224 SEEK_SET :
> 225 way == BOOST_IOS::cur ?
> 226 SEEK_CUR :
> 227 SEEK_END );
>
> To:
>
> 203 #if !defined(BOOST_IOSTREAMS_HAS_LSEEK64) && !defined(__MACH__)
> ...
> 218 #if defined(BOOST_IOSTREAMS_HAS_LSEEK64) ||
> defined(__MACH__)
> ...
>

> }}}

New description:

 {{{
 Mac OS X has 64-bit file offsets but uses the standard lseek call rather
 than lseek64.

 The following is one fix for file_descriptor::seek() but there's no doubt
 a better way...

 Change lines 203 and 218 from:

   203 #ifndef BOOST_IOSTREAMS_HAS_LSEEK64
   204 if ( off > integer_traits<long>::const_max ||
   205 off < integer_traits<long>::const_min )
   206 {
   207 throw BOOST_IOSTREAMS_FAILURE("bad offset");
   208 }
   209 #endif
   210
   211 stream_offset result =
   212 #ifdef BOOST_IOSTREAMS_HAS_LSEEK64
   213 lseek64
   214 #else
   215 lseek
   216 #endif
   217 ( pimpl_->fd_,
   218 #ifdef BOOST_IOSTREAMS_HAS_LSEEK64
   219 off,
   220 #else
   221 static_cast<long>(off),
   222 #endif
   223 way == BOOST_IOS::beg ?
   224 SEEK_SET :
   225 way == BOOST_IOS::cur ?
   226 SEEK_CUR :
   227 SEEK_END );

 To:

   203 #if !defined(BOOST_IOSTREAMS_HAS_LSEEK64) && !defined(__MACH__)
   ...
   218 #if defined(BOOST_IOSTREAMS_HAS_LSEEK64) ||
 defined(__MACH__)
   ...


 }}}

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/824#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:56 UTC