From: Philippe E. <ph...@us...> - 2003-07-26 07:15:28
|
Update of /cvsroot/oprofile/oprofile/libpp In directory sc8-pr-cvs1:/tmp/cvs-serv18265/libpp Modified Files: profile.cpp profile.h symbol_sort.cpp Log Message: 3 Fix, problem revealed by gcc cvs stl debug mode, one UB, a compile problem and a potential bogosity, see ChangeLog Index: profile.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/profile.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -p -d -r1.9 -r1.10 --- profile.cpp 8 Jul 2003 11:26:51 -0000 1.9 +++ profile.cpp 26 Jul 2003 05:10:50 -0000 1.10 @@ -108,7 +108,7 @@ profile_t::samples_range(unsigned int st ordered_samples_t::const_iterator first = ordered_samples.lower_bound(start); ordered_samples_t::const_iterator last = - last = ordered_samples.lower_bound(end); + ordered_samples.lower_bound(end); return make_pair(const_iterator(first, start_offset), const_iterator(last, start_offset)); Index: profile.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/profile.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -d -r1.7 -r1.8 --- profile.h 9 Jun 2003 00:58:18 -0000 1.7 +++ profile.h 26 Jul 2003 05:10:50 -0000 1.8 @@ -15,6 +15,7 @@ #include <string> #include <map> +#include <iterator> #include "odb_hash.h" #include "op_types.h" @@ -97,7 +98,25 @@ private: u32 start_offset; }; -class profile_t::const_iterator { + +// It will be easier to derive profile_t::const_iterator from +// std::iterator<std::input_iterator_tag, unsigned int> but this doesn't +// work for gcc <= 2.95 so we provide the neccessary typedef in the hard way. +// See ISO C++ 17.4.3.1 § 1 and 14.7.3 § 9. +namespace std { + template <> + struct iterator_traits<profile_t::const_iterator> { + typedef ptrdiff_t difference_type; + typedef unsigned int value_type; + typedef unsigned int* pointer; + typedef unsigned int& reference; + typedef input_iterator_tag iterator_category; + }; +} + + +class profile_t::const_iterator +{ typedef ordered_samples_t::const_iterator iterator_t; public: const_iterator() : start_offset(0) {} Index: symbol_sort.cpp =================================================================== RCS file: /cvsroot/oprofile/oprofile/libpp/symbol_sort.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -d -r1.4 -r1.5 --- symbol_sort.cpp 11 Jun 2003 18:36:38 -0000 1.4 +++ symbol_sort.cpp 26 Jul 2003 05:10:50 -0000 1.5 @@ -113,7 +113,7 @@ bool symbol_compare::operator()(symbol_e if (ret != 0) return ret < 0; } - return true; + return false; } } // anonymous namespace |