]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: base64 - Add base64_get_full_encoded_size().
authorStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 15 May 2019 08:09:01 +0000 (10:09 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 07:02:27 +0000 (10:02 +0300)
src/lib/base64.c
src/lib/base64.h

index 980aa12005653cc96b248541275613514a916505..96ecde5cc4f301c8aa61f5c87769480d12dba2ce 100644 (file)
@@ -8,6 +8,17 @@
  * Low-level Base64 encoder
  */
 
+off_t base64_get_full_encoded_size(struct base64_encoder *enc ATTR_UNUSED,
+                                  off_t src_size)
+{
+       off_t out_size;
+
+       /* calculate size of encoded data */
+       out_size = MAX_BASE64_ENCODED_SIZE(src_size);
+
+       return out_size;
+}
+
 static size_t
 base64_encode_get_out_size(struct base64_encoder *enc, size_t src_size)
 {
index cfb78070959003d1c944bb7812605688609a5fd3..03f699e4c9e32686b85648c98e5315eb65361d20 100644 (file)
@@ -61,6 +61,10 @@ base64_encode_reset(struct base64_encoder *enc)
        base64_encode_init(enc, b64);
 }
 
+/* Translate the size of the full encoder input to the size of the encoder
+   output.
+ */
+off_t base64_get_full_encoded_size(struct base64_encoder *enc, off_t src_size);
 /* Translate the size of the next input to the size of the output once encoded.
    This yields the amount of data appended to the dest buffer by
    base64_encode_more() with the indicated src_size. */