Fix some MSVC int conversion warnings
kernel\qmetaobjectbuilder.cpp(1279): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data kernel\qmetaobjectbuilder.cpp(1432): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data sax\qxml.cpp(1275): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data text\qfontsubset.cpp(920): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data text\qfontsubset.cpp(920): warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data text\qtextengine.cpp(2664): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data text\qtextengine.cpp(2665): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data text\qtextengine.cpp(2706): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data text\qtextengine.cpp(2707): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data itemviews\qbsptree.cpp(60): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) kernel\qprintengine_win.cpp(1558): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data qsql_odbc.cpp(804): warning C4267: 'argument': conversion from 'size_t' to 'SQLINTEGER', possible loss of data qsql_odbc.cpp(822): warning C4267: 'argument': conversion from 'size_t' to 'SQLINTEGER', possible loss of data qsql_odbc.cpp(1585): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data qsql_odbc.cpp(1602): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data qwindowsmime.cpp(770): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data windows\qwindowsmime.cpp(770): warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data Change-Id: I04fbe17b9782f4c2704933fc005449b1e992475e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
d145dbc43f
commit
ae5d021f45
@ -1276,7 +1276,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
|
||||
|
||||
// Output the methods in the class.
|
||||
Q_ASSERT(!buf || dataIndex == pmeta->methodData);
|
||||
int parameterMetaTypesIndex = d->properties.size();
|
||||
int parameterMetaTypesIndex = int(d->properties.size());
|
||||
for (const auto &method : d->methods) {
|
||||
int name = strings.enter(method.name());
|
||||
int argc = method.parameterCount();
|
||||
|
@ -913,11 +913,11 @@ static int convertToRelative(QList<TTF_POINT> *points)
|
||||
|
||||
static void getGlyphData(QTtfGlyph *glyph, const QList<TTF_POINT> &points, const QList<int> &endPoints, int point_array_size)
|
||||
{
|
||||
const int max_size = 5*sizeof(qint16) // header
|
||||
const int max_size = int(5 * sizeof(qint16) // header
|
||||
+ endPoints.size() * sizeof(quint16) // end points of contours
|
||||
+ sizeof(quint16) // instruction length == 0
|
||||
+ points.size()*(1) // flags
|
||||
+ point_array_size; // coordinates
|
||||
+ point_array_size); // coordinates
|
||||
|
||||
glyph->data.resize(max_size);
|
||||
|
||||
|
@ -2661,8 +2661,8 @@ QTextEngine::LayoutData::LayoutData(const QString &str, void **stack_memory, int
|
||||
{
|
||||
allocated = _allocated;
|
||||
|
||||
int space_charAttributes = sizeof(QCharAttributes)*string.length()/sizeof(void*) + 1;
|
||||
int space_logClusters = sizeof(unsigned short)*string.length()/sizeof(void*) + 1;
|
||||
int space_charAttributes = int(sizeof(QCharAttributes) * string.length() / sizeof(void*) + 1);
|
||||
int space_logClusters = int(sizeof(unsigned short) * string.length() / sizeof(void*) + 1);
|
||||
available_glyphs = ((int)allocated - space_charAttributes - space_logClusters)*(int)sizeof(void*)/(int)QGlyphLayout::SpaceNeeded;
|
||||
|
||||
if (available_glyphs < str.length()) {
|
||||
@ -2703,8 +2703,8 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs)
|
||||
return true;
|
||||
}
|
||||
|
||||
int space_charAttributes = sizeof(QCharAttributes)*string.length()/sizeof(void*) + 1;
|
||||
int space_logClusters = sizeof(unsigned short)*string.length()/sizeof(void*) + 1;
|
||||
int space_charAttributes = int(sizeof(QCharAttributes) * string.length() / sizeof(void*) + 1);
|
||||
int space_logClusters = int(sizeof(unsigned short) * string.length() / sizeof(void*) + 1);
|
||||
int space_glyphs = (totalGlyphs * QGlyphLayout::SpaceNeeded) / sizeof(void *) + 2;
|
||||
|
||||
int newAllocated = space_charAttributes + space_glyphs + space_logClusters;
|
||||
|
@ -763,7 +763,7 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
|
||||
if (getCf(formatetc) == CF_HDROP) {
|
||||
const auto &urls = mimeData->urls();
|
||||
QStringList fileNames;
|
||||
int size = sizeof(DROPFILES)+2;
|
||||
size_t size = sizeof(DROPFILES) + 2;
|
||||
for (const QUrl &url : urls) {
|
||||
const QString fn = QDir::toNativeSeparators(url.toLocalFile());
|
||||
if (!fn.isEmpty()) {
|
||||
@ -772,7 +772,7 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray result(size, '\0');
|
||||
QByteArray result(int(size), '\0');
|
||||
auto* d = reinterpret_cast<DROPFILES *>(result.data());
|
||||
d->pFiles = sizeof(DROPFILES);
|
||||
GetCursorPos(&d->pt); // try
|
||||
|
@ -801,7 +801,7 @@ bool QODBCDriverPrivate::setConnectionOptions(const QString& connOpts)
|
||||
val.utf16(); // 0 terminate
|
||||
r = SQLSetConnectAttr(hDbc, SQL_ATTR_CURRENT_CATALOG,
|
||||
toSQLTCHAR(val).data(),
|
||||
val.length()*sizeof(SQLTCHAR));
|
||||
SQLINTEGER(val.length() * sizeof(SQLTCHAR)));
|
||||
} else if (opt.toUpper() == QLatin1String("SQL_ATTR_METADATA_ID")) {
|
||||
if (val.toUpper() == QLatin1String("SQL_TRUE")) {
|
||||
v = SQL_TRUE;
|
||||
@ -819,7 +819,7 @@ bool QODBCDriverPrivate::setConnectionOptions(const QString& connOpts)
|
||||
val.utf16(); // 0 terminate
|
||||
r = SQLSetConnectAttr(hDbc, SQL_ATTR_TRACEFILE,
|
||||
toSQLTCHAR(val).data(),
|
||||
val.length()*sizeof(SQLTCHAR));
|
||||
SQLINTEGER(val.length() * sizeof(SQLTCHAR)));
|
||||
} else if (opt.toUpper() == QLatin1String("SQL_ATTR_TRACE")) {
|
||||
if (val.toUpper() == QLatin1String("SQL_OPT_TRACE_OFF")) {
|
||||
v = SQL_OPT_TRACE_OFF;
|
||||
@ -1582,7 +1582,7 @@ bool QODBCResult::exec()
|
||||
QString str = val.toString();
|
||||
if (*ind != SQL_NULL_DATA)
|
||||
*ind = str.length() * sizeof(SQLTCHAR);
|
||||
int strSize = str.length() * sizeof(SQLTCHAR);
|
||||
const qsizetype strSize = str.length() * sizeof(SQLTCHAR);
|
||||
|
||||
if (bindValueType(i) & QSql::Out) {
|
||||
const QVarLengthArray<SQLTCHAR> a(toSQLTCHAR(str));
|
||||
@ -1599,7 +1599,8 @@ bool QODBCResult::exec()
|
||||
ind);
|
||||
break;
|
||||
}
|
||||
ba = QByteArray ((const char *)toSQLTCHAR(str).constData(), str.size()*sizeof(SQLTCHAR));
|
||||
ba = QByteArray(reinterpret_cast<const char *>(toSQLTCHAR(str).constData()),
|
||||
int(strSize));
|
||||
r = SQLBindParameter(d->hStmt,
|
||||
i + 1,
|
||||
qParamType[bindValueType(i) & QSql::InOut],
|
||||
|
@ -1555,7 +1555,7 @@ HGLOBAL *QWin32PrintEngine::createGlobalDevNames()
|
||||
{
|
||||
Q_D(QWin32PrintEngine);
|
||||
|
||||
int size = sizeof(DEVNAMES) + d->m_printDevice.id().length() * 2 + 2;
|
||||
const size_t size = sizeof(DEVNAMES) + d->m_printDevice.id().length() * 2 + 2;
|
||||
auto hGlobal = reinterpret_cast<HGLOBAL *>(GlobalAlloc(GMEM_MOVEABLE, size));
|
||||
auto dn = reinterpret_cast<DEVNAMES*>(GlobalLock(hGlobal));
|
||||
|
||||
|
@ -56,8 +56,8 @@ void QBspTree::create(int n, int d)
|
||||
}
|
||||
depth = qMax(depth, uint(1));
|
||||
|
||||
nodes.resize((1 << depth) - 1); // resize to number of nodes
|
||||
leaves.resize(1 << depth); // resize to number of leaves
|
||||
nodes.resize((1ll << depth) - 1); // resize to number of nodes
|
||||
leaves.resize(1ll << depth); // resize to number of leaves
|
||||
}
|
||||
|
||||
void QBspTree::destroy()
|
||||
|
@ -1272,7 +1272,8 @@ void QXmlInputSource::fetchData()
|
||||
if (!device) {
|
||||
if (d->inputStream && d->inputStream->string()) {
|
||||
QString *s = d->inputStream->string();
|
||||
rawData = QByteArray((const char *) s->constData(), s->size() * sizeof(QChar));
|
||||
rawData = QByteArray(reinterpret_cast<const char *>(s->constData()),
|
||||
int(s->size() * sizeof(QChar)));
|
||||
}
|
||||
} else if (device->isOpen() || device->open(QIODevice::ReadOnly)) {
|
||||
rawData.resize(BufferSize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user