// The Construct // // Copyright (C) The Construct Developers, Authors & Contributors // Copyright (C) 2016-2021 Jason Volk // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice is present in all copies. The // full license for this software is available in the LICENSE file. #include (ptr), size }; // Get source buffer from our callback user data. const_buffer &src { *reinterpret_cast(png_get_io_ptr(handle)) }; // Copy from our buffer to libpng buffer. const size_t copied { copy(dst, src) }; // Advance our source pointer for the amount copied. const size_t consumed { consume(src, copied) }; assert(copied == consumed); } #endif #ifdef HAVE_PNG_H void * ircd::png::handle_alloc(png_structp handle, size_t size) noexcept { return std::malloc(size); } #endif #ifdef HAVE_PNG_H void ircd::png::handle_free(png_structp handle, void *const ptr) noexcept { std::free(ptr); } #endif #ifdef HAVE_PNG_H void ircd::png::handle_warn(png_structp handle, const char *const msg) noexcept { log::dwarning { log, "handle(%p) :%s", static_cast(handle), msg, }; } #endif #ifdef HAVE_PNG_H void ircd::png::handle_error(png_structp handle, const char *const msg) noexcept(false) { log::error { log, "handle(%p) :%s", static_cast(handle), msg, }; throw error { "%s", msg }; } #endif