mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
wicdec: (msvs) quiet some /analyze warnings
add additional return checks and asserts to avoid: C6102: Using 'XXX' from failed function call ... Change-Id: I51f5fa630324e0cd7b2d9fceefecb4f4021474b1
This commit is contained in:
parent
5487529368
commit
9b228b5416
@ -15,6 +15,7 @@
|
|||||||
#include "webp/config.h"
|
#include "webp/config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef HAVE_WINCODEC_H
|
#ifdef HAVE_WINCODEC_H
|
||||||
@ -109,6 +110,7 @@ static HRESULT ExtractICCP(IWICImagingFactory* const factory,
|
|||||||
IFS(IWICBitmapFrameDecode_GetColorContexts(frame,
|
IFS(IWICBitmapFrameDecode_GetColorContexts(frame,
|
||||||
count, color_contexts,
|
count, color_contexts,
|
||||||
&num_color_contexts));
|
&num_color_contexts));
|
||||||
|
assert(FAILED(hr) || num_color_contexts <= count);
|
||||||
for (i = 0; SUCCEEDED(hr) && i < num_color_contexts; ++i) {
|
for (i = 0; SUCCEEDED(hr) && i < num_color_contexts; ++i) {
|
||||||
WICColorContextType type;
|
WICColorContextType type;
|
||||||
IFS(IWICColorContext_GetType(color_contexts[i], &type));
|
IFS(IWICColorContext_GetType(color_contexts[i], &type));
|
||||||
@ -116,7 +118,7 @@ static HRESULT ExtractICCP(IWICImagingFactory* const factory,
|
|||||||
UINT size;
|
UINT size;
|
||||||
IFS(IWICColorContext_GetProfileBytes(color_contexts[i],
|
IFS(IWICColorContext_GetProfileBytes(color_contexts[i],
|
||||||
0, NULL, &size));
|
0, NULL, &size));
|
||||||
if (size > 0) {
|
if (SUCCEEDED(hr) && size > 0) {
|
||||||
iccp->bytes = (uint8_t*)malloc(size);
|
iccp->bytes = (uint8_t*)malloc(size);
|
||||||
if (iccp->bytes == NULL) {
|
if (iccp->bytes == NULL) {
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
@ -261,7 +263,7 @@ int ReadPictureWithWIC(const char* const filename,
|
|||||||
IFS(IWICBitmapFrameDecode_GetPixelFormat(frame, &src_pixel_format));
|
IFS(IWICBitmapFrameDecode_GetPixelFormat(frame, &src_pixel_format));
|
||||||
IFS(IWICBitmapDecoder_GetContainerFormat(decoder, &src_container_format));
|
IFS(IWICBitmapDecoder_GetContainerFormat(decoder, &src_container_format));
|
||||||
|
|
||||||
if (keep_alpha) {
|
if (SUCCEEDED(hr) && keep_alpha) {
|
||||||
const GUID** guid;
|
const GUID** guid;
|
||||||
for (guid = kAlphaContainers; *guid != NULL; ++guid) {
|
for (guid = kAlphaContainers; *guid != NULL; ++guid) {
|
||||||
if (IsEqualGUID(MAKE_REFGUID(src_container_format),
|
if (IsEqualGUID(MAKE_REFGUID(src_container_format),
|
||||||
|
Loading…
Reference in New Issue
Block a user