mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-28 14:38:21 +01:00
WebPMuxGetImage: allow image param to be NULL
but not both alpha & image Change-Id: I6822a740de7577eedcbe7529382aa2c020d1e8e4
This commit is contained in:
parent
4be52f4a65
commit
135e8b1942
@ -230,8 +230,8 @@ WebPMuxError WebPMuxGetImage(const WebPMux* const mux,
|
|||||||
WebPMuxError err;
|
WebPMuxError err;
|
||||||
WebPMuxImage* wpi = NULL;
|
WebPMuxImage* wpi = NULL;
|
||||||
|
|
||||||
if (mux == NULL || image == NULL) return WEBP_MUX_INVALID_ARGUMENT;
|
if (mux == NULL || (image == NULL && alpha == NULL))
|
||||||
memset(image, 0, sizeof(*image));
|
return WEBP_MUX_INVALID_ARGUMENT;
|
||||||
|
|
||||||
err = ValidateForImage(mux);
|
err = ValidateForImage(mux);
|
||||||
if (err != WEBP_MUX_OK) return err;
|
if (err != WEBP_MUX_OK) return err;
|
||||||
@ -250,10 +250,13 @@ WebPMuxError WebPMuxGetImage(const WebPMux* const mux,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get image chunk.
|
// Get image chunk.
|
||||||
|
if (image != NULL) {
|
||||||
|
memset(image, 0, sizeof(*image));
|
||||||
if (wpi->vp8_ != NULL) {
|
if (wpi->vp8_ != NULL) {
|
||||||
image->bytes_ = wpi->vp8_->data_;
|
image->bytes_ = wpi->vp8_->data_;
|
||||||
image->size_ = wpi->vp8_->payload_size_;
|
image->size_ = wpi->vp8_->payload_size_;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return WEBP_MUX_OK;
|
return WEBP_MUX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetImage(WebPMux* const mux,
|
|||||||
// image - (out) the image data
|
// image - (out) the image data
|
||||||
// alpha - (out) the alpha data of the image (if present)
|
// alpha - (out) the alpha data of the image (if present)
|
||||||
// Returns:
|
// Returns:
|
||||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux or image is NULL
|
// WEBP_MUX_INVALID_ARGUMENT - if either mux or both image & alpha are NULL
|
||||||
// OR if mux contains animation/tiling.
|
// OR mux contains animation/tiling.
|
||||||
// WEBP_MUX_NOT_FOUND - if image is not present in mux object.
|
// WEBP_MUX_NOT_FOUND - if image is not present in mux object.
|
||||||
// WEBP_MUX_OK - on success.
|
// WEBP_MUX_OK - on success.
|
||||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetImage(const WebPMux* const mux,
|
WEBP_EXTERN(WebPMuxError) WebPMuxGetImage(const WebPMux* const mux,
|
||||||
|
Loading…
Reference in New Issue
Block a user