Some fixes for inspection report, Run Date: 15:00:47 UTC, Friday 27 June 2008

[SVN r46786]
This commit is contained in:
Ion Gaztañaga
2008-06-27 18:19:38 +00:00
parent 513cf6fbb4
commit 2e27404b33
8 changed files with 52 additions and 133 deletions

View File

@@ -1952,7 +1952,7 @@ operator+(const basic_string<CharT,Traits,A>& x,
const detail::moved_object<basic_string<CharT,Traits,A> >& my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
return my.get().replace(size_type(0), size_type(0), x);
return my.get().replace(size_type(0), size_type(0), x);
}
#else
template <class CharT, class Traits, class A>
@@ -1961,7 +1961,7 @@ operator+(const basic_string<CharT,Traits,A>& x,
basic_string<CharT,Traits,A> && my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
return my.replace(size_type(0), size_type(0), x);
return my.replace(size_type(0), size_type(0), x);
}
#endif
@@ -1986,7 +1986,7 @@ operator+(const CharT* s,
const detail::moved_object<basic_string<CharT,Traits,A> >& my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
return my.get().replace(size_type(0), size_type(0), s);
return my.get().replace(size_type(0), size_type(0), s);
}
#else
template <class CharT, class Traits, class A>
@@ -1995,7 +1995,7 @@ operator+(const CharT* s,
basic_string<CharT,Traits,A> && my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
return detail::move_impl(my.get().replace(size_type(0), size_type(0), s));
return detail::move_impl(my.get().replace(size_type(0), size_type(0), s));
}
#endif
@@ -2019,7 +2019,7 @@ operator+(CharT c,
const detail::moved_object<basic_string<CharT,Traits,A> >& my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
return my.get().replace(size_type(0), size_type(0), &c, &c + 1);
return my.get().replace(size_type(0), size_type(0), &c, &c + 1);
}
#else
template <class CharT, class Traits, class A>
@@ -2028,7 +2028,7 @@ operator+(CharT c,
basic_string<CharT,Traits,A> && my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
return my.replace(size_type(0), size_type(0), &c, &c + 1);
return my.replace(size_type(0), size_type(0), &c, &c + 1);
}
#endif

View File

@@ -1042,7 +1042,7 @@ class vector : private detail::vector_alloc_holder<A>
T *pos = detail::get_pointer(position.get_ptr());
T *beg = detail::get_pointer(this->members_.m_start);
std::copy(assign_move_it(pos + 1), assign_move_it(beg + this->members_.m_size), pos);
std::copy(assign_move_it(pos + 1), assign_move_it(beg + this->members_.m_size), pos);
--this->members_.m_size;
//Destroy last element
base_t::destroy(detail::get_pointer(this->members_.m_start) + this->members_.m_size);
@@ -1056,12 +1056,12 @@ class vector : private detail::vector_alloc_holder<A>
//! <b>Complexity</b>: Linear to the distance between first and last.
iterator erase(const_iterator first, const_iterator last)
{
if (first != last){ // worth doing, copy down over hole
if (first != last){ // worth doing, copy down over hole
T* end_pos = detail::get_pointer(this->members_.m_start) + this->members_.m_size;
T* ptr = detail::get_pointer(std::copy
(assign_move_it(detail::get_pointer(last.get_ptr()))
,assign_move_it(end_pos)
,detail::get_pointer(first.get_ptr())
,detail::get_pointer(first.get_ptr())
));
size_type destroyed = (end_pos - ptr);
this->destroy_n(ptr, destroyed);
@@ -1310,8 +1310,8 @@ class vector : private detail::vector_alloc_holder<A>
//Destroy and deallocate old elements
//If there is allocated memory, destroy and deallocate
if(this->members_.m_start != 0){
if(!base_t::trivial_dctr_after_move)
this->destroy_n(detail::get_pointer(this->members_.m_start), this->members_.m_size);
if(!base_t::trivial_dctr_after_move)
this->destroy_n(detail::get_pointer(this->members_.m_start), this->members_.m_size);
this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
}
this->members_.m_start = new_start;
@@ -1702,7 +1702,7 @@ class vector : private detail::vector_alloc_holder<A>
scoped_alloc.release();
//Destroy and deallocate old buffer
if(this->members_.m_start != 0){
this->destroy_n(detail::get_pointer(this->members_.m_start), this->members_.m_size);
this->destroy_n(detail::get_pointer(this->members_.m_start), this->members_.m_size);
this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
}
this->members_.m_start = ret.first;

View File

@@ -121,7 +121,7 @@ template<class T> inline
T *copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, detail::bool_<true>)
{
std::size_t size = length*sizeof(T);
return ((T*)std::memmove(dest, first, size)) + size;
return ((T*)std::memmove(dest, first, size)) + size;
}
template<class InIt, class OutIt> inline
@@ -165,7 +165,7 @@ template<class T> inline
T *uninitialized_copy_n_dispatch(const T *first, typename std::iterator_traits<const T*>::difference_type length, T *dest, detail::bool_<true>)
{
std::size_t size = length*sizeof(T);
return ((T*)std::memmove(dest, first, size)) + size;
return ((T*)std::memmove(dest, first, size)) + size;
}
template<class InIt, class FwdIt> inline

View File

@@ -1,3 +1,12 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2008. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTERPROCESS_CONFIG_INCLUDED
#define BOOST_INTERPROCESS_CONFIG_INCLUDED
#include <boost/config.hpp>
@@ -15,20 +24,20 @@
#pragma warning (disable : 4146) // unary minus operator applied to unsigned type, result still unsigned
#pragma warning (disable : 4284) // odd return type for operator->
#pragma warning (disable : 4244) // possible loss of data
#pragma warning (disable : 4251) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
#pragma warning (disable : 4267) // conversion from 'X' to 'Y', possible loss of data
#pragma warning (disable : 4275) // non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
#pragma warning (disable : 4355) // 'this' : used in base member initializer list
#pragma warning (disable : 4503) // 'identifier' : decorated name length exceeded, name was truncated
#pragma warning (disable : 4251) // "identifier" : class "type" needs to have dll-interface to be used by clients of class "type2"
#pragma warning (disable : 4267) // conversion from "X" to "Y", possible loss of data
#pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier"
#pragma warning (disable : 4355) // "this" : used in base member initializer list
#pragma warning (disable : 4503) // "identifier" : decorated name length exceeded, name was truncated
#pragma warning (disable : 4511) // copy constructor could not be generated
#pragma warning (disable : 4512) // assignment operator could not be generated
#pragma warning (disable : 4514) // unreferenced inline removed
#pragma warning (disable : 4521) // Disable "multiple copy constructors specified"
#pragma warning (disable : 4522) // 'class' : multiple assignment operators specified
#pragma warning (disable : 4675) // 'method' should be declared 'static' and have exactly one parameter
#pragma warning (disable : 4522) // "class" : multiple assignment operators specified
#pragma warning (disable : 4675) // "method" should be declared "static" and have exactly one parameter
#pragma warning (disable : 4710) // function not inlined
#pragma warning (disable : 4711) // function selected for automatic inline expansion
#pragma warning (disable : 4786) // identifier truncated in debug info
#pragma warning (disable : 4996) // 'function': was declared deprecated
#pragma warning (disable : 4996) // "function": was declared deprecated
#pragma warning (disable : 4197) // top-level volatile in cast is ignored
#endif

View File

@@ -1,3 +1,12 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2008. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#if defined BOOST_MSVC
#pragma warning (pop)
#ifdef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE

View File

@@ -97,7 +97,7 @@ inline std::size_t floor_log2 (std::size_t x)
for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
std::size_t tmp = n >> shift;
if (tmp)
log2 += shift, n = tmp;
log2 += shift, n = tmp;
}
return log2;

View File

@@ -1,3 +1,14 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2007-2008.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
#define BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED

View File

@@ -1,110 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Stephen Cleary 2000.
// (C) Copyright Ion Gaztanaga 2007-2008.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
// This file is a slightly modified file from Boost.Pool
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP
#define BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP
#include <boost/static_assert.hpp> //BOOST_STATIC_ASSERT
#include <climits> //CHAR_BIT
namespace boost {
namespace interprocess {
namespace detail {
// Greatest common divisor and least common multiple
//
// gcd is an algorithm that calculates the greatest common divisor of two
// integers, using Euclid's algorithm.
//
// Pre: A > 0 && B > 0
// Recommended: A > B
template <typename Integer>
inline Integer gcd(Integer A, Integer B)
{
do
{
const Integer tmp(B);
B = A % B;
A = tmp;
} while (B != 0);
return A;
}
//
// lcm is an algorithm that calculates the least common multiple of two
// integers.
//
// Pre: A > 0 && B > 0
// Recommended: A > B
template <typename Integer>
inline Integer lcm(const Integer & A, const Integer & B)
{
Integer ret = A;
ret /= gcd(A, B);
ret *= B;
return ret;
}
template <typename Integer>
inline Integer log2_ceil(const Integer & A)
{
Integer i = 0;
Integer power_of_2 = 1;
while(power_of_2 < A){
power_of_2 <<= 1;
++i;
}
return i;
}
template <typename Integer>
inline Integer upper_power_of_2(const Integer & A)
{
Integer power_of_2 = 1;
while(power_of_2 < A){
power_of_2 <<= 1;
}
return power_of_2;
}
//This function uses binary search to discover the
//highest set bit of the integer
inline std::size_t floor_log2 (std::size_t x)
{
const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT;
const bool Size_t_Bits_Power_2= !(Bits & (Bits-1));
BOOST_STATIC_ASSERT(Size_t_Bits_Power_2);
std::size_t n = x;
std::size_t log2 = 0;
for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
std::size_t tmp = n >> shift;
if (tmp)
log2 += shift, n = tmp;
}
return log2;
}
} // namespace detail
} // namespace interprocess
} // namespace boost
#endif