diff -r 510d5bd079ad boost/iostreams/detail/system_failure.hpp
|
a
|
b
|
|
| 18 | 18 | #include <cstring> |
| 19 | 19 | #include <string> |
| 20 | 20 | #include <boost/config.hpp> |
| | 21 | #include <boost/throw_exception.hpp> |
| 21 | 22 | #include <boost/iostreams/detail/config/windows_posix.hpp> |
| 22 | 23 | #include <boost/iostreams/detail/ios.hpp> // failure. |
| 23 | 24 | |
| … |
… |
|
| 73 | 74 | { return system_failure(msg.c_str()); } |
| 74 | 75 | |
| 75 | 76 | inline void throw_system_failure(const char* msg) |
| 76 | | { throw system_failure(msg); } |
| | 77 | { boost::throw_exception(system_failure(msg)); } |
| 77 | 78 | |
| 78 | 79 | inline void throw_system_failure(const std::string& msg) |
| 79 | | { throw system_failure(msg); } |
| | 80 | { boost::throw_exception(system_failure(msg)); } |
| 80 | 81 | |
| 81 | 82 | } } } // End namespaces detail, iostreams, boost. |
| 82 | 83 | |
diff -r 510d5bd079ad libs/iostreams/src/bzip2.cpp
|
a
|
b
|
|
| 14 | 14 | // than using it (possibly importing code). |
| 15 | 15 | #define BOOST_IOSTREAMS_SOURCE |
| 16 | 16 | |
| | 17 | #include <boost/throw_exception.hpp> |
| 17 | 18 | #include <boost/iostreams/detail/config/dyn_link.hpp> |
| 18 | 19 | #include <boost/iostreams/filter/bzip2.hpp> |
| 19 | 20 | #include "bzlib.h" // Julian Seward's "bzip.h" header. |
| … |
… |
|
| 65 | 66 | case BZ_STREAM_END: |
| 66 | 67 | return; |
| 67 | 68 | case BZ_MEM_ERROR: |
| 68 | | throw std::bad_alloc(); |
| | 69 | boost::throw_exception(std::bad_alloc()); |
| 69 | 70 | default: |
| 70 | | throw bzip2_error(error); |
| | 71 | boost::throw_exception(bzip2_error(error)); |
| 71 | 72 | } |
| 72 | 73 | } |
| 73 | 74 | |
diff -r 510d5bd079ad libs/iostreams/src/file_descriptor.cpp
|
a
|
b
|
|
| 24 | 24 | #include <boost/iostreams/detail/ios.hpp> // openmodes, failure. |
| 25 | 25 | #include <boost/iostreams/device/file_descriptor.hpp> |
| 26 | 26 | #include <boost/integer_traits.hpp> |
| | 27 | #include <boost/throw_exception.hpp> |
| 27 | 28 | |
| 28 | 29 | // OS-specific headers for low-level i/o. |
| 29 | 30 | |
| … |
… |
|
| 154 | 155 | |
| 155 | 156 | int fd = BOOST_IOSTREAMS_FD_OPEN(path.c_str(), oflag, pmode); |
| 156 | 157 | if (fd == -1) { |
| 157 | | throw BOOST_IOSTREAMS_FAILURE("bad open"); |
| | 158 | boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad open")); |
| 158 | 159 | } else { |
| 159 | 160 | pimpl_->handle_ = fd; |
| 160 | 161 | pimpl_->flags_ = impl::close_on_exit; |
| … |
… |
|
| 172 | 173 | #ifdef BOOST_IOSTREAMS_WINDOWS |
| 173 | 174 | DWORD result; |
| 174 | 175 | if (!::ReadFile(pimpl_->handle_, s, n, &result, NULL)) |
| 175 | | throw detail::bad_read(); |
| | 176 | boost::throw_exception(detail::bad_read()); |
| 176 | 177 | return result == 0 ? -1 : static_cast<std::streamsize>(result); |
| 177 | 178 | #else // #ifdef BOOST_IOSTREAMS_WINDOWS |
| 178 | 179 | errno = 0; |
| 179 | 180 | std::streamsize result = BOOST_IOSTREAMS_FD_READ(pimpl_->handle_, s, n); |
| 180 | 181 | if (errno != 0) |
| 181 | | throw detail::bad_read(); |
| | 182 | boost::throw_exception(detail::bad_read()); |
| 182 | 183 | return result == 0 ? -1 : result; |
| 183 | 184 | #endif // #ifdef BOOST_IOSTREAMS_WINDOWS |
| 184 | 185 | } |
| … |
… |
|
| 192 | 193 | if ( dwResult == INVALID_SET_FILE_POINTER && |
| 193 | 194 | ::GetLastError() != NO_ERROR ) |
| 194 | 195 | { |
| 195 | | throw detail::bad_seek(); |
| | 196 | boost::throw_exception(detail::bad_seek()); |
| 196 | 197 | } |
| 197 | 198 | } |
| 198 | 199 | DWORD ignore; |
| 199 | 200 | if (!::WriteFile(pimpl_->handle_, s, n, &ignore, NULL)) |
| 200 | | throw detail::bad_write(); |
| | 201 | boost::throw_exception(detail::bad_write()); |
| 201 | 202 | return n; |
| 202 | 203 | #else // #ifdef BOOST_IOSTREAMS_WINDOWS |
| 203 | 204 | int amt = BOOST_IOSTREAMS_FD_WRITE(pimpl_->handle_, s, n); |
| 204 | 205 | if (amt < n) |
| 205 | | throw detail::bad_write(); // Handles blocking fd's only. |
| | 206 | boost::throw_exception(detail::bad_write()); // Handles blocking fd's only. |
| 206 | 207 | return n; |
| 207 | 208 | #endif // #ifdef BOOST_IOSTREAMS_WINDOWS |
| 208 | 209 | } |
| … |
… |
|
| 226 | 227 | if ( dwResultLow == INVALID_SET_FILE_POINTER && |
| 227 | 228 | ::GetLastError() != NO_ERROR ) |
| 228 | 229 | { |
| 229 | | throw detail::bad_seek(); |
| | 230 | boost::throw_exception(detail::bad_seek()); |
| 230 | 231 | } else { |
| 231 | 232 | return offset_to_position( |
| 232 | 233 | (stream_offset(lDistanceToMoveHigh) << 32) + dwResultLow |
| … |
… |
|
| 236 | 237 | if ( off > integer_traits<BOOST_IOSTREAMS_FD_OFFSET>::const_max || |
| 237 | 238 | off < integer_traits<BOOST_IOSTREAMS_FD_OFFSET>::const_min ) |
| 238 | 239 | { |
| 239 | | throw BOOST_IOSTREAMS_FAILURE("bad offset"); |
| | 240 | boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset")); |
| 240 | 241 | } |
| 241 | 242 | stream_offset result = |
| 242 | 243 | BOOST_IOSTREAMS_FD_SEEK( |
| … |
… |
|
| 249 | 250 | SEEK_END ) |
| 250 | 251 | ); |
| 251 | 252 | if (result == -1) |
| 252 | | throw detail::bad_seek(); |
| | 253 | boost::throw_exception(detail::bad_seek()); |
| 253 | 254 | return offset_to_position(result); |
| 254 | 255 | #endif // #ifdef BOOST_IOSTREAMS_WINDOWS |
| 255 | 256 | } |
| … |
… |
|
| 261 | 262 | #ifdef BOOST_IOSTREAMS_WINDOWS |
| 262 | 263 | if (i.handle_ != reinterpret_cast<handle_type>(-1)) { |
| 263 | 264 | if (!::CloseHandle(i.handle_)) |
| 264 | | throw BOOST_IOSTREAMS_FAILURE("bad close"); |
| | 265 | boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad close")); |
| 265 | 266 | i.handle_ = reinterpret_cast<handle_type>(-1); |
| 266 | 267 | i.flags_ = 0; |
| 267 | 268 | return; |
| … |
… |
|
| 269 | 270 | #else // #ifdef BOOST_IOSTREAMS_WINDOWS |
| 270 | 271 | if (i.handle_ != -1) { |
| 271 | 272 | if (BOOST_IOSTREAMS_FD_CLOSE(i.handle_) == -1) |
| 272 | | throw BOOST_IOSTREAMS_FAILURE("bad close"); |
| | 273 | boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad close")); |
| 273 | 274 | i.handle_ = -1; |
| 274 | 275 | i.flags_ = 0; |
| 275 | 276 | } |
diff -r 510d5bd079ad libs/iostreams/src/mapped_file.cpp
|
a
|
b
|
|
| 22 | 22 | #include <boost/iostreams/detail/ios.hpp> // failure. |
| 23 | 23 | #include <boost/iostreams/detail/system_failure.hpp> |
| 24 | 24 | #include <boost/iostreams/device/mapped_file.hpp> |
| | 25 | #include <boost/throw_exception.hpp> |
| 25 | 26 | |
| 26 | 27 | #ifdef BOOST_IOSTREAMS_WINDOWS |
| 27 | 28 | # define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
| … |
… |
|
| 338 | 339 | using namespace std; |
| 339 | 340 | |
| 340 | 341 | if (is_open()) |
| 341 | | throw BOOST_IOSTREAMS_FAILURE("file already open"); |
| | 342 | boost::throw_exception(BOOST_IOSTREAMS_FAILURE("file already open")); |
| 342 | 343 | if (!pimpl_) |
| 343 | 344 | pimpl_.reset(new impl_type); |
| 344 | 345 | else |
diff -r 510d5bd079ad libs/iostreams/src/zlib.cpp
|
a
|
b
|
|
| 14 | 14 | // than using it (possibly importing code). |
| 15 | 15 | #define BOOST_IOSTREAMS_SOURCE |
| 16 | 16 | |
| | 17 | #include <boost/throw_exception.hpp> |
| 17 | 18 | #include <boost/iostreams/detail/config/dyn_link.hpp> |
| 18 | 19 | #include <boost/iostreams/filter/zlib.hpp> |
| 19 | 20 | #include "zlib.h" // Jean-loup Gailly's and Mark Adler's "zlib.h" header. |
| … |
… |
|
| 78 | 79 | //case Z_BUF_ERROR: |
| 79 | 80 | return; |
| 80 | 81 | case Z_MEM_ERROR: |
| 81 | | throw std::bad_alloc(); |
| | 82 | boost::throw_exception(std::bad_alloc()); |
| 82 | 83 | default: |
| 83 | | throw zlib_error(error); |
| | 84 | boost::throw_exception(zlib_error(error)); |
| 84 | 85 | ; |
| 85 | 86 | } |
| 86 | 87 | } |