mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 15:01:16 -03:00
Fix and add tests for format_long_safe with negative numbers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user