breaking change: arrays of char do not convert to cstring; ptr to array of char does

This commit is contained in:
Andreas Rumpf 2017-10-10 00:17:20 +02:00
commit 3308d26581
12 changed files with 73 additions and 36 deletions

View file

@ -1890,11 +1890,17 @@ proc formatBiggestFloat*(f: BiggestFloat, format: FloatFormatMode = ffDefault,
frmtstr[3] = '*'
frmtstr[4] = floatFormatToChar[format]
frmtstr[5] = '\0'
L = c_sprintf(buf, frmtstr, precision, f)
when defined(nimNoArrayToCstringConversion):
L = c_sprintf(addr buf, addr frmtstr, precision, f)
else:
L = c_sprintf(buf, frmtstr, precision, f)
else:
frmtstr[1] = floatFormatToChar[format]
frmtstr[2] = '\0'
L = c_sprintf(buf, frmtstr, f)
when defined(nimNoArrayToCstringConversion):
L = c_sprintf(addr buf, addr frmtstr, f)
else:
L = c_sprintf(buf, frmtstr, f)
result = newString(L)
for i in 0 ..< L:
# Depending on the locale either dot or comma is produced,