Leptonica
1.54
|
Функции | |
static l_int32 | isBase64 (char) |
static l_int32 * | genReverseTab64 (void) |
static void | byteConvert3to4 (l_uint8 *in3, l_uint8 *out4) |
static void | byteConvert4to3 (l_uint8 *in4, l_uint8 *out3) |
static l_int32 | convertChunkToAscii85 (l_uint8 *inarray, l_int32 insize, l_int32 *pindex, char *outbuf, l_int32 *pnbout) |
char * | encodeBase64 (l_uint8 *inarray, l_int32 insize, l_int32 *poutsize) |
l_uint8 * | decodeBase64 (const char *inarray, l_int32 insize, l_int32 *poutsize) |
char * | encodeAscii85 (l_uint8 *inarray, l_int32 insize, l_int32 *poutsize) |
l_uint8 * | decodeAscii85 (char *inarray, l_int32 insize, l_int32 *poutsize) |
char * | reformatPacked64 (char *inarray, l_int32 insize, l_int32 leadspace, l_int32 linechars, l_int32 addquotes, l_int32 *poutsize) |
Переменные | |
static const l_int32 | MAX_BASE64_LINE = 72 |
static const char * | tablechar64 = "0123456789+/" |
static const l_int32 | MAX_ASCII85_LINE = 64 |
static const l_uint32 | power85 [5] |
static void byteConvert3to4 | ( | l_uint8 * | in3, |
l_uint8 * | out4 | ||
) | [static] |
static void byteConvert4to3 | ( | l_uint8 * | in4, |
l_uint8 * | out3 | ||
) | [static] |
static l_int32 convertChunkToAscii85 | ( | l_uint8 * | inarray, |
l_int32 | insize, | ||
l_int32 * | pindex, | ||
char * | outbuf, | ||
l_int32 * | pnbout | ||
) | [static] |
Input: inarray (input data) insize (number of bytes in input array) &index (use and <return> -- ptr) outbuf (holds 8 ascii chars; we use no more than 7) &nbsout (<return> number of bytes written to outbuf) Return: boolean for eof (0 if more data, 1 if end of file)
Notes: (1) Attempts to read 4 bytes and write 5. (2) Writes 1 byte if the value is 0.
l_uint8* decodeAscii85 | ( | char * | inarray, |
l_int32 | insize, | ||
l_int32 * | poutsize | ||
) |
Input: inarray (ascii85 input data) insize (number of bytes in input array) &outsize (<return> number of bytes in output l_uint8 array) Return: outarray (binary)
Notes: (1) We assume the data is properly encoded, so we do not check for invalid characters or the final '>' character. (2) We permit whitespace to be added to the encoding in an arbitrary way.
l_uint8* decodeBase64 | ( | const char * | inarray, |
l_int32 | insize, | ||
l_int32 * | poutsize | ||
) |
Input: inarray (input encoded char data, with 72 chars/line)) insize (number of bytes in input array) &outsize (<return> number of bytes in output byte array) Return: bytea (decoded byte data), or null on error
Notes: (1) The input character data should have only 66 different characters: The 64 character set for base64 encoding, plus the pad character '=' and newlines for formatting with fixed line lengths. If there are any other characters, the decoder will declare the input data to be invalid and return NULL. (2) The decoder ignores newlines and, for a valid input string, stops reading input when a pad byte is found.
char* encodeAscii85 | ( | l_uint8 * | inarray, |
l_int32 | insize, | ||
l_int32 * | poutsize | ||
) |
Input: inarray (input data) insize (number of bytes in input array) &outsize (<return> number of bytes in output char array) Return: chara (with 64 characters +
in each line)
Notes: (1) Ghostscript has a stack break if the last line of data only has a '>', so we avoid the problem by always putting '~>' on the last line.
char* encodeBase64 | ( | l_uint8 * | inarray, |
l_int32 | insize, | ||
l_int32 * | poutsize | ||
) |
Input: inarray (input binary data) insize (number of bytes in input array) &outsize (<return> number of bytes in output char array) Return: chara (with MAX_BASE64_LINE characters +
in each line)
Notes: (1) The input character data is unrestricted binary. The ouput encoded data consists of the 64 characters in the base64 set, plus newlines and the pad character '='.
static l_int32 * genReverseTab64 | ( | ) | [static] |
char* reformatPacked64 | ( | char * | inarray, |
l_int32 | insize, | ||
l_int32 | leadspace, | ||
l_int32 | linechars, | ||
l_int32 | addquotes, | ||
l_int32 * | poutsize | ||
) |
Input: inarray (base64 encoded string with newlines) insize (number of bytes in input array) leadspace (number of spaces in each line before the data) linechars (number of bytes of data in each line; multiple of 4) addquotes (1 to add quotes to each line of data; 0 to skip) &outsize (<return> number of bytes in output char array) Return: outarray (ascii)
Notes: (1) Each line in the output array has space characters, followed optionally by a double-quote, followed by bytes of base64 data, followed optionally by a double-quote, followed by a newline. (2) This can be used to convert a base64 encoded string to a string formatted for inclusion in a C source file.
const l_int32 MAX_ASCII85_LINE = 64 [static] |
const l_int32 MAX_BASE64_LINE = 72 [static] |
const char* tablechar64 = "0123456789+/" [static] |