From f0b65c9a1e7c7c43a53ca718b2a7474bf14f70be Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Sat, 26 Apr 2014 01:10:52 -0700 Subject: [PATCH] make ExUtilLoadWebP() accept NULL bitstream param. Change-Id: Ifce379873ca39e46d011a1cb829beab89de5f15d --- examples/example_util.c | 5 +++++ examples/example_util.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/example_util.c b/examples/example_util.c index 8bfff69f..d3dbc618 100644 --- a/examples/example_util.c +++ b/examples/example_util.c @@ -131,8 +131,13 @@ int ExUtilLoadWebP(const char* const in_file, const uint8_t** data, size_t* data_size, WebPBitstreamFeatures* bitstream) { VP8StatusCode status; + WebPBitstreamFeatures local_features; if (!ExUtilReadFile(in_file, data, data_size)) return 0; + if (bitstream == NULL) { + bitstream = &local_features; + } + status = WebPGetFeatures(*data, *data_size, bitstream); if (status != VP8_STATUS_OK) { free((void*)*data); diff --git a/examples/example_util.h b/examples/example_util.h index a160786e..9b396350 100644 --- a/examples/example_util.h +++ b/examples/example_util.h @@ -47,7 +47,7 @@ int ExUtilWriteFile(const char* const file_name, void ExUtilPrintWebPError(const char* const in_file, int status); // Reads a WebP from 'in_file', returning the contents and size in 'data' and -// 'data_size'. 'bitstream' is populated using WebPGetFeatures(). +// 'data_size'. If not NULL, 'bitstream' is populated using WebPGetFeatures(). // Returns true on success. int ExUtilLoadWebP(const char* const in_file, const uint8_t** data, size_t* data_size,