19 Mar
2018
19 Mar
'18
7:41 p.m.
HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, - UINT stride, UINT datasize, BYTE *bits, + UINT stride, UINT datasize, BYTE *data, void *view, UINT offset, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap) { HRESULT hr; BitmapImpl *This; - BYTE *data; UINT bpp;
hr = get_pixelformat_bpp(pixelFormat, &bpp);
data is not being used as an argument. It'd make more sense to keep it as a local and remove bits.
+ if (!stride) stride = (((bpp * width) + 31) / 32) * 4; + size = stride * height; + if (size / height != stride || offset > size) return E_INVALIDARG;
Why is it an error if offset > size?