mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-05 22:44:18 +01:00
23 lines
912 B
C
23 lines
912 B
C
#pragma once
|
|
|
|
#include "fastfetch.h"
|
|
|
|
// `str`, `out_size` and `output` are dereferenced unconditionally
|
|
[[gnu::nonnull(2, 3, 4)]] void ffBase64EncodeRaw(uint32_t size, const char* str, uint32_t* out_size, char* output);
|
|
[[gnu::nonnull(1), nodiscard]] static inline FFstrbuf ffBase64EncodeStrbuf(const FFstrbuf* in) {
|
|
FFstrbuf out = ffStrbufCreateA(10 + in->length * 4 / 3);
|
|
ffBase64EncodeRaw(in->length, in->chars, &out.length, out.chars);
|
|
assert(out.length < out.allocated);
|
|
|
|
return out;
|
|
}
|
|
|
|
[[gnu::nonnull(2, 3, 4)]] void ffBase64DecodeRaw(uint32_t size, const char* str, uint32_t* out_size, char* output);
|
|
[[gnu::nonnull(1), nodiscard]] static inline FFstrbuf ffBase64DecodeStrbuf(const FFstrbuf* in) {
|
|
FFstrbuf out = ffStrbufCreateA(10 + in->length * 3 / 4);
|
|
ffBase64DecodeRaw(in->length, in->chars, &out.length, out.chars);
|
|
assert(out.length < out.allocated);
|
|
|
|
return out;
|
|
}
|