Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-11-20 06:40:29


Author: johnmaddock
Date: 2007-11-20 06:40:28 EST (Tue, 20 Nov 2007)
New Revision: 41254
URL: http://svn.boost.org/trac/boost/changeset/41254

Log:
Added missing #include.
Fix warnings on MSVC: the code should now be clean with -W4.
Fix warnings on gcc: the code should now be clean with -Wall -Wshadow.
This fixes Track issues #585, #980, #1196, #1278 and #1340.
Text files modified:
   trunk/boost/format/alt_sstream_impl.hpp | 11 +++++++++--
   trunk/boost/format/feed_args.hpp | 6 +++---
   trunk/boost/format/format_implementation.hpp | 10 +++++-----
   trunk/boost/format/group.hpp | 6 ++++++
   trunk/boost/format/internals.hpp | 2 ++
   trunk/boost/format/parsing.hpp | 1 +
   6 files changed, 26 insertions(+), 10 deletions(-)

Modified: trunk/boost/format/alt_sstream_impl.hpp
==============================================================================
--- trunk/boost/format/alt_sstream_impl.hpp (original)
+++ trunk/boost/format/alt_sstream_impl.hpp 2007-11-20 06:40:28 EST (Tue, 20 Nov 2007)
@@ -107,7 +107,7 @@
                     return pos_type(off_type(-1));
                 if(eback() <= off+gptr() && off+gptr() <= putend_ ) {
                     // set gptr
- streambuf_t::gbump(off);
+ streambuf_t::gbump(static_cast<int>(off));
                     if(which & ::std::ios_base::out && pptr() != NULL)
                         // update pptr to match gptr
                         streambuf_t::pbump(static_cast<int>(gptr()-pptr()));
@@ -125,7 +125,7 @@
                     return pos_type(off_type(-1));
                 if(pbase() <= off+pptr() && off+pptr() <= putend_)
                     // set pptr
- streambuf_t::pbump(off);
+ streambuf_t::pbump(static_cast<int>(off));
                 else
                     off = off_type(-1);
             }
@@ -221,6 +221,10 @@
         typename basic_altstringbuf<Ch, Tr, Alloc>::int_type
         basic_altstringbuf<Ch, Tr, Alloc>::
         overflow (int_type meta) {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4996)
+#endif
             if(compat_traits_type::eq_int_type(compat_traits_type::eof(), meta))
                 return compat_traits_type::not_eof(meta); // nothing to do
             else if(pptr() != NULL && pptr() < epptr()) {
@@ -276,6 +280,9 @@
                 streambuf_t::sputc(compat_traits_type::to_char_type(meta));
                 return meta;
             }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
         }
         // -end overflow(..)
 

Modified: trunk/boost/format/feed_args.hpp
==============================================================================
--- trunk/boost/format/feed_args.hpp (original)
+++ trunk/boost/format/feed_args.hpp 2007-11-20 06:40:28 EST (Tue, 20 Nov 2007)
@@ -51,7 +51,7 @@
         else {
             std::streamsize n=static_cast<std::streamsize>(w-size-!!prefix_space);
             std::streamsize n_after = 0, n_before = 0;
- res.reserve(w); // allocate once for the 2 inserts
+ res.reserve(static_cast<size_type>(w)); // allocate once for the 2 inserts
             if(center)
                 n_after = n/2, n_before = n - n_after;
             else
@@ -60,12 +60,12 @@
                 else
                     n_before = n;
             // now make the res string :
- if(n_before) res.append(n_before, fill_char);
+ if(n_before) res.append(static_cast<size_type>(n_before), fill_char);
             if(prefix_space)
               res.append(1, prefix_space);
             if (size)
               res.append(beg, size);
- if(n_after) res.append(n_after, fill_char);
+ if(n_after) res.append(static_cast<size_type>(n_after), fill_char);
         }
     } // -mk_str(..)
 

Modified: trunk/boost/format/format_implementation.hpp
==============================================================================
--- trunk/boost/format/format_implementation.hpp (original)
+++ trunk/boost/format/format_implementation.hpp 2007-11-20 06:40:28 EST (Tue, 20 Nov 2007)
@@ -25,21 +25,21 @@
 // --- basic_format implementation -----------------------------------------//
 
     template< class Ch, class Tr, class Alloc>
- basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* str)
+ basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s)
         : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
           exceptions_(io::all_error_bits)
     {
- if( str)
- parse( str );
+ if( s)
+ parse( s );
     }
 
 #if !defined(BOOST_NO_STD_LOCALE)
     template< class Ch, class Tr, class Alloc>
- basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* str, const std::locale & loc)
+ basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s, const std::locale & loc)
         : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
           loc_(loc), exceptions_(io::all_error_bits)
     {
- if(str) parse( str );
+ if(s) parse( s );
     }
 
     template< class Ch, class Tr, class Alloc>

Modified: trunk/boost/format/group.hpp
==============================================================================
--- trunk/boost/format/group.hpp (original)
+++ trunk/boost/format/group.hpp 2007-11-20 06:40:28 EST (Tue, 20 Nov 2007)
@@ -55,6 +55,8 @@
     group1(T1 a1)
       : a1_(a1)
       {}
+private:
+ group1& operator=(const group1&);
 };
 
 template <class Ch, class Tr, class T1>
@@ -78,6 +80,8 @@
     group2(T1 a1,T2 a2)
       : a1_(a1),a2_(a2)
       {}
+private:
+ group2& operator=(const group2&);
 };
 
 template <class Ch, class Tr, class T1,class T2>
@@ -99,6 +103,8 @@
     group3(T1 a1,T2 a2,T3 a3)
       : a1_(a1),a2_(a2),a3_(a3)
       {}
+private:
+ group3& operator=(const group3&);
 };
 
 template <class Ch, class Tr, class T1,class T2,class T3>

Modified: trunk/boost/format/internals.hpp
==============================================================================
--- trunk/boost/format/internals.hpp (original)
+++ trunk/boost/format/internals.hpp 2007-11-20 06:40:28 EST (Tue, 20 Nov 2007)
@@ -119,6 +119,8 @@
             os.imbue(loc_.get());
         else if(loc_default)
             os.imbue(*loc_default);
+#else
+ (void) loc_default; // keep compiler quiet if we don't support locales
 #endif
     }
 

Modified: trunk/boost/format/parsing.hpp
==============================================================================
--- trunk/boost/format/parsing.hpp (original)
+++ trunk/boost/format/parsing.hpp 2007-11-20 06:40:28 EST (Tue, 20 Nov 2007)
@@ -16,6 +16,7 @@
 
 
 #include <boost/format/format_class.hpp>
+#include <boost/format/exceptions.hpp>
 #include <boost/throw_exception.hpp>
 #include <boost/assert.hpp>
 


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