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 bcda401191)
r14.1.x
Alexander Golubev 2 months ago committed by Michele Calgaro
parent 4bed6be862
commit 336e61b230
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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 )

Loading…
Cancel
Save