d3dx9_36-DrawText: Fix condition when stripping NULL chars at the end of buffer.

This commit is contained in:
Sebastian Lackner 2014-12-31 00:54:52 +01:00
parent 6294cf99ff
commit 706ff96060

View File

@ -1,4 +1,4 @@
From 98842c6d30ae5f0eaec87f7c2d52b542332884bd Mon Sep 17 00:00:00 2001
From 4d6d770eb49046728e4262f796b1d1dd597d288d Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sun, 26 May 2013 19:42:08 +0200
Subject: d3dx9_36: Implement ID3DXFontImpl_DrawText.
@ -21,7 +21,7 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
1 file changed, 210 insertions(+), 19 deletions(-)
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index dd1243e..e4dba78 100644
index dd1243e..368c784 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -36,8 +36,29 @@ struct d3dx_font
@ -128,7 +128,7 @@ index dd1243e..e4dba78 100644
+ return 0;
+
+ /* Strip terminating NULL characters */
+ while (count && !string[count-1])
+ while (count > 0 && !string[count-1])
+ count--;
+
+ height = DrawTextW(This->hdc, string, count, &calc_rect, format | DT_CALCRECT);