Author: mlandres
Date: Fri Oct 31 15:28:03 2008
New Revision: 11559
URL: http://svn.opensuse.org/viewcvs/zypp?rev=11559&view=rev
Log:
Test size of Arch CompatBits.
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=11559&r1=11558&r2=11559&view=diff
==============================================================================
--- trunk/libzypp/zypp/Arch.cc (original)
+++ trunk/libzypp/zypp/Arch.cc Fri Oct 31 15:28:03 2008
@@ -13,6 +13,7 @@
#include <list>
#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
#include "zypp/base/NonCopyable.h"
#include "zypp/base/Tr1hash.h"
#include "zypp/Arch.h"
@@ -37,6 +38,7 @@
{
/** Bitfield for architecture IDs and compatBits relation.
* \note Need one bit for each builtin Arch.
+ * \todo Migrate to some infinite BitField
*/
typedef bit::BitField CompatBits;
@@ -150,6 +152,9 @@
// NOTE: Builtin CLASS Arch CONSTANTS are defined below.
// You have to change them accordingly.
//
+ // NOTE: Thake care CompatBits::IntT is able to provide one
+ // bit for each architectue.
+ //
#define DEF_BUILTIN(A) const IdString _##A( #A );
DEF_BUILTIN( noarch );
@@ -313,7 +318,7 @@
defCompatibleWith( _sh4a, _noarch,_sh4 );
//
///////////////////////////////////////////////////////////////////
- //dumpOn( USR ) << endl;
+ // dumpOn( USR ) << endl;
}
private:
@@ -324,8 +329,13 @@
*/
CompatBits::IntT nextIdBit() const
{
+ if ( CompatBits::size == _compatSet.size() )
+ {
+ // Provide more bits in CompatBits::IntT
+ INT << "Need more than " << CompatBits::size << " bits to encode architectures." << endl;
+ ZYPP_THROW( Exception("Need more bits to encode architectures.") );
+ }
CompatBits::IntT nextBit = CompatBits::IntT(1) << (_compatSet.size());
- assert( nextBit ); // need more bits in CompatBits::IntT
return nextBit;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org