Fix -Wformat issues in our headers
Before we add __attribute__((format(printf))) to qsnprintf(), we need to make sure our code is clean. Pick-to: 6.7 6.5 6.2 5.15 Task-number: QTBUG-127110 Change-Id: I7411ff0036482ad68bd5867b624518f68f249229 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 63295f43e70955a194602a7acf39013f124e14b7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d520bfe803
commit
e4a03a4001
@ -56,8 +56,9 @@ bool _q_compareSequence(ActualIterator actualIt, ActualIterator actualEnd,
|
|||||||
|
|
||||||
if (!isOk) {
|
if (!isOk) {
|
||||||
qsnprintf(msg, sizeof(msg), "Compared lists have different sizes.\n"
|
qsnprintf(msg, sizeof(msg), "Compared lists have different sizes.\n"
|
||||||
" Actual (%s) size: %zd\n"
|
" Actual (%s) size: %lld\n"
|
||||||
" Expected (%s) size: %zd", actual, actualSize,
|
" Expected (%s) size: %lld",
|
||||||
|
actual, qlonglong(actualSize),
|
||||||
expected, expectedSize);
|
expected, expectedSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,9 +68,10 @@ bool _q_compareSequence(ActualIterator actualIt, ActualIterator actualEnd,
|
|||||||
char *val1 = toString(*actualIt);
|
char *val1 = toString(*actualIt);
|
||||||
char *val2 = toString(*expectedIt);
|
char *val2 = toString(*expectedIt);
|
||||||
|
|
||||||
qsnprintf(msg, sizeof(msg), "Compared lists differ at index %zd.\n"
|
qsnprintf(msg, sizeof(msg), "Compared lists differ at index %lld.\n"
|
||||||
" Actual (%s): %s\n"
|
" Actual (%s): %s\n"
|
||||||
" Expected (%s): %s", i, actual, val1 ? val1 : "<null>",
|
" Expected (%s): %s",
|
||||||
|
qlonglong(i), actual, val1 ? val1 : "<null>",
|
||||||
expected, val2 ? val2 : "<null>");
|
expected, val2 ? val2 : "<null>");
|
||||||
isOk = false;
|
isOk = false;
|
||||||
|
|
||||||
|
@ -206,7 +206,9 @@ template<> inline char *toString(const QChar &c)
|
|||||||
template<> inline char *toString(const QModelIndex &idx)
|
template<> inline char *toString(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
char msg[128];
|
char msg[128];
|
||||||
qsnprintf(msg, sizeof(msg), "QModelIndex(%d,%d,%p,%p)", idx.row(), idx.column(), idx.internalPointer(), idx.model());
|
qsnprintf(msg, sizeof(msg), "QModelIndex(%d,%d,%p,%p)",
|
||||||
|
idx.row(), idx.column(), idx.internalPointer(),
|
||||||
|
static_cast<const void*>(idx.model()));
|
||||||
return qstrdup(msg);
|
return qstrdup(msg);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -319,7 +321,8 @@ struct QCborValueFormatter
|
|||||||
{
|
{
|
||||||
QScopedArrayPointer<char> hold(format(taggedValue));
|
QScopedArrayPointer<char> hold(format(taggedValue));
|
||||||
char *buf = new char[BufferLen];
|
char *buf = new char[BufferLen];
|
||||||
qsnprintf(buf, BufferLen, "QCborValue(QCborTag(%llu), %s)", tag, hold.get());
|
qsnprintf(buf, BufferLen, "QCborValue(QCborTag(%llu), %s)",
|
||||||
|
qToUnderlying(tag), hold.get());
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user