From d0c7f718ca9b50c37a3b47acdc43992d568b19eb Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 2 Aug 2021 17:50:03 +0200 Subject: [PATCH] replaceArgEscapes(): rework nested conditional to avoid repetition Change-Id: I42306cb38d745bde33b93d3f66e86f19f58a868a Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/corelib/text/qstring.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index e9b132f8e2..ab8c32464b 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -7800,10 +7800,11 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp ++c; int escape = c->digitValue(); - if (escape != -1) { - if (c + 1 != uc_end && (c + 1)->digitValue() != -1) { - escape = (10 * escape) + (c + 1)->digitValue(); + if (escape != -1 && c + 1 != uc_end) { + int digit = c[1].digitValue(); + if (digit != -1) { ++c; + escape = 10 * escape + digit; } }