PATCH: controls, windows fixes

Marcus Meissner marcus at jet.franken.de
Sun Jul 11 12:45:12 CDT 2004


Hi,

There are those warnings in controls/ and windows/ with the new compiler:

../../controls/combo.c: In function `COMBO_Command':
../../controls/combo.c:1346: Warnung: case label value -2 is less than minimum value for type
../../controls/menu.c: In function `MENU_DrawMenuItem':
../../controls/menu.c:777: Warnung: case label value -1 is less than minimum value for type
../../controls/menu.c: In function `MENU_CalcItemSize':
../../controls/menu.c:721: Warnung: case label value -1 is less than minimum value for type
../../windows/nonclient.c: In function `NC_HandleSetCursor':
../../windows/nonclient.c:1135: Warnung: case label value -2 is less than minimum value for type

And they are correct warnings, since we do:

	switch (unsigned short casted expression) {
	...
	case -1:	/*stuff*/
	...

and LBN_ERRSPACE, HBMMENU_CALLBACK and HTERROR are negative.

Appended is a suggested patch, I am not sure if it is good enough.


Ciao, Marcus

Changelog:
	Fixed switch (unsigned int) { case -1 / -2: } problems.


Index: controls/combo.c
===================================================================
RCS file: /home/wine/wine/controls/combo.c,v
retrieving revision 1.106
diff -u -r1.106 combo.c
--- controls/combo.c	17 May 2004 19:49:19 -0000	1.106
+++ controls/combo.c	11 Jul 2004 17:41:44 -0000
@@ -1345,7 +1345,7 @@
    {
        switch( HIWORD(wParam) )
        {
-	   case LBN_ERRSPACE:
+	   case (WORD)LBN_ERRSPACE:
 		CB_NOTIFY( lphc, CBN_ERRSPACE );
 		break;
 
Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.183
diff -u -r1.183 menu.c
--- controls/menu.c	18 Jun 2004 19:31:57 -0000	1.183
+++ controls/menu.c	11 Jul 2004 17:41:47 -0000
@@ -735,7 +735,7 @@
             size->cx = GetSystemMetrics( SM_CYMENU ) - 4;
             size->cy = size->cx;
             return;
-        case (INT_PTR)HBMMENU_CALLBACK:
+        case (WORD)(INT_PTR)HBMMENU_CALLBACK:
         case (INT_PTR)HBMMENU_POPUP_CLOSE:
         case (INT_PTR)HBMMENU_POPUP_RESTORE:
         case (INT_PTR)HBMMENU_POPUP_MAXIMIZE:
@@ -806,7 +806,7 @@
         case (INT_PTR)HBMMENU_MBAR_CLOSE_D:
             flags = DFCS_CAPTIONCLOSE | DFCS_INACTIVE;
             break;
-        case (INT_PTR)HBMMENU_CALLBACK:
+        case (WORD)(INT_PTR)HBMMENU_CALLBACK:
         case (INT_PTR)HBMMENU_POPUP_CLOSE:
         case (INT_PTR)HBMMENU_POPUP_RESTORE:
         case (INT_PTR)HBMMENU_POPUP_MAXIMIZE:
Index: windows/nonclient.c
===================================================================
RCS file: /home/wine/wine/windows/nonclient.c,v
retrieving revision 1.119
diff -u -r1.119 nonclient.c
--- windows/nonclient.c	1 Apr 2004 04:57:12 -0000	1.119
+++ windows/nonclient.c	11 Jul 2004 17:41:48 -0000
@@ -1134,7 +1134,7 @@
 
     switch(LOWORD(lParam))
     {
-    case HTERROR:
+    case (WORD)HTERROR:
 	{
 	    WORD msg = HIWORD( lParam );
 	    if ((msg == WM_LBUTTONDOWN) || (msg == WM_MBUTTONDOWN) ||
-- 



More information about the wine-patches mailing list