Tim Hentenaar : user32: GetTabbedTextExtent() returns non-zero value when nCount == 0.

Alexandre Julliard julliard at winehq.org
Wed Apr 27 12:47:26 CDT 2011


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

Author: Tim Hentenaar <tim at hentenaar.com>
Date:   Sat Apr 23 07:36:12 2011 -0400

user32: GetTabbedTextExtent() returns non-zero value when nCount == 0.

---

 dlls/user32/tests/text.c |    3 +++
 dlls/user32/text.c       |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/text.c b/dlls/user32/tests/text.c
index 88ea6b5..b45a312 100644
--- a/dlls/user32/tests/text.c
+++ b/dlls/user32/tests/text.c
@@ -617,6 +617,9 @@ static void test_TabbedText(void)
     ret = GetTextMetricsA( hdc, &tm);
     ok( ret, "GetTextMetrics error %u\n", GetLastError());
 
+    extent = GetTabbedTextExtentA( hdc, "x", 0, 1, tabs);
+    ok( extent == 0, "GetTabbedTextExtentA returned non-zero on nCount == 0\n");
+
     extent = GetTabbedTextExtentA( hdc, "x", 1, 1, tabs);
     cx = LOWORD( extent);
     cy = HIWORD( extent);
diff --git a/dlls/user32/text.c b/dlls/user32/text.c
index e34877f..c9ded68 100644
--- a/dlls/user32/text.c
+++ b/dlls/user32/text.c
@@ -1281,6 +1281,8 @@ static LONG TEXT_TabbedTextOut( HDC hdc, INT x, INT y, LPCWSTR lpstr,
     int i, j;
     int start = x;
 
+    if (!lpstr || count == 0) return 0;
+
     if (!lpTabPos)
         cTabStops=0;
 




More information about the wine-cvs mailing list