ChangeSet ID: 21164 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/11/08 06:55:40
Modified files: dlls/hhctrl.ocx: hhctrl.c dlls/gdi : font.c
Log message: Vincent BĂ©ron vberon@mecano.gme.usherb.ca Correct some allocated buffer lengths while converting to Unicode.
Patch: http://cvs.winehq.org/patch.py?id=21164
Old revision New revision Changes Path 1.10 1.11 +1 -1 wine/dlls/hhctrl.ocx/hhctrl.c 1.24 1.25 +9 -11 wine/dlls/gdi/font.c
Index: wine/dlls/hhctrl.ocx/hhctrl.c diff -u -p wine/dlls/hhctrl.ocx/hhctrl.c:1.10 wine/dlls/hhctrl.ocx/hhctrl.c:1.11 --- wine/dlls/hhctrl.ocx/hhctrl.c:1.10 8 Nov 2005 12:55:40 -0000 +++ wine/dlls/hhctrl.ocx/hhctrl.c 8 Nov 2005 12:55:40 -0000 @@ -111,7 +111,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCST { DWORD len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
- wfile = HeapAlloc( GetProcessHeap(), 0, (len+1) * sizeof(WCHAR)); + wfile = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len ); }
Index: wine/dlls/gdi/font.c diff -u -p wine/dlls/gdi/font.c:1.24 wine/dlls/gdi/font.c:1.25 --- wine/dlls/gdi/font.c:1.24 8 Nov 2005 12:55:40 -0000 +++ wine/dlls/gdi/font.c 8 Nov 2005 12:55:40 -0000 @@ -344,15 +344,14 @@ static void FONT_NewTextMetricExWToA(con /*********************************************************************** * FONT_mbtowc * - * Returns a '\0' terminated Unicode translation of str using the - * charset of the currently selected font in hdc. If count is -1 then - * str is assumed to be '\0' terminated, otherwise it contains the - * number of bytes to convert. If plenW is non-NULL, on return it - * will point to the number of WCHARs (excluding the '\0') that have - * been written. If pCP is non-NULL, on return it will point to the - * codepage used in the conversion. - * The caller should free the returned LPWSTR from the process - * heap itself. + * Returns a Unicode translation of str using the charset of the + * currently selected font in hdc. If count is -1 then str is assumed + * to be '\0' terminated, otherwise it contains the number of bytes to + * convert. If plenW is non-NULL, on return it will point to the + * number of WCHARs that have been written. If pCP is non-NULL, on + * return it will point to the codepage used in the conversion. The + * caller should free the returned LPWSTR from the process heap + * itself. */ static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP) { @@ -401,9 +400,8 @@ static LPWSTR FONT_mbtowc(HDC hdc, LPCST
if(count == -1) count = strlen(str); lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0); - strW = HeapAlloc(GetProcessHeap(), 0, (lenW + 1) * sizeof(WCHAR)); + strW = HeapAlloc(GetProcessHeap(), 0, lenW*sizeof(WCHAR)); MultiByteToWideChar(cp, 0, str, count, strW, lenW); - strW[lenW] = '\0'; TRACE("mapped %s -> %s\n", debugstr_an(str, count), debugstr_wn(strW, lenW)); if(plenW) *plenW = lenW; if(pCP) *pCP = cp;