Detect and use png_get_io_ptr if provided
This commit is contained in:
parent
d32b26ffa8
commit
5cdfad50e6
@ -24,7 +24,7 @@ AC_TYPE_SSIZE_T
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_FUNC_REALLOC
|
||||
AC_CHECK_FUNCS([gettimeofday memmove memset select strdup])
|
||||
AC_CHECK_FUNCS([gettimeofday memmove memset select strdup png_get_io_ptr])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
@ -248,7 +248,15 @@ void guac_send_copy(GUACIO* io, int srcl, int srcx, int srcy, int w, int h, int
|
||||
|
||||
void __guac_write_png(png_structp png, png_bytep data, png_size_t length) {
|
||||
|
||||
if (guac_write_base64((GUACIO*) png->io_ptr, data, length) < 0) {
|
||||
#ifdef HAVE_PNG_GET_IO_PTR
|
||||
GUACIO* io = (GUACIO*) png_get_io_ptr(png);
|
||||
#else
|
||||
/* Direct access to io_ptr has been deprecated, but we'll
|
||||
use it if we have to. */
|
||||
GUACIO* io = (GUACIO*) png->io_ptr;
|
||||
#endif
|
||||
|
||||
if (guac_write_base64(io, data, length) < 0) {
|
||||
perror("Error writing PNG");
|
||||
png_error(png, "Error writing PNG");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user