In qlltoa we simply discarded sign, passing absolute value down to
qulltoa; given that it had just one caller and did something only that
caller is apt to want - violating the principle of least surprise for
those who would expect it to handle sign sanely - it is better to just
inline it in the one place it was used.
That one place, QLocaleData::longLongToString(), handles sign
separately and (for reasons I shall argue elsewhere are bogus) ignores
sign for bases other than ten. When ignoring sign, it passes negative
values directly to qulltoa, which caught the attention of Coverity
(CID 22326). This deliberately cast (for the same bogus reasons)
negatives to large unsigned. Inlining base ten's call to qlltoa() as
a call to qulltoa() could now be unified into a simple (and less
obviously perverse) form. Making the (contentious) cast explicit can
then calm Coverity and we get a simpler implementation all round.
Incorporate also Marc Mutz's fix for unary minus applied to unsigned
and handling of the most negative value, suitably adapted.
Change-Id: Iea02500a5dd7c6d7ac6e73656e1b11f116ae85c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>