Alexandre Julliard : wordpad: Fix a compiler warning.

Alexandre Julliard julliard at winehq.org
Mon Dec 10 08:54:31 CST 2007


Module: wine
Branch: master
Commit: 2702da697753e2694ce9c10b737e00f965153a18
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2702da697753e2694ce9c10b737e00f965153a18

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 10 15:15:42 2007 +0100

wordpad: Fix a compiler warning.

---

 programs/wordpad/wordpad.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c
index ce3e161..8c97ae5 100644
--- a/programs/wordpad/wordpad.c
+++ b/programs/wordpad/wordpad.c
@@ -724,7 +724,7 @@ static void set_default_font(void)
     SendMessageW(hEditorWnd, EM_SETCHARFORMAT,  SCF_DEFAULT, (LPARAM)&fmt);
 }
 
-static void add_font(LPWSTR fontName, DWORD fontType, HWND hListWnd, NEWTEXTMETRICEXW *ntmc)
+static void add_font(LPCWSTR fontName, DWORD fontType, HWND hListWnd, NEWTEXTMETRICEXW *ntmc)
 {
     COMBOBOXEXITEMW cbItem;
     WCHAR buffer[MAX_PATH];
@@ -742,7 +742,8 @@ static void add_font(LPWSTR fontName, DWORD fontType, HWND hListWnd, NEWTEXTMETR
         else
             break;
     }
-    cbItem.pszText = fontName;
+    cbItem.pszText = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(fontName) + 1)*sizeof(WCHAR) );
+    lstrcpyW( cbItem.pszText, fontName );
 
     cbItem.mask |= CBEIF_LPARAM;
     if(fontType & RASTER_FONTTYPE)
@@ -750,6 +751,7 @@ static void add_font(LPWSTR fontName, DWORD fontType, HWND hListWnd, NEWTEXTMETR
 
     cbItem.lParam = MAKELONG(fontType,fontHeight);
     SendMessageW(hListWnd, CBEM_INSERTITEMW, 0, (LPARAM)&cbItem);
+    HeapFree( GetProcessHeap(), 0, cbItem.pszText );
 }
 
 static void dialog_choose_font(void)




More information about the wine-cvs mailing list