Mercurial > libpst
view src/libstrfunc.c @ 388:292ad0f71fd4
Add operator and quotes to the AX_PYTHON_DEVEL parameter
The operator is required and the quotes are needed to protect PYTHON_VERSION.
See-also: https://www.gnu.org/software/autoconf-archive/ax_python_devel.html
Fixes:
checking whether to build the libpst python interface... yes
checking for python build information...
checking for python3.7... python3.7
checking for main in -lpython3.7... no
checking for main in -lpython3.7m... yes
results of the Python check:
Binary: python3.7
Library: python3.7m
Include Dir: /usr/include/python3.7m
checking for python3.7... /usr/bin/python3.7
checking for a version of Python >= '2.1.0'... yes
checking for a version of Python 3.7... File "<string>", line 1
import sys; ver = sys.version.split ()[0]; print (ver 3.7)
^
SyntaxError: invalid syntax
no
configure: error: this package requires Python 3.7.
If you have it installed, but it isn't the default Python
interpreter in your system path, please pass the PYTHON_VERSION
variable to configure. See ``configure --help'' for reference.
author | Paul Wise <pabs3@bonedaddy.net> |
---|---|
date | Sat, 21 Dec 2019 21:25:45 +0800 |
parents | c947b8812120 |
children |
line wrap: on
line source
/* Taken from LibStrfunc v7.3 */ #include "define.h" static char base64_code_chars[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=="; static void base64_append(char **ou, int *line_count, char data); static void base64_append(char **ou, int *line_count, char data) { if (*line_count == 76) { *(*ou)++ = '\n'; *line_count = 0; } *(*ou)++ = data; if (*line_count >= 0) (*line_count)++; } char *pst_base64_encode(void *data, size_t size) { int line_count = 0; return pst_base64_encode_multiple(data, size, &line_count); } char *pst_base64_encode_single(void *data, size_t size) { int line_count = -1; return pst_base64_encode_multiple(data, size, &line_count); } char *pst_base64_encode_multiple(void *data, size_t size, int *line_count) { char *output; char *ou; unsigned char *p = (unsigned char *)data; unsigned char *dte = p + size; if (data == NULL || size == 0) return NULL; ou = output = (char *)malloc(size / 3 * 4 + (size / 57) + 6); if (!output) return NULL; while((dte-p) >= 3) { unsigned char x = p[0]; unsigned char y = p[1]; unsigned char z = p[2]; base64_append(&ou, line_count, base64_code_chars[ x >> 2 ]); base64_append(&ou, line_count, base64_code_chars[ ((x & 0x03) << 4) | (y >> 4) ]); base64_append(&ou, line_count, base64_code_chars[ ((y & 0x0F) << 2) | (z >> 6) ]); base64_append(&ou, line_count, base64_code_chars[ z & 0x3F ]); p+=3; }; if ((dte-p) == 2) { base64_append(&ou, line_count, base64_code_chars[ *p >> 2 ]); base64_append(&ou, line_count, base64_code_chars[ ((*p & 0x03) << 4) | (p[1] >> 4) ]); base64_append(&ou, line_count, base64_code_chars[ ((p[1] & 0x0F) << 2) ]); base64_append(&ou, line_count, '='); } else if ((dte-p) == 1) { base64_append(&ou, line_count, base64_code_chars[ *p >> 2 ]); base64_append(&ou, line_count, base64_code_chars[ ((*p & 0x03) << 4) ]); base64_append(&ou, line_count, '='); base64_append(&ou, line_count, '='); }; *ou=0; return output; };