Add a few explicit conversions back from int

Suppresses GCC's -Wconversion, which is not enabled by default.

error: conversion from ‘int’ to ‘quint8’ {aka ‘unsigned char’} may change value [-Werror=conversion]

Change-Id: I0e5f6bec596a4a78bd3bfffd16c998102bd51f7c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Thiago Macieira 2022-01-12 09:58:00 -08:00
parent ed753eb5fb
commit 214df31916
3 changed files with 4 additions and 4 deletions

View File

@ -417,7 +417,7 @@ public:
{ return QMetaType(type).name(); }
QT_DEPRECATED_VERSION_6_0
static int sizeOf(int type)
{ return QMetaType(type).sizeOf(); }
{ return int(QMetaType(type).sizeOf()); }
QT_DEPRECATED_VERSION_6_0
static TypeFlags typeFlags(int type)
{ return QMetaType(type).flags(); }

View File

@ -333,7 +333,7 @@ constexpr inline uint qConstexprCountTrailingZeroBits(quint64 v) noexcept
constexpr inline uint qConstexprCountTrailingZeroBits(quint8 v) noexcept
{
unsigned int c = 8; // c will be the number of zero bits on the right
v &= -signed(v);
v &= quint8(-signed(v));
if (v) c--;
if (v & 0x0000000F) c -= 4;
if (v & 0x00000033) c -= 2;
@ -344,7 +344,7 @@ constexpr inline uint qConstexprCountTrailingZeroBits(quint8 v) noexcept
constexpr inline uint qConstexprCountTrailingZeroBits(quint16 v) noexcept
{
unsigned int c = 16; // c will be the number of zero bits on the right
v &= -signed(v);
v &= quint16(-signed(v));
if (v) c--;
if (v & 0x000000FF) c -= 8;
if (v & 0x00000F0F) c -= 4;

View File

@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
namespace QtPrivate {
constexpr quint8 nextByteSize(quint8 bits) { return (bits + 7) / 8; }
constexpr quint8 nextByteSize(quint8 bits) { return quint8((bits + 7) / 8); }
template <typename T>
struct TagInfo