dlls/kernel32/local16.c

Gerald Pfeifer gerald at pfeifer.com
Sat Nov 3 08:36:44 CDT 2007


ChangeLog:
Handle default case in Local32_FromHandle().  Minor formatting tweak.


In Local32_ToHandle() directly above this function, the variables
passed by reference are initialized to NULL at the beginning of the
function.  If you prefer I can prepare a patch along these lines instead.

Gerald

Index: dlls/kernel32/local16.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel32/local16.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 local16.c
--- dlls/kernel32/local16.c	4 Jun 2007 13:16:17 -0000	1.3
+++ dlls/kernel32/local16.c	3 Nov 2007 13:11:58 -0000
@@ -31,6 +31,7 @@
 
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 #include "wine/winbase16.h"
@@ -1938,8 +1939,8 @@ static VOID Local32_FromHandle( LOCAL32H
             WORD *selTable = (LPWORD)(header->base + header->selectorTableOffset);
             DWORD offset   = (LPBYTE)ptr - header->base;
             *addr = MAKELONG( offset & 0x7fff, selTable[offset >> 15] );
+            break;
         }
-        break;
 
         case -1:    /* 32-bit offset */
         case  2:
@@ -1949,6 +1950,10 @@ static VOID Local32_FromHandle( LOCAL32H
         case  0:    /* handle */
             *addr = (LPBYTE)handle - (LPBYTE)header;
             break;
+
+        default:
+            assert( 0 ); /* should never happen */
+            *addr = 0;
     }
 }



More information about the wine-patches mailing list