forked from qt-creator/qt-creator
tst_QtcProcess: Use snprintf instead of sprintf
This fixes the following warning: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. Change-Id: Ic8eac91b02cb60122f603506e083dbdf9eca8712 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -698,11 +698,11 @@ void tst_QtcProcess::expandMacros_data()
|
|||||||
title = vals[i].in;
|
title = vals[i].in;
|
||||||
} else {
|
} else {
|
||||||
char buf[80];
|
char buf[80];
|
||||||
sprintf(buf, "%s: %s", title, vals[i].in);
|
snprintf(buf, 80, "%s: %s", title, vals[i].in);
|
||||||
QTest::newRow(buf) << QString::fromLatin1(vals[i].in)
|
QTest::newRow(buf) << QString::fromLatin1(vals[i].in)
|
||||||
<< QString::fromLatin1(vals[i].out)
|
<< QString::fromLatin1(vals[i].out)
|
||||||
<< vals[i].os;
|
<< vals[i].os;
|
||||||
sprintf(buf, "padded %s: %s", title, vals[i].in);
|
snprintf(buf, 80, "padded %s: %s", title, vals[i].in);
|
||||||
QTest::newRow(buf) << QString(sp + QString::fromLatin1(vals[i].in) + sp)
|
QTest::newRow(buf) << QString(sp + QString::fromLatin1(vals[i].in) + sp)
|
||||||
<< QString(sp + QString::fromLatin1(vals[i].out) + sp)
|
<< QString(sp + QString::fromLatin1(vals[i].out) + sp)
|
||||||
<< vals[i].os;
|
<< vals[i].os;
|
||||||
|
Reference in New Issue
Block a user