Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 1 | From c1ba44d83cc7d9d756cfb063717852eae9d03328 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 27 Mar 2021 22:12:41 -0700 |
| 4 | Subject: [PATCH] initialize encoder/decoder state in the constructors |
| 5 | |
| 6 | Author: Jakub Wilk <jwilk@debian.org> |
| 7 | |
| 8 | Upstream-Status: Pending |
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 10 | --- |
| 11 | include/b64/decode.h | 4 +++- |
| 12 | include/b64/encode.h | 4 +++- |
| 13 | 2 files changed, 6 insertions(+), 2 deletions(-) |
| 14 | |
| 15 | diff --git a/include/b64/decode.h b/include/b64/decode.h |
| 16 | index e9019f3..aefb7bc 100644 |
| 17 | --- a/include/b64/decode.h |
| 18 | +++ b/include/b64/decode.h |
| 19 | @@ -25,7 +25,9 @@ namespace base64 |
| 20 | |
| 21 | decoder(int buffersize_in = BUFSIZ) |
| 22 | : _buffersize(buffersize_in) |
| 23 | - {} |
| 24 | + { |
| 25 | + base64_init_decodestate(&_state); |
| 26 | + } |
| 27 | |
| 28 | int decode(char value_in) |
| 29 | { |
| 30 | diff --git a/include/b64/encode.h b/include/b64/encode.h |
| 31 | index e7a7035..33848b3 100644 |
| 32 | --- a/include/b64/encode.h |
| 33 | +++ b/include/b64/encode.h |
| 34 | @@ -25,7 +25,9 @@ namespace base64 |
| 35 | |
| 36 | encoder(int buffersize_in = BUFSIZ) |
| 37 | : _buffersize(buffersize_in) |
| 38 | - {} |
| 39 | + { |
| 40 | + base64_init_encodestate(&_state); |
| 41 | + } |
| 42 | |
| 43 | int encode(char value_in) |
| 44 | { |