use glib's b64 encode/decode, if available
see https://github.com/libvips/libvips/issues/1263
This commit is contained in:
parent
d7f9ad8b41
commit
af0dc5265f
10
configure.ac
10
configure.ac
@ -461,6 +461,16 @@ AC_CHECK_LIB(m,atan2,[AC_DEFINE(HAVE_ATAN2,1,[have atan2() in libm.])])
|
|||||||
PKG_CHECK_MODULES(REQUIRED, glib-2.0 >= 2.6 gmodule-2.0 gobject-2.0)
|
PKG_CHECK_MODULES(REQUIRED, glib-2.0 >= 2.6 gmodule-2.0 gobject-2.0)
|
||||||
PACKAGES_USED="$PACKAGES_USED glib-2.0 gmodule-2.0 gobject-2.0"
|
PACKAGES_USED="$PACKAGES_USED glib-2.0 gmodule-2.0 gobject-2.0"
|
||||||
|
|
||||||
|
# from 2.12 we have g_base64_encode()
|
||||||
|
PKG_CHECK_MODULES(BASE64_ENCODE, glib-2.0 >= 2.12,
|
||||||
|
[AC_DEFINE(HAVE_BASE64_ENCODE,1,
|
||||||
|
[define if your glib has g_base64_encode().]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
[:
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
# from 2.14 we have g_option_context_get_help()
|
# from 2.14 we have g_option_context_get_help()
|
||||||
PKG_CHECK_MODULES(CONTEXT_GET_HELP, glib-2.0 >= 2.14,
|
PKG_CHECK_MODULES(CONTEXT_GET_HELP, glib-2.0 >= 2.14,
|
||||||
[AC_DEFINE(HAVE_CONTEXT_GET_HELP,1,
|
[AC_DEFINE(HAVE_CONTEXT_GET_HELP,1,
|
||||||
|
@ -90,6 +90,24 @@ Modified on:
|
|||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
#include <vips/internal.h>
|
#include <vips/internal.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_BASE64_ENCODE
|
||||||
|
|
||||||
|
/* glib 2.12 adds these.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
vips__b64_encode( const unsigned char *data, size_t data_length )
|
||||||
|
{
|
||||||
|
return( g_base64_encode( data, data_length ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char *
|
||||||
|
vips__b64_decode( const char *buffer, size_t *data_length )
|
||||||
|
{
|
||||||
|
return( g_base64_decode( buffer, data_length ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /*!HAVE_BASE64_ENCODE*/
|
||||||
|
|
||||||
static unsigned char b64_list[] =
|
static unsigned char b64_list[] =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
|
||||||
@ -295,3 +313,5 @@ vips__b64_decode( const char *buffer, size_t *data_length )
|
|||||||
|
|
||||||
return( data );
|
return( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /*HAVE_BASE64_ENCODE*/
|
||||||
|
Loading…
Reference in New Issue
Block a user