Sven Baars : gdi32: Handle 0 count in GetCharacterPlacementW.

Alexandre Julliard julliard at winehq.org
Tue Feb 18 16:13:46 CST 2020


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

Author: Sven Baars <sbaars at codeweavers.com>
Date:   Mon Feb 17 16:28:52 2020 +0100

gdi32: Handle 0 count in GetCharacterPlacementW.

Signed-off-by: Sven Baars <sbaars at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/font.c       | 3 +++
 dlls/gdi32/tests/font.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index d451f30c3e..8788426a2c 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -3313,6 +3313,9 @@ GetCharacterPlacementW(
     TRACE("%s, %d, %d, 0x%08x\n",
           debugstr_wn(lpString, uCount), uCount, nMaxExtent, dwFlags);
 
+    if (!uCount)
+        return 0;
+
     if (!lpResults)
         return GetTextExtentPoint32W(hdc, lpString, uCount, &size) ? MAKELONG(size.cx, size.cy) : 0;
 
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index c96d8b1b56..bc07f11b2c 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4951,9 +4951,9 @@ static void test_GetCharacterPlacement(void)
     result.nGlyphs = 20;
     size2 = GetCharacterPlacementA(hdc, "Wine Test", 0, 0, &result, 0);
     ok(!size2, "Expected GetCharacterPlacementA to fail\n");
-    todo_wine ok(result.nGlyphs == 20, "Unexpected number of glyphs %u\n", result.nGlyphs);
+    ok(result.nGlyphs == 20, "Unexpected number of glyphs %u\n", result.nGlyphs);
     ok(glyphs[0] == '!', "Unexpected first glyph %s\n", wine_dbgstr_wn(glyphs, 1));
-    todo_wine ok(pos[0] == -1, "Unexpected caret position %d\n", pos[0]);
+    ok(pos[0] == -1, "Unexpected caret position %d\n", pos[0]);
 
     size2 = GetCharacterPlacementA(hdc, "Wine Test", 9, 0, NULL, 0);
     ok(size2, "GetCharacterPlacementA failed!\n");




More information about the wine-cvs mailing list