diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-07-20 09:27:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-20 09:27:14 +0200 |
commit | 9e9ce6a4e34f4256a68527b7b0c4aa7a9fc53cc5 (patch) | |
tree | edc0dafdf7d143a074b43561babf62437b9281bc /lib/system/widestrs.nim | |
parent | 850b908f150ac7c6053f67cc2d8480cd9e42d56b (diff) | |
parent | 46dad3cb6be73222425dea914864beefcf0b0a4a (diff) | |
download | Nim-9e9ce6a4e34f4256a68527b7b0c4aa7a9fc53cc5.tar.gz |
Merge pull request #4500 from nigredo-tori/fix-osproc-env
Fix passing environment in startProcess (win)
Diffstat (limited to 'lib/system/widestrs.nim')
-rw-r--r-- | lib/system/widestrs.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/system/widestrs.nim b/lib/system/widestrs.nim index 6ad0cfd58..578bebe80 100644 --- a/lib/system/widestrs.nim +++ b/lib/system/widestrs.nim @@ -73,11 +73,11 @@ template fastRuneAt(s: cstring, i: int, result: expr, doInc = true) = result = 0xFFFD when doInc: inc(i) -iterator runes(s: cstring): int = +iterator runes(s: cstring, L: int): int = var i = 0 result: int - while s[i] != '\0': + while i < L: fastRuneAt(s, i, result, true) yield result @@ -85,7 +85,7 @@ proc newWideCString*(source: cstring, L: int): WideCString = unsafeNew(result, L * 4 + 2) #result = cast[wideCString](alloc(L * 4 + 2)) var d = 0 - for ch in runes(source): + for ch in runes(source, L): if ch <=% UNI_MAX_BMP: if ch >=% UNI_SUR_HIGH_START and ch <=% UNI_SUR_LOW_END: result[d] = UNI_REPLACEMENT_CHAR |