The comment says that flush returns the number of bytes written to output buffer, but it returns the encoder. Is the comment outdated?
|
# Flush input buffer and convert it into output buffer |
|
# Returns the number of bytes written to output buffer |
|
function flush(s::StringEncoder) |
|
s.cd == C_NULL && return s |
|
|
|
# We need to retry several times in case output buffer is too small to convert |
|
# all of the input. Even so, some incomplete sequences may remain in the input |
|
# until more data is written, which will only trigger an error on close(). |
|
s.outbytesleft[] = 0 |
|
while s.outbytesleft[] < BUFSIZE |
|
iconv!(s.cd, s.inbuf, s.outbuf, s.inbufptr, s.outbufptr, s.inbytesleft, s.outbytesleft) |
|
write(s.stream, view(s.outbuf, 1:(BUFSIZE - Int(s.outbytesleft[])))) |
|
end |
|
|
|
s |
|
end |
The comment says that
flushreturns the number of bytes written to output buffer, but it returns the encoder. Is the comment outdated?StringEncodings.jl/src/StringEncodings.jl
Lines 219 to 234 in 5ad92b7