QPROPERTY_TEST_COMPARISON_HELPER: don't write 1KiB of NULs
qsnprint() is unconditionally called to fill the buffer and is
guaranteed to NUL-terminate, so there's no point in filling the whole
1KiB stack buffer with NULs beforehand. Leave it uninitialized.
Amends 930e59b798.
Pick-to: 6.7 6.5 6.2
Change-Id: I7da859d609ad4492c9038cb3e14f2a721b2acbe4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 47c2263e896408e733c9aa466aec388cc4b4a6ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
bb10
parent
5797326b16
commit
6cda03c5d6
|
|
@ -45,7 +45,7 @@ namespace QTestPrivate {
|
|||
#define QPROPERTY_TEST_COMPARISON_HELPER(actual, expected, comparator, represent) \
|
||||
do { \
|
||||
const size_t maxMsgLen = 1024; \
|
||||
char msg[maxMsgLen] = { '\0' }; \
|
||||
char msg[maxMsgLen]; \
|
||||
auto actualStr = represent(actual); \
|
||||
auto expectedStr = represent(expected); \
|
||||
const size_t len1 = mbstowcs(nullptr, #actual, maxMsgLen); \
|
||||
|
|
|
|||
Loading…
Reference in New Issue