[7918] Improve portability in work with uint64 string format specifiers and in code literals. Author: VladimirMangos
* Replace platform seelction MaNGOS code for select format descriptor for uint64 by using ACE define.
I64FMTD renamed to UI64FMTD for more clear name.
* Add new define UI64LIT (base at ACE seelction) for build portables uint64 literals.
Please always use UI64LIT(0x00001) instead less portable 0x00001LL
--HG--
branch : trunk
This commit is contained in:
+8
-4
@@ -103,6 +103,7 @@
|
||||
#include "LockedQueue.h"
|
||||
#include "Threading.h"
|
||||
|
||||
#include <ace/Basic_Types.h>
|
||||
#include <ace/Guard_T.h>
|
||||
#include <ace/RW_Thread_Mutex.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
@@ -130,8 +131,6 @@
|
||||
#include <float.h>
|
||||
|
||||
#define I64FMT "%016I64X"
|
||||
#define I64FMTD "%I64u"
|
||||
#define SI64FMTD "%I64d"
|
||||
#define snprintf _snprintf
|
||||
#define atoll __atoi64
|
||||
#define vsnprintf _vsnprintf
|
||||
@@ -143,10 +142,15 @@
|
||||
#define stricmp strcasecmp
|
||||
#define strnicmp strncasecmp
|
||||
#define I64FMT "%016llX"
|
||||
#define I64FMTD "%llu"
|
||||
#define SI64FMTD "%lld"
|
||||
|
||||
#endif
|
||||
|
||||
#define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER
|
||||
#define UI64LIT(N) ACE_UINT64_LITERAL(N)
|
||||
|
||||
#define SI64FMTD ACE_INT64_FORMAT_SPECIFIER
|
||||
#define SI64LIT(N) ACE_INT64_LITERAL(N)
|
||||
|
||||
inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; }
|
||||
|
||||
#define atol(a) strtoul( a, NULL, 10)
|
||||
|
||||
@@ -59,7 +59,7 @@ class Field
|
||||
if(mValue)
|
||||
{
|
||||
uint64 value;
|
||||
sscanf(mValue,I64FMTD,&value);
|
||||
sscanf(mValue,UI64FMTD,&value);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
|
||||
+1
-1
@@ -353,7 +353,7 @@ void Log::outDB( LogTypes type, const char * str )
|
||||
LoginDatabase.escape_string(new_str);
|
||||
|
||||
LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, string) "
|
||||
"VALUES ("I64FMTD", %u, %u, '%s');", uint64(time(0)), realm, (uint32)type, new_str.c_str());
|
||||
"VALUES (" UI64FMTD ", %u, %u, '%s');", uint64(time(0)), realm, (uint32)type, new_str.c_str());
|
||||
}
|
||||
|
||||
void Log::outString( const char * str, ... )
|
||||
|
||||
Reference in New Issue
Block a user