[PATCH] krnl386.exe16: Fix dialog size computation.

Alex Henrie alexhenrie24 at gmail.com
Fri Oct 23 20:36:48 CDT 2015


Cc: Andrew Talbot <andrew.talbot at talbotville.com>

Coverity #1225841, "The same code is executed regardless of whether
dialogEx is true, because the 'then' and 'else' branches are identical."

This partially reverts commit a5bf67ef9b5f85ad66e722184bf828a79e0191a7,
"kernel: Constify some formal parameters."

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/krnl386.exe16/resource.c | 48 +++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/dlls/krnl386.exe16/resource.c b/dlls/krnl386.exe16/resource.c
index e05ea41..da54f6d 100644
--- a/dlls/krnl386.exe16/resource.c
+++ b/dlls/krnl386.exe16/resource.c
@@ -596,24 +596,24 @@ WORD WINAPI GetDialog32Size16( LPCVOID dialog32 )
         p = (const DWORD *)p + 1; /* exStyle */
 
     nbItems = get_word(&p);
-    p = (const DWORD *)p + 1; /* x */
-    p = (const DWORD *)p + 1; /* y */
-    p = (const DWORD *)p + 1; /* cx */
-    p = (const DWORD *)p + 1; /* cy */
+    p = (const WORD *)p + 1; /* x */
+    p = (const WORD *)p + 1; /* y */
+    p = (const WORD *)p + 1; /* cx */
+    p = (const WORD *)p + 1; /* cy */
 
     /* Skip menu name */
-    switch (*(const DWORD *)p)
+    switch (*(const WORD *)p)
     {
-    case 0x0000:  p = (const DWORD *)p + 1; break;
-    case 0xffff:  p = (const DWORD *)p + 2; break;
+    case 0x0000:  p = (const WORD *)p + 1; break;
+    case 0xffff:  p = (const WORD *)p + 2; break;
     default:      p = (LPCWSTR)p + strlenW( p ) + 1; break;
     }
 
     /* Skip class name */
-    switch (*(const DWORD *)p)
+    switch (*(const WORD *)p)
     {
-    case 0x0000:  p = (const DWORD *)p + 1; break;
-    case 0xffff:  p = (const DWORD *)p + 2; break;
+    case 0x0000:  p = (const WORD *)p + 1; break;
+    case 0xffff:  p = (const WORD *)p + 2; break;
     default:      p = (LPCWSTR)p + strlenW( p ) + 1; break;
     }
 
@@ -623,11 +623,11 @@ WORD WINAPI GetDialog32Size16( LPCVOID dialog32 )
     /* Skip font info */
     if (style & DS_SETFONT)
     {
-        p = (const DWORD *)p + 1;  /* pointSize */
+        p = (const WORD *)p + 1;  /* pointSize */
         if (dialogEx)
         {
-            p = (const DWORD *)p + 1; /* weight */
-            p = (const DWORD *)p + 1; /* italic */
+            p = (const WORD *)p + 1; /* weight */
+            p = (const WORD *)p + 1; /* italic */
         }
         p = (LPCWSTR)p + strlenW( p ) + 1;  /* faceName */
     }
@@ -650,29 +650,29 @@ WORD WINAPI GetDialog32Size16( LPCVOID dialog32 )
             p = (const DWORD *)p + 1; /* exStyle */
         }
 
-        p = (const DWORD *)p + 1; /* x */
-        p = (const DWORD *)p + 1; /* y */
-        p = (const DWORD *)p + 1; /* cx */
-        p = (const DWORD *)p + 1; /* cy */
+        p = (const WORD *)p + 1; /* x */
+        p = (const WORD *)p + 1; /* y */
+        p = (const WORD *)p + 1; /* cx */
+        p = (const WORD *)p + 1; /* cy */
 
         if (dialogEx)
             p = (const DWORD *)p + 1; /* ID */
         else
-            p = (const DWORD *)p + 1; /* ID */
+            p = (const WORD *)p + 1; /* ID */
 
         /* Skip class name */
-        switch (*(const DWORD *)p)
+        switch (*(const WORD *)p)
         {
-        case 0x0000:  p = (const DWORD *)p + 1; break;
-        case 0xffff:  p = (const DWORD *)p + 2; break;
+        case 0x0000:  p = (const WORD *)p + 1; break;
+        case 0xffff:  p = (const WORD *)p + 2; break;
         default:      p = (LPCWSTR)p + strlenW( p ) + 1; break;
         }
 
         /* Skip window name */
-        switch (*(const DWORD *)p)
+        switch (*(const WORD *)p)
         {
-        case 0x0000:  p = (const DWORD *)p + 1; break;
-        case 0xffff:  p = (const DWORD *)p + 2; break;
+        case 0x0000:  p = (const WORD *)p + 1; break;
+        case 0xffff:  p = (const WORD *)p + 2; break;
         default:      p = (LPCWSTR)p + strlenW( p ) + 1; break;
         }
 
-- 
2.6.2




More information about the wine-patches mailing list