forked from qt-creator/qt-creator
QmlProfiler: Avoid some compiler warnings
If size_t is 32bit wide, any comparison to qint64Max is pointless. And in order to compare a size_t to intMax, we need to cast intMax to size_t. Change-Id: Ida1945ca0cd8865b8d8620c8b23b7e21a20dc43c Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -480,14 +480,16 @@ int QmlProfilerEventTypeStorage::append(Timeline::TraceEventType &&type)
|
|||||||
QTC_CHECK(false);
|
QTC_CHECK(false);
|
||||||
m_types.push_back(QmlEventType());
|
m_types.push_back(QmlEventType());
|
||||||
}
|
}
|
||||||
QTC_ASSERT(index <= std::numeric_limits<int>::max(), return std::numeric_limits<int>::max());
|
QTC_ASSERT(index <= static_cast<size_t>(std::numeric_limits<int>::max()),
|
||||||
|
return std::numeric_limits<int>::max());
|
||||||
return static_cast<int>(index);
|
return static_cast<int>(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int QmlProfilerEventTypeStorage::size() const
|
int QmlProfilerEventTypeStorage::size() const
|
||||||
{
|
{
|
||||||
const size_t size = m_types.size();
|
const size_t size = m_types.size();
|
||||||
QTC_ASSERT(size <= std::numeric_limits<int>::max(), return std::numeric_limits<int>::max());
|
QTC_ASSERT(size <= static_cast<size_t>(std::numeric_limits<int>::max()),
|
||||||
|
return std::numeric_limits<int>::max());
|
||||||
return static_cast<int>(size);
|
return static_cast<int>(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
{
|
{
|
||||||
static const qint64 qint64Max = std::numeric_limits<qint64>::max();
|
static const qint64 qint64Max = std::numeric_limits<qint64>::max();
|
||||||
size_t size = durations.size();
|
size_t size = durations.size();
|
||||||
QTC_ASSERT(size <= qint64Max, size = qint64Max);
|
QTC_ASSERT(sizeof(size_t) < sizeof(qint64) || size <= qint64Max, size = qint64Max);
|
||||||
calls = static_cast<qint64>(size);
|
calls = static_cast<qint64>(size);
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user