ddraw: Use the available ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f450e8e32f
commit
27ef844bd1
|
@ -1738,7 +1738,7 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
|
|||
|
||||
outsize = NumCodes && Codes ? *NumCodes : 0;
|
||||
|
||||
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
||||
{
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, 0, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
|
||||
|
@ -2395,7 +2395,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
|||
wined3d_mutex_lock();
|
||||
|
||||
pixelformat.dwSize = sizeof(pixelformat);
|
||||
for(fmt = 0; fmt < (sizeof(checkFormatList) / sizeof(checkFormatList[0])); fmt++)
|
||||
for(fmt = 0; fmt < ARRAY_SIZE(checkFormatList); fmt++)
|
||||
{
|
||||
modenum = 0;
|
||||
while (wined3d_enum_adapter_modes(ddraw->wined3d, WINED3DADAPTER_DEFAULT, checkFormatList[fmt],
|
||||
|
@ -3111,7 +3111,7 @@ static BOOL ddraw_match_surface_desc(const DDSURFACEDESC2 *requested, const DDSU
|
|||
if ((requested->dwFlags & provided->dwFlags) != requested->dwFlags)
|
||||
return FALSE;
|
||||
|
||||
for (i=0; i < sizeof(compare)/sizeof(compare[0]); i++)
|
||||
for (i=0; i < ARRAY_SIZE(compare); i++)
|
||||
{
|
||||
if (requested->dwFlags & compare[i].flag
|
||||
&& memcmp((const char *)provided + compare[i].offset,
|
||||
|
@ -3643,7 +3643,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
|
|||
return hr;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(device_list7)/sizeof(device_list7[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(device_list7); i++)
|
||||
{
|
||||
HRESULT ret;
|
||||
|
||||
|
@ -4357,7 +4357,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
|
|||
return hr;
|
||||
}
|
||||
|
||||
for (i = 0; i < (sizeof(formats) / sizeof(*formats)); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
||||
{
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
|
||||
WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
|
||||
|
|
|
@ -1086,7 +1086,7 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
|
|||
return hr;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(FormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, WINED3DUSAGE_TEXTURE, WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
|
@ -1108,7 +1108,7 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(BumpFormatList) / sizeof(*BumpFormatList); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(BumpFormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT,
|
||||
WINED3D_DEVICE_TYPE_HAL, mode.format_id, WINED3DUSAGE_TEXTURE | WINED3DUSAGE_QUERY_LEGACYBUMPMAP,
|
||||
|
@ -1214,7 +1214,7 @@ static HRESULT WINAPI d3d_device2_EnumTextureFormats(IDirect3DDevice2 *iface,
|
|||
return hr;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(FormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, 0, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, WINED3DUSAGE_TEXTURE, WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
|
|
|
@ -740,13 +740,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **out)
|
|||
&& !IsEqualGUID(&IID_IUnknown, riid))
|
||||
return E_NOINTERFACE;
|
||||
|
||||
for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
|
||||
for (i=0; i < ARRAY_SIZE(object_creation); i++)
|
||||
{
|
||||
if (IsEqualGUID(object_creation[i].clsid, rclsid))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == sizeof(object_creation)/sizeof(object_creation[0]))
|
||||
if (i == ARRAY_SIZE(object_creation))
|
||||
{
|
||||
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
|
|
|
@ -768,8 +768,8 @@ void DDRAW_dump_DDSCAPS2(const DDSCAPS2 *in)
|
|||
FE(DDSCAPS2_STEREOSURFACELEFT)
|
||||
};
|
||||
|
||||
DDRAW_dump_flags_nolf(in->dwCaps, flags, sizeof(flags)/sizeof(flags[0]));
|
||||
DDRAW_dump_flags(in->dwCaps2, flags2, sizeof(flags2)/sizeof(flags2[0]));
|
||||
DDRAW_dump_flags_nolf(in->dwCaps, flags, ARRAY_SIZE(flags));
|
||||
DDRAW_dump_flags(in->dwCaps2, flags2, ARRAY_SIZE(flags2));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -806,7 +806,7 @@ DDRAW_dump_pixelformat_flag(DWORD flagmask)
|
|||
FE(DDPF_ZPIXELS)
|
||||
};
|
||||
|
||||
DDRAW_dump_flags_nolf(flagmask, flags, sizeof(flags)/sizeof(flags[0]));
|
||||
DDRAW_dump_flags_nolf(flagmask, flags, ARRAY_SIZE(flags));
|
||||
}
|
||||
|
||||
static void DDRAW_dump_members(DWORD flags, const void *data, const struct member_info *mems, size_t num_mems)
|
||||
|
@ -906,8 +906,7 @@ void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd)
|
|||
{
|
||||
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members_caps, 1);
|
||||
}
|
||||
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members,
|
||||
sizeof(members)/sizeof(members[0]));
|
||||
DDRAW_dump_members(lpddsd->dwFlags, lpddsd, members, ARRAY_SIZE(members));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -984,7 +983,7 @@ void DDRAW_dump_cooperativelevel(DWORD cooplevel)
|
|||
if (TRACE_ON(ddraw))
|
||||
{
|
||||
TRACE(" - ");
|
||||
DDRAW_dump_flags(cooplevel, flags, sizeof(flags)/sizeof(flags[0]));
|
||||
DDRAW_dump_flags(cooplevel, flags, ARRAY_SIZE(flags));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1143,13 +1142,13 @@ void DDRAW_dump_DDCAPS(const DDCAPS *lpcaps)
|
|||
};
|
||||
|
||||
TRACE(" - dwSize : %d\n", lpcaps->dwSize);
|
||||
TRACE(" - dwCaps : "); DDRAW_dump_flags(lpcaps->dwCaps, flags1, sizeof(flags1)/sizeof(flags1[0]));
|
||||
TRACE(" - dwCaps2 : "); DDRAW_dump_flags(lpcaps->dwCaps2, flags2, sizeof(flags2)/sizeof(flags2[0]));
|
||||
TRACE(" - dwCKeyCaps : "); DDRAW_dump_flags(lpcaps->dwCKeyCaps, flags3, sizeof(flags3)/sizeof(flags3[0]));
|
||||
TRACE(" - dwFXCaps : "); DDRAW_dump_flags(lpcaps->dwFXCaps, flags4, sizeof(flags4)/sizeof(flags4[0]));
|
||||
TRACE(" - dwFXAlphaCaps : "); DDRAW_dump_flags(lpcaps->dwFXAlphaCaps, flags5, sizeof(flags5)/sizeof(flags5[0]));
|
||||
TRACE(" - dwPalCaps : "); DDRAW_dump_flags(lpcaps->dwPalCaps, flags6, sizeof(flags6)/sizeof(flags6[0]));
|
||||
TRACE(" - dwSVCaps : "); DDRAW_dump_flags(lpcaps->dwSVCaps, flags7, sizeof(flags7)/sizeof(flags7[0]));
|
||||
TRACE(" - dwCaps : "); DDRAW_dump_flags(lpcaps->dwCaps, flags1, ARRAY_SIZE(flags1));
|
||||
TRACE(" - dwCaps2 : "); DDRAW_dump_flags(lpcaps->dwCaps2, flags2, ARRAY_SIZE(flags2));
|
||||
TRACE(" - dwCKeyCaps : "); DDRAW_dump_flags(lpcaps->dwCKeyCaps, flags3, ARRAY_SIZE(flags3));
|
||||
TRACE(" - dwFXCaps : "); DDRAW_dump_flags(lpcaps->dwFXCaps, flags4, ARRAY_SIZE(flags4));
|
||||
TRACE(" - dwFXAlphaCaps : "); DDRAW_dump_flags(lpcaps->dwFXAlphaCaps, flags5, ARRAY_SIZE(flags5));
|
||||
TRACE(" - dwPalCaps : "); DDRAW_dump_flags(lpcaps->dwPalCaps, flags6, ARRAY_SIZE(flags6));
|
||||
TRACE(" - dwSVCaps : "); DDRAW_dump_flags(lpcaps->dwSVCaps, flags7, ARRAY_SIZE(flags7));
|
||||
TRACE("...\n");
|
||||
TRACE(" - dwNumFourCCCodes : %d\n", lpcaps->dwNumFourCCCodes);
|
||||
TRACE(" - dwCurrVisibleOverlays : %d\n", lpcaps->dwCurrVisibleOverlays);
|
||||
|
|
Loading…
Reference in New Issue