AtoW3.diff: Changelog: Remove the last calls to HEAP_strdupAtoW. AtoW4.diff: Changelog: Remove the HEAP_strdupAtoW macro. -- Matthew Davison <m.davison@virgin.net>
Index: winproc.c =================================================================== RCS file: /home/wine/wine/windows/winproc.c,v retrieving revision 1.99 diff -u -r1.99 winproc.c --- winproc.c 3 Dec 2002 23:34:52 -0000 1.99 +++ winproc.c 23 Jan 2003 20:29:56 -0000 @@ -41,6 +41,7 @@ #include "message.h" #include "thread.h" #include "dde.h" +#include "winternl.h" WINE_DECLARE_DEBUG_CHANNEL(msg); WINE_DECLARE_DEBUG_CHANNEL(relay); @@ -573,6 +574,7 @@ */ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plparam ) { + switch(msg) { case WM_GETTEXT: @@ -593,9 +595,13 @@ case LB_DIR: case LB_ADDFILE: case EM_REPLACESEL: + { + UNICODE_STRING usBuffer; if(!*plparam) return 0; - *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)*plparam); + *plparam = (LPARAM)usBuffer.Buffer; return (*plparam ? 1 : -1); + } case WM_GETTEXTLENGTH: case CB_GETLBTEXTLEN: case LB_GETTEXTLEN: @@ -603,6 +609,7 @@ case WM_NCCREATE: case WM_CREATE: { + UNICODE_STRING usBuffer; struct s { CREATESTRUCTW cs; /* new structure */ LPCWSTR lpszName; /* allocated Name */ @@ -613,11 +620,15 @@ if (!xs) return -1; xs->cs = *(CREATESTRUCTW *)*plparam; if (HIWORD(xs->cs.lpszName)) - xs->lpszName = xs->cs.lpszName = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)xs->cs.lpszName ); + { + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)xs->cs.lpszName); + xs->lpszName = xs->cs.lpszName = usBuffer.Buffer; + } if (HIWORD(xs->cs.lpszClass)) - xs->lpszClass = xs->cs.lpszClass = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)xs->cs.lpszClass ); + { + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)xs->cs.lpszClass); + xs->lpszClass = xs->cs.lpszClass = usBuffer.Buffer; + } *plparam = (LPARAM)xs; } return 1; @@ -628,11 +639,17 @@ if (!cs) return -1; *cs = *(MDICREATESTRUCTW *)*plparam; if (HIWORD(cs->szClass)) - cs->szClass = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)cs->szClass ); + { + UNICODE_STRING usBuffer; + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)cs->szClass); + cs->szClass = usBuffer.Buffer; + } if (HIWORD(cs->szTitle)) - cs->szTitle = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)cs->szTitle ); + { + UNICODE_STRING usBuffer; + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)cs->szTitle); + cs->szTitle = usBuffer.Buffer; + } *plparam = (LPARAM)cs; } return 1; @@ -645,7 +662,11 @@ case LB_SELECTSTRING: if(!*plparam) return 0; if ( WINPROC_TestLBForStr( hwnd )) - *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); + { + UNICODE_STRING usBuffer; + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)*plparam); + *plparam = (LPARAM)usBuffer.Buffer; + } return (*plparam ? 1 : -1); case LB_GETTEXT: /* FIXME: fixed sized buffer */ @@ -666,7 +687,11 @@ case CB_SELECTSTRING: if(!*plparam) return 0; if ( WINPROC_TestCBForStr( hwnd )) - *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); + { + UNICODE_STRING usBuffer; + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)*plparam); + *plparam = (LPARAM)usBuffer.Buffer; + } return (*plparam ? 1 : -1); case CB_GETLBTEXT: /* FIXME: fixed sized buffer */
Index: heap.h =================================================================== RCS file: /home/wine/wine/include/heap.h,v retrieving revision 1.23 diff -u -r1.23 heap.h --- heap.h 23 Oct 2002 20:20:59 -0000 1.23 +++ heap.h 23 Jan 2003 20:39:11 -0000 @@ -27,19 +27,7 @@ #include "winnls.h" /* strdup macros */ -/* DO NOT USE THEM!! they will go away soon */ - -inline static LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str ) -{ - LPWSTR ret; - INT len; - - if (!str) return NULL; - len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); - ret = HeapAlloc( heap, flags, len * sizeof(WCHAR) ); - if (ret) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); - return ret; -} +/* DO NOT USE IT!! it will go away soon */ inline static LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str ) {