Andrew Talbot : user/tests: Write-strings warnings fix.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 27 05:42:33 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: aa57a0b939f304dcee7122e08d4265375e51cedf
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=aa57a0b939f304dcee7122e08d4265375e51cedf

Author: Andrew Talbot <Andrew.Talbot at talbotville.com>
Date:   Wed Jul 26 22:22:05 2006 +0100

user/tests: Write-strings warnings fix.

---

 dlls/user/tests/menu.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/user/tests/menu.c b/dlls/user/tests/menu.c
index 3dadbb3..23fb1e8 100644
--- a/dlls/user/tests/menu.c
+++ b/dlls/user/tests/menu.c
@@ -24,6 +24,7 @@ #define NONAMELESSSTRUCT
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
+#include <string.h>
 #include <assert.h>
 
 #include "windef.h"
@@ -75,7 +76,7 @@ #define MOD_NRMENUS 8
 
  /* menu texts with their sizes */
 static struct {
-    char *text;
+    LPCSTR text;
     SIZE size; /* size of text up to any \t */
     SIZE sc_size; /* size of the short-cut */
 } MOD_txtsizes[] = {
@@ -324,13 +325,14 @@ static void test_menu_ownerdraw(void)
 /* 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, LPCSTR text, SIZE size, SIZE sc_size)
 {
     BOOL ret;
     HMENU hmenu, submenu;
     MENUITEMINFO mii={ sizeof( MENUITEMINFO )};
     MENUINFO mi;
     RECT rc;
+    CHAR text_copy[16];
     int hastab,  expect;
     int failed = 0;
 
@@ -344,7 +346,8 @@ static void test_mbs_help( int ispop, in
     if( text ) {
         char *p;
         mii.fMask |= MIIM_STRING;
-        mii.dwTypeData = text;
+        strcpy(text_copy, text);
+        mii.dwTypeData = text_copy; /* structure member declared non-const */
         if( ( p = strchr( text, '\t'))) {
             hastab = *(p + 1) ? 2 : 1;
         }




More information about the wine-cvs mailing list