From dffd27ec31952fc7e6da5767203fe03d3769f200 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 15 Oct 2004 20:58:23 +0000 Subject: [PATCH] removed pragma interface which resulted in link errors when inline functions from this file were used; remove wxULongToPtr/wxPtrToULong which could truncate the pointer; added wxUIntToPtr in addition to existing wxPtrToUInt (which now takes const pointer) to replace them git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/defs.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index fb6d8b018c..5384b97696 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -14,10 +14,6 @@ #ifndef _WX_DEFS_H_ #define _WX_DEFS_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "defs.h" -#endif - /* ---------------------------------------------------------------------------- */ /* compiler and OS identification */ /* ---------------------------------------------------------------------------- */ @@ -779,8 +775,8 @@ typedef wxUint32 wxDword; #endif #ifdef __cplusplus -/* And also define a simple function to cast pointer to it. */ -inline wxUIntPtr wxPtrToUInt(void *p) +/* And also define a couple of simple functions to cast pointer to/from it. */ +inline wxUIntPtr wxPtrToUInt(const void *p) { /* VC++ 7.1 gives warnings about casts such as below even when they're @@ -797,6 +793,11 @@ inline wxUIntPtr wxPtrToUInt(void *p) #pragma warning(default: 4311) #endif } + +inline void *wxUIntToPtr(wxUIntPtr p) +{ + return wx_reinterpret_cast(void *, p); +} #endif /*__cplusplus*/ @@ -1048,12 +1049,6 @@ typedef float wxFloat32; #define wxUINT64_SWAP_ON_BE(val) (val) #endif -/* Macros to convert from unsigned long to void pointer. */ -/* High order truncation occurs if the respective type is not large enough. */ -#define WXPTRULONGSLICE (((wxBYTE_ORDER==wxBIG_ENDIAN)&&(sizeof(void*)==8)&&(sizeof(unsigned long)<8))?1:0) -#define wxPtrToULong(p) (((unsigned long*)(&(p)))[WXPTRULONGSLICE]) -#define wxULongToPtr(p,n) (p=NULL,wxPtrToULong(p)=(unsigned long)(n),p) - /* ---------------------------------------------------------------------------- */ /* Geometric flags */ /* ---------------------------------------------------------------------------- */