From 33c2ad5712a13d4ec19c99121b6062876162ba6c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 19 May 2003 23:24:30 +0000 Subject: [PATCH] Fixed return value of GetTextFaceA. --- objects/font.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/objects/font.c b/objects/font.c index 81139eba5c2..31a18df1d3e 100644 --- a/objects/font.c +++ b/objects/font.c @@ -860,8 +860,11 @@ INT WINAPI GetTextFaceA( HDC hdc, INT count, LPSTR name ) GetTextFaceW( hdc, res, nameW ); if (name) - res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, count, - NULL, NULL); + { + if (count && !WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, count, NULL, NULL)) + name[count-1] = 0; + res = strlen(name); + } else res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL); HeapFree( GetProcessHeap(), 0, nameW );