QTaggedPointer: Assert on the same tag value as we use in setTag()
If we assert on a different cast we may just get a different integer value, if Tag is a sufficiently nefarious type. Coverity-Id: 403056 Change-Id: I6e8e3883bce124b3350ad8276d88ac7ed030d982 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
cf471f9a91
commit
410449ea21
|
|
@ -104,8 +104,10 @@ public:
|
|||
|
||||
void setTag(Tag tag)
|
||||
{
|
||||
Q_ASSERT_X((static_cast<typename QtPrivate::TagInfo<T>::TagType>(tag) & pointerMask()) == 0,
|
||||
"QTaggedPointer<T, Tag>::setTag", "Tag is larger than allowed by number of available tag bits");
|
||||
Q_ASSERT_X(
|
||||
(static_cast<quintptr>(tag) & pointerMask()) == 0,
|
||||
"QTaggedPointer<T, Tag>::setTag",
|
||||
"Tag is larger than allowed by number of available tag bits");
|
||||
|
||||
d = (d & pointerMask()) | static_cast<quintptr>(tag);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue