Matteo Bruni : d3dx9: Switch character count to unsigned int in the DrawText implementation.

Alexandre Julliard julliard at winehq.org
Wed Apr 1 15:50:59 CDT 2020


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Wed Apr  1 20:27:12 2020 +0200

d3dx9: Switch character count to unsigned int in the DrawText implementation.

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

---

 dlls/d3dx9_36/font.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index 54b1574bb1..ebbda69580 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -552,11 +552,11 @@ static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len,
     heap_free(sla);
 }
 
-static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count,
+static const WCHAR *read_line(HDC hdc, const WCHAR *str, unsigned int *count,
         WCHAR *dest, unsigned int *dest_len, int width, DWORD format, SIZE *size)
 {
+    unsigned int orig_count = *count;
     unsigned int i = 0;
-    int orig_count = *count;
     int num_fit;
 
     *dest_len = 0;
@@ -600,25 +600,25 @@ static const WCHAR *read_line(HDC hdc, const WCHAR *str, int *count,
 }
 
 static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite,
-        const WCHAR *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
+        const WCHAR *string, INT in_count, RECT *rect, DWORD format, D3DCOLOR color)
 {
     struct d3dx_font *font = impl_from_ID3DXFont(iface);
     ID3DXSprite *target = sprite;
-    WCHAR *line;
     RECT textrect = {0};
     int lh, x, y, width;
+    unsigned int count;
     int max_width = 0;
+    WCHAR *line;
     int ret = 0;
     SIZE size;
 
-    TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x.\n",
-          iface,  sprite, debugstr_wn(string, count), count, wine_dbgstr_rect(rect), format, color);
+    TRACE("iface %p, sprite %p, string %s, in_count %d, rect %s, format %#x, color 0x%08x.\n",
+          iface,  sprite, debugstr_wn(string, in_count), in_count, wine_dbgstr_rect(rect), format, color);
 
     if (!string)
         return 0;
 
-    if (count < 0)
-        count = lstrlenW(string);
+    count = in_count < 0 ? lstrlenW(string) : in_count;
 
     if (!count)
         return 0;




More information about the wine-cvs mailing list