mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
Added love.math.encode(format, data | string [, linelength]) and love.math.decode(format, data | string). Current formats are "base64" and "hex". The optional line length only applies to base64 and specifies the maximum number of characters per line in the encoded string.
Removed the variant of love.filesystem.newFileData which decoded a base64-encoded string since it's redundant. --HG-- branch : minor
This commit is contained in:
+17
-3
@@ -20,21 +20,35 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef LOVE_B64_H
|
||||
#define LOVE_B64_H
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
/**
|
||||
* Base64-encode data.
|
||||
*
|
||||
* @param src The data to encode.
|
||||
* @param srclen The size in bytes of the data.
|
||||
* @param linelen The maximum length of each line in the encoded string.
|
||||
* 0 indicates no maximum length.
|
||||
* @param dstlen The length of the encoded string is stored here.
|
||||
* @return A string containing the base64-encoded data (allocated with new[]).
|
||||
*/
|
||||
char *b64_encode(const char *src, size_t srclen, size_t linelen, size_t &dstlen);
|
||||
|
||||
/**
|
||||
* Decode base64 encoded data.
|
||||
*
|
||||
* @param src The string containing the base64 data.
|
||||
* @param slen The length of the string.
|
||||
* @param size The size of the binary data is stored here.
|
||||
* @param srclen The length of the string.
|
||||
* @param dstlen The size of the binary data is stored here.
|
||||
* @return A chunk of memory containing the binary data (allocated with new[]).
|
||||
*/
|
||||
char *b64_decode(const char *src, int slen, int &size);
|
||||
char *b64_decode(const char *src, size_t srclen, size_t &dstlen);
|
||||
|
||||
} // love
|
||||
|
||||
|
||||
Reference in New Issue
Block a user