Eric Pouech : include/basetsd.h: Define PtrTo(Ul|L)ong to return a long (as SDK does).

Alexandre Julliard julliard at winehq.org
Tue Feb 1 15:21:34 CST 2022


Module: wine
Branch: master
Commit: c3e57fc3e47c33c90e7a0cfaa28a578533e3c7d5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c3e57fc3e47c33c90e7a0cfaa28a578533e3c7d5

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Tue Feb  1 14:04:51 2022 +0100

include/basetsd.h: Define PtrTo(Ul|L)ong to return a long (as SDK does).

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/basetsd.h | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/include/basetsd.h b/include/basetsd.h
index 329db66c8f0..6a6a3945205 100644
--- a/include/basetsd.h
+++ b/include/basetsd.h
@@ -165,6 +165,17 @@ static inline long HandleToLong(const void *h)
     return (long)(LONG_PTR)h;
 }
 
+static inline unsigned long PtrToUlong(const void *p)
+{
+    return (unsigned long)(ULONG_PTR)p;
+}
+
+static inline long PtrToLong(const void *p)
+{
+    return (long)(LONG_PTR)p;
+}
+
+
 #else
 
 static inline unsigned HandleToULong(const void *h)
@@ -177,26 +188,27 @@ static inline int HandleToLong(const void *h)
     return (int)(LONG_PTR)h;
 }
 
-#endif /* !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES) */
-
-static inline void *ULongToHandle(ULONG32 ul)
+static inline unsigned PtrToUlong(const void *p)
 {
-    return (void *)(ULONG_PTR)ul;
+    return (unsigned)(ULONG_PTR)p;
 }
 
-static inline void *LongToHandle(LONG32 l)
+static inline int PtrToLong(const void *p)
 {
-    return (void *)(LONG_PTR)l;
+    return (int)(LONG_PTR)p;
 }
 
-static inline ULONG32 PtrToUlong(const void *p)
+
+#endif /* !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES) */
+
+static inline void *ULongToHandle(ULONG32 ul)
 {
-    return (ULONG32)(ULONG_PTR)p;
+    return (void *)(ULONG_PTR)ul;
 }
 
-static inline LONG32 PtrToLong(const void *p)
+static inline void *LongToHandle(LONG32 l)
 {
-    return (LONG32)(LONG_PTR)p;
+    return (void *)(LONG_PTR)l;
 }
 
 static inline UINT32 PtrToUint(const void *p)




More information about the wine-cvs mailing list