glong written = 0, wr, slen;
gint64 i64;
guint64 ui64;
- guint width, sign, hex, humanize, bytes, frac_width, b32;
+ guint width, sign, hex, humanize, bytes, frac_width, b32, b64;
rspamd_fstring_t *v;
rspamd_ftok_t *tok;
GString *gs;
sign = 0;
fmt++;
continue;
+ case 'B':
+ b64 = 1;
+ sign = 0;
+ fmt++;
+ continue;
case 'H':
humanize = 1;
bytes = 1;
buf_start = fmt;
}
+ else if (G_UNLIKELY (b64)) {
+ gchar *b64buf;
+ gsize olen = 0;
+
+ if (G_UNLIKELY (slen == -1)) {
+ if (G_LIKELY (width != 0)) {
+ slen = width;
+ }
+ else {
+ /* NULL terminated string */
+ slen = strlen (p);
+ }
+ }
+
+ b64buf = rspamd_encode_base64 (p, slen, 0, &olen);
+
+ if (b64buf) {
+ RSPAMD_PRINTF_APPEND (b64buf, olen);
+ g_free (b64buf);
+ }
+ else {
+ RSPAMD_PRINTF_APPEND ("(NULL)", sizeof ("(NULL)") - 1);
+ }
+ }
else {
if (slen == -1) {
/* NULL terminated string */