From f3bebeb023c4a1af42bae0b06399b33d5bae8117 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 25 Oct 2024 09:28:31 +0200 Subject: [PATCH] Merge pull request #2294 from Osyotr/checked_iterator_nuke Remove checked_iterator.h (cherry picked from commit e9de6a1f568710829668495c37dfef2c9ba74550) # Conflicts: # ACE/NEWS # ACE/ace/ace_for_tao.mpc # ACE/ace/checked_iterator.h # ACE/bin/MakeProjectCreator/config/vc_warnings.mpb --- ACE/ace/Array_Map.cpp | 14 ++----- ACE/ace/ace.mpc | 1 - ACE/ace/ace_for_tao.mpc | 1 - ACE/ace/checked_iterator.h | 56 ---------------------------- TAO/tao/Generic_Sequence_T.h | 5 +-- TAO/tao/Unbounded_Octet_Sequence_T.h | 5 +-- 6 files changed, 8 insertions(+), 74 deletions(-) delete mode 100644 ACE/ace/checked_iterator.h diff --git a/ACE/ace/Array_Map.cpp b/ACE/ace/Array_Map.cpp index 4917c51e42f05..da43312bd06b0 100644 --- a/ACE/ace/Array_Map.cpp +++ b/ACE/ace/Array_Map.cpp @@ -7,8 +7,6 @@ # include "ace/Array_Map.inl" #endif /* !__ACE_INLINE__ */ -#include "ace/checked_iterator.h" - #include ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -23,8 +21,7 @@ ACE_Array_Map::ACE_Array_Map (InputIterator f, { (void) std::uninitialized_copy (f, l, - ACE_make_checked_array_iterator (this->begin (), - this->size_)); + this->begin ()); } template @@ -36,8 +33,7 @@ ACE_Array_Map::ACE_Array_Map ( { (void) std::uninitialized_copy (map.begin (), map.end (), - ACE_make_checked_array_iterator (this->begin (), - this->size_)); + this->begin ()); } template @@ -215,8 +211,7 @@ ACE_Array_Map::grow ( std::copy (this->begin (), this->end (), - ACE_make_checked_array_iterator (temp.begin (), - temp.capacity_)); + temp.begin ()); size_type const n = this->size (); // Do not swap out the size // since we bypassed the @@ -241,8 +236,7 @@ operator== (ACE_Array_Map const & lhs, return (lhs.size () == rhs.size () && std::equal (lhs.begin (), lhs.end (), - ACE_make_checked_array_iterator (rhs.begin (), - rhs.size ()))); + rhs.begin ())); } template diff --git a/ACE/ace/ace.mpc b/ACE/ace/ace.mpc index 59d06539cc8c2..f1e84d4019836 100644 --- a/ACE/ace/ace.mpc +++ b/ACE/ace/ace.mpc @@ -469,7 +469,6 @@ project(ACE) : ace_output, acedefaults, install, other, codecs, token, svcconf, Version.h Versioned_Namespace.h ace_wchar.h - checked_iterator.h config-*.h config.h iosfwd.h diff --git a/ACE/ace/ace_for_tao.mpc b/ACE/ace/ace_for_tao.mpc index 629b5c9d145b8..f4606cdc94fa7 100644 --- a/ACE/ace/ace_for_tao.mpc +++ b/ACE/ace/ace_for_tao.mpc @@ -361,7 +361,6 @@ project(ACE_FOR_TAO) : acedefaults, install, svcconf, uuid, versioned_namespace, Value_Ptr.h Version.h ace_wchar.h - checked_iterator.h config-WinCE.h config-all.h config-borland-common.h diff --git a/ACE/ace/checked_iterator.h b/ACE/ace/checked_iterator.h deleted file mode 100644 index 473ca5c9db92f..0000000000000 --- a/ACE/ace/checked_iterator.h +++ /dev/null @@ -1,56 +0,0 @@ -// -*- C++ -*- - -#ifndef ACE_CHECKED_ITERATOR_H -#define ACE_CHECKED_ITERATOR_H - -/** - * @file checked_iterator.h - * - * @brief Checked iterator factory function. - * - * Some compilers (e.g. MSVC++ >= 8) issue security related - * diagnostics if algorithms such as std::copy() are used in an unsafe - * way. Normally this isn't an issue if STL container iterators are - * used in conjuction with the standard algorithms. However, in cases - * where application-specific iterators are use with standard - * algorithms that could potentially overrun a buffer, extra care must - * be taken to prevent such an overrun. If supported, checked - * iterators can be used to address the potential destination buffer - * overrun. - * - * This header provides function templates that generate the - * appropriate checked iterator. In cases where checked iterators are - * not supported, the pointer passed to the function is returned - * instead. - * - * @internal The functions and types in this header are meant for - * internal use. They may change at any point between - * releases. - * - * @author Ossama Othman - */ - -# if defined (_MSC_VER) && (_MSC_FULL_VER >= 140050000) && (!defined (_STLPORT_VERSION)) -// Checked iterators are currently only supported in MSVC++ 8 or better. -# include -# endif /* _MSC_VER >= 1400 && !_STLPORT_VERSION */ - -# if defined (_MSC_VER) && (_MSC_FULL_VER >= 140050000) && (!defined (_STLPORT_VERSION)) -template -stdext::checked_array_iterator -ACE_make_checked_array_iterator (PTR buf, size_t len) -{ - return stdext::checked_array_iterator (buf, len); -} -# else -template -PTR -ACE_make_checked_array_iterator (PTR buf, size_t /* len */) -{ - // Checked iterators are unsupported. Just return the pointer to - // the buffer itself. - return buf; -} -# endif /* _MSC_VER >= 1400 && !_STLPORT_VERSION */ - -#endif /* ACE_CHECKED_ITERATOR_H */ diff --git a/TAO/tao/Generic_Sequence_T.h b/TAO/tao/Generic_Sequence_T.h index f34e92110e3a9..fe366d6628b44 100644 --- a/TAO/tao/Generic_Sequence_T.h +++ b/TAO/tao/Generic_Sequence_T.h @@ -55,7 +55,6 @@ */ #include "tao/Range_Checking_T.h" -#include "ace/checked_iterator.h" #include @@ -155,7 +154,7 @@ class generic_sequence element_traits::copy_range( rhs.buffer_, rhs.buffer_ + rhs.length_, - ACE_make_checked_array_iterator (tmp.buffer_, tmp.length_)); + tmp.buffer_); swap(tmp); } @@ -239,7 +238,7 @@ class generic_sequence element_traits::copy_swap_range( buffer_, buffer_ + length_, - ACE_make_checked_array_iterator (tmp.buffer_, tmp.length_)); + tmp.buffer_); swap(tmp); } diff --git a/TAO/tao/Unbounded_Octet_Sequence_T.h b/TAO/tao/Unbounded_Octet_Sequence_T.h index 695b37e59a71d..5ab9b70f5be88 100644 --- a/TAO/tao/Unbounded_Octet_Sequence_T.h +++ b/TAO/tao/Unbounded_Octet_Sequence_T.h @@ -22,7 +22,6 @@ #include "tao/Basic_Types.h" #include "ace/Message_Block.h" #include "ace/OS_Memory.h" -#include "ace/checked_iterator.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -140,7 +139,7 @@ class TAO_Export unbounded_value_sequence element_traits::copy_range( buffer_, buffer_ + length, - ACE_make_checked_array_iterator (tmp.buffer_, tmp.length_)); + tmp.buffer_); swap(tmp); } return; @@ -151,7 +150,7 @@ class TAO_Export unbounded_value_sequence element_traits::copy_range( buffer_, buffer_ + length_, - ACE_make_checked_array_iterator (tmp.buffer_, tmp.length_)); + tmp.buffer_); swap(tmp); } inline value_type const & operator[](CORBA::ULong i) const {