From ab0158474b94ea6a86a448ade5f8a33816553393 Mon Sep 17 00:00:00 2001 From: Isak Fyksen Date: Tue, 27 Feb 2024 13:06:15 +0100 Subject: [PATCH] Fix conversion warnings in tst_qstring Change type of variables `int` -> `size_t`, to match assigned value. Fixes: QTBUG-122300 Change-Id: I5b99bd6a3b307ba2ec4ef79bcc517da60ae36413 Reviewed-by: Matthias Rauter --- tests/auto/corelib/text/qstring/tst_qstring.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 51159b51fb..14447d6798 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -1289,7 +1289,7 @@ void tst_QString::constructor() { // String literal with explicit \0 character static constexpr char16_t utf16[] = u"String DX\u0000"; - const int size_minus_null_terminator = std::size(utf16) - 1; + const size_t size_minus_null_terminator = std::size(utf16) - 1; const auto *qchar = reinterpret_cast(utf16); // Up to but not including the explicit \0 in utf16[] @@ -3481,7 +3481,7 @@ void tst_QString::append_special_cases() { { static constexpr char16_t utf16[] = u"Hello, World!"; - constexpr int len = std::char_traits::length(utf16); + constexpr size_t len = std::char_traits::length(utf16); const auto *unicode = reinterpret_cast(utf16); QString a; a.append(unicode, len); @@ -5951,7 +5951,7 @@ void tst_QString::toStdString() // For now, most QString constructors are also broken with respect // to embedded null characters, had to find one that works... const char16_t utf16[] = u"Embedded\0null\0character!"; - const int size = std::size(utf16) - 1; // - 1, null terminator of the string literal + const size_t size = std::size(utf16) - 1; // - 1, null terminator of the string literal QString qtnull(reinterpret_cast(utf16), size); std::string stdnull = qtnull.toStdString();