[PATCH] wincodecs: Remove some of error handling duplication in InitializePredefined()

Dmitry Timoshkov dmitry at baikal.ru
Thu Dec 8 05:32:25 CST 2016


Nikolay Sivov <nsivov at codeweavers.com> wrote:

>      case WICBitmapPaletteTypeFixedHalftone125:
>          colors = generate_halftone125_palette(&count, add_transparent);
> -        if (!colors) return E_OUTOFMEMORY;
>          break;
>  
>      case WICBitmapPaletteTypeFixedHalftone216:
>          colors = generate_halftone216_palette(&count, add_transparent);
> -        if (!colors) return E_OUTOFMEMORY;
>          break;
>  
>      case WICBitmapPaletteTypeFixedHalftone252:
>          colors = generate_halftone252_palette(&count, add_transparent);
> -        if (!colors) return E_OUTOFMEMORY;
>          break;
>  
>      case WICBitmapPaletteTypeFixedHalftone256:
>          colors = generate_halftone256_palette(&count, add_transparent);
> -        if (!colors) return E_OUTOFMEMORY;
>          break;
>  
>      default:
> @@ -406,6 +417,9 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
>          return E_INVALIDARG;
>      }
>  
> +    if (!colors)
> +        return E_OUTOFMEMORY;

That's hardly an improvement, at best this is a personal preference.
When I wrote this code I was considering other versions as well, and
current variant I like better. Please leave this code as it is.

-- 
Dmitry.



More information about the wine-devel mailing list