| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
Pointed out by Marc in code review.
Drive-by, use \c to markup ushort.
Pick-to: 6.10 6.8 6.5
Change-Id: I81e9997bd07d3c8e4093f42b3a9c2068d8ba4e6e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
| |
This de-duplicates the code.
Change-Id: Ia40131ccd0d45e32794ea059c8fe9e310df98812
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
| |
To ease using QStringAlgorithms mehtods in the next commit.
Change-Id: Ia523c0dcc818dac6c1a1e9eecab71134a227e04c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since 2024, the preferred upper-casing of ß in the German locale is ẞ,
not SS. See https://en.wikipedia.org/wiki/%C3%9F reference [5].
[5] https://www.rechtschreibrat.com/DOX/RfdR_Amtliches-Regelwerk_2024.pdf,
specifically §25 E3 on p.48 (German only).
Qt currently implements the old semantics, by following
Unicode. Document the work-around needed to get the new behavior.
Task-number: QTBUG-141534
Pick-to: 6.10 6.8 6.5
Change-Id: I0fe5c9d4f454f8e4dce84767deecdd9aa55bfab5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For years, I've been confused by the various foldCase() overloads,
until Clang 21 -Wcharacter-conversion now forced me down the rabbit
hole.
Turns out that there's just one user of the ch,ch& overload and it's
readily ported to the ch*,ch* overload, so do that and remove the
now-unused overload.
Amends the start of the public history.
Pick-to: 6.10 6.8 6.5
Change-Id: I8ddd22b08423540f58c1a5fe0ef36c93c8b337f1
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The only caller, ucstricmp(), passes UTF-16 code units, as implied by
the implementation of foldCase(char32_t, char32_t&) (which decodes
surrogate pairs, which shouldn't exist in UTF-32, and, if they do, not
be decoded). Of course, the accumulator variables were char32_t, but
only because C++ enforces this, due to the foldCase() signature.
Fix by taking both arguments as char16_t instead of char32_t.
As a drive-by, don't store the first argument in a char32_t and then
narrow it for the QChar::*surrogate*() calls, use the argument
instead.
Found by Clang 21's -Wcharacter-conversion.
Amends the start of the public history.
Pick-to: 6.10 6.8 6.5
Change-Id: Ic08b695749d7f68353a4af8703eb6a86ba88d567
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to support (unscoped) enums, the overload accepted everything
that implicitly converted to q(u)longlong. But like the reporter of
QTBUG-138471 found out, that incorrectly matches types that implicitly
convert to float. Those types used to call the FP-ish overload set in
6.8, but that one is now restricted to actual FP types (by way of
being a template constrained, essentially, on std::is_floating_point),
and a type that converts to float is not itself a floating-point
type. Unfortunately, the int-ish overload accepted the call,
truncating the float to an int for printing.
Fix by being more explicit in the arg(int-ish) constraint, saying
exactly what we want: integrals, enums, but not scoped ones, and
nothing that already matches the string-ish or FP-ish overloads.
[ChangeLog][Potentially Source-Incompatible Changes][QtCore][QString]
Fixed the integral arg() overload to reject types that merely
implicitly convert to an integral type. This was always the intent,
but 6.9 and 6.10.0 incorrectly accepted types that implicitly convert
to float to match this overload, causing truncated results. We now
reject such types. A backwards-compatible fix is to cast such types to
a C++ type whose displayed form matches your intent.
Amends 563ed822f867c6c3040956017d4ca7f3795f172c.
Fixes: QTBUG-138471
Pick-to: 6.10
Change-Id: I6f3b6b93c243df574b878794b6304109d28d58ff
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
... over Qt::Literals::StringLiterals.
The latter works, but is needlessly verbose. Since such code is
copy'n'pasted, use the preferred form everywhere, to avoid
proliferation.
The docs have been fixed to suggest the shortcut in a separate commit.
As a drive-by, move them to their preferred location, after the
QT_BEGIN_NAMESPACE, but only if they were far away to begin with.
Pick-to: 6.10 6.8 6.5
Change-Id: I0325f749f3b5a331d9c6af458a9bd3bb70d4aa3b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is in preparation for storing this information in a separate
array to save space by removing the many duplicates in there.
Pick to all active branches to have the same internal API going
forward, even if we don't pick the storage optimization back as far.
Qt 6.5 doesn't have QSpan, yet (not even as private API), but
returning a reference to const std::array<.,4> will be an adequate
replacement. To enable that without casting, convert `cases` from a C
array to a std::array. For some reason, this requires extra
parentheses, so add them.
Task-number: QTBUG-139427
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I5331fd6d71a6a447b0445d8235b5eb8e38178e2e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It makes no sense to have a negative length here, it most likely is a
result of a calculation error in user code.
Fix the issue by documenting the precondition and enforcing it in debug
builds with Q_PRE.
Remove the test data rows that were supposed to be fixed; now we assert
that `len` isn't negative.
QByteArray should behave the same, but due to historic/backwards
compatibility issues it treats a negative `len` as if it's `0`, i.e. it
inserts `after` at pos.
Pick-to: 6.10
Change-Id: I46ad5934412aeed86a94a3753c42bda262af1cf9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Coverity had an issue with how we called this function to get the next
character from a UTF-8 sequence. In particular, it complained about
passing the address of a char32_t object to fromUtf8(), which "treats
it as an array", as Coverity notes.
The C++ standard says this is fine¹, but callers of this function,
specifically, are almost by definition security-critical, so we
shouldn't leave Coverity issues unfixed in them.
The fix is to use an array of one element instead: char32_t[1].
We have already applied this fix in qstring.cpp
(4eb9e0d3eedfc1b6de968308167af01b19f6ffe7) and qurlrecode.cpp
(7a32a2238f52217bc4f0dc4c9620a2a2d350a1ca), but there are more cases
in QXmlStream and QStringConverter, some of which this patch fixes.
In order to simplify the task, package up the fix in a small function
for easier reuse and so that the proverbial maintenance programmer is
less likely to undo these fixes again. Incidentally, this function
makes those callers that can use it much more readable than before.
Many other calls (incl. the one in qurlrecode.cpp and some others in
qstringconverter.cpp) cannot be ported over, as they are using the
return value of fromUtf8(), or have already advanced the input pointer
themselves when they call fromUtf8().
Amends 94c62e322264e2e7d61193ae74ba8556a330385c,
ea0a08c898fed9cfd8d8eb16613e352740d3eb02 and
b977ae371a753a82e1d0bb32c5b62099da663721.
¹ https://eel.is/c++draft/basic.compound#3.sentence-11
Pick-to: 6.10 6.9 6.8
Coverity-Id: 378348
Coverity-Id: 403740
Coverity-Id: 403748
Coverity-Id: 459945
Change-Id: I4957ea2ee7b6e0e9c361eb2bcd4351708762a6e9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
| |
Pick-to: 6.10
Change-Id: Ib3e0cef69b215730b202d29d6b698489cda108f9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On GCC, this function is NRVO'd, but depending on the definition of
va_list, a compiler may be unable to NRVO this function, in which case
the const on 's' prevents the implicit return by move.
Found by Coverity.
Fix by dropping the const. It doesn't hurt readability in such a short
function, shuts up Coverity, and may improve codegen on some
platforms.
Amends d251cae7b7370af328307948aca9bb63def22fe4.
Coverity-Id: 474158
Pick-to: 6.10 6.9 6.8
Change-Id: I4f842f690ea45c8db4c02f32f858d2700f57d128
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In reallocData() and reallocGrowData(), when we create a completely
new QArrayDataPointer, we merely copy-assigned it to this->d in the
end. This needlessly ups and downs the atomic ref-count, so use a
swap() instead.
Found by Coverity, which wants us to use std::move(), but I believe
the QtCore maintainer would prefer the swap here, so use "C++98 move".
Amends
- 20041afe3bdb3d3476c02897b8da288cba6011f4 QByteArray::reallocData()
- 287ace562ee5ddff22f7dbf4e49ae5f0520f2308 QString::reallocData()
- 4b9ec005340ac0d8aa103009c0f8ceda623de8cc QByteArray::reallocGrowData()
- a2b1b0292d3d9909a690ba701f0a447cdf1a66fa QString::reallocGrowData()
Pick-to: 6.10 6.9 6.8
Coverity-Id: 425077
Coverity-Id: 425941
Coverity-Id: 426231
Coverity-Id: 427184
Change-Id: I037f38c6541068b91b55343a20f149a772ba79c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Error handling code has no business bloating Qt executable code size,
so take two more steps to reduce its impact, on top of the locking it
away in a Q_DECL_COLD_FUNCTION:
First, split the 'where' argument into 'class' and 'method', in order
to facilitate the reuse of the class strings across users.
Second, move the QRegularExpression::pattern() call into the warning
function, to centralize the temporary QString handling code.
Saves half a KiB in text size on optimized Clang 19 Linux AMD64 C++23
builds.
Pick-to: 6.10 6.9 6.8
Change-Id: I7fe23bdafc9f63d0d43b801e704866be9961648c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The type doesn't need to have constructors, certainly not a default
constructor that doesn't initialize the 'length' member (so that even
value-initialization leaves it uninit'ed).
Since we don't depend on C++20, yet, this requires the use of {}
instead of () for initialization.
As a drive-by, fix the errornous spaces inside QStringView{ *this }.
Lack of initialization pointed out by Coverity.
Amends d807a16e7f9555e02991fc86ac5085ebe0101ef3.
Coverity-Id: 54563
Pick-to: 6.10 6.9 6.8
Change-Id: I8111ab253934a74e5f466a0457a9f7f3fb1f2721
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was the whole point of making the arg() overloads templates, but
we didn't document it well enough, contributng to QTBUG-138471
This patch fixes this.
Amends 563ed822f867c6c3040956017d4ca7f3795f172c.
Task-number: QTBUG-138471
Pick-to: 6.10 6.9
Change-Id: I95e6866ca1a98d6191bc71a8a6ed88b81dc70192
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
| |
and mention it's since 6.8
Amends 21dfb0ebcc6b3a3408a8272ce536a1e4d53910cd
Pick-to: 6.10 6.9 6.8
Change-Id: If4e027678f64468072e379b7aca3f011bfc2ca42
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
From the API review:
«QBA is security-critical, so we shouldn't have too much stuff in the
header; and certainly not if it involves manipulation of the atomics»
Pick-to: 6.10
Change-Id: I314c6b09b6445901e92958b3db0fa51efd808eba
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
This section has very useful flowcharts. The question "Which string
class to use?" is exactly what most users will want the answer to when
faced with all of the different string types we provide.
Task-number: QTBUG-135947
Change-Id: I2ae79803e205693d6c7ee8f50cad5d057c4d24ea
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
These classes are usually the first line of defense, containing
tainted data before anything else had the chance the verify it.
Amends 8df072fc8006510c9b743e8ffedaaf51a876883a.
QUIP: 23
Task-number: QTBUG-135195
Pick-to: 6.9 6.8
Change-Id: I91413e022b9794e21b6816b80962f5169ce8cd78
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
|
| |
|
|
|
|
|
| |
The attribute must appear before the modifiers like 'inline' and 'constexpr'.
Change-Id: If3d143fc2f85a8eba6e3ac2ceca10720649f33cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The old code used a `<QString>` to indicate an object of QString
type. I have not seen this pattern used elsewhere, so rewrite the
expression to say "call X on the QString" instead of "call
<QString>.X".
Also, the constData() link in the expression ('X' in the previous
paragraph) was unqualified, so resolved to QString::constData(), but
the result of toLocal8Bit() is a QByteArray, and it's thence the link
should point to. Redirect it manually whereever we fell into that
trap.
Amends the start of the public history.
Pick-to: 6.9 6.8 6.5 5.15
Change-Id: I2204522351976be0f045bfd60a30c82c9e784dd6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Assuming QString has seen a lot more effort put into this, simply copy
the preamble of QString::replace(ptr, n, ptr, n, cs) over to the
corresponding QByteArray::replace(view, view) function, so they behave
the same.
On reviewer request, change d.size == 0 to isEmpty(), in both functions'
preambles.
[ChangeLog][QtCore][Important Behavior Changes][QByteArray] replace()
is now consistent with QString::replace() in its treatment of empty
haystacks and needles.
Fixes: QTBUG-134079
Change-Id: I2366febee7de4646d6b33c39d2338760b58f2ec4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 315210de916d060c044c01e53ff249d676122b1b.
The change was not correct. If the newly-inserted reserve() call
actually grows the string, and `after` aliased a part of the old
string, it will now reference deleted data, as the q_points_into_range
check now comes too late.
Change-Id: I2e016b8b90f74126dfc7126800b7b7fde96a091e
Pick-to: 6.9 6.8 6.7
Task-number: QTBUG-127549
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Coverity has this checker where it complains if you use a T as a
T[1]. The C++ standard says this is fine¹, but qstring.cpp,
specifically, is security-critical, so we shouldn't leave Coverity
issues unfixed in there.
So replace uc1 with a decoded[1] array and make both output and uc1
point to decoded's first (and only) element.
Amends 45838673df6e64a6fd42570c4e8874c5181f7717.
¹ https://eel.is/c++draft/basic.compound#3.sentence-11
Pick-to: 6.9 6.8 6.5
Coverity-Id: 378348
Change-Id: Ib149386defd8b263df522a4f12b1af1b3fc1a20c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Several \fn signatures were either incorrect or missing qualifiers
required to make QDoc match the documentation with the declarations.
These were not caught in the CI when testing documentation builds due
to a bug in QDoc.
Pick-to: 6.9
Task-number: QTBUG-134250
Change-Id: I7a4af11d9bc3687597b348cc2d4ee15212e0281f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have divergence in the way we document function, operator and
constructor constraints. About half use \note, while the other
doesn't. Some say "if and only if" while others say just "participates
only if".
So add a qdoc macro, \constraints, to semantically mark up these
constraints. It expands to a section titled `Constraints`, and
uses a predefined sentence (prefix) for constraints.
Documentation for constraints is moved to the end of the comment
blocks to separate them from the rest of the text.
Apply them to all the standard-ish constraint documentation blocks
(grepped for "participate"). I didn't look for other, one-off, ways
documentation authors may have documented constraints, but I'm also
not aware of any.
Re-wrap lines only if the result fits into a single line.
As a drive-by, drop additional "if"s, as in "only if X and -if- Y" to
make the texts work with the `Constraints` section.
Fixes: QTBUG-106871
Pick-to: 6.9 6.8 6.5
Change-Id: I18c2f9f734474017264e49165389f8c9c7f34030
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
|
| |
|
|
|
|
|
|
| |
It should be spelled UTF-8 (official name by the Unicode Consortium).
Pick-to: 6.9 6.8
Change-Id: Ib358d0870e77f0cb4cdb920ed5ca829f100707a1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
We can simply write the UTF-8 string into the std::string buffer,
bypassing our temporary. And when Qt is compiled with C++23, we even get
resize_and_overwrite() support, removing the unnecessary memset() -
though the compiler might have been smart enough to suppress it (GCC and
Clang currently aren't that smart; in fact, GCC even generates code to
deal with a default-constructed std::string not being empty).
Change-Id: I3883268b30a9065757dcfffd6da4705a4aa44d7a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The file is actually in src/corelib/text, and the majority
of the implementation is in the header file.
In any case, I don't think mentioning the name here is good
practice. Those who are a bit into Qt probably can find the
implementation quite easily themselves.
Change-Id: I7c7f0d655b55b509a830e92a02940f7b91df2dea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: hjk <hjk@qt.io>
|
| |
|
|
|
|
|
|
| |
And make it and the QByteArray equivalent use the QArrayDataPointer
function of the same name, which hides the const_cast.
Change-Id: I15d7b43afb6269eba411fffd496bca3f13e86a8e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
And I've updated the documentation to use char16_t too, making this the
primary (recommended) overload over the QChar one.
[ChangeLog][QtCore][QString] Added fromRawData() overload taking
char16_t* (was: only QChar*).
Change-Id: Iad8dd905a494706d72c4fffd40ded1cbf7122597
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
qdoc tries to auto-link text written like a function call. Since there
isn't a terminated() function to link to, we ended up with unlinked
text, so we just remove the parentheses.
Amends 3b95bfe7c7b918bfececd9734780aa9e2f91ec02.
Pick-to: 6.9
Change-Id: I83bd19973aea939b51a512ca65ba7ae4ad8c34ed
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
|
| |
|
|
|
|
|
|
| |
Functions in 6.10 were incorrectly marked as \since 6.9. This was
noticed when automatic cherry-picking of a documentation change failed.
Change-Id: Idc6fe958cd1f4dfed6252e2b1fce6c8fea4d77fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
| |
Pick-to: 6.9
Change-Id: I89498714daae5415fa595f0216dd888f4c6b9d33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As requested in code review.
utf16() guarantees that the string will always be \0-terminated which
could mean allocating behind the scenes. On the other hand
nullTerminate{,d}() makes it obvious that the data may be deep-copied.
For QByteArray, this partially reverts
e0206fe9d47bfbf18a0d4c2e5e780504305f72e7. Adding the same method to
QByteArray was requested in code review for API symmetry.
[ChangeLog][QtCore][QString] Added nullTerminate() and nullTerminated()
methods (like chop() and chopped()), which are useful for strings
constructed with fromRawData() when calling methods that expect
\0-terminated strings.
[ChangeLog][QtCore][QByteArray] Added nullTerminate() and
nullTerminated() methods, which are useful for byte arrays constructed
with fromRawData() when calling methods that expect \0-terminated data.
Change-Id: Iec33b889a9ab62460b7a0df8f9b2189f3f794a54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a first step for adding QT_NO_INTEGRAL_STRINGS in the next
commit.
Mark setUtf16(const ushort *) as obsolete.
Use the weak overload workaround, so that the call isn't ambiguous if
it's called on a nullptr.
[ChangeLog][QtCore][QString] Added setUtf16(const char16_t *) and
setUnicode(const char16_t *) overloads.
Pick-to: 6.9
Task-number: QTBUG-125871
Change-Id: I25d12c19876466c235c0d9928aae6fd332836bf5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
So it's less ambiguous in case there's a comma in either the pattern
string or the replacement one. It will still be ambiguous for strings
with quotes themselves, but escaping requires content not present in the
bootstrap library.
Drive-by test that unsigned and floating point also complain.
Pick-to: 6.9
Change-Id: Ia8ca184a7d54b240d653fffd631dbcb7f9e1c97d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
|
| |
|
|
|
|
|
|
|
| |
And fix some compilation bugs if QT_NO_DEBUG_STREAM is defined.
Drive-by fix the grammar in the qcommandlineparser.cpp qWarning().
Change-Id: Ia9287ea189ae4a4b7545fffdbff7dbb9196de519
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
|
| |
|
|
|
|
| |
Pick-to: 6.8 6.9
Change-Id: Ief8a9c429b5cdf424e0c3a57d15b1fcb4fdc963c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
... when the user passes size = -1. std::char_traits<char32_t>::length()
doesn't appear to be an any better implementation than our simple loop,
but maybe some compiler will optimize it.
wcslen() is usually optimized in the C libraries, even for Unix
platforms that hardly ever use it (it's used as a fallback in qustrlen()
for non-x86 Windows systems).
Pick-to: 6.8 6.9
Change-Id: Ia143270869a3a7cf5754fffdc17e500fc454397b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
They are now the same, but the name UTF-32 is preferred over UCS-4.
The original ISO-10646 UCS-4 encoding was allowed to use all 31-bit code
units, from 0 to 0x7FFFFFFF[1] including those above 0x10FFFF, which
correspond to UTF-8's five- and six-byte sequences. Unicode doesn't
allow that and restricts the UTF to the range possible in UTF-16.
Renaming the functions is left as an exercise for the reader.
[1] https://en.wikipedia.org/wiki/UTF-32#History
Pick-to: 6.8 6.9
Change-Id: I2f29db62b974cb689585fffd9a6434ae252a7651
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
UTF-8 ones)
This is the public API for the functionality already implemented in
pt.1 of this patch series (except the replacement of the remaining
Q_UNREACHABLE).
I opted to do the minimal change to enable this important
functionality: the ArgBase hierarchy stays and gets extended a bit
differently than originally envisioned. ArgBase, of course, is just
yet another QAnyStringView re-implementation, so eventually, this will
go. But the churn to do this in a binary-compatible way would just be
too big. Instead of the U8 tag representing UTF-8 arguments, repurpose
this up-to-now unused tag to mean QAnyStringView. This allows to get
rid of the qStringLikeToArg() overloads, leaving only one accepting
QAnyStringView. This is the only one that new code will ever call. But
we still need to support L1 and U16 ArgBases for old code.
[ChangeLog][QtCore][QString/QStringView/QAnyStringView] Added
(multi-)arg() support for UTF-8 (QUtf8StringView) and QAnyStringView
arguments. Passing C string literals or QByteArrays to arg() now no
longer implicitly converts to QString first.
Fixes: QTBUG-124365
Change-Id: I0d710365a45d2c62af26184e8a857c3f4cdeeae2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before porting multi-arg() to QAnyStringView, first port the unary
arg() overloads for symmetry reasons (unlike the views, multi-arg() on
QString is only considered for more than one argument().
This causes tension with the other arg() overloads, so finally make
the overload set a sane one by using constrained templates instead of
overloaded regular functions. This also solves the following problems:
- that char16_t and char8_t didn't match the char-ish overloads, but
the integer-ish ones,
- that arg('a') matched the char overload (and therefore printed a
character 'a') while arg('a', 2, 16) was ambiguous and arg('a', 2,
16, QChar('0')) called the integral overload, printing the numeric
value instead,
- that arg(qfloat16) was ambiguous when QFLOAT16_IS_NATIVE
- that using u' ' as `fillChar` sometimes caused ambiguities (and you
had to use ' '_L1 instead).
Needed to explicitly exclude wchar_t from the is_string_like arg()
overload, to at least keep existing behavior and not make matters
worse by treating wchar_t as a string-like on Windows and as
integer-like on Unix :( We'll hopefully still fix QTBUG-126054 before
this is relased.
[ChangeLog][QtCore][Potentially Source-Incompatible Changes] The
QString::arg() overloads have been redesigned. Character-like types
(char, char16_t, char8_t, wchar_t (still subject to QTBUG-126054 at
the time of writing), char32_t) now always output the character, not
its numeric value. In particular, char16_t and char arguments now
match the string-ish arg() overload (and therefore don't provide a
`base` argument anymore. A backwards-compatible fix is to cast char,
char16_t, and wchar_t arguments to uint. This also fixes the ambiguity
errors you may have seen when using a char16_t as `fillChar`.
[ChangeLog][QtCore][QString] Unary arg() now accepts QAnyStringView
(incl. QUtf8StringView).
Fixes: QTBUG-125588
Fixes: QTBUG-126053
Fixes: QTBUG-126055
Task-number: QTBUG-126054
Change-Id: If0bfd92e15952738f3870a540f52a7cc470b047f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
|
| |
|
|
|
|
|
|
|
| |
The snippet referred to had a duplicate identifier to an earlier snippet
in the snippet file, causing that one to be quoted instead.
Change-Id: Id46f6da807806f874291cd5d4c25b8884e511cfc
Pick-to: 6.8
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
Other functions that creates QString instances from buffers document
that the size argument represents the number of characters to copy. This
patch adds this statement to QString::fromWCharArray too, but makes it
explicit that the size represents the number of code units.
Pick-to: 6.8
Change-Id: If3c0ebe299281a3c0ffc2d9e609b89df2578811d
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the visitation of the QAnyStringView pattern from argToQString()
to parseMultiArgFormatString(). The latter is the only part of the
former that depends on the type (L1, U8, U16) of the pattern, the rest
is independent. By retaining the QAnyStringView as a variant for
longer, we share the post-processing steps previously duplicated for
each view type.
Amends a193d5c30347d4f9e2cb4caf2bded10f93a54406, but the duplication
existed since 35431062bd7bf0d27b9bf785ab3cbc7fac5a69da (Qt 5).
Task-number: QTBUG-124365
Change-Id: I8c346da45d72aeda92d18c6afa2236b62b842cc2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have some patterns for how to document certain functions, but we
also vary the sentences a lot, and you have to look up one
documentation piece and copy it, essentially. If we ever want to
change them, we end up with shotgun surgery.
So apply DRY to the documentation and start a collection of macros to
help with repetitive C++ class documentation tasks.
The first macro is for member-swap(), and the first patch is for
documentation that used the traditional phrasing ("Swaps the X \a
other with this X.").
This doesn't change the documentation, except as follows:
* adds the "very fast and never fails" blurb, if it was missing
* changes the function's argument name to `other`, as required by
the macro.
Task-number: QTBUG-129573
Pick-to: 6.8 6.7 6.5 6.2
Change-Id: Ib494bd218334724b3b43796ba6f71fb52b83aa94
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
The implementation of the pattern parser was already a template, and
the escape sequences are US-ASCII, so we can just reuse the
implementation 1:1. Just need to call it from QAnyStringView::visit().
Task-number: QTBUG-124365
Change-Id: Ifd7b7b73429ab04a13b9ee69e93763a995b1728b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|