diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:41:18 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:43:11 +0900 |
commit | f763a99a501650eff2c60288aa6f10ef916d769e (patch) | |
tree | 02af7e13f9a38c888ebf340fe764cbe7dae99da9 /boost/iostreams/detail/buffer.hpp | |
parent | 5cde13f21d36c7224b0e13d11c4b49379ae5210d (diff) | |
download | boost-f763a99a501650eff2c60288aa6f10ef916d769e.tar.gz boost-f763a99a501650eff2c60288aa6f10ef916d769e.tar.bz2 boost-f763a99a501650eff2c60288aa6f10ef916d769e.zip |
Imported Upstream version 1.62.0upstream/1.62.0
Change-Id: I9d4c1ddb7b7d8f0069217ecc582700f9fda6dd4c
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/iostreams/detail/buffer.hpp')
-rw-r--r-- | boost/iostreams/detail/buffer.hpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/boost/iostreams/detail/buffer.hpp b/boost/iostreams/detail/buffer.hpp index 1168289d91..72400f04ca 100644 --- a/boost/iostreams/detail/buffer.hpp +++ b/boost/iostreams/detail/buffer.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_IOSTREAMS_DETAIL_BUFFERS_HPP_INCLUDED #define BOOST_IOSTREAMS_DETAIL_BUFFERS_HPP_INCLUDED -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif @@ -45,9 +45,9 @@ private: #endif public: basic_buffer(); - basic_buffer(int buffer_size); + basic_buffer(std::streamsize buffer_size); ~basic_buffer(); - void resize(int buffer_size); + void resize(std::streamsize buffer_size); Ch* begin() const { return buf_; } Ch* end() const { return buf_ + size_; } Ch* data() const { return buf_; } @@ -83,7 +83,7 @@ public: using base::data; using base::size; typedef Ch* const const_pointer; - buffer(int buffer_size); + buffer(std::streamsize buffer_size); Ch* & ptr() { return ptr_; } const_pointer& ptr() const { return ptr_; } Ch* & eptr() { return eptr_; } @@ -98,7 +98,11 @@ public: using namespace std; std::streamsize keep; if ((keep = static_cast<std::streamsize>(eptr_ - ptr_)) > 0) - traits_type::move(this->data(), ptr_, keep); + traits_type::move( + this->data(), + ptr_, + static_cast<size_t>(keep) + ); set(0, keep); std::streamsize result = iostreams::read(src, this->data() + keep, this->size() - keep); @@ -121,8 +125,8 @@ public: std::streamsize result = iostreams::write_if(dest, ptr_, amt); if (result < amt) { traits_type::move( this->data(), - ptr_ + result, - amt - result ); + ptr_ + static_cast<size_t>(result), + static_cast<size_t>(amt - result) ); } this->set(0, amt - result); return result != 0; @@ -141,8 +145,9 @@ template<typename Ch, typename Alloc> basic_buffer<Ch, Alloc>::basic_buffer() : buf_(0), size_(0) { } template<typename Ch, typename Alloc> -basic_buffer<Ch, Alloc>::basic_buffer(int buffer_size) - : buf_(static_cast<Ch*>(allocator_type().allocate(buffer_size, 0))), +basic_buffer<Ch, Alloc>::basic_buffer(std::streamsize buffer_size) + : buf_(static_cast<Ch*>(allocator_type().allocate( + static_cast<BOOST_DEDUCED_TYPENAME Alloc::size_type>(buffer_size), 0))), size_(buffer_size) // Cast for SunPro 5.3. { } @@ -156,7 +161,7 @@ inline basic_buffer<Ch, Alloc>::~basic_buffer() } template<typename Ch, typename Alloc> -inline void basic_buffer<Ch, Alloc>::resize(int buffer_size) +inline void basic_buffer<Ch, Alloc>::resize(std::streamsize buffer_size) { if (size_ != buffer_size) { basic_buffer<Ch, Alloc> temp(buffer_size); @@ -175,7 +180,7 @@ void basic_buffer<Ch, Alloc>::swap(basic_buffer& rhs) //--------------Implementation of buffer--------------------------------------// template<typename Ch, typename Alloc> -buffer<Ch, Alloc>::buffer(int buffer_size) +buffer<Ch, Alloc>::buffer(std::streamsize buffer_size) : basic_buffer<Ch, Alloc>(buffer_size) { } template<typename Ch, typename Alloc> |