Author: mlandres Date: Wed Oct 29 16:29:28 2008 New Revision: 11542 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11542&view=rev Log: fix logging Modified: trunk/libzypp/zypp/Arch.cc Modified: trunk/libzypp/zypp/Arch.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Arch.cc?rev=11542&r1=11541&r2=11542&view=diff ============================================================================== --- trunk/libzypp/zypp/Arch.cc (original) +++ trunk/libzypp/zypp/Arch.cc Wed Oct 29 16:29:28 2008 @@ -10,7 +10,7 @@ * */ #include <iostream> -#include <set> +#include <list> #include "zypp/base/Logger.h" #include "zypp/base/NonCopyable.h" @@ -110,7 +110,14 @@ /** \relates Arch::CompatEntry Stream output */ inline std::ostream & operator<<( std::ostream & str, const Arch::CompatEntry & obj ) { - return str << str::form( "%-15s ", obj._archStr.c_str() ) << obj._idBit << ' ' + Arch::CompatEntry::CompatBits bit( obj._idBit ); + unsigned bitnum = 0; + while ( bit ) + { + ++bitnum; + bit >>= 1; + } + return str << str::form( "%-15s ", obj._archStr.c_str() ) << str::numstring(bitnum,2) << ' ' << obj._compatBits << ' ' << obj._compatScore; } @@ -232,10 +239,18 @@ const_iterator end() const { return _compatSet.end(); } + struct DumpOnCompare + { + int operator()( const CompatEntry & lhs, const CompatEntry & rhs ) const + { return lhs._idBit.value() < rhs._idBit.value(); } + }; + std::ostream & dumpOn( std::ostream & str ) const { str << "ArchCompatSet:"; - for ( const_iterator it = _compatSet.begin(); it != _compatSet.end(); ++it ) + std::list<CompatEntry> ov( _compatSet.begin(), _compatSet.end() ); + ov.sort( DumpOnCompare() ); + for_( it, ov.begin(), ov.end() ) { str << endl << ' ' << *it; } @@ -298,7 +313,7 @@ defCompatibleWith( _sh4a, _noarch,_sh4 ); // /////////////////////////////////////////////////////////////////// - dumpOn( USR ) << endl; + //dumpOn( USR ) << endl; } private: -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org