Ticket #2094: boost_iostreams_no_throw.diff
File boost_iostreams_no_throw.diff, 33.8 KB (added by , 13 years ago) |
---|
-
boost/iostreams/device/mapped_file.hpp
Patch from <https://svn.boost.org/trac/boost/ticket/2094>
old new 25 25 #include <boost/iostreams/positioning.hpp> 26 26 #include <boost/shared_ptr.hpp> 27 27 #include <boost/static_assert.hpp> 28 #include <boost/throw_execption.hpp> 28 29 #include <boost/type_traits/is_same.hpp> 29 30 30 31 // Must come last. … … 393 394 param_type params(p); 394 395 if (params.flags) { 395 396 if (params.flags != mapped_file::readonly) 396 throw BOOST_IOSTREAMS_FAILURE("invalid flags");397 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags")); 397 398 } else { 398 399 if (params.mode & BOOST_IOS::out) 399 throw BOOST_IOSTREAMS_FAILURE("invalid mode");400 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode")); 400 401 params.mode |= BOOST_IOS::in; 401 402 } 402 403 open_impl(params); … … 479 480 param_type params(p); 480 481 if (params.flags) { 481 482 if (params.flags & mapped_file::readonly) 482 throw BOOST_IOSTREAMS_FAILURE("invalid flags");483 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags")); 483 484 } else { 484 485 if (params.mode & BOOST_IOS::in) 485 throw BOOST_IOSTREAMS_FAILURE("invalid mode");486 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode")); 486 487 params.mode |= BOOST_IOS::out; 487 488 } 488 489 mapped_file::open(params); -
boost/iostreams/detail/adapter/direct_adapter.hpp
old new 30 30 #include <boost/preprocessor/repetition/enum_binary_params.hpp> 31 31 #include <boost/preprocessor/repetition/enum_params.hpp> 32 32 #include <boost/static_assert.hpp> 33 #include <boost/throw_exception.hpp> 33 34 #include <boost/type_traits/is_convertible.hpp> 34 35 35 36 // Must come last. … … 209 210 using namespace std; 210 211 pointers& put = ptrs_.second(); 211 212 if (n > static_cast<std::streamsize>(put.end - put.ptr)) 212 throw write_area_exhausted();213 boost::throw_exception(write_area_exhausted()); 213 214 std::copy(s, s + n, put.ptr); 214 215 put.ptr += n; 215 216 return n; … … 224 225 pointers& get = ptrs_.first(); 225 226 pointers& put = ptrs_.second(); 226 227 if (way == BOOST_IOS::cur && get.ptr != put.ptr) 227 throw bad_seek();228 boost::throw_exception(bad_seek()); 228 229 ptrdiff_t next = 0; 229 230 if ((which & BOOST_IOS::in) || !is_double::value) { 230 231 if (way == BOOST_IOS::beg) … … 236 237 if (next >= 0 && next <= get.end - get.beg) 237 238 get.ptr = get.beg + next; 238 239 else 239 throw bad_seek();240 boost::throw_exception(bad_seek()); 240 241 } 241 242 if ((which & BOOST_IOS::out) && is_double::value) { 242 243 if (way == BOOST_IOS::beg) … … 248 249 if (next >= 0 && next <= put.end - put.beg) 249 250 put.ptr = put.beg + next; 250 251 else 251 throw bad_seek();252 boost::throw_exception(bad_seek()); 252 253 } 253 254 return offset_to_position(next); 254 255 } -
boost/iostreams/detail/adapter/concept_adapter.hpp
old new 22 22 #include <boost/iostreams/operations.hpp> 23 23 #include <boost/mpl/if.hpp> 24 24 #include <boost/static_assert.hpp> 25 #include <boost/throw_exception.hpp> 25 26 26 27 // Must come last. 27 28 #include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC. … … 137 138 seek( Device&, stream_offset, BOOST_IOS::seekdir, 138 139 BOOST_IOS::openmode, any_tag ) 139 140 { 140 throw cant_seek();141 boost::throw_exception(cant_seek()); 141 142 } 142 143 143 144 template<typename Device> … … 171 172 static std::streamsize 172 173 write( Device&, Dummy*, const typename char_type_of<Device>::type*, 173 174 std::streamsize ) 174 { throw cant_write(); }175 { boost::throw_exception(cant_write()); } 175 176 }; 176 177 177 178 template<> … … 179 180 template<typename Device, typename Dummy> 180 181 static std::streamsize 181 182 read(Device&, Dummy*, typename char_type_of<Device>::type*, std::streamsize) 182 { throw cant_read(); }183 { boost::throw_exception(cant_read()); } 183 184 184 185 template<typename Device, typename Dummy> 185 186 static std::streamsize … … 205 206 static std::streampos 206 207 seek( Filter&, Device*, stream_offset, 207 208 BOOST_IOS::seekdir, BOOST_IOS::openmode, any_tag ) 208 { throw cant_seek(); }209 { boost::throw_exception(cant_seek()); } 209 210 210 211 template<typename Filter, typename Device> 211 212 static std::streampos … … 252 253 static std::streamsize 253 254 write( Filter&, Sink*, const typename char_type_of<Filter>::type*, 254 255 std::streamsize ) 255 { throw cant_write(); }256 { boost::throw_exception(cant_write()); } 256 257 }; 257 258 258 259 template<> … … 260 261 template<typename Filter, typename Source> 261 262 static std::streamsize 262 263 read(Filter&, Source*, typename char_type_of<Filter>::type*,std::streamsize) 263 { throw cant_read(); }264 { boost::throw_exception(cant_read()); } 264 265 265 266 template<typename Filter, typename Sink> 266 267 static std::streamsize -
boost/iostreams/detail/adapter/range_adapter.hpp
old new 21 21 #include <boost/iostreams/detail/error.hpp> 22 22 #include <boost/iostreams/positioning.hpp> 23 23 #include <boost/mpl/if.hpp> 24 #include <boost/throw_exception.hpp> 24 25 #include <boost/type_traits/is_convertible.hpp> 25 26 #include <boost/utility/enable_if.hpp> 26 27 … … 116 117 { 117 118 while (cur != last && n-- > 0) *cur++ = *s++; 118 119 if (cur == last && n > 0) 119 throw write_area_exhausted();120 boost::throw_exception(write_area_exhausted()); 120 121 return n; 121 122 } 122 123 }; … … 144 145 std::copy(s, s + count, cur); 145 146 cur += count; 146 147 if (count < n) 147 throw write_area_exhausted();148 boost::throw_exception(write_area_exhausted()); 148 149 return n; 149 150 } 150 151 … … 156 157 using namespace std; 157 158 switch (way) { 158 159 case BOOST_IOS::beg: 159 if (off > last - first || off < 0) throw bad_seek(); 160 if (off > last - first || off < 0) 161 boost::throw_exception(bad_seek()); 160 162 cur = first + off; 161 163 break; 162 164 case BOOST_IOS::cur: 163 165 { 164 166 std::ptrdiff_t newoff = cur - first + off; 165 if (newoff > last - first || newoff < 0) throw bad_seek(); 167 if (newoff > last - first || newoff < 0) 168 boost::throw_exception(bad_seek()); 166 169 cur += off; 167 170 break; 168 171 } 169 172 case BOOST_IOS::end: 170 if (last - first + off < 0 || off > 0) throw bad_seek(); 173 if (last - first + off < 0 || off > 0) 174 boost::throw_exception(bad_seek()); 171 175 cur = last + off; 172 176 break; 173 177 default: -
boost/iostreams/detail/system_failure.hpp
old new 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 -
boost/iostreams/detail/streambuf/indirect_streambuf.hpp
old new 35 35 #include <boost/iostreams/traits.hpp> 36 36 #include <boost/iostreams/operations.hpp> 37 37 #include <boost/mpl/if.hpp> 38 #include <boost/throw_exception.hpp> 38 39 #include <boost/type_traits/is_convertible.hpp> 39 40 40 41 // Must come last. … … 274 275 *gptr() = traits_type::to_char_type(c); 275 276 return traits_type::not_eof(c); 276 277 } else { 277 throw bad_putback();278 boost::throw_exception(bad_putback()); 278 279 } 279 280 } 280 281 -
boost/iostreams/detail/streambuf/direct_streambuf.hpp
old new 29 29 #include <boost/iostreams/operations.hpp> 30 30 #include <boost/iostreams/positioning.hpp> 31 31 #include <boost/iostreams/traits.hpp> 32 #include <boost/throw_exception.hpp> 32 33 33 34 // Must come last. 34 35 #include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC. … … 138 139 direct_streambuf<T, Tr>::underflow() 139 140 { 140 141 if (!ibeg_) 141 throw cant_read();142 boost::throw_exception(cant_read()); 142 143 if (!gptr()) 143 144 init_get_area(); 144 145 return gptr() != iend_ ? … … 152 153 { 153 154 using namespace std; 154 155 if (!ibeg_) 155 throw cant_read();156 boost::throw_exception(cant_read()); 156 157 if (gptr() != 0 && gptr() != ibeg_) { 157 158 gbump(-1); 158 159 if (!traits_type::eq_int_type(c, traits_type::eof())) 159 160 *gptr() = traits_type::to_char_type(c); 160 161 return traits_type::not_eof(c); 161 162 } 162 throw bad_putback();163 boost::throw_exception(bad_putback()); 163 164 } 164 165 165 166 template<typename T, typename Tr> … … 167 168 direct_streambuf<T, Tr>::overflow(int_type c) 168 169 { 169 170 using namespace std; 170 if (!obeg_) throw BOOST_IOSTREAMS_FAILURE("no write access"); 171 if (!obeg_) 172 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("no write access")); 171 173 if (!pptr()) init_put_area(); 172 174 if (!traits_type::eq_int_type(c, traits_type::eof())) { 173 175 if (pptr() == oend_) 174 throw BOOST_IOSTREAMS_FAILURE("write area exhausted"); 176 boost::throw_exception( 177 BOOST_IOSTREAMS_FAILURE("write area exhausted") 178 ); 175 179 *pptr() = traits_type::to_char_type(c); 176 180 pbump(1); 177 181 return c; … … 215 219 using namespace std; 216 220 BOOST_IOS::openmode both = BOOST_IOS::in | BOOST_IOS::out; 217 221 if (two_head() && (which & both) == both) 218 throw bad_seek();222 boost::throw_exception(bad_seek()); 219 223 stream_offset result = -1; 220 224 bool one = one_head(); 221 225 if (one && (pptr() != 0 || gptr()== 0)) … … 230 234 default: assert(0); 231 235 } 232 236 if (next < 0 || next > (iend_ - ibeg_)) 233 throw bad_seek();237 boost::throw_exception(bad_seek()); 234 238 setg(ibeg_, ibeg_ + next, iend_); 235 239 result = next; 236 240 } … … 244 248 default: assert(0); 245 249 } 246 250 if (next < 0 || next > (oend_ - obeg_)) 247 throw bad_seek();251 boost::throw_exception(bad_seek()); 248 252 pbump(static_cast<int>(next - (pptr() - obeg_))); 249 253 result = next; 250 254 } -
libs/iostreams/src/zlib.cpp
old new 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 } -
libs/iostreams/src/mapped_file.cpp
old new 14 14 #include <boost/iostreams/detail/file_handle.hpp> 15 15 #include <boost/iostreams/detail/system_failure.hpp> 16 16 #include <boost/iostreams/device/mapped_file.hpp> 17 #include <boost/throw_exception.hpp> 17 18 18 19 #ifdef BOOST_IOSTREAMS_WINDOWS 19 20 # define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers … … 82 83 void mapped_file_impl::open(param_type p) 83 84 { 84 85 if (is_open()) 85 throw BOOST_IOSTREAMS_FAILURE("file already open");86 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("file already open")); 86 87 p.normalize(); 87 88 open_file(p); 88 89 map_file(p); // May modify p.hint … … 110 111 void mapped_file_impl::resize(stream_offset new_size) 111 112 { 112 113 if (!is_open()) 113 throw BOOST_IOSTREAMS_FAILURE("file is closed");114 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("file is closed")); 114 115 if (flags() & mapped_file::priv) 115 throw BOOST_IOSTREAMS_FAILURE("can't resize private mapped file"); 116 boost::throw_exception( 117 BOOST_IOSTREAMS_FAILURE("can't resize private mapped file") 118 ); 116 119 if (!(flags() & mapped_file::readwrite)) 117 throw BOOST_IOSTREAMS_FAILURE("can't resize readonly mapped file"); 120 boost::throw_exception( 121 BOOST_IOSTREAMS_FAILURE("can't resize readonly mapped file") 122 ); 118 123 if (params_.offset >= new_size) 119 throw BOOST_IOSTREAMS_FAILURE("can't resize below mapped offset"); 124 boost::throw_exception( 125 BOOST_IOSTREAMS_FAILURE("can't resize below mapped offset") 126 ); 120 127 if (!unmap_file()) 121 128 cleanup_and_throw("failed unmapping file"); 122 129 #ifdef BOOST_IOSTREAMS_WINDOWS … … 335 342 p.hint = 0; 336 343 try_map_file(p); 337 344 } else { 338 throw e;345 boost::throw_exception(e); 339 346 } 340 347 } 341 348 } … … 393 400 void mapped_file_params_base::normalize() 394 401 { 395 402 if (mode && flags) 396 throwBOOST_IOSTREAMS_FAILURE(403 boost::throw_exception(BOOST_IOSTREAMS_FAILURE( 397 404 "at most one of 'mode' and 'flags' may be specified" 398 ) ;405 )); 399 406 if (flags) { 400 407 switch (flags) { 401 408 case mapped_file::readonly: … … 403 410 case mapped_file::priv: 404 411 break; 405 412 default: 406 throw BOOST_IOSTREAMS_FAILURE("invalid flags");413 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid flags")); 407 414 } 408 415 } else { 409 416 flags = (mode & BOOST_IOS::out) ? … … 412 419 mode = BOOST_IOS::openmode(); 413 420 } 414 421 if (offset < 0) 415 throw BOOST_IOSTREAMS_FAILURE("invalid offset");422 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid offset")); 416 423 if (new_file_size < 0) 417 throw BOOST_IOSTREAMS_FAILURE("invalid new file size"); 424 boost::throw_exception( 425 BOOST_IOSTREAMS_FAILURE("invalid new file size") 426 ); 418 427 } 419 428 420 429 } // End namespace detail. -
libs/iostreams/src/bzip2.cpp
old new 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 -
libs/iostreams/src/gzip.cpp
old new 15 15 #define BOOST_IOSTREAMS_SOURCE 16 16 17 17 #include <boost/iostreams/detail/config/dyn_link.hpp> 18 #include <boost/iostreams/filter/gzip.hpp> 18 #include <boost/iostreams/filter/gzip.hpp> 19 #include <boost/throw_exception.hpp> 19 20 20 21 namespace boost { namespace iostreams { 21 22 … … 29 30 switch (state_) { 30 31 case s_id1: 31 32 if (value != gzip::magic::id1) 32 throw gzip_error(gzip::bad_header);33 boost::throw_exception(gzip_error(gzip::bad_header)); 33 34 state_ = s_id2; 34 35 break; 35 36 case s_id2: 36 37 if (value != gzip::magic::id2) 37 throw gzip_error(gzip::bad_header);38 boost::throw_exception(gzip_error(gzip::bad_header)); 38 39 state_ = s_cm; 39 40 break; 40 41 case s_cm: 41 42 if (value != gzip::method::deflate) 42 throw gzip_error(gzip::bad_method);43 boost::throw_exception(gzip_error(gzip::bad_method)); 43 44 state_ = s_flg; 44 45 break; 45 46 case s_flg: -
libs/iostreams/src/file_descriptor.cpp
old new 22 22 #include <boost/iostreams/detail/ios.hpp> // openmodes, failure. 23 23 #include <boost/iostreams/device/file_descriptor.hpp> 24 24 #include <boost/integer_traits.hpp> 25 #include <boost/throw_exception.hpp> 25 26 26 27 // OS-specific headers for low-level i/o. 27 28 … … 108 109 (BOOST_IOS::in | BOOST_IOS::out) ) 109 110 { 110 111 if (mode & BOOST_IOS::app) 111 throw BOOST_IOSTREAMS_FAILURE("bad open mode");112 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad open mode")); 112 113 dwDesiredAccess = GENERIC_READ | GENERIC_WRITE; 113 114 dwCreationDisposition = 114 115 (mode & BOOST_IOS::trunc) ? … … 116 117 OPEN_EXISTING; 117 118 } else if (mode & BOOST_IOS::in) { 118 119 if (mode & (BOOST_IOS::app |BOOST_IOS::trunc)) 119 throw BOOST_IOSTREAMS_FAILURE("bad open mode");120 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad open mode")); 120 121 dwDesiredAccess = GENERIC_READ; 121 122 dwCreationDisposition = OPEN_EXISTING; 122 123 } else if (mode & BOOST_IOS::out) { … … 125 126 if (mode & BOOST_IOS::app) 126 127 flags_ |= append; 127 128 } else { 128 throw BOOST_IOSTREAMS_FAILURE("bad open mode");129 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad open mode")); 129 130 } 130 131 131 132 HANDLE handle = p.is_wide() ? … … 186 187 187 188 int fd = BOOST_IOSTREAMS_FD_OPEN(p.c_str(), oflag, pmode); 188 189 if (fd == -1) { 189 throw system_failure("failed opening file");190 boost::throw_exception(system_failure("failed opening file")); 190 191 } else { 191 192 handle_ = fd; 192 193 flags_ = close_on_exit; … … 271 272 if ( dwResultLow == INVALID_SET_FILE_POINTER && 272 273 ::GetLastError() != NO_ERROR ) 273 274 { 274 throw system_failure("failed seeking");275 boost::throw_exception(system_failure("failed seeking")); 275 276 } else { 276 277 return offset_to_position( 277 278 (stream_offset(lDistanceToMoveHigh) << 32) + dwResultLow … … 281 282 if ( off > integer_traits<BOOST_IOSTREAMS_FD_OFFSET>::const_max || 282 283 off < integer_traits<BOOST_IOSTREAMS_FD_OFFSET>::const_min ) 283 284 { 284 throw BOOST_IOSTREAMS_FAILURE("bad offset");285 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset")); 285 286 } 286 287 stream_offset result = 287 288 BOOST_IOSTREAMS_FD_SEEK( … … 294 295 SEEK_END ) 295 296 ); 296 297 if (result == -1) 297 throw system_failure("failed seeking");298 boost::throw_exception(system_failure("failed seeking")); 298 299 return offset_to_position(result); 299 300 #endif // #ifdef BOOST_IOSTREAMS_WINDOWS 300 301 } … … 431 432 const detail::path& path, BOOST_IOS::openmode mode) 432 433 { 433 434 if (mode & (BOOST_IOS::out | BOOST_IOS::app | BOOST_IOS::trunc)) 434 throw BOOST_IOSTREAMS_FAILURE("invalid mode");435 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode")); 435 436 file_descriptor::open(path, mode, BOOST_IOS::in); 436 437 } 437 438 … … 482 483 const detail::path& path, BOOST_IOS::openmode mode) 483 484 { 484 485 if (mode & BOOST_IOS::in) 485 throw BOOST_IOSTREAMS_FAILURE("invalid mode");486 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("invalid mode")); 486 487 file_descriptor::open(path, mode, BOOST_IOS::out); 487 488 } 488 489 -
boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp
old new 9 9 #define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_BUFFER_HPP_INCLUDED 10 10 11 11 #include <boost/iostreams/detail/broken_overload_resolution/forward.hpp> 12 #include <boost/throw_exception.hpp> 12 13 13 14 namespace boost { namespace iostreams { 14 15 … … 179 180 void check_open() 180 181 { 181 182 if (this->is_open()) 182 throw BOOST_IOSTREAMS_FAILURE("already open");183 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("already open")); 183 184 } 184 185 }; 185 186 -
boost/iostreams/chain.hpp
old new 36 36 #include <boost/next_prior.hpp> 37 37 #include <boost/shared_ptr.hpp> 38 38 #include <boost/static_assert.hpp> 39 #include <boost/throw_exception.hpp> 39 40 #include <boost/type_traits/is_convertible.hpp> 40 41 #include <boost/type.hpp> 41 42 #include <boost/iostreams/detail/execute.hpp> // VC6.5 requires this … … 172 173 const std::type_info& component_type(int n) const 173 174 { 174 175 if (static_cast<size_type>(n) >= size()) 175 throw std::out_of_range("bad chain offset");176 boost::throw_exception(std::out_of_range("bad chain offset")); 176 177 return (*boost::next(list().begin(), n))->component_type(); 177 178 } 178 179 … … 196 197 T* component(int n, boost::type<T>) const 197 198 { 198 199 if (static_cast<size_type>(n) >= size()) 199 throw std::out_of_range("bad chain offset");200 boost::throw_exception(std::out_of_range("bad chain offset")); 200 201 streambuf_type* link = *boost::next(list().begin(), n); 201 202 if (BOOST_IOSTREAMS_COMPARE_TYPE_ID(link->component_type(), typeid(T))) 202 203 return static_cast<T*>(link->component_impl()); … … 238 239 typedef typename list_type::iterator iterator; 239 240 BOOST_STATIC_ASSERT((is_convertible<category, Mode>::value)); 240 241 if (is_complete()) 241 throw std::logic_error("chain complete");242 boost::throw_exception(std::logic_error("chain complete")); 242 243 streambuf_type* prev = !empty() ? list().back() : 0; 243 244 buffer_size = 244 245 buffer_size != -1 ? -
boost/iostreams/checked_operations.hpp
old new 20 20 #include <boost/iostreams/seek.hpp> 21 21 #include <boost/iostreams/traits.hpp> 22 22 #include <boost/iostreams/write.hpp> 23 #include <boost/throw_exception.hppp> 23 24 24 25 // Must come last. 25 26 #include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC. … … 93 94 94 95 template<typename T> 95 96 static bool put(T&, typename char_type_of<T>::type) 96 { throw cant_write(); }97 { boost::throw_exception(cant_write()); } 97 98 98 99 template<typename T> 99 100 static std::streamsize 100 101 write(T&, const typename char_type_of<T>::type*, std::streamsize) 101 { throw cant_write(); }102 { boost::throw_exception(cant_write()); } 102 103 }; 103 104 104 105 template<> 105 106 struct read_write_if_impl<output> { 106 107 template<typename T> 107 108 static typename int_type_of<T>::type get(T&) 108 { throw cant_read(); }109 { boost::throw_exception(cant_read()); } 109 110 110 111 template<typename T> 111 112 static std::streamsize 112 113 read(T&, typename char_type_of<T>::type*, std::streamsize) 113 { throw cant_read(); }114 { boost::throw_exception(cant_read()); } 114 115 115 116 template<typename T> 116 117 static bool put(T& t, typename char_type_of<T>::type c) … … 139 140 template<typename T> 140 141 static std::streampos 141 142 seek(T&, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode) 142 { throw cant_seek(); }143 { boost::throw_exception(cant_seek()); } 143 144 }; 144 145 145 146 } // End namespace detail. -
boost/iostreams/code_converter.hpp
old new 44 44 #include <boost/iostreams/operations.hpp> 45 45 #include <boost/shared_ptr.hpp> 46 46 #include <boost/static_assert.hpp> 47 #include <boost/throw_exception.hpp> 47 48 #include <boost/type_traits/is_convertible.hpp> 48 49 #include <boost/type_traits/is_same.hpp> 49 50 … … 155 156 void open(const Device& dev, int buffer_size) 156 157 { 157 158 if (flags_ & f_open) 158 throw BOOST_IOSTREAMS_FAILURE("already open");159 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("already open")); 159 160 if (buffer_size == -1) 160 161 buffer_size = default_filter_buffer_size; 161 162 int max_length = cvt_.get().max_length(); … … 354 355 case std::codecvt_base::error: 355 356 default: 356 357 buf.state() = state_type(); 357 throw code_conversion_error();358 boost::throw_exception(code_conversion_error()); 358 359 } 359 360 360 361 } while (total < n && status != EOF && status != WOULD_BLOCK); … … 407 408 case std::codecvt_base::error: 408 409 default: 409 410 buf.state() = state_type(); 410 throw code_conversion_error();411 boost::throw_exception(code_conversion_error()); 411 412 } 412 413 } 413 414 return total; -
boost/iostreams/detail/restrict_impl.hpp
old new 44 44 # include <boost/iostreams/traits.hpp> // mode_of, is_direct. 45 45 # include <boost/mpl/bool.hpp> 46 46 # include <boost/static_assert.hpp> 47 # include <boost/throw_exception.hpp> 47 48 # include <boost/type_traits/is_convertible.hpp> 48 49 49 50 # include <boost/iostreams/detail/config/disable_warnings.hpp> … … 248 249 end_(len != -1 ? off + len : -1) 249 250 { 250 251 if (len < -1 || off < 0) 251 throw BOOST_IOSTREAMS_FAILURE("bad offset");252 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset")); 252 253 iostreams::skip(this->component(), off); 253 254 } 254 255 … … 314 315 if ( off < 0 || len < -1 || 315 316 (len != -1 && off + len > seq.second - seq.first) ) 316 317 { 317 throw BOOST_IOSTREAMS_FAILURE("bad offset");318 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset")); 318 319 } 319 320 beg_ = seq.first + off; 320 321 end_ = len != -1 ? … … 357 358 pos_(off), end_(len != -1 ? off + len : -1), open_(false) 358 359 { 359 360 if (len < -1 || off < 0) 360 throw BOOST_IOSTREAMS_FAILURE("bad offset");361 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad offset")); 361 362 } 362 363 363 364 } // End namespace detail. -
boost/iostreams/filter/gzip.hpp
old new 36 36 #include <boost/iostreams/device/back_inserter.hpp> 37 37 #include <boost/iostreams/filter/zlib.hpp> 38 38 #include <boost/iostreams/pipeline.hpp> 39 #include <boost/iostreams/putback.hpp> 39 #include <boost/iostreams/putback.hpp> 40 #include <boost/throw_exception.hpp> 40 41 41 42 // Must come last. 42 43 #if defined(BOOST_MSVC) … … 417 418 if (state_ == s_header) { 418 419 int c = boost::iostreams::get(peek); 419 420 if (traits_type::is_eof(c)) { 420 throw gzip_error(gzip::bad_header);421 boost::throw_exception(gzip_error(gzip::bad_header)); 421 422 } else if (traits_type::would_block(c)) { 422 423 break; 423 424 } … … 437 438 state_ = s_footer; 438 439 } 439 440 } catch (const zlib_error& e) { 440 throw gzip_error(e);441 boost::throw_exception(gzip_error(e)); 441 442 } 442 443 } else { // state_ == s_footer 443 444 int c = boost::iostreams::get(peek); 444 445 if (traits_type::is_eof(c)) { 445 throw gzip_error(gzip::bad_footer);446 boost::throw_exception(gzip_error(gzip::bad_footer)); 446 447 } else if (traits_type::would_block(c)) { 447 448 break; 448 449 } 449 450 footer_.process(c); 450 451 if (footer_.done()) { 451 452 if (footer_.crc() != this->crc()) 452 throw gzip_error(gzip::bad_crc);453 boost::throw_exception(gzip_error(gzip::bad_crc)); 453 454 int c = boost::iostreams::get(peek); 454 455 if (traits_type::is_eof(c)) { 455 456 state_ = s_done; … … 482 483 state_ = s_start; 483 484 header_.reset(); 484 485 footer_.reset(); 485 throw gzip_error(e);486 boost::throw_exception(gzip_error(e)); 486 487 } 487 488 state_ = s_start; 488 489 } -
boost/iostreams/filter/newline.hpp
old new 27 27 #include <boost/iostreams/pipeline.hpp> 28 28 #include <boost/iostreams/putback.hpp> 29 29 #include <boost/mpl/bool.hpp> 30 #include <boost/throw_exception.hpp> 30 31 #include <boost/type_traits/is_convertible.hpp> 31 32 32 33 // Must come last. … … 124 125 target != newline::dos && 125 126 target != newline::mac ) 126 127 { 127 throw std::logic_error("bad flags");128 boost::throw_exception(std::logic_error("bad flags")); 128 129 } 129 130 } 130 131 … … 420 421 } 421 422 } 422 423 private: 423 void fail() { throw newline_error(source()); }424 void fail() { boost::throw_exception(newline_error(source())); } 424 425 int& source() { return flags_; } 425 426 int source() const { return flags_; } 426 427 -
boost/iostreams/skip.hpp
old new 22 22 #include <boost/mpl/and.hpp> 23 23 #include <boost/mpl/bool.hpp> 24 24 #include <boost/mpl/or.hpp> 25 #include <boost/throw_exception.hpp> 25 26 #include <boost/type_traits/is_convertible.hpp> 26 27 27 28 namespace boost { namespace iostreams { … … 40 41 for (stream_offset z = 0; z < off; ) { 41 42 typename traits_type::int_type c; 42 43 if (traits_type::is_eof(c = iostreams::get(dev))) 43 throw BOOST_IOSTREAMS_FAILURE("bad skip offset");44 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad skip offset")); 44 45 if (!traits_type::would_block(c)) 45 46 ++z; 46 47 } … … 60 61 for (stream_offset z = 0; z < off; ) { 61 62 std::streamsize amt; 62 63 if ((amt = iostreams::read(flt, dev, &c, 1)) == -1) 63 throw BOOST_IOSTREAMS_FAILURE("bad skip offset");64 boost::throw_exception(BOOST_IOSTREAMS_FAILURE("bad skip offset")); 64 65 if (amt == 1) 65 66 ++z; 66 67 }