Updown: A -> W cleanup

Dimitrie O. Paun dpaun at rogers.com
Sat Oct 23 23:27:46 CDT 2004


ChangeLog
    Use only Unicode functions, it makes it easier to see we are
    fully Unicode compliant.


Index: dlls/comctl32/updown.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/updown.c,v
retrieving revision 1.61
diff -u -r1.61 updown.c
--- dlls/comctl32/updown.c	5 Oct 2004 18:15:29 -0000	1.61
+++ dlls/comctl32/updown.c	24 Oct 2004 04:22:12 -0000
@@ -92,12 +92,12 @@
 #define TIMER_ACCEL        2
 #define TIMER_AUTOPRESS    3
 
-#define BUDDY_UPDOWN_HWND        "buddyUpDownHWND"
-#define BUDDY_SUPERCLASS_WNDPROC "buddySupperClassWndProc"
-
 #define UPDOWN_GetInfoPtr(hwnd) ((UPDOWN_INFO *)GetWindowLongPtrW (hwnd,0))
 #define COUNT_OF(a) (sizeof(a)/sizeof(a[0]))
 
+static const WCHAR BUDDY_UPDOWN_HWND[] = { 'b', 'u', 'd', 'd', 'y', 'U', 'p', 'D', 'o', 'w', 'n', 'H', 'W', 'N', 'D', 0 };
+static const WCHAR  BUDDY_SUPERCLASS_WNDPROC[] = { 'b', 'u', 'd', 'd', 'y', 'S', 'u', 'p', 'p', 'e', 'r', 
+						   'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 };
 static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action);
 
 /***********************************************************************
@@ -427,12 +427,12 @@
 static LRESULT CALLBACK
 UPDOWN_Buddy_SubclassProc(HWND  hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    WNDPROC superClassWndProc = (WNDPROC)GetPropA(hwnd, BUDDY_SUPERCLASS_WNDPROC);
+    WNDPROC superClassWndProc = (WNDPROC)GetPropW(hwnd, BUDDY_SUPERCLASS_WNDPROC);
     TRACE("hwnd=%p, wndProc=%d, uMsg=%04x, wParam=%d, lParam=%d\n",
 	  hwnd, (INT)superClassWndProc, uMsg, wParam, (UINT)lParam);
 
     if (uMsg == WM_KEYDOWN) {
-        HWND upDownHwnd = GetPropA(hwnd, BUDDY_UPDOWN_HWND);
+        HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND);
 
 	UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam);
     }
@@ -452,11 +452,13 @@
  */
 static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
 {
+    static const WCHAR editW[] = { 'E', 'd', 'i', 't', 0 };
+    static const WCHAR  listboxW[] = { 'L', 'i', 's', 't', 'b', 'o', 'x', 0 };
     DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE);
     RECT  budRect;  /* new coord for the buddy */
     int   x, width;  /* new x position and width for the up-down */
     WNDPROC baseWndProc;
-    CHAR buddyClass[40];
+    WCHAR buddyClass[40];
     HWND ret;
 
     TRACE("(hwnd=%p, bud=%p)\n", infoPtr->Self, bud);
@@ -464,7 +466,7 @@
     ret = infoPtr->Buddy;
 
     /* there is already a body assigned */
-    if (infoPtr->Buddy)  RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
+    if (infoPtr->Buddy)  RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
 
     if(!IsWindow(bud))
         bud = 0;
@@ -475,14 +477,14 @@
     if(bud) {
 
         /* keep upDown ctrl hwnd in a buddy property */
-        SetPropA( bud, BUDDY_UPDOWN_HWND, infoPtr->Self);
+        SetPropW( bud, BUDDY_UPDOWN_HWND, infoPtr->Self);
 
         /* Store buddy window class type */
         infoPtr->BuddyType = BUDDY_TYPE_UNKNOWN;
-        if (GetClassNameA(bud, buddyClass, COUNT_OF(buddyClass))) {
-            if (lstrcmpiA(buddyClass, "Edit") == 0)
+        if (GetClassNameW(bud, buddyClass, COUNT_OF(buddyClass))) {
+            if (lstrcmpiW(buddyClass, editW) == 0)
                 infoPtr->BuddyType = BUDDY_TYPE_EDIT;
-            else if (lstrcmpiA(buddyClass, "Listbox") == 0)
+            else if (lstrcmpiW(buddyClass, listboxW) == 0)
                 infoPtr->BuddyType = BUDDY_TYPE_LISTBOX;
         }
 
@@ -490,9 +492,9 @@
             /* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property
                when we reset the upDown ctrl buddy to another buddy because it is not
                good to break the window proc chain. */
-            if (!GetPropA(bud, BUDDY_SUPERCLASS_WNDPROC)) {
+            if (!GetPropW(bud, BUDDY_SUPERCLASS_WNDPROC)) {
                 baseWndProc = (WNDPROC)SetWindowLongPtrW(bud, GWLP_WNDPROC, (LPARAM)UPDOWN_Buddy_SubclassProc);
-                SetPropA(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
+                SetPropW(bud, BUDDY_SUPERCLASS_WNDPROC, (HANDLE)baseWndProc);
             }
         }
 
@@ -710,8 +712,7 @@
 /***********************************************************************
  *           UpDownWndProc
  */
-static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
-				LPARAM lParam)
+static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
     DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
@@ -750,7 +751,7 @@
 	case WM_DESTROY:
 	    if(infoPtr->AccelVect) Free (infoPtr->AccelVect);
 
-	    if(infoPtr->Buddy) RemovePropA(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
+	    if(infoPtr->Buddy) RemovePropW(infoPtr->Buddy, BUDDY_UPDOWN_HWND);
 
 	    Free (infoPtr);
 	    SetWindowLongPtrW (hwnd, 0, 0);



More information about the wine-patches mailing list