the compiler does not rely on the zero terminator anymore

This commit is contained in:
Andreas Rumpf 2018-04-29 01:09:05 +02:00
commit 7e0540ed80
3 changed files with 13 additions and 14 deletions

View file

@ -251,7 +251,7 @@ proc `%`*(frmt: FormatStr, args: openArray[Rope]): Rope =
while true:
j = j * 10 + ord(frmt[i]) - ord('0')
inc(i)
if frmt[i] notin {'0'..'9'}: break
if i >= frmt.len or frmt[i] notin {'0'..'9'}: break
num = j
if j > high(args) + 1:
errorHandler(rInvalidFormatStr, $(j))