Negating a negative value may attempt to negate the minimal value for the signed type, whose only set bit is its sign; this is UB. So don't do that. Since the non-decimal branch of the code just prepends locale.negativeSign(), and we're passing -1 as width parameter to the QLocalePrivate formatters (so there's no zero-padding, whose size would be reduced to make space for a sign), we can treat decimal the same as all other bases. This, furthermore, simplifies the code. In the process, I noticed (because a test only done for decimal failed) that if QTextStream::ForceSign is set, this code-path for negatives would prepend the minus sign before a plus sign supplied by QLocaleData. Skip the flag to include sign, for negative input, since we'll be including a negative sign anyway. Remove the QEXPECT_FAIL() from the test I've added for this in a preparatory commit. Purge one now-redundant comment and revise some others. Expand on why we need to hack octal zero to display two zeros. Add a second test row to keep the lonely zero-row company in the test for that. Fixes: QTBUG-133269 Pick-to: 6.9 6.8 6.5 5.15 Change-Id: I35c9bdf34b812cff578de9b0a2570a60e6145c80 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
…
…
Description
Languages
C++
84.3%
HTML
4.9%
C
3.9%
CMake
3.6%
Objective-C++
2%
Other
0.8%