From 55ba26feb7ab279002263227c712e9e3fb51eede Mon Sep 17 00:00:00 2001
From: Juniper Tyree <50025784+juntyr@users.noreply.github.com>
Date: Tue, 10 Jan 2023 12:58:54 +0200
Subject: [PATCH] Bump base64 to v0.21 (#433)

[FG]
backported

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 Cargo.toml     | 2 +-
 src/de/mod.rs  | 5 +++--
 src/error.rs   | 4 ++--
 src/parse.rs   | 4 ++++
 src/ser/mod.rs | 8 ++++++--
 6 files changed, 17 insertions(+), 7 deletions(-)

Index: ron/Cargo.toml
===================================================================
--- ron.orig/Cargo.toml
+++ ron/Cargo.toml
@@ -40,7 +40,7 @@ autotests = false
 name = "ron"
 
 [dependencies.base64]
-version = "0.13"
+version = "0.22"
 
 [dependencies.bitflags]
 version = "1.0.4"
Index: ron/src/de/mod.rs
===================================================================
--- ron.orig/src/de/mod.rs
+++ ron/src/de/mod.rs
@@ -1,6 +1,7 @@
 /// Deserialization module.
 pub use crate::error::{Error, ErrorCode, Position, Result};
 
+use base64::Engine;
 use serde::de::{self, DeserializeSeed, Deserializer as SerdeError, Visitor};
 use std::{borrow::Cow, io, str};
 
@@ -8,7 +9,7 @@ use self::{id::IdDeserializer, tag::TagD
 use crate::{
     extensions::Extensions,
     options::Options,
-    parse::{AnyNum, Bytes, ParsedStr},
+    parse::{AnyNum, Bytes, ParsedStr, BASE64_ENGINE},
 };
 
 mod id;
@@ -325,7 +326,7 @@ impl<'de, 'a> de::Deserializer<'de> for
                 ParsedStr::Allocated(ref s) => s.as_str(),
                 ParsedStr::Slice(s) => s,
             };
-            base64::decode(base64_str)
+            BASE64_ENGINE.decode(base64_str)
         };
 
         match res {
Index: ron/src/parse.rs
===================================================================
--- ron.orig/src/parse.rs
+++ ron/src/parse.rs
@@ -5,11 +5,15 @@ use std::{
     str::{from_utf8, from_utf8_unchecked, FromStr},
 };
 
+use base64::engine::general_purpose::{GeneralPurpose, STANDARD};
+
 use crate::{
     error::{Error, ErrorCode, Position, Result},
     extensions::Extensions,
 };
 
+pub const BASE64_ENGINE: GeneralPurpose = STANDARD;
+
 // We have the following char categories.
 const INT_CHAR: u8 = 1 << 0; // [0-9A-Fa-f_]
 const FLOAT_CHAR: u8 = 1 << 1; // [0-9\.Ee+-_]
Index: ron/src/ser/mod.rs
===================================================================
--- ron.orig/src/ser/mod.rs
+++ ron/src/ser/mod.rs
@@ -1,3 +1,4 @@
+use base64::Engine;
 use serde::{ser, Deserialize, Serialize};
 use std::io;
 
@@ -5,7 +6,7 @@ use crate::{
     error::{Error, Result},
     extensions::Extensions,
     options::Options,
-    parse::{is_ident_first_char, is_ident_other_char},
+    parse::{is_ident_first_char, is_ident_other_char, BASE64_ENGINE},
 };
 
 #[cfg(test)]
@@ -537,7 +538,7 @@ impl<'a, W: io::Write> ser::Serializer f
     }
 
     fn serialize_bytes(self, v: &[u8]) -> Result<()> {
-        self.serialize_str(base64::encode(v).as_str())
+        self.serialize_str(BASE64_ENGINE.encode(v).as_str())
     }
 
     fn serialize_none(self) -> Result<()> {
