Correct compiler warnings for sign conversion

qstrlen() returns a uint. When assigned to an int, the compiler warns
about sign conversions. Because these calls are used within templates,
the code appears in user generated code, and hence the warnings cannot
be suppressed by the -isystem directive. Using the -Werror flag, makes
the user code fail.

[ChangeLog][QtCore] Fixed sign conversion warnings in code using QMetaTypeId.

Change-Id: Ib7603679d6526467f8cbb9d7bcf5f56c6af47ceb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Kurt Pattyn 2013-11-24 14:00:19 +01:00 committed by The Qt Project
parent 03affacaa3
commit 862e11cd19

View File

@ -1741,7 +1741,7 @@ struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \
return id; \
const char *tName = QMetaType::typeName(qMetaTypeId<T>()); \
Q_ASSERT(tName); \
const int tNameLen = qstrlen(tName); \
const int tNameLen = int(qstrlen(tName)); \
QByteArray typeName; \
typeName.reserve(int(sizeof(#SINGLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + 1); \
typeName.append(#SINGLE_ARG_TEMPLATE, int(sizeof(#SINGLE_ARG_TEMPLATE)) - 1) \
@ -1782,8 +1782,8 @@ struct QMetaTypeId< DOUBLE_ARG_TEMPLATE<T, U> > \
const char *uName = QMetaType::typeName(qMetaTypeId<U>()); \
Q_ASSERT(tName); \
Q_ASSERT(uName); \
const int tNameLen = qstrlen(tName); \
const int uNameLen = qstrlen(uName); \
const int tNameLen = int(qstrlen(tName)); \
const int uNameLen = int(qstrlen(uName)); \
QByteArray typeName; \
typeName.reserve(int(sizeof(#DOUBLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + uNameLen + 1 + 1); \
typeName.append(#DOUBLE_ARG_TEMPLATE, int(sizeof(#DOUBLE_ARG_TEMPLATE)) - 1) \