aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-01-18 16:03:21 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-01-18 16:03:21 -0800
commit68efa5233c3fb338a52c38730a04d0da1c50ff30 (patch)
treee438b29438e8dd05a69190536f6d972ea374cd10 /common.cpp
parentdce487380c771da7a9507549baf6fde496d14d57 (diff)
Fix and add tests for format_long_safe with negative numbers
Diffstat (limited to 'common.cpp')
-rw-r--r--common.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/common.cpp b/common.cpp
index c6fa9129..3440f075 100644
--- a/common.cpp
+++ b/common.cpp
@@ -806,10 +806,9 @@ void format_long_safe(wchar_t buff[64], long val)
size_t idx = 0;
bool negative = (val < 0);
- while (val > 0)
+ while (val != 0)
{
long rem = val % 10;
- /* Here we're assuming that wide character digits are contiguous - is that a correct assumption? */
buff[idx++] = L'0' + (wchar_t)(rem < 0 ? -rem : rem);
val /= 10;
}