forked from qt-creator/qt-creator
QmlProfiler: Fix some number conversion issues
Qt containers have int as size type, while std containers have size_t. We can use auto and decltype to deal with this. Also, memcpy and malloc expect size_t, not int. Change-Id: Id2942d14978c8a15f72967962d551ddb20905471 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -240,7 +240,7 @@ private:
|
||||
void assignData(const QmlEvent &other)
|
||||
{
|
||||
if (m_dataType & External) {
|
||||
int length = m_dataLength * (other.m_dataType / 8);
|
||||
size_t length = m_dataLength * (other.m_dataType / 8);
|
||||
m_data.external = malloc(length);
|
||||
memcpy(m_data.external, other.m_data.external, length);
|
||||
} else {
|
||||
@@ -278,8 +278,9 @@ private:
|
||||
void assignNumbers(const Container &numbers)
|
||||
{
|
||||
Number *data;
|
||||
m_dataLength = squeezable<size_t, quint16>(numbers.size()) ?
|
||||
static_cast<quint16>(numbers.size()) : std::numeric_limits<quint16>::max();
|
||||
const auto size = numbers.size();
|
||||
m_dataLength = squeezable<decltype(size), quint16>(size) ?
|
||||
static_cast<quint16>(size) : std::numeric_limits<quint16>::max();
|
||||
if (m_dataLength > sizeof(m_data) / sizeof(Number)) {
|
||||
if (squeeze<Container, Number>(numbers))
|
||||
return;
|
||||
|
Reference in New Issue
Block a user