From 2e27404b333ab993b1fafce8825fffe91697098a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 27 Jun 2008 18:19:38 +0000 Subject: [PATCH] Some fixes for inspection report, Run Date: 15:00:47 UTC, Friday 27 June 2008 [SVN r46786] --- .../boost/interprocess/containers/string.hpp | 12 +- .../boost/interprocess/containers/vector.hpp | 12 +- .../boost/interprocess/detail/algorithms.hpp | 4 +- .../interprocess/detail/config_begin.hpp | 25 ++-- .../boost/interprocess/detail/config_end.hpp | 9 ++ .../interprocess/detail/math_functions.hpp | 2 +- .../smart_ptr/detail/sp_counted_base.hpp | 11 ++ .../interprocess/sync/math_functions.hpp | 110 ------------------ 8 files changed, 52 insertions(+), 133 deletions(-) delete mode 100644 include/boost/interprocess/sync/math_functions.hpp diff --git a/include/boost/interprocess/containers/string.hpp b/include/boost/interprocess/containers/string.hpp index 33ca269..b1bf30d 100644 --- a/include/boost/interprocess/containers/string.hpp +++ b/include/boost/interprocess/containers/string.hpp @@ -1952,7 +1952,7 @@ operator+(const basic_string& x, const detail::moved_object >& my) { typedef typename basic_string::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 @@ -1961,7 +1961,7 @@ operator+(const basic_string& x, basic_string && my) { typedef typename basic_string::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 >& my) { typedef typename basic_string::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 @@ -1995,7 +1995,7 @@ operator+(const CharT* s, basic_string && my) { typedef typename basic_string::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 >& my) { typedef typename basic_string::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 @@ -2028,7 +2028,7 @@ operator+(CharT c, basic_string && my) { typedef typename basic_string::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 diff --git a/include/boost/interprocess/containers/vector.hpp b/include/boost/interprocess/containers/vector.hpp index 85bd620..5372eda 100644 --- a/include/boost/interprocess/containers/vector.hpp +++ b/include/boost/interprocess/containers/vector.hpp @@ -1042,7 +1042,7 @@ class vector : private detail::vector_alloc_holder 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 //! Complexity: 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 //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 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; diff --git a/include/boost/interprocess/detail/algorithms.hpp b/include/boost/interprocess/detail/algorithms.hpp index a949e96..62e3637 100644 --- a/include/boost/interprocess/detail/algorithms.hpp +++ b/include/boost/interprocess/detail/algorithms.hpp @@ -121,7 +121,7 @@ template inline T *copy_n_dispatch(const T *first, typename std::iterator_traits::difference_type length, T *dest, detail::bool_) { std::size_t size = length*sizeof(T); - return ((T*)std::memmove(dest, first, size)) + size; + return ((T*)std::memmove(dest, first, size)) + size; } template inline @@ -165,7 +165,7 @@ template inline T *uninitialized_copy_n_dispatch(const T *first, typename std::iterator_traits::difference_type length, T *dest, detail::bool_) { std::size_t size = length*sizeof(T); - return ((T*)std::memmove(dest, first, size)) + size; + return ((T*)std::memmove(dest, first, size)) + size; } template inline diff --git a/include/boost/interprocess/detail/config_begin.hpp b/include/boost/interprocess/detail/config_begin.hpp index e872b53..0273a8e 100644 --- a/include/boost/interprocess/detail/config_begin.hpp +++ b/include/boost/interprocess/detail/config_begin.hpp @@ -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 @@ -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 diff --git a/include/boost/interprocess/detail/config_end.hpp b/include/boost/interprocess/detail/config_end.hpp index 5c6ad50..1e6c30e 100644 --- a/include/boost/interprocess/detail/config_end.hpp +++ b/include/boost/interprocess/detail/config_end.hpp @@ -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 diff --git a/include/boost/interprocess/detail/math_functions.hpp b/include/boost/interprocess/detail/math_functions.hpp index 7094b78..3d750ea 100644 --- a/include/boost/interprocess/detail/math_functions.hpp +++ b/include/boost/interprocess/detail/math_functions.hpp @@ -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; diff --git a/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp b/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp index 9d144f5..8d0c65d 100644 --- a/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp +++ b/include/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp @@ -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 diff --git a/include/boost/interprocess/sync/math_functions.hpp b/include/boost/interprocess/sync/math_functions.hpp deleted file mode 100644 index 54d4126..0000000 --- a/include/boost/interprocess/sync/math_functions.hpp +++ /dev/null @@ -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 -#include //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 -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 -inline Integer lcm(const Integer & A, const Integer & B) -{ - Integer ret = A; - ret /= gcd(A, B); - ret *= B; - return ret; -} - -template -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 -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