Skip to content

Commit 7c2592c

Browse files
committed
Don't use _FPOSOFF on VC++14 on up.
1 parent 71b4ed2 commit 7c2592c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

include/boost/iostreams/detail/config/fpos.hpp

+9
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@
2222
# pragma once
2323
#endif
2424

25+
#include <boost/config.hpp>
26+
2527
# if (defined(_YVALS) || defined(_CPPLIB_VER)) && !defined(__SGI_STL_PORT) && \
2628
!defined(_STLPORT_VERSION) && !defined(__QNX__)
2729
/**/
2830
# define BOOST_IOSTREAMS_HAS_DINKUMWARE_FPOS
31+
32+
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1900
33+
#define BOOST_IOSTREAMS_FPOSOFF(fp) ((long long)(fp))
34+
#else
35+
#define BOOST_IOSTREAMS_FPOSOFF(fp) _FPOSOFF(fp)
36+
#endif
37+
2938
# endif
3039

3140
#endif // #ifndef BOOST_IOSTREAMS_DETAIL_CONFIG_FPOS_HPP_INCLUDED

include/boost/iostreams/positioning.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ inline stream_offset position_to_offset(std::streampos pos) { return pos; }
7575
// Dinkumware version. The value of _Myoff cannot be extracted directly, but can
7676
// be calculated as the difference between the result of converting the
7777
// std::fpos to a std::streamoff and the result of converting the member _Fpos
78-
// to a long. The latter operation is accomplished with the macro _FPOSOFF,
78+
// to a long. The latter operation is accomplished with the macro BOOST_IOSTREAMS_FPOSOFF,
7979
// which works correctly on platforms where std::fpos_t is an integral type and
8080
// platforms where it is a struct
8181

@@ -85,7 +85,7 @@ inline stream_offset fpos_t_to_offset(std::fpos_t pos)
8585
# if defined(_POSIX_) || (_INTEGRAL_MAX_BITS >= 64) || defined(__IBMCPP__)
8686
return pos;
8787
# else
88-
return _FPOSOFF(pos);
88+
return BOOST_IOSTREAMS_FPOSOFF(pos);
8989
# endif
9090
}
9191

@@ -104,7 +104,7 @@ inline stream_offset position_to_offset(std::streampos pos)
104104
return fpos_t_to_offset(streampos_to_fpos_t(pos)) +
105105
static_cast<stream_offset>(
106106
static_cast<std::streamoff>(pos) -
107-
_FPOSOFF(streampos_to_fpos_t(pos))
107+
BOOST_IOSTREAMS_FPOSOFF(streampos_to_fpos_t(pos))
108108
);
109109
}
110110

0 commit comments

Comments
 (0)