hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 5fae03cb0900fdea7a14b5665e1a2d6ac0f90e55
parent 577e39d694db9c6b40760293eb5574322e93bb7d
Author: Ajay R <ar324@protonmail.com>
Date:   Mon,  4 Apr 2022 05:50:14 +0000

base32 and base64: return correct number of bytes processed by encode_writer

Signed-off-by: Ajay R <ar324@protonmail.com>

Diffstat:
Mencoding/base32/base32.ha | 4+---
Mencoding/base64/base64.ha | 4+---
2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/encoding/base32/base32.ha b/encoding/base32/base32.ha @@ -80,7 +80,6 @@ fn encode_writer( case void => yield; }; - let n = 0z; // number of bytes processed let l = len(in); let i = 0z; for (i + 4 < l + s.avail; i += 5) { @@ -114,7 +113,6 @@ fn encode_writer( case size => yield; }; - n += 5; }; // storing leftover bytes if (l + s.avail < 5) { @@ -128,7 +126,7 @@ fn encode_writer( }; }; s.avail = (l + s.avail) % 5; - return n; + return l; }; fn encode_closer(s: *io::stream) void = { diff --git a/encoding/base64/base64.ha b/encoding/base64/base64.ha @@ -85,7 +85,6 @@ fn encode_writer( case void => yield; }; - let n = 0z; // number of bytes processed let l = len(in); let i = 0z; for (i + 2 < l + s.avail; i += 3) { @@ -115,7 +114,6 @@ fn encode_writer( case size => yield; }; - n += 3; }; // storing leftover bytes if (l + s.avail < 3) { @@ -129,7 +127,7 @@ fn encode_writer( }; }; s.avail = (l + s.avail) % 3; - return n; + return l; }; fn encode_closer(s: *io::stream) void = {