user/tests: Write-strings warnings fix
Andrew Talbot
Andrew.Talbot at talbotville.com
Mon Jul 24 16:17:40 CDT 2006
Changelog:
user/tests: Write-strings warnings fix.
diff -urN a/dlls/user/tests/menu.c b/dlls/user/tests/menu.c
--- a/dlls/user/tests/menu.c 2006-07-06 12:11:00.000000000 +0100
+++ b/dlls/user/tests/menu.c 2006-07-24 21:59:25.000000000 +0100
@@ -75,7 +75,7 @@
/* menu texts with their sizes */
static struct {
- char *text;
+ const CHAR *text;
SIZE size; /* size of text up to any \t */
SIZE sc_size; /* size of the short-cut */
} MOD_txtsizes[] = {
@@ -324,13 +324,14 @@
/* helper for test_menu_bmp_and_string() */
static void test_mbs_help( int ispop, int hassub, int mnuopt,
HWND hwnd, int arrowwidth, int count, HBITMAP hbmp,
- SIZE bmpsize, char *text, SIZE size, SIZE sc_size)
+ SIZE bmpsize, const CHAR *text, SIZE size, SIZE sc_size)
{
BOOL ret;
HMENU hmenu, submenu;
MENUITEMINFO mii={ sizeof( MENUITEMINFO )};
MENUINFO mi;
RECT rc;
+ CHAR *text_copy = NULL;
int hastab, expect;
int failed = 0;
@@ -344,7 +345,9 @@
if( text ) {
char *p;
mii.fMask |= MIIM_STRING;
- mii.dwTypeData = text;
+ text_copy = HeapAlloc(GetProcessHeap(), 0, strlen(text) + 1);
+ strcpy(text_copy, text);
+ mii.dwTypeData = text_copy;
if( ( p = strchr( text, '\t'))) {
hastab = *(p + 1) ? 2 : 1;
}
@@ -375,6 +378,7 @@
ok( ret, "SetMenuInfo failed with error %ld\n", GetLastError());
}
ret = InsertMenuItem( hmenu, 0, FALSE, &mii);
+ HeapFree(GetProcessHeap(), 0, text_copy);
ok( ret, "InsertMenuItem failed with error %ld\n", GetLastError());
failed = !ret;
if( winetest_debug) {
More information about the wine-patches
mailing list