|
Boost-Commit : |
From: technews_at_[hidden]
Date: 2007-12-24 23:56:10
Author: turkanis
Date: 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
New Revision: 42290
URL: http://svn.boost.org/trac/boost/changeset/42290
Log:
I. Eliminated most VC8.0-9.0 and some BCB iostreams warnings. This affects:
boost/iostreams/restrict.hpp
code_converter.hpp [switched to private optional]
copy.hpp [added private operator=]
detail/adapter/concept_adapter.hpp [added private operator=, removed unused params]
detail/adapter/non_blocking_adapter.hpp [added private operator=]
detail/codecvt_holder.hpp [removed unused params]
detail/config/disable_warnings.hpp [VC:4127,4130,4706; BCB:8072]
detail/functional.hpp [added private operator='s]
filter/stdio.hpp [added operator=]
filter/symmetric.hpp [removed unused params]
filter/test.hpp [added private operator=]
iostreams/read.hpp [removed unused params]
pipeline.hpp [added private operator=]
example/container_device.hpp [added private operator=]
src/bzip2.cpp [removed unused params]
src/zlib.cpp [removed unused params]
test/Jamfile.v2
test/detail/closable.hpp [removed unused params]
test/detail/filters.hpp [removed unused params]
test/detail/null_padded_codecvt.hpp [removed unused params]
test/detail/operation_sequence.hpp [added private operator=]
test/detail/utf8_codecvt_facet.hpp [removed unused params]
test/execute_test.cpp [added private operator='s]
test/stream_state_test.cpp [removed unused params]
II. Fixed coding style. This affects:
test/operation_sequence_test.cpp [rewrote include paths]
test/close_test.cpp [rewrote include paths]
III. Corrected integer overflow in positioning test which masked failures by
Borland 5.6.4-5.8.2 (at least); split positioning test into two files:
stream_offset_32biit_test.cpp and stream_offset_64bit_test.cpp.
This affects:
test/Jamfile.v2
test/positioning_test.cpp
test/stream_offset_32biit_test.cpp
test/stream_offset_64bit_test.cpp
IV. Throw exceptions rather than allow undefined behavior in serveral cases:
doc/tutorial/container_device.html
example/container_device.hpp
src/file_descriptor.cpp
V. Fixed member initialization:
boost/iostreams/filter/regex.hpp [format flags]
test/symmetric_filter_test.cpp [buffer size]
Text files modified:
branches/iostreams_dev/boost/iostreams/code_converter.hpp | 2
branches/iostreams_dev/boost/iostreams/copy.hpp | 15 +++--
branches/iostreams_dev/boost/iostreams/detail/adapter/concept_adapter.hpp | 3
branches/iostreams_dev/boost/iostreams/detail/adapter/non_blocking_adapter.hpp | 1
branches/iostreams_dev/boost/iostreams/detail/codecvt_holder.hpp | 2
branches/iostreams_dev/boost/iostreams/detail/config/disable_warnings.hpp | 5 +
branches/iostreams_dev/boost/iostreams/detail/functional.hpp | 104 ++++++++++++++++++++++++---------------
branches/iostreams_dev/boost/iostreams/filter/regex.hpp | 2
branches/iostreams_dev/boost/iostreams/filter/stdio.hpp | 5 +
branches/iostreams_dev/boost/iostreams/filter/symmetric.hpp | 2
branches/iostreams_dev/boost/iostreams/filter/test.hpp | 1
branches/iostreams_dev/boost/iostreams/pipeline.hpp | 2
branches/iostreams_dev/boost/iostreams/read.hpp | 2
branches/iostreams_dev/boost/iostreams/restrict.hpp | 2
branches/iostreams_dev/libs/iostreams/doc/tutorial/container_device.html | 4 +
branches/iostreams_dev/libs/iostreams/example/container_device.hpp | 6 ++
branches/iostreams_dev/libs/iostreams/src/bzip2.cpp | 4
branches/iostreams_dev/libs/iostreams/src/file_descriptor.cpp | 9 ++
branches/iostreams_dev/libs/iostreams/src/zlib.cpp | 2
branches/iostreams_dev/libs/iostreams/test/Jamfile.v2 | 6 +
branches/iostreams_dev/libs/iostreams/test/close_test.cpp | 4
branches/iostreams_dev/libs/iostreams/test/detail/closable.hpp | 8 +-
branches/iostreams_dev/libs/iostreams/test/detail/filters.hpp | 2
branches/iostreams_dev/libs/iostreams/test/detail/null_padded_codecvt.hpp | 10 +++
branches/iostreams_dev/libs/iostreams/test/detail/operation_sequence.hpp | 1
branches/iostreams_dev/libs/iostreams/test/detail/utf8_codecvt_facet.hpp | 2
branches/iostreams_dev/libs/iostreams/test/execute_test.cpp | 50 ++++++++++++------
branches/iostreams_dev/libs/iostreams/test/operation_sequence_test.cpp | 2
branches/iostreams_dev/libs/iostreams/test/positioning_test.cpp | 30 ++++++-----
branches/iostreams_dev/libs/iostreams/test/stream_state_test.cpp | 6 +-
branches/iostreams_dev/libs/iostreams/test/symmetric_filter_test.cpp | 2
31 files changed, 186 insertions(+), 110 deletions(-)
Modified: branches/iostreams_dev/boost/iostreams/code_converter.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/code_converter.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/code_converter.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -37,10 +37,10 @@
#include <boost/iostreams/detail/forward.hpp>
#include <boost/iostreams/detail/functional.hpp>
#include <boost/iostreams/detail/ios.hpp> // failure, openmode, int types.
+#include <boost/iostreams/detail/optional.hpp>
#include <boost/iostreams/detail/select.hpp>
#include <boost/iostreams/traits.hpp>
#include <boost/iostreams/operations.hpp>
-#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_convertible.hpp>
Modified: branches/iostreams_dev/boost/iostreams/copy.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/copy.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/copy.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -138,19 +138,22 @@
// Function object that delegates to one of the above four
// overloads of compl_impl()
template<typename Source, typename Sink>
-struct copy_operation {
+class copy_operation {
+public:
typedef std::streamsize result_type;
copy_operation(Source& src, Sink& snk, std::streamsize buffer_size)
- : src(src), snk(snk), buffer_size(buffer_size)
+ : src_(src), snk_(snk), buffer_size_(buffer_size)
{ }
std::streamsize operator()()
{
- return copy_impl( src, snk, buffer_size,
+ return copy_impl( src_, snk_, buffer_size_,
is_direct<Source>(), is_direct<Sink>() );
}
- Source& src;
- Sink& snk;
- std::streamsize buffer_size;
+private:
+ copy_operation& operator=(const copy_operation&);
+ Source& src_;
+ Sink& snk_;
+ std::streamsize buffer_size_;
};
// Primary overload of copy_impl. Delegates to one of the above four
Modified: branches/iostreams_dev/boost/iostreams/detail/adapter/concept_adapter.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/adapter/concept_adapter.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/adapter/concept_adapter.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -114,6 +114,7 @@
std::streamsize optimal_buffer_size() const
{ return iostreams::optimal_buffer_size(t_); }
public:
+ concept_adapter& operator=(const concept_adapter&);
value_type t_;
};
@@ -218,7 +219,7 @@
template<typename Filter, typename Device>
static std::streampos
seek( Filter& f, Device* dev, stream_offset off,
- BOOST_IOS::seekdir way, BOOST_IOS::openmode which,
+ BOOST_IOS::seekdir way, BOOST_IOS::openmode,
random_access, any_tag )
{ return f.seek(*dev, off, way); }
Modified: branches/iostreams_dev/boost/iostreams/detail/adapter/non_blocking_adapter.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/adapter/non_blocking_adapter.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/adapter/non_blocking_adapter.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -49,6 +49,7 @@
BOOST_IOS::in | BOOST_IOS::out )
{ return iostreams::seek(device_, off, way, which); }
public:
+ non_blocking_adapter& operator=(const non_blocking_adapter&);
Device& device_;
};
Modified: branches/iostreams_dev/boost/iostreams/detail/codecvt_holder.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/codecvt_holder.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/codecvt_holder.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -30,7 +30,7 @@
struct codecvt_holder {
typedef Codecvt codecvt_type;
const codecvt_type& get() const { return codecvt_; }
- void imbue(const std::locale& loc) { }
+ void imbue(const std::locale&) { }
Codecvt codecvt_;
};
Modified: branches/iostreams_dev/boost/iostreams/detail/config/disable_warnings.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/config/disable_warnings.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/config/disable_warnings.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -9,13 +9,16 @@
#if defined(BOOST_MSVC)
# pragma warning(push)
+# pragma warning(disable:4127) // Conditional expression is constant.
+# pragma warning(disable:4130) // Logical operation on address of string constant.
# pragma warning(disable:4224) // Parameter previously defined as type.
# pragma warning(disable:4244) // Conversion: possible loss of data.
+# pragma warning(disable:4706) // Assignment within conditional expression.
#else
# if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
# pragma warn -8008 // Condition always true/false.
# pragma warn -8071 // Conversion may lose significant digits.
+# pragma warn -8072 // Suspicious pointer arithmetic.
# pragma warn -8080 // identifier declared but never used.
# endif
#endif
-
Modified: branches/iostreams_dev/boost/iostreams/detail/functional.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/detail/functional.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/detail/functional.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -29,26 +29,32 @@
// boost::iostreams::close
template<typename T>
-struct device_close_operation {
+class device_close_operation {
+public:
typedef void result_type;
device_close_operation(T& t, BOOST_IOS::openmode which)
- : t(t), which(which)
+ : t_(t), which_(which)
{ }
- void operator()() const { boost::iostreams::close(t, which); }
- T& t;
- BOOST_IOS::openmode which;
+ void operator()() const { boost::iostreams::close(t_, which_); }
+private:
+ device_close_operation& operator=(const device_close_operation&);
+ T& t_;
+ BOOST_IOS::openmode which_;
};
template<typename T, typename Sink>
-struct filter_close_operation {
+class filter_close_operation {
+public:
typedef void result_type;
filter_close_operation(T& t, Sink& snk, BOOST_IOS::openmode which)
- : t(t), snk(snk), which(which)
+ : t_(t), snk_(snk), which_(which)
{ }
- void operator()() const { boost::iostreams::close(t, snk, which); }
- T& t;
- Sink& snk;
- BOOST_IOS::openmode which;
+ void operator()() const { boost::iostreams::close(t_, snk_, which_); }
+private:
+ filter_close_operation& operator=(const filter_close_operation&);
+ T& t_;
+ Sink& snk_;
+ BOOST_IOS::openmode which_;
};
template<typename T>
@@ -65,20 +71,26 @@
// boost::iostreams::detail::close_all
template<typename T>
-struct device_close_all_operation {
+class device_close_all_operation {
+public:
typedef void result_type;
- device_close_all_operation(T& t) : t(t) { }
- void operator()() const { detail::close_all(t); }
- T& t;
+ device_close_all_operation(T& t) : t_(t) { }
+ void operator()() const { detail::close_all(t_); }
+private:
+ device_close_all_operation& operator=(const device_close_all_operation&);
+ T& t_;
};
template<typename T, typename Sink>
-struct filter_close_all_operation {
+class filter_close_all_operation {
+public:
typedef void result_type;
- filter_close_all_operation(T& t, Sink& snk) : t(t), snk(snk) { }
- void operator()() const { detail::close_all(t, snk); }
- T& t;
- Sink& snk;
+ filter_close_all_operation(T& t, Sink& snk) : t_(t), snk_(snk) { }
+ void operator()() const { detail::close_all(t_, snk_); }
+private:
+ filter_close_all_operation& operator=(const filter_close_all_operation&);
+ T& t_;
+ Sink& snk_;
};
template<typename T>
@@ -94,14 +106,17 @@
// member function void close(std::ios_base::openmode)
template<typename T>
-struct member_close_operation {
+class member_close_operation {
+public:
typedef void result_type;
member_close_operation(T& t, BOOST_IOS::openmode which)
- : t(t), which(which)
+ : t_(t), which_(which)
{ }
- void operator()() const { t.close(which); }
- T& t;
- BOOST_IOS::openmode which;
+ void operator()() const { t_.close(which_); }
+private:
+ member_close_operation& operator=(const member_close_operation&);
+ T& t_;
+ BOOST_IOS::openmode which_;
};
template<typename T>
@@ -112,10 +127,13 @@
// member function void reset()
template<typename T>
-struct reset_operation {
- reset_operation(T& t) : t(t) { }
- void operator()() const { t.reset(); }
- T& t;
+class reset_operation {
+public:
+ reset_operation(T& t) : t_(t) { }
+ void operator()() const { t_.reset(); }
+private:
+ reset_operation& operator=(const reset_operation&);
+ T& t_;
};
template<typename T>
@@ -124,11 +142,14 @@
// Function object and object generator for clearing a flag
template<typename T>
-struct clear_flags_operation {
+class clear_flags_operation {
+public:
typedef void result_type;
- clear_flags_operation(T& t) : t(t) { }
- void operator()() const { t = 0; }
- T& t;
+ clear_flags_operation(T& t) : t_(t) { }
+ void operator()() const { t_ = 0; }
+private:
+ clear_flags_operation& operator=(const clear_flags_operation&);
+ T& t_;
};
template<typename T>
@@ -139,19 +160,22 @@
// Function object for use with execute_all()
template<typename Buffer, typename Device>
-struct flush_buffer_operation {
+class flush_buffer_operation {
+public:
typedef void result_type;
flush_buffer_operation(Buffer& buf, Device& dev, bool flush)
- : buf(buf), dev(dev), flush(flush)
+ : buf_(buf), dev_(dev), flush_(flush)
{ }
void operator()() const
{
- if (flush)
- buf.flush(dev);
+ if (flush_)
+ buf_.flush(dev_);
}
- Buffer& buf;
- Device& dev;
- bool flush;
+private:
+ flush_buffer_operation& operator=(const flush_buffer_operation&);
+ Buffer& buf_;
+ Device& dev_;
+ bool flush_;
};
template<typename Buffer, typename Device>
Modified: branches/iostreams_dev/boost/iostreams/filter/regex.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/filter/regex.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/filter/regex.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -72,7 +72,7 @@
}
struct simple_formatter {
simple_formatter(const string_type& fmt, flag_type fmt_flags)
- : fmt_(fmt), fmt_flags_(fmt_flags_) { }
+ : fmt_(fmt), fmt_flags_(fmt_flags) { }
string_type operator() (const match_type& match) const
{ return match.format(fmt_, fmt_flags_); }
string_type fmt_;
Modified: branches/iostreams_dev/boost/iostreams/filter/stdio.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/filter/stdio.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/filter/stdio.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -56,8 +56,9 @@
: ios_(ios), old_(ios.rdbuf(newbuf))
{ }
~scoped_redirector() { ios_.rdbuf(old_); }
- ios_type& ios_;
- streambuf_type* old_;
+ scoped_redirector& operator=(const scoped_redirector&);
+ ios_type& ios_;
+ streambuf_type* old_;
};
virtual void do_filter() = 0;
Modified: branches/iostreams_dev/boost/iostreams/filter/symmetric.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/filter/symmetric.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/filter/symmetric.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -228,7 +228,7 @@
}
template<typename Sink>
- bool flush(Sink& snk, mpl::false_) { return true;}
+ bool flush(Sink&, mpl::false_) { return true;}
void close_impl();
Modified: branches/iostreams_dev/boost/iostreams/filter/test.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/filter/test.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/filter/test.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -133,6 +133,7 @@
return amt;
}
private:
+ non_blocking_sink& operator=(const non_blocking_sink&);
std::string& dest_;
std::streamsize inc_;
};
Modified: branches/iostreams_dev/boost/iostreams/pipeline.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/pipeline.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/pipeline.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -80,6 +80,7 @@
template<typename Chain>
void push(Chain& chn) const { chn.push(component_); }
private:
+ pipeline_segment operator=(const pipeline_segment&);
const Component& component_;
};
@@ -109,6 +110,7 @@
const Pipeline& tail() const { return *this; }
const Component& head() const { return component_; }
private:
+ pipeline operator=(const pipeline&);
const Component& component_;
};
Modified: branches/iostreams_dev/boost/iostreams/read.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/read.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/read.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -79,7 +79,7 @@
template<>
struct true_eof_impl<false> {
template<typename T>
- static bool true_eof(T& t) { return true; }
+ static bool true_eof(T&) { return true; }
};
template<typename T>
Modified: branches/iostreams_dev/boost/iostreams/restrict.hpp
==============================================================================
--- branches/iostreams_dev/boost/iostreams/restrict.hpp (original)
+++ branches/iostreams_dev/boost/iostreams/restrict.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -31,7 +31,7 @@
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_convertible.hpp>
-#include <boost/iostreams/detail/config/disable_warnings.hpp> // VC7.1 C4244.
+#include <boost/iostreams/detail/config/disable_warnings.hpp>
namespace boost { namespace iostreams {
Modified: branches/iostreams_dev/libs/iostreams/doc/tutorial/container_device.html
==============================================================================
--- branches/iostreams_dev/libs/iostreams/doc/tutorial/container_device.html (original)
+++ branches/iostreams_dev/libs/iostreams/doc/tutorial/container_device.html 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -153,11 +153,13 @@
next = pos_ + off;
} <SPAN CLASS="keyword">else</SPAN> <SPAN CLASS="keyword">if</SPAN> (way == ios_bas::end) {
next = container_.size() + off - <SPAN CLASS='numeric_literal'>1</SPAN>;
+ } <SPAN CLASS="keyword">else</SPAN> {
+ <SPAN CLASS="keyword">throw</SPAN> ios_base::failure(<SPAN CLASS='numeric_literal'>"bad seek direction"</SPAN>);
}
<SPAN CLASS='comment'>// Check for errors</SPAN>
<SPAN CLASS="keyword">if</SPAN> (next < <SPAN CLASS='numeric_literal'>0</SPAN> || next >= container_.size())
- <SPAN CLASS="keyword">throw</SPAN> ios_base::failure("bad seek offset");
+ <SPAN CLASS="keyword">throw</SPAN> ios_base::failure(<SPAN CLASS='numeric_literal'>"bad seek offset"</SPAN>);
pos_ = next;
<SPAN CLASS="keyword">return</SPAN> pos_;
Modified: branches/iostreams_dev/libs/iostreams/example/container_device.hpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/example/container_device.hpp (original)
+++ branches/iostreams_dev/libs/iostreams/example/container_device.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -8,6 +8,7 @@
#define BOOST_IOSTREAMS_CONTAINTER_DEVICE_HPP_INCLUDED
#include <algorithm> // copy, min.
+#include <cassert>
#include <boost/config.hpp> // BOOST_NO_STDC_NAMESPACE.
#include <boost/iostreams/categories.hpp>
#include <boost/iostreams/detail/ios.hpp> // failure.
@@ -43,6 +44,7 @@
}
Container& container() { return container_; }
private:
+ container_source operator=(const container_source&);
typedef typename Container::size_type size_type;
Container& container_;
size_type pos_;
@@ -64,6 +66,7 @@
}
Container& container() { return container_; }
private:
+ container_sink operator=(const container_sink&);
Container& container_;
};
@@ -124,6 +127,8 @@
next = pos_ + off;
} else if (way == BOOST_IOS::end) {
next = container_.size() + off - 1;
+ } else {
+ throw BOOST_IOSTREAMS_FAILURE("bad seek direction");
}
// Check for errors
@@ -136,6 +141,7 @@
Container& container() { return container_; }
private:
+ container_device operator=(const container_device&);
typedef typename Container::size_type size_type;
Container& container_;
size_type pos_;
Modified: branches/iostreams_dev/libs/iostreams/src/bzip2.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/src/bzip2.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/src/bzip2.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -121,8 +121,8 @@
void bzip2_base::do_init
( bool compress,
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
- bzip2::alloc_func alloc,
- bzip2::free_func free,
+ bzip2::alloc_func /* alloc */,
+ bzip2::free_func /* free */,
#endif
void* derived )
{
Modified: branches/iostreams_dev/libs/iostreams/src/file_descriptor.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/src/file_descriptor.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/src/file_descriptor.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -12,6 +12,7 @@
// than using it (possibly importing code).
#define BOOST_IOSTREAMS_SOURCE
+#include <cassert>
#include <boost/config.hpp> // BOOST_JOIN
#include <boost/iostreams/detail/error.hpp>
#include <boost/iostreams/detail/config/dyn_link.hpp>
@@ -67,14 +68,16 @@
==
(BOOST_IOS::in | BOOST_IOS::out) )
{
- assert(!(m & BOOST_IOS::app));
+ if (m & BOOST_IOS::app)
+ throw BOOST_IOSTREAMS_FAILURE("bad open mode");
dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
dwCreationDisposition =
(m & BOOST_IOS::trunc) ?
OPEN_ALWAYS :
OPEN_EXISTING;
} else if (m & BOOST_IOS::in) {
- assert(!(m & (BOOST_IOS::app |BOOST_IOS::trunc)));
+ if (m & (BOOST_IOS::app |BOOST_IOS::trunc))
+ throw BOOST_IOSTREAMS_FAILURE("bad open mode");
dwDesiredAccess = GENERIC_READ;
dwCreationDisposition = OPEN_EXISTING;
} else if (m & BOOST_IOS::out) {
@@ -82,6 +85,8 @@
dwCreationDisposition = OPEN_ALWAYS;
if (m & BOOST_IOS::app)
pimpl_->flags_ |= impl::append;
+ } else {
+ throw BOOST_IOSTREAMS_FAILURE("bad open mode");
}
HANDLE handle =
Modified: branches/iostreams_dev/libs/iostreams/src/zlib.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/src/zlib.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/src/zlib.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -153,7 +153,7 @@
void zlib_base::do_init
( const zlib_params& p, bool compress,
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
- zlib::alloc_func alloc, zlib::free_func free,
+ zlib::alloc_func /* alloc */, zlib::free_func /* free*/,
#endif
void* derived )
{
Modified: branches/iostreams_dev/libs/iostreams/test/Jamfile.v2
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/Jamfile.v2 (original)
+++ branches/iostreams_dev/libs/iostreams/test/Jamfile.v2 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -22,6 +22,9 @@
: # input files
: # build requirements
<toolset>msvc,<stdlib>stlport:<runtime-link>static
+ <toolset>msvc:<cxxflags>"-wd4996"
+ <toolset>msvc:<cxxflags>"-wd4512"
+ <toolset>msvc:<warnings>all
<toolset>cw-9.3,<os>darwin:<runtime-link>static
<define>BOOST_IOSTREAMS_NO_LIB
<link>shared:<define>BOOST_IOSTREAMS_DYN_LINK=1
@@ -70,7 +73,6 @@
[ test-iostreams null_test.cpp ]
[ test-iostreams operation_sequence_test.cpp ]
[ test-iostreams pipeline_test.cpp ]
- [ test-iostreams positioning_test.cpp ]
[ test-iostreams
regex_filter_test.cpp
/boost/regex//boost_regex ]
@@ -79,6 +81,8 @@
[ test-iostreams seekable_filter_test.cpp ]
[ test-iostreams sequence_test.cpp ]
[ test-iostreams stdio_filter_test.cpp ]
+ [ test-iostreams stream_offset_32bit_test.cpp ]
+ [ test-iostreams stream_offset_64bit_test.cpp ]
[ test-iostreams stream_state_test.cpp ]
[ test-iostreams symmetric_filter_test.cpp ]
[ test-iostreams tee_test.cpp ]
Modified: branches/iostreams_dev/libs/iostreams/test/close_test.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/close_test.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/close_test.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -24,8 +24,8 @@
#include <boost/iostreams/tee.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test.hpp>
-#include "./detail/closable.hpp"
-#include "./detail/operation_sequence.hpp"
+#include "detail/closable.hpp"
+#include "detail/operation_sequence.hpp"
using namespace std;
using namespace boost;
Modified: branches/iostreams_dev/libs/iostreams/test/detail/closable.hpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/detail/closable.hpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/detail/closable.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -45,7 +45,7 @@
class closable_device<output> : public sink {
public:
closable_device(operation close) : close_(close) { }
- std::streamsize write(const char*, std::streamsize n) { return 0; }
+ std::streamsize write(const char*, std::streamsize) { return 0; }
void close() { close_.execute(); }
private:
operation close_;
@@ -58,7 +58,7 @@
class closable_device<borland_output> : public sink {
public:
closable_device(operation close) : close_(close) { }
- std::streamsize write(const char*, std::streamsize n) { return 0; }
+ std::streamsize write(const char*, std::streamsize) { return 0; }
void close() { close_.execute(); }
private:
operation close_;
@@ -72,7 +72,7 @@
: close_input_(close_input), close_output_(close_output)
{ }
std::streamsize read(char*, std::streamsize) { return -1; }
- std::streamsize write(const char*, std::streamsize n) { return 0; }
+ std::streamsize write(const char*, std::streamsize) { return 0; }
void close(BOOST_IOS::openmode which)
{
switch (which) {
@@ -97,7 +97,7 @@
public:
closable_device(operation close) : close_(close) { }
std::streamsize read(char*, std::streamsize) { return -1; }
- std::streamsize write(const char*, std::streamsize n) { return 0; }
+ std::streamsize write(const char*, std::streamsize) { return 0; }
stream_offset seek(stream_offset, BOOST_IOS::seekdir) { return 0; }
void close() { close_.execute(); }
private:
Modified: branches/iostreams_dev/libs/iostreams/test/detail/filters.hpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/detail/filters.hpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/detail/filters.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -134,7 +134,7 @@
flushable_tag
{ };
template<typename Sink>
- bool put(Sink& s, char c)
+ bool put(Sink&, char c)
{
buf_.push_back(c);
return true;
Modified: branches/iostreams_dev/libs/iostreams/test/detail/null_padded_codecvt.hpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/detail/null_padded_codecvt.hpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/detail/null_padded_codecvt.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -132,7 +132,10 @@
}
std::codecvt_base::result
- do_unshift(state_type& state, char* first2, char* last2, char*& next2) const
+ do_unshift( state_type& state,
+ char* /* first2 */,
+ char* last2,
+ char*& next2 ) const
{
using namespace std;
next2 = last2;
@@ -231,7 +234,10 @@
}
std::codecvt_base::result
- do_unshift(state_type&, char* first2, char* last2, char*& next2) const
+ do_unshift( state_type&,
+ char* /* first2 */,
+ char* /* last2 */,
+ char*& /* next2 */ ) const
{
return std::codecvt_base::ok;
}
Modified: branches/iostreams_dev/libs/iostreams/test/detail/operation_sequence.hpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/detail/operation_sequence.hpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/detail/operation_sequence.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -62,6 +62,7 @@
: seq(seq), id(id), error_code(error_code)
{ }
~impl() { remove_operation(seq, id); }
+ impl& operator=(const impl&); // Supress VC warning 4512
operation_sequence& seq;
int id;
int error_code;
Modified: branches/iostreams_dev/libs/iostreams/test/detail/utf8_codecvt_facet.hpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/detail/utf8_codecvt_facet.hpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/detail/utf8_codecvt_facet.hpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -110,7 +110,7 @@
virtual std::codecvt_base::result do_unshift(
std::mbstate_t&,
char * from,
- char * to,
+ char * /* to */,
char * & next
) const{
next = from;
Modified: branches/iostreams_dev/libs/iostreams/test/execute_test.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/execute_test.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/execute_test.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -26,25 +26,33 @@
// Function object that sets a boolean flag and returns a value
// specified at construction
template<typename Result>
-struct operation {
+class operation {
+public:
typedef Result result_type;
- operation(Result r, bool& executed) : r(r), executed(executed) { }
+ explicit operation(Result r, bool& executed)
+ : r_(r), executed_(executed)
+ { }
Result operator()() const
{
- executed = true;
- return r;
+ executed_ = true;
+ return r_;
}
- Result r;
- bool& executed;
+private:
+ operation& operator=(const operation&);
+ Result r_;
+ bool& executed_;
};
// Specialization for void return
template<>
-struct operation<void> {
+class operation<void> {
+public:
typedef void result_type;
- operation(bool& executed) : executed(executed) { }
- void operator()() const { executed = true; }
- bool& executed;
+ explicit operation(bool& executed) : executed_(executed) { }
+ void operator()() const { executed_ = true; }
+private:
+ operation& operator=(const operation&);
+ bool& executed_;
};
// Simple exception class with error code built in to type
@@ -53,24 +61,28 @@
// Function object that sets a boolean flag and throws an exception
template<int Code>
-struct thrower {
+class thrower {
+public:
typedef void result_type;
- thrower(bool& executed) : executed(executed) { }
+ explicit thrower(bool& executed) : executed_(executed) { }
void operator()() const
{
- executed = true;
+ executed_ = true;
throw error<Code>();
}
- bool& executed;
+private:
+ thrower& operator=(const thrower&);
+ bool& executed_;
};
// Function object for use by foreach_test
-struct foreach_func {
+class foreach_func {
+public:
typedef void result_type;
- foreach_func(int& count) : count(count) { }
+ explicit foreach_func(int& count) : count_(count) { }
void operator()(int x) const
{
- ++count;
+ ++count_;
switch (x) {
case 0: throw error<0>();
case 1: throw error<1>();
@@ -86,7 +98,9 @@
break;
}
}
- int& count; // Number of times operator() has been called
+private:
+ foreach_func& operator=(const foreach_func&);
+ int& count_; // Number of times operator() has been called
};
void success_test()
Modified: branches/iostreams_dev/libs/iostreams/test/operation_sequence_test.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/operation_sequence_test.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/operation_sequence_test.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -17,7 +17,7 @@
#include <stdexcept>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test.hpp>
-#include "./detail/operation_sequence.hpp"
+#include "detail/operation_sequence.hpp"
using namespace std;
using namespace boost;
Modified: branches/iostreams_dev/libs/iostreams/test/positioning_test.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/positioning_test.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/positioning_test.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -11,31 +11,34 @@
#include <boost/test/unit_test.hpp>
#include <iostream>
+#include <fstream>
using namespace std;
using namespace boost;
using namespace boost::iostreams;
using boost::unit_test::test_suite;
-//void extrema_test_test()
-//{
-// stream_offset minoff = integer_traits<stream_offset>::const_min;
-// stream_offset maxoff = integer_traits<stream_offset>::const_max;
-//
-// BOOST_CHECK(minoff == position_to_offset(offset_to_position(minoff)));
-// BOOST_CHECK(0 == position_to_offset(offset_to_position(0)));
-// BOOST_CHECK(maxoff == position_to_offset(offset_to_position(maxoff)));
-//}
-
void large_file_test()
{
- stream_offset large_file = 100 * 1024 * 1024 * 1024; // 100GB.
+ stream_offset large_file = (stream_offset) 100 *
+ (stream_offset) 1024 *
+ (stream_offset) 1024 *
+ (stream_offset) 1024;
stream_offset first = -large_file - (-large_file) % 10000000;
stream_offset last = large_file - large_file % 10000000;
+ fstream log;
+ log.open("C:/borland-output-5.8.2.txt", std::ios::out | std::ios::trunc);
for (stream_offset off = first; off < last; off += 10000000)
- {
- BOOST_CHECK(off == position_to_offset(offset_to_position(off)));
+ {
+ if (off == position_to_offset(offset_to_position(off))) {
+ log << "offset = " << off << "\n";
+ } else {
+ log << "offset = " << off
+ << "; pos = " << position_to_offset(offset_to_position(off))
+ << "\n";
+ }
+ //BOOST_CHECK(off == position_to_offset(offset_to_position(off)));
}
}
@@ -61,7 +64,6 @@
test_suite* init_unit_test_suite(int, char* [])
{
test_suite* test = BOOST_TEST_SUITE("positioning test");
- //test->add(BOOST_TEST_CASE(&extrema_test_test));
test->add(BOOST_TEST_CASE(&large_file_test));
test->add(BOOST_TEST_CASE(&small_file_test));
return test;
Modified: branches/iostreams_dev/libs/iostreams/test/stream_state_test.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/stream_state_test.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/stream_state_test.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -38,15 +38,15 @@
typedef char char_type;
typedef seekable_device_tag category;
error_device(char const*) {}
- std::streamsize read(char_type* s, std::streamsize n)
+ std::streamsize read(char_type*, std::streamsize)
{
throw detail::bad_read();
}
- std::streamsize write(const char_type* s, std::streamsize n)
+ std::streamsize write(const char_type*, std::streamsize)
{
throw detail::bad_write();
}
- std::streampos seek(stream_offset off, BOOST_IOS::seekdir way)
+ std::streampos seek(stream_offset, BOOST_IOS::seekdir)
{
throw detail::bad_seek();
}
Modified: branches/iostreams_dev/libs/iostreams/test/symmetric_filter_test.cpp
==============================================================================
--- branches/iostreams_dev/libs/iostreams/test/symmetric_filter_test.cpp (original)
+++ branches/iostreams_dev/libs/iostreams/test/symmetric_filter_test.cpp 2007-12-24 23:56:07 EST (Mon, 24 Dec 2007)
@@ -29,7 +29,7 @@
std::streamsize buffer_size =
default_filter_buffer_size
)
- : buf_(default_filter_buffer_size)
+ : buf_(buffer_size)
{
buf_.set(0, 0);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk