diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2024-03-16 19:05:22 +0300 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-03-17 12:11:59 +0900 |
commit | 336e61b2302bd34e0e80af1bb38533d4f1a912ba (patch) | |
tree | a6b8d59c991849e62598226e7c38b2d80f1f20bc | |
parent | 4bed6be8623bd95cee11fc9ea758db70a7ca1789 (diff) | |
download | tqt3-336e61b2302bd34e0e80af1bb38533d4f1a912ba.tar.gz tqt3-336e61b2302bd34e0e80af1bb38533d4f1a912ba.zip |
Fix TQString::sprintf() not calling va_end() in case of bad cformat
Also rearrange code a bit so it would be obvious that the function
doesn't return a dangling reference.
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
(cherry picked from commit bcda4011918a88064d35908b089a3300e187245a)
-rw-r--r-- | src/tools/qstring.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tools/qstring.cpp b/src/tools/qstring.cpp index e12c2344..a7256e35 100644 --- a/src/tools/qstring.cpp +++ b/src/tools/qstring.cpp @@ -2622,13 +2622,12 @@ TQString &TQString::sprintf(const char *cformat, ...) if ( !cformat || !*cformat ) { // TQt 1.x compat *this = fromLatin1( "" ); - return *this; + } else { + vsprintf(cformat, ap); } - TQString &s = vsprintf(cformat, ap); - va_end(ap); - return s; + return *this; } TQString &TQString::vsprintf( const char* cformat, va_list ap ) |