Michael Stefaniuc : d3dx9: Use the ARRAY_SIZE() macro.

Alexandre Julliard julliard at winehq.org
Wed Nov 14 16:18:59 CST 2018


Module: wine
Branch: master
Commit: df722d262837e612baecf87385cceb1907101047
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=df722d262837e612baecf87385cceb1907101047

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Tue Nov 13 20:33:39 2018 +0100

d3dx9: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/font.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index 5522dea..418a3be 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -105,7 +105,7 @@ static HRESULT WINAPI ID3DXFontImpl_GetDescA(ID3DXFont *iface, D3DXFONT_DESCA *d
 
     if( !desc ) return D3DERR_INVALIDCALL;
     memcpy(desc, &This->desc, FIELD_OFFSET(D3DXFONT_DESCA, FaceName));
-    WideCharToMultiByte(CP_ACP, 0, This->desc.FaceName, -1, desc->FaceName, sizeof(desc->FaceName) / sizeof(CHAR), NULL, NULL);
+    WideCharToMultiByte(CP_ACP, 0, This->desc.FaceName, -1, desc->FaceName, ARRAY_SIZE(desc->FaceName), NULL, NULL);
 
     return D3D_OK;
 }
@@ -284,8 +284,7 @@ HRESULT WINAPI D3DXCreateFontIndirectA(IDirect3DDevice9 *device, const D3DXFONT_
     /* Copy everything but the last structure member. This requires the
        two D3DXFONT_DESC structures to be equal until the FaceName member */
     memcpy(&widedesc, desc, FIELD_OFFSET(D3DXFONT_DESCA, FaceName));
-    MultiByteToWideChar(CP_ACP, 0, desc->FaceName, -1,
-                        widedesc.FaceName, sizeof(widedesc.FaceName)/sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, desc->FaceName, -1, widedesc.FaceName, ARRAY_SIZE(widedesc.FaceName));
     return D3DXCreateFontIndirectW(device, &widedesc, font);
 }
 




More information about the wine-cvs mailing list