Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2007-11-14 10:50:43


Samuel,

Looking through our open issues list on the Track at svn.boost.org, there
are quite a few for Boost.Format that can be dealt with fairly easily:

These two issues:

http://svn.boost.org/trac/boost/ticket/704
and
http://svn.boost.org/trac/boost/ticket/1195

appear to be fixed, and have had the relevent test cases added: is it OK to
close these down?

These issues:

585, 980, 1196, 1278 and 1340

relate to suppressing warnings, or have a trivial fix (missing #include
reported in 1340), patches that fix all these issues are below.
Coincidentally this fixes some of the pesky warnings I was getting when
building Boost.Math as well, so I have an incentive to fix these :-)

Is it OK to apply these patches and close down the issues?

Thanks, John Maddock.

Index: group.hpp
===================================================================
--- group.hpp (revision 41086)
+++ group.hpp (working copy)
@@ -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>
Index: format_implementation.hpp
===================================================================
--- format_implementation.hpp (revision 41086)
+++ format_implementation.hpp (working copy)
@@ -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>
Index: alt_sstream_impl.hpp
===================================================================
--- alt_sstream_impl.hpp (revision 41086)
+++ alt_sstream_impl.hpp (working copy)
@@ -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(..)

Index: feed_args.hpp
===================================================================
--- feed_args.hpp (revision 41086)
+++ feed_args.hpp (working copy)
@@ -51,7 +51,7 @@
         else {
             std::streamsize
n=static_cast<std::streamsize>(w-size-!!prefix_spac
e);
             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(..)

Index: internals.hpp
===================================================================
--- internals.hpp (revision 41086)
+++ internals.hpp (working copy)
@@ -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
     }

Index: parsing.hpp
===================================================================
--- parsing.hpp (revision 41086)
+++ parsing.hpp (working copy)
@@ -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 list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk