Fix English spelling for `readed` variable. (#534)

This commit is contained in:
Eugene Kabanov 2024-04-18 02:08:19 +03:00 committed by GitHub
parent bd7d84fbcb
commit 7a3eaffa4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 20 deletions

View File

@ -317,7 +317,7 @@ proc readExactly*(rstream: AsyncStreamReader, pbytes: pointer,
## Read exactly ``nbytes`` bytes from read-only stream ``rstream`` and store
## 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``.
doAssert(not(isNil(pbytes)), "pbytes must not be nil")
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 rstream.atEof():
raise newAsyncStreamIncompleteError()
var readed = 0
var bytesRead = 0
for (region, rsize) in rstream.buffer.backend.regions():
let count = min(nbytes - index, rsize)
readed += count
bytesRead += count
if count > 0:
copyMem(addr pbuffer[index], region, count)
index += count
if index == nbytes:
break
(consumed: readed, done: index == nbytes)
(consumed: bytesRead, done: index == nbytes)
proc readOnce*(rstream: AsyncStreamReader, pbytes: pointer,
nbytes: int): Future[int] {.
@ -547,11 +547,11 @@ proc read*(rstream: AsyncStreamReader): Future[seq[byte]] {.
if rstream.atEof():
(0, true)
else:
var readed = 0
var bytesRead = 0
for (region, rsize) in rstream.buffer.backend.regions():
readed += rsize
bytesRead += rsize
res.add(region.toUnchecked().toOpenArray(0, rsize - 1))
(readed, false)
(bytesRead, false)
res
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():
(0, true)
else:
var readed = 0
var bytesRead = 0
for (region, rsize) in rstream.buffer.backend.regions():
let count = min(rsize, n - len(res))
readed += count
bytesRead += count
res.add(region.toUnchecked().toOpenArray(0, count - 1))
(readed, len(res) == n)
(bytesRead, len(res) == n)
res
proc consume*(rstream: AsyncStreamReader): Future[int] {.

View File

@ -2579,7 +2579,7 @@ proc readExactly*(transp: StreamTransport, pbytes: pointer,
##
## 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
## already written.
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 transp.atEof():
raise newException(TransportIncompleteError, "Data incomplete!")
var readed = 0
var bytesRead = 0
for (region, rsize) in transp.buffer.regions():
let count = min(nbytes - index, rsize)
readed += count
bytesRead += count
if count > 0:
copyMem(addr pbuffer[index], region, count)
index += count
if index == nbytes:
break
(consumed: readed, done: index == nbytes)
(consumed: bytesRead, done: index == nbytes)
proc readOnce*(transp: StreamTransport, pbytes: pointer,
nbytes: int): Future[int] {.
@ -2736,11 +2736,11 @@ proc read*(transp: StreamTransport): Future[seq[byte]] {.
if transp.atEof():
(0, true)
else:
var readed = 0
var bytesRead = 0
for (region, rsize) in transp.buffer.regions():
readed += rsize
bytesRead += rsize
res.add(region.toUnchecked().toOpenArray(0, rsize - 1))
(readed, false)
(bytesRead, false)
res
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():
(0, true)
else:
var readed = 0
var bytesRead = 0
for (region, rsize) in transp.buffer.regions():
let count = min(rsize, n - len(res))
readed += count
bytesRead += count
res.add(region.toUnchecked().toOpenArray(0, count - 1))
(readed, len(res) == n)
(bytesRead, len(res) == n)
res
proc consume*(transp: StreamTransport): Future[int] {.