add assert for valid value in o3tl::typed_flags_set
, fixing a couple of bugs in the process Change-Id: I40f932deecbcc99dff9aa13dd1882c7487e7fa8e Reviewed-on: https://gerrit.libreoffice.org/17411 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
a45827b230
commit
cebfe56ae5
@@ -70,7 +70,10 @@ struct is_typed_flags {
|
|||||||
public:
|
public:
|
||||||
explicit Wrap(typename std::underlying_type<E>::type value):
|
explicit Wrap(typename std::underlying_type<E>::type value):
|
||||||
value_(value)
|
value_(value)
|
||||||
{ assert(detail::isNonNegative(value)); }
|
{
|
||||||
|
assert(detail::isNonNegative(value));
|
||||||
|
assert((value & ~M) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
operator E() { return static_cast<E>(value_); }
|
operator E() { return static_cast<E>(value_); }
|
||||||
|
|
||||||
|
@@ -253,7 +253,7 @@ enum class ControlState {
|
|||||||
};
|
};
|
||||||
namespace o3tl
|
namespace o3tl
|
||||||
{
|
{
|
||||||
template<> struct typed_flags<ControlState> : is_typed_flags<ControlState, 0xc007f> {};
|
template<> struct typed_flags<ControlState> : is_typed_flags<ControlState, 0xc07f> {};
|
||||||
}
|
}
|
||||||
|
|
||||||
class ControlCacheKey
|
class ControlCacheKey
|
||||||
|
@@ -82,7 +82,7 @@ enum class FrmTypeFlags {
|
|||||||
};
|
};
|
||||||
namespace o3tl
|
namespace o3tl
|
||||||
{
|
{
|
||||||
template<> struct typed_flags<FrmTypeFlags> : is_typed_flags<FrmTypeFlags, 0x4fff> {};
|
template<> struct typed_flags<FrmTypeFlags> : is_typed_flags<FrmTypeFlags, 0x7fff> {};
|
||||||
}
|
}
|
||||||
|
|
||||||
//! values can be combined via logical or
|
//! values can be combined via logical or
|
||||||
|
Reference in New Issue
Block a user