mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 07:22:52 +01:00
Introduce CHUNK_SIZE_BYTES in muxi.h.
Plus a style fix. Change-Id: Id94df6c91a96598cb022c813e0981f542aebe982
This commit is contained in:
parent
14757f8ae2
commit
c579a71012
@ -643,9 +643,9 @@ WebPMuxError WebPMuxAssemble(WebPMux* const mux,
|
||||
|
||||
// Main RIFF header.
|
||||
PutLE32(data + 0, mktag('R', 'I', 'F', 'F'));
|
||||
PutLE32(data + 4, (uint32_t)size - CHUNK_HEADER_SIZE);
|
||||
PutLE32(data + TAG_SIZE, (uint32_t)size - CHUNK_HEADER_SIZE);
|
||||
assert(size == (uint32_t)size);
|
||||
PutLE32(data + 8, mktag('W', 'E', 'B', 'P'));
|
||||
PutLE32(data + TAG_SIZE + CHUNK_SIZE_BYTES, mktag('W', 'E', 'B', 'P'));
|
||||
|
||||
// Chunks.
|
||||
dst = data + RIFF_HEADER_SIZE;
|
||||
|
@ -87,6 +87,7 @@ typedef enum {
|
||||
// Maximum chunk payload (data) size such that adding the header and padding
|
||||
// won't overflow an uint32.
|
||||
#define MAX_CHUNK_PAYLOAD (~0U - CHUNK_HEADER_SIZE - 1)
|
||||
#define CHUNK_SIZE_BYTES 4
|
||||
|
||||
#define NIL_TAG 0x00000000u // To signal void chunk.
|
||||
|
||||
|
@ -217,9 +217,7 @@ WebPMuxError WebPMuxGetFeatures(const WebPMux* const mux, uint32_t* flags) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// TODO(urvang): Add a '#define CHUNK_SIZE_BYTES 4' and use it instead of
|
||||
// hard-coded value of 4 everywhere.
|
||||
if (data.size_ < 4) return WEBP_MUX_BAD_DATA;
|
||||
if (data.size_ < CHUNK_SIZE_BYTES) return WEBP_MUX_BAD_DATA;
|
||||
|
||||
// All OK. Fill up flags.
|
||||
*flags = GetLE32(data.bytes_);
|
||||
@ -231,8 +229,9 @@ WebPMuxError WebPMuxGetImage(const WebPMux* const mux,
|
||||
WebPMuxError err;
|
||||
WebPMuxImage* wpi = NULL;
|
||||
|
||||
if (mux == NULL || (image == NULL && alpha == NULL))
|
||||
if (mux == NULL || (image == NULL && alpha == NULL)) {
|
||||
return WEBP_MUX_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
err = ValidateForImage(mux);
|
||||
if (err != WEBP_MUX_OK) return err;
|
||||
|
Loading…
x
Reference in New Issue
Block a user