From a43a3b080319787efc4fe8b3a0bd031910edb51d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 26 Feb 2006 05:03:05 +0000 Subject: [PATCH] committed patch for correct typecasting --- amxmodx/CPlugin.cpp | 2 +- amxmodx/amxmodx.h | 11 +++++++++++ amxmodx/debugger.cpp | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/amxmodx/CPlugin.cpp b/amxmodx/CPlugin.cpp index 0edd4085..e56adcc2 100755 --- a/amxmodx/CPlugin.cpp +++ b/amxmodx/CPlugin.cpp @@ -288,7 +288,7 @@ static cell AMX_NATIVE_CALL invalid_native(AMX *amx, cell *params) } char name[sNAMEMAX + 1]; - int native = (int)(amx->usertags[UT_NATIVE]); + int native = (int)(_INT_PTR)(amx->usertags[UT_NATIVE]); int err = amx_GetNative(amx, native, name); if (err != AMX_ERR_NONE) diff --git a/amxmodx/amxmodx.h b/amxmodx/amxmodx.h index 3807c576..fbaaa3b7 100755 --- a/amxmodx/amxmodx.h +++ b/amxmodx/amxmodx.h @@ -88,6 +88,17 @@ extern AMX_NATIVE_INFO vault_Natives[]; #define DLFREE(m) dlclose(m) #endif +#if defined __GNUC__ + #include + typedef intptr_t _INT_PTR; +#else + #if defined AMD64 + typedef __int64 _INT_PTR; + #else + typedef __int32 _INT_PTR; + #endif +#endif + #ifndef __linux__ typedef HINSTANCE DLHANDLE; #else diff --git a/amxmodx/debugger.cpp b/amxmodx/debugger.cpp index a787b6a5..70e3fa53 100755 --- a/amxmodx/debugger.cpp +++ b/amxmodx/debugger.cpp @@ -395,7 +395,7 @@ int Debugger::FormatError(char *buffer, size_t maxLength) num = (int)*p_cip; }*/ //New code only requires this... - num = (int)m_pAmx->usertags[UT_NATIVE]; + num = (int)(_INT_PTR)m_pAmx->usertags[UT_NATIVE]; amx_err = amx_GetNative(m_pAmx, num, native_name); /*if (num) amx_err = amx_GetNative(m_pAmx, (int)*p_cip, native_name);