joeylib2/tools/common/toolBase64.h

20 lines
688 B
C

// Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
// See LICENSE.md for license information.
// SPDX-License-Identifier: MIT
//
// toolBase64.h - base64 decoding for the JoeyLib host tools (Tiled's
// layer data), forgiving as Python's base64.b64decode is: characters
// outside the alphabet are skipped, and padding ends the data.
#ifndef TOOL_BASE64_H
#define TOOL_BASE64_H
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
// Decode len bytes of text into a malloc'd buffer; false when the data
// ends part way through a group of four (bad padding).
bool toolBase64Decode(const char *text, size_t len, uint8_t **out, size_t *outLen);
#endif