#include "./pngdec.h"
#ifdef HAVE_CONFIG_H
#include "webp/config.h"
#endif
#include <stdio.h>
#ifdef WEBP_HAVE_PNG
#ifndef PNG_USER_MEM_SUPPORTED
#define PNG_USER_MEM_SUPPORTED …
#endif
#include <png.h>
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include "webp/encode.h"
#include "./imageio_util.h"
#include "./metadata.h"
#define LOCAL_PNG_VERSION …
#define LOCAL_PNG_PREREQ(maj, min) …
static void PNGAPI error_function(png_structp png, png_const_charp error) { … }
#if LOCAL_PNG_PREREQ(1,4)
LocalPngAllocSize;
#else
typedef png_size_t LocalPngAllocSize;
#endif
static png_voidp MallocFunc(png_structp png_ptr, LocalPngAllocSize size) { … }
static void FreeFunc(png_structp png_ptr, png_voidp ptr) { … }
static uint8_t* HexStringToBytes(const char* hexstring,
size_t expected_length) { … }
static int ProcessRawProfile(const char* profile, size_t profile_len,
MetadataPayload* const payload) { … }
static const struct { … } kPNGMetadataMap[] = …;
static int ExtractMetadataFromPNG(png_structp png,
png_infop const head_info,
png_infop const end_info,
Metadata* const metadata) { … }
PNGReadContext;
static void ReadFunc(png_structp png_ptr, png_bytep data, png_size_t length) { … }
int ReadPNG(const uint8_t* const data, size_t data_size,
struct WebPPicture* const pic,
int keep_alpha, struct Metadata* const metadata) { … }
#else
int ReadPNG(const uint8_t* const data, size_t data_size,
struct WebPPicture* const pic,
int keep_alpha, struct Metadata* const metadata) {
(void)data;
(void)data_size;
(void)pic;
(void)keep_alpha;
(void)metadata;
fprintf(stderr, "PNG support not compiled. Please install the libpng "
"development package before building.\n");
return 0;
}
#endif