Fix English spelling for `readed` variable. (#534)
This commit is contained in:
parent
bd7d84fbcb
commit
7a3eaffa4f
|
@ -317,7 +317,7 @@ proc readExactly*(rstream: AsyncStreamReader, pbytes: pointer,
|
||||||
## Read exactly ``nbytes`` bytes from read-only stream ``rstream`` and store
|
## Read exactly ``nbytes`` bytes from read-only stream ``rstream`` and store
|
||||||
## it to ``pbytes``.
|
## it to ``pbytes``.
|
||||||
##
|
##
|
||||||
## If EOF is received and ``nbytes`` is not yet readed, the procedure
|
## If EOF is received and ``nbytes`` is not yet read, the procedure
|
||||||
## will raise ``AsyncStreamIncompleteError``.
|
## will raise ``AsyncStreamIncompleteError``.
|
||||||
doAssert(not(isNil(pbytes)), "pbytes must not be nil")
|
doAssert(not(isNil(pbytes)), "pbytes must not be nil")
|
||||||
doAssert(nbytes >= 0, "nbytes must be non-negative integer")
|
doAssert(nbytes >= 0, "nbytes must be non-negative integer")
|
||||||
|
@ -347,16 +347,16 @@ proc readExactly*(rstream: AsyncStreamReader, pbytes: pointer,
|
||||||
if len(rstream.buffer.backend) == 0:
|
if len(rstream.buffer.backend) == 0:
|
||||||
if rstream.atEof():
|
if rstream.atEof():
|
||||||
raise newAsyncStreamIncompleteError()
|
raise newAsyncStreamIncompleteError()
|
||||||
var readed = 0
|
var bytesRead = 0
|
||||||
for (region, rsize) in rstream.buffer.backend.regions():
|
for (region, rsize) in rstream.buffer.backend.regions():
|
||||||
let count = min(nbytes - index, rsize)
|
let count = min(nbytes - index, rsize)
|
||||||
readed += count
|
bytesRead += count
|
||||||
if count > 0:
|
if count > 0:
|
||||||
copyMem(addr pbuffer[index], region, count)
|
copyMem(addr pbuffer[index], region, count)
|
||||||
index += count
|
index += count
|
||||||
if index == nbytes:
|
if index == nbytes:
|
||||||
break
|
break
|
||||||
(consumed: readed, done: index == nbytes)
|
(consumed: bytesRead, done: index == nbytes)
|
||||||
|
|
||||||
proc readOnce*(rstream: AsyncStreamReader, pbytes: pointer,
|
proc readOnce*(rstream: AsyncStreamReader, pbytes: pointer,
|
||||||
nbytes: int): Future[int] {.
|
nbytes: int): Future[int] {.
|
||||||
|
@ -547,11 +547,11 @@ proc read*(rstream: AsyncStreamReader): Future[seq[byte]] {.
|
||||||
if rstream.atEof():
|
if rstream.atEof():
|
||||||
(0, true)
|
(0, true)
|
||||||
else:
|
else:
|
||||||
var readed = 0
|
var bytesRead = 0
|
||||||
for (region, rsize) in rstream.buffer.backend.regions():
|
for (region, rsize) in rstream.buffer.backend.regions():
|
||||||
readed += rsize
|
bytesRead += rsize
|
||||||
res.add(region.toUnchecked().toOpenArray(0, rsize - 1))
|
res.add(region.toUnchecked().toOpenArray(0, rsize - 1))
|
||||||
(readed, false)
|
(bytesRead, false)
|
||||||
res
|
res
|
||||||
|
|
||||||
proc read*(rstream: AsyncStreamReader, n: int): Future[seq[byte]] {.
|
proc read*(rstream: AsyncStreamReader, n: int): Future[seq[byte]] {.
|
||||||
|
@ -581,12 +581,12 @@ proc read*(rstream: AsyncStreamReader, n: int): Future[seq[byte]] {.
|
||||||
if rstream.atEof():
|
if rstream.atEof():
|
||||||
(0, true)
|
(0, true)
|
||||||
else:
|
else:
|
||||||
var readed = 0
|
var bytesRead = 0
|
||||||
for (region, rsize) in rstream.buffer.backend.regions():
|
for (region, rsize) in rstream.buffer.backend.regions():
|
||||||
let count = min(rsize, n - len(res))
|
let count = min(rsize, n - len(res))
|
||||||
readed += count
|
bytesRead += count
|
||||||
res.add(region.toUnchecked().toOpenArray(0, count - 1))
|
res.add(region.toUnchecked().toOpenArray(0, count - 1))
|
||||||
(readed, len(res) == n)
|
(bytesRead, len(res) == n)
|
||||||
res
|
res
|
||||||
|
|
||||||
proc consume*(rstream: AsyncStreamReader): Future[int] {.
|
proc consume*(rstream: AsyncStreamReader): Future[int] {.
|
||||||
|
|
|
@ -2579,7 +2579,7 @@ proc readExactly*(transp: StreamTransport, pbytes: pointer,
|
||||||
##
|
##
|
||||||
## If ``nbytes == 0`` this operation will return immediately.
|
## If ``nbytes == 0`` this operation will return immediately.
|
||||||
##
|
##
|
||||||
## If EOF is received and ``nbytes`` is not yet readed, the procedure
|
## If EOF is received and ``nbytes`` is not yet read, the procedure
|
||||||
## will raise ``TransportIncompleteError``, potentially with some bytes
|
## will raise ``TransportIncompleteError``, potentially with some bytes
|
||||||
## already written.
|
## already written.
|
||||||
doAssert(not(isNil(pbytes)), "pbytes must not be nil")
|
doAssert(not(isNil(pbytes)), "pbytes must not be nil")
|
||||||
|
@ -2595,16 +2595,16 @@ proc readExactly*(transp: StreamTransport, pbytes: pointer,
|
||||||
if len(transp.buffer) == 0:
|
if len(transp.buffer) == 0:
|
||||||
if transp.atEof():
|
if transp.atEof():
|
||||||
raise newException(TransportIncompleteError, "Data incomplete!")
|
raise newException(TransportIncompleteError, "Data incomplete!")
|
||||||
var readed = 0
|
var bytesRead = 0
|
||||||
for (region, rsize) in transp.buffer.regions():
|
for (region, rsize) in transp.buffer.regions():
|
||||||
let count = min(nbytes - index, rsize)
|
let count = min(nbytes - index, rsize)
|
||||||
readed += count
|
bytesRead += count
|
||||||
if count > 0:
|
if count > 0:
|
||||||
copyMem(addr pbuffer[index], region, count)
|
copyMem(addr pbuffer[index], region, count)
|
||||||
index += count
|
index += count
|
||||||
if index == nbytes:
|
if index == nbytes:
|
||||||
break
|
break
|
||||||
(consumed: readed, done: index == nbytes)
|
(consumed: bytesRead, done: index == nbytes)
|
||||||
|
|
||||||
proc readOnce*(transp: StreamTransport, pbytes: pointer,
|
proc readOnce*(transp: StreamTransport, pbytes: pointer,
|
||||||
nbytes: int): Future[int] {.
|
nbytes: int): Future[int] {.
|
||||||
|
@ -2736,11 +2736,11 @@ proc read*(transp: StreamTransport): Future[seq[byte]] {.
|
||||||
if transp.atEof():
|
if transp.atEof():
|
||||||
(0, true)
|
(0, true)
|
||||||
else:
|
else:
|
||||||
var readed = 0
|
var bytesRead = 0
|
||||||
for (region, rsize) in transp.buffer.regions():
|
for (region, rsize) in transp.buffer.regions():
|
||||||
readed += rsize
|
bytesRead += rsize
|
||||||
res.add(region.toUnchecked().toOpenArray(0, rsize - 1))
|
res.add(region.toUnchecked().toOpenArray(0, rsize - 1))
|
||||||
(readed, false)
|
(bytesRead, false)
|
||||||
res
|
res
|
||||||
|
|
||||||
proc read*(transp: StreamTransport, n: int): Future[seq[byte]] {.
|
proc read*(transp: StreamTransport, n: int): Future[seq[byte]] {.
|
||||||
|
@ -2756,12 +2756,12 @@ proc read*(transp: StreamTransport, n: int): Future[seq[byte]] {.
|
||||||
if transp.atEof():
|
if transp.atEof():
|
||||||
(0, true)
|
(0, true)
|
||||||
else:
|
else:
|
||||||
var readed = 0
|
var bytesRead = 0
|
||||||
for (region, rsize) in transp.buffer.regions():
|
for (region, rsize) in transp.buffer.regions():
|
||||||
let count = min(rsize, n - len(res))
|
let count = min(rsize, n - len(res))
|
||||||
readed += count
|
bytesRead += count
|
||||||
res.add(region.toUnchecked().toOpenArray(0, count - 1))
|
res.add(region.toUnchecked().toOpenArray(0, count - 1))
|
||||||
(readed, len(res) == n)
|
(bytesRead, len(res) == n)
|
||||||
res
|
res
|
||||||
|
|
||||||
proc consume*(transp: StreamTransport): Future[int] {.
|
proc consume*(transp: StreamTransport): Future[int] {.
|
||||||
|
|
Loading…
Reference in New Issue