DSTRICT: cast3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

this is the last patch in the series of fixes for warnings of type "cast
between pointer and integer off different size": it kills the warnings
when converting between ATOM and HSZ (i hope it's the right fix).

License: LGPL, X11
Changelog:
        Michael Stefaniuc <mstefani@redhat.com>
	- fix warnings when converting between an ATOM and a HSZ

bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: dlls/user/dde/misc.c
===================================================================
RCS file: /home/wine/wine/dlls/user/dde/misc.c,v
retrieving revision 1.12
diff -u -r1.12 misc.c
--- dlls/user/dde/misc.c	31 May 2002 23:40:54 -0000	1.12
+++ dlls/user/dde/misc.c	18 Oct 2002 22:26:40 -0000
@@ -42,6 +42,10 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
 
+/* convert between ATOM and HSZ avoiding compiler warnings */
+#define ATOM2HSZ(atom)	((HSZ)	(ULONG_PTR)(atom))
+#define HSZ2ATOM(hsz)	((ATOM)	(ULONG_PTR)(hsz))
+
 static WDML_INSTANCE*	WDML_InstanceList = NULL;
 static DWORD		WDML_MaxInstanceID = 0;  /* OK for present, have to worry about wrap-around later */
 const char		WDML_szEventClass[] = "DdeEventClass";
@@ -836,7 +840,7 @@
 {
     WCHAR nameBuffer[MAX_BUFFER_LEN];
 
-    if (GetAtomNameW((ATOM)hsz, nameBuffer, MAX_BUFFER_LEN))
+    if (GetAtomNameW(HSZ2ATOM(hsz), nameBuffer, MAX_BUFFER_LEN))
 	return GlobalAddAtomW(nameBuffer);
     WARN("HSZ 0x%x not found\n", hsz);
     return 0;
@@ -910,7 +914,7 @@
 		    pPrev->next = pCurrent->next;
 		}
 		HeapFree(GetProcessHeap(), 0, pCurrent);
-		DeleteAtom((ATOM)hsz);
+		DeleteAtom(HSZ2ATOM(hsz));
 	    }
 	    return TRUE;
 	}
@@ -985,10 +989,10 @@
     switch (codepage)
     {
     case CP_WINANSI:
-	ret = GetAtomNameA((ATOM)hsz, ptr, cchMax);
+	ret = GetAtomNameA(HSZ2ATOM(hsz), ptr, cchMax);
 	break;
     case CP_WINUNICODE:
-	ret = GetAtomNameW((ATOM)hsz, ptr, cchMax);
+	ret = GetAtomNameW(HSZ2ATOM(hsz), ptr, cchMax);
     default:
 	ERR("Unknown code page %d\n", codepage);
 	ret = 0;
@@ -1061,11 +1065,11 @@
     switch (codepage)
     {
     case CP_WINANSI:
-	hsz = (HSZ)AddAtomA(ptr);
+	hsz = ATOM2HSZ(AddAtomA(ptr));
 	TRACE("added atom %s with HSZ 0x%x, \n", debugstr_a(ptr), hsz);
 	break;
     case CP_WINUNICODE:
-	hsz = (HSZ)AddAtomW(ptr);
+	hsz = ATOM2HSZ(AddAtomW(ptr));
 	TRACE("added atom %s with HSZ 0x%x, \n", debugstr_w(ptr), hsz);
 	break;
     default:
@@ -1203,8 +1207,8 @@
     int		ret = 0;
     int		ret1, ret2;
 
-    ret1 = GetAtomNameW((ATOM)hsz1, psz1, MAX_BUFFER_LEN);
-    ret2 = GetAtomNameW((ATOM)hsz2, psz2, MAX_BUFFER_LEN);
+    ret1 = GetAtomNameW(HSZ2ATOM(hsz1), psz1, MAX_BUFFER_LEN);
+    ret2 = GetAtomNameW(HSZ2ATOM(hsz2), psz2, MAX_BUFFER_LEN);
 
     TRACE("(%x<%s> %x<%s>);\n", hsz1, debugstr_w(psz1), hsz2, debugstr_w(psz2));
 

Attachment: pgp00058.pgp
Description: PGP signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux