[PATCH v2] gdi32: Avoid awkward cast in GetGlyphOutlineA (Coverity)

Alex Henrie alexhenrie24 at gmail.com
Fri Jun 1 08:08:01 CDT 2018


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
v2: Moved the declaration of WCHAR into the if statement to be with all
the other declarations

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

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 17b160d2dc..9f47578a70 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -2823,6 +2823,7 @@ DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat,
         UINT cp;
         int len;
         char mbchs[2];
+        WCHAR wChar = 0;
 
         cp = GdiGetCodePage(hdc);
         if (IsDBCSLeadByteEx(cp, uChar >> 8)) {
@@ -2833,8 +2834,8 @@ DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat,
             len = 1;
             mbchs[0] = (uChar & 0xff);
         }
-        uChar = 0;
-        MultiByteToWideChar(cp, 0, mbchs, len, (LPWSTR)&uChar, 1);
+        MultiByteToWideChar(cp, 0, mbchs, len, &wChar, 1);
+        uChar = wChar;
     }
 
     return GetGlyphOutlineW(hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer,
-- 
2.17.0




More information about the wine-devel mailing list