summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/sysio.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim
index 7918569e1..edf3d347a 100644
--- a/lib/system/sysio.nim
+++ b/lib/system/sysio.nim
@@ -38,7 +38,6 @@ proc fseek(f: File, offset: clong, whence: int): int {.
   importc: "fseek", header: "<stdio.h>", tags: [].}
 proc ftell(f: File): int {.importc: "ftell", header: "<stdio.h>", tags: [].}
 proc ferror(f: File): int {.importc: "ferror", header: "<stdio.h>", tags: [].}
-proc feof(f: File): int {.importc: "feof", header: "<stdio.h>", tags: [].}
 proc setvbuf(stream: File, buf: pointer, typ, size: cint): cint {.
   importc, header: "<stdio.h>", tags: [].}
 proc memchr(s: pointer, c: cint, n: csize): pointer {.
@@ -153,11 +152,11 @@ proc readAllFile(file: File, len: int): string =
   let bytes = readBuffer(file, addr(result[0]), len)
   if endOfFile(file):
     if bytes < len:
-      result = substr(result, 0 , bytes - 1)
+      result.setLen(bytes)
   elif fileError(file):
     raiseEIO("error while reading from file")
   else:
-    # We red all the bytes but did not reach the EOF
+    # We read all the bytes but did not reach the EOF
     # Try to read it as a buffer
     result = readAllBuffer(file)
 
>126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168