[COMCTRL32] Remove the checking/setting in TRACKBAR_Create

Paul Vriens Paul.Vriens at xs4all.nl
Fri Jan 14 14:18:39 CST 2005


Hi,

TBS_RIGHT and TBS_BOTTOM are zero, so whatever the outcome of the checks
is:

    oldStyle = newStyle = GetWindowLongW (hwnd, GWL_STYLE);
    if (oldStyle & TBS_VERT) {
       if (! (oldStyle & (TBS_LEFT | TBS_RIGHT | TBS_BOTH)) )
           newStyle |= TBS_RIGHT;
    } else {
       if (! (oldStyle & (TBS_TOP | TBS_BOTTOM | TBS_BOTH)) )
           newStyle |= TBS_BOTTOM;
    }

newStyle will always be equal to oldStyle and this 'if' will never be
entered:

    if (newStyle != oldStyle)
       SetWindowLongW (hwnd, GWL_STYLE, newStyle);

Again all checks should be done on the non-zero flags, which is the case
in the rest of the code

Changelog:
 remove the checking/setting of the defaults in TRACKBAR_Create.

Cheers,

Paul.

Index: dlls/comctl32/trackbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/trackbar.c,v
retrieving revision 1.64
diff -u -r1.64 trackbar.c
--- dlls/comctl32/trackbar.c    9 Jan 2005 16:42:54 -0000       1.64
+++ dlls/comctl32/trackbar.c    14 Jan 2005 19:20:20 -0000
@@ -1336,7 +1336,7 @@
 TRACKBAR_Create (HWND hwnd, LPCREATESTRUCTW lpcs)
 {
     TRACKBAR_INFO *infoPtr;
-    DWORD oldStyle, newStyle;
+    DWORD dwStyle;
  
     infoPtr = (TRACKBAR_INFO *)Alloc (sizeof(TRACKBAR_INFO));
     if (!infoPtr) return -1;
@@ -1359,19 +1359,10 @@
  
     TRACKBAR_InitializeThumb (infoPtr);
  
-    oldStyle = newStyle = GetWindowLongW (hwnd, GWL_STYLE);
-    if (oldStyle & TBS_VERT) {
-       if (! (oldStyle & (TBS_LEFT | TBS_RIGHT | TBS_BOTH)) )
-           newStyle |= TBS_RIGHT;
-    } else {
-       if (! (oldStyle & (TBS_TOP | TBS_BOTTOM | TBS_BOTH)) )
-           newStyle |= TBS_BOTTOM;
-    }
-    if (newStyle != oldStyle)
-       SetWindowLongW (hwnd, GWL_STYLE, newStyle);
+    dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
  
     /* Create tooltip control */
-    if (newStyle & TBS_TOOLTIPS) {
+    if (dwStyle & TBS_TOOLTIPS) {
  
        infoPtr->hwndToolTip =
             CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0,





More information about the wine-patches mailing list