diff options
author | def <dennis@felsin9.de> | 2015-02-18 21:13:01 +0100 |
---|---|---|
committer | def <dennis@felsin9.de> | 2015-02-18 21:13:01 +0100 |
commit | ecfaab68f176651e2b836423cdc5682046bbd409 (patch) | |
tree | e591ee144ac050ddb6cd1844d073e9fcf7d57076 /lib/system/sysio.nim | |
parent | 358d4b958c46fdc740be647ee27ecdbba15597f3 (diff) | |
download | Nim-ecfaab68f176651e2b836423cdc5682046bbd409.tar.gz |
Make readBytes and writeBytes work with uint8
So far only openarray[int8] worked. Now it's openarray[int8|uint8]. This should make sense, since uint8 is comfortable to represent a byte (0-255) and there is already type byte* = uint8 in system.
Diffstat (limited to 'lib/system/sysio.nim')
-rw-r--r-- | lib/system/sysio.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim index aed17de80..5d68d112e 100644 --- a/lib/system/sysio.nim +++ b/lib/system/sysio.nim @@ -246,14 +246,14 @@ proc fwrite(buf: pointer, size, n: int, f: File): int {. proc readBuffer(f: File, buffer: pointer, len: int): int = result = fread(buffer, 1, len, f) -proc readBytes(f: File, a: var openArray[int8], start, len: int): int = +proc readBytes(f: File, a: var openArray[int8|uint8], start, len: int): int = result = readBuffer(f, addr(a[start]), len) proc readChars(f: File, a: var openArray[char], start, len: int): int = result = readBuffer(f, addr(a[start]), len) {.push stackTrace:off, profiler:off.} -proc writeBytes(f: File, a: openArray[int8], start, len: int): int = +proc writeBytes(f: File, a: openArray[int8|uint8], start, len: int): int = var x = cast[ptr array[0..1000_000_000, int8]](a) result = writeBuffer(f, addr(x[start]), len) proc writeChars(f: File, a: openArray[char], start, len: int): int = |