[PATCH v3 1/5] d3dx9: Implement ID3DXFont_PreloadText.

Matteo Bruni matteo.mystral at gmail.com
Tue Mar 3 07:06:50 CST 2020


Hi Sven,

I'm attaching a diff to be applied on top of this patch. Does it look
okay to you?
In particular I'm interested if you have more tests not yet upstream.
-------------- next part --------------
diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
index 81ba1e4fa0f..a84f55ab1bb 100644
--- a/dlls/d3dx9_36/font.c
+++ b/dlls/d3dx9_36/font.c
@@ -426,21 +426,23 @@ static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(ID3DXFont *iface, const char *s
 
     TRACE("iface %p, string %s, count %d.\n", iface, debugstr_an(string, count), count);
 
-    if (!string && !count)
+    if (!count)
         return D3D_OK;
 
     if (!string)
         return D3DERR_INVALIDCALL;
 
-    countW = MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, NULL, 0);
+    if (count < 0)
+        count = -1;
+    countW = MultiByteToWideChar(CP_ACP, 0, string, count, NULL, 0);
 
     wstr = heap_alloc(countW * sizeof(*wstr));
     if (!wstr)
         return E_OUTOFMEMORY;
 
-    MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, wstr, countW);
+    MultiByteToWideChar(CP_ACP, 0, string, count, wstr, countW);
 
-    hr = ID3DXFont_PreloadTextW(iface, wstr, count < 0 ? countW - 1 : countW);
+    hr = ID3DXFont_PreloadTextW(iface, wstr, countW);
 
     heap_free(wstr);
 
@@ -455,7 +457,7 @@ static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(ID3DXFont *iface, const WCHAR *
 
     TRACE("iface %p, string %s, count %d.\n", iface, debugstr_wn(string, count), count);
 
-    if (!string && !count)
+    if (!count)
         return D3D_OK;
 
     if (!string)


More information about the wine-devel mailing list