summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/cbasetypes.h25
-rw-r--r--src/common/malloc.c2
-rw-r--r--src/common/socket.c2
-rw-r--r--src/common/sql.c4
-rw-r--r--src/common/timer.c4
-rw-r--r--src/common/timer.h8
6 files changed, 11 insertions, 34 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index aee54a4bc..87f91ef92 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -78,6 +78,7 @@
// NOTE: Visual C++ uses <inttypes.h> and <stdint.h> provided in /3rdparty
//////////////////////////////////////////////////////////////////////////
#include <inttypes.h>
+#include <stdint.h>
//////////////////////////////////////////////////////////////////////////
// typedefs to compensate type size change from 32bit to 64bit
@@ -197,30 +198,6 @@ typedef unsigned long long uint64;
//////////////////////////////////////////////////////////////////////////
-// pointer sized integers
-//////////////////////////////////////////////////////////////////////////
-#undef UINTPTR_MIN
-#undef UINTPTR_MAX
-#undef INTPTR_MIN
-#undef INTPTR_MAX
-#ifdef __64BIT__
-typedef uint64 uintptr;
-typedef int64 intptr;
-#define UINTPTR_MIN UINT64_MIN
-#define UINTPTR_MAX UINT64_MAX
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-#else
-typedef uint32 uintptr;
-typedef int32 intptr;
-#define UINTPTR_MIN UINT32_MIN
-#define UINTPTR_MAX UINT32_MAX
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////
// some redefine of function redefines for some Compilers
//////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) || defined(__BORLANDC__)
diff --git a/src/common/malloc.c b/src/common/malloc.c
index a52d2337a..f80d11fb4 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -428,7 +428,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func )
hash_unfill[ block->unit_hash ] = block;
}
head->size = block->unit_unfill;
- block->unit_unfill = (unsigned short)(((uintptr)head - (uintptr)block->data) / block->unit_size);
+ block->unit_unfill = (unsigned short)(((uintptr_t)head - (uintptr_t)block->data) / block->unit_size);
}
}
}
diff --git a/src/common/socket.c b/src/common/socket.c
index 8f60f8df5..81ea19468 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -938,7 +938,7 @@ static int connect_check_(uint32 ip)
/// Timer function.
/// Deletes old connection history records.
-static int connect_check_clear(int tid, unsigned int tick, int id, intptr data)
+static int connect_check_clear(int tid, unsigned int tick, int id, intptr_t data)
{
int i;
int clear = 0;
diff --git a/src/common/sql.c b/src/common/sql.c
index d8e397e8d..edac5a297 100644
--- a/src/common/sql.c
+++ b/src/common/sql.c
@@ -182,7 +182,7 @@ int Sql_Ping(Sql* self)
/// Wrapper function for Sql_Ping.
///
/// @private
-static int Sql_P_KeepaliveTimer(int tid, unsigned int tick, int id, intptr data)
+static int Sql_P_KeepaliveTimer(int tid, unsigned int tick, int id, intptr_t data)
{
Sql* self = (Sql*)data;
ShowInfo("Pinging SQL server to keep connection alive...\n");
@@ -212,7 +212,7 @@ static int Sql_P_Keepalive(Sql* self)
// establish keepalive
ping_interval = timeout - 30; // 30-second reserve
//add_timer_func_list(Sql_P_KeepaliveTimer, "Sql_P_KeepaliveTimer");
- return add_timer_interval(gettick() + ping_interval*1000, Sql_P_KeepaliveTimer, 0, (intptr)self, ping_interval*1000);
+ return add_timer_interval(gettick() + ping_interval*1000, Sql_P_KeepaliveTimer, 0, (intptr_t)self, ping_interval*1000);
}
diff --git a/src/common/timer.c b/src/common/timer.c
index 86e148ee3..05c53b8a3 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -241,7 +241,7 @@ static int acquire_timer(void)
/// Starts a new timer that is deleted once it expires (single-use).
/// Returns the timer's id.
-int add_timer(unsigned int tick, TimerFunc func, int id, intptr data)
+int add_timer(unsigned int tick, TimerFunc func, int id, intptr_t data)
{
int tid;
@@ -259,7 +259,7 @@ int add_timer(unsigned int tick, TimerFunc func, int id, intptr data)
/// Starts a new timer that automatically restarts itself (infinite loop until manually removed).
/// Returns the timer's id, or INVALID_TIMER if it fails.
-int add_timer_interval(unsigned int tick, TimerFunc func, int id, intptr data, int interval)
+int add_timer_interval(unsigned int tick, TimerFunc func, int id, intptr_t data, int interval)
{
int tid;
diff --git a/src/common/timer.h b/src/common/timer.h
index 354a71113..d27bf4c70 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -19,7 +19,7 @@
// Struct declaration
-typedef int (*TimerFunc)(int tid, unsigned int tick, int id, intptr data);
+typedef int (*TimerFunc)(int tid, unsigned int tick, int id, intptr_t data);
struct TimerData {
unsigned int tick;
@@ -30,7 +30,7 @@ struct TimerData {
// general-purpose storage
int id;
- intptr data;
+ intptr_t data;
};
// Function prototype declaration
@@ -38,8 +38,8 @@ struct TimerData {
unsigned int gettick(void);
unsigned int gettick_nocache(void);
-int add_timer(unsigned int tick, TimerFunc func, int id, intptr data);
-int add_timer_interval(unsigned int tick, TimerFunc func, int id, intptr data, int interval);
+int add_timer(unsigned int tick, TimerFunc func, int id, intptr_t data);
+int add_timer_interval(unsigned int tick, TimerFunc func, int id, intptr_t data, int interval);
const struct TimerData* get_timer(int tid);
int delete_timer(int tid, TimerFunc func);