* more fixes to make gcc happy. thx shlainn!

This commit is contained in:
false_genesis 2008-03-28 18:19:54 +00:00
parent f57fd3aef3
commit cb74a228dc
8 changed files with 33 additions and 47 deletions

View File

@ -43,7 +43,7 @@ std::string DefScriptTools::toString(ldbl num)
// hex numbers: 0xa56ff, 0XFF, 0xDEADBABE, etc (must begin with 0x) // hex numbers: 0xa56ff, 0XFF, 0xDEADBABE, etc (must begin with 0x)
// float numbers: 99.65, 0.025 // float numbers: 99.65, 0.025
// negative numbers: -100, -0x3d, -55.123 // negative numbers: -100, -0x3d, -55.123
ldbl DefScriptTools::toNumber(std::string& str) ldbl DefScriptTools::toNumber(std::string str)
{ {
ldbl num=0; ldbl num=0;
uint64 u=0; uint64 u=0;
@ -93,14 +93,14 @@ ldbl DefScriptTools::toNumber(std::string& str)
return num; return num;
} }
bool DefScriptTools::isTrue(std::string& s) bool DefScriptTools::isTrue(std::string s)
{ {
if(s.empty() || s=="false" || s=="0") if(s.empty() || s=="false" || s=="0")
return false; return false;
return true; return true;
} }
uint64 DefScriptTools::toUint64(std::string& str) uint64 DefScriptTools::toUint64(std::string str)
{ {
bool negative=false; bool negative=false;
uint64 num = 0; uint64 num = 0;
@ -135,7 +135,7 @@ uint64 DefScriptTools::toUint64(std::string& str)
return num; return num;
} }
uint64 DefScriptTools::atoi64(std::string& str) uint64 DefScriptTools::atoi64(std::string str)
{ {
uint64 l = 0; uint64 l = 0;
for (size_t i = 0; i < str.size(); i++) for (size_t i = 0; i < str.size(); i++)

View File

@ -18,10 +18,10 @@ namespace DefScriptTools
return ss.str(); return ss.str();
} }
ldbl toNumber(std::string&); ldbl toNumber(std::string);
bool isTrue(std::string&); bool isTrue(std::string);
uint64 toUint64(std::string&); uint64 toUint64(std::string);
uint64 atoi64(std::string&); uint64 atoi64(std::string);
inline long double Round(long double z,unsigned int n); inline long double Round(long double z,unsigned int n);
} }

View File

@ -1,4 +1,4 @@
#include <stdarg.h>
#include "common.h" #include "common.h"
#include "PseuWoW.h" #include "PseuWoW.h"
#include "DefScript/DefScript.h" #include "DefScript/DefScript.h"

View File

@ -124,7 +124,7 @@ public:
mouse.right = false; mouse.right = false;
} }
virtual bool OnEvent(SEvent event) bool OnEvent(SEvent event)
{ {
bool value = false; bool value = false;

View File

@ -13,12 +13,12 @@ struct WorldPosition
float x,y,z,o; float x,y,z,o;
}; };
inline ByteBuffer& operator<<(ByteBuffer& bb, WorldPosition& p) inline ByteBuffer& operator<<(ByteBuffer& bb, WorldPosition p)
{ {
bb << p.x << p.y << p.z << p.o; bb << p.x << p.y << p.z << p.o;
return bb; return bb;
} }
inline ByteBuffer& operator>>(ByteBuffer& bb, WorldPosition& p) inline ByteBuffer& operator>>(ByteBuffer& bb, WorldPosition p)
{ {
bb >> p.x >> p.y >> p.z >> p.o; bb >> p.x >> p.y >> p.z >> p.o;
return bb; return bb;

View File

@ -740,7 +740,7 @@ bool TcpSocket::OnSocks4Read()
return false; return false;
} }
/*
void TcpSocket::Sendf(char const *format, ...) void TcpSocket::Sendf(char const *format, ...)
{ {
va_list ap; va_list ap;
@ -750,7 +750,7 @@ void TcpSocket::Sendf(char const *format, ...)
va_end(ap); va_end(ap);
Send( slask ); Send( slask );
} }
*/
void TcpSocket::OnSSLConnect() void TcpSocket::OnSSLConnect()
{ {

View File

@ -72,7 +72,7 @@ class TcpSocket : public Socket
int Close(); int Close();
void Send(const std::string &); void Send(const std::string &);
void Sendf(char const *format, ...); //void Sendf(char const *format, ...);
virtual void SendBuf(const char *,size_t); virtual void SendBuf(const char *,size_t);
virtual void OnRawData(const char *,size_t) {} virtual void OnRawData(const char *,size_t) {}

View File

@ -71,18 +71,6 @@
#define I64FMT "%016llX" #define I64FMT "%016llX"
#define I64FMTD "%llu" #define I64FMTD "%llu"
#define SI64FMTD "%lld" #define SI64FMTD "%lld"
# if PLATFORM == PLATFORM_UNIX
typedef __int64_t int64;
typedef __int32_t int32;
typedef __int16_t int16;
typedef __int8_t int8;
typedef __uint64_t uint64;
typedef __uint32_t uint32;
typedef __uint16_t uint16;
typedef __uint8_t uint8;
typedef uint16 WORD;
typedef uint32 DWORD;
# else
typedef long long int64; typedef long long int64;
typedef long int32; typedef long int32;
typedef short int16; typedef short int16;
@ -94,18 +82,17 @@
typedef unsigned short WORD; typedef unsigned short WORD;
typedef uint32 DWORD; typedef uint32 DWORD;
#endif #endif
#endif
#ifndef SIGQUIT #ifndef SIGQUIT
#define SIGQUIT 3 #define SIGQUIT 3
#endif #endif
#ifdef min #ifndef min
#undef min #define min(a, b) ((a < b) ? a : b)
#endif #endif
#ifdef max #ifndef max
#undef max #define max(a, b) ((a > b) ? a : b)
#endif #endif
#if COMPILER == COMPILER_MICROSOFT #if COMPILER == COMPILER_MICROSOFT
@ -120,12 +107,11 @@
# define COMPILER_VERSION_OUT "%u" # define COMPILER_VERSION_OUT "%u"
#elif COMPILER == COMPILER_GNU #elif COMPILER == COMPILER_GNU
# define COMPILER_NAME "GCC" # define COMPILER_NAME "GCC"
# ifdef __GNUC_PATCHLEVEL__ # ifndef __GNUC_PATCHLEVEL__
# define COMPILER_VERSION STRINGIZE(__GNUC__) "." STRINGIZE(__GNUC_MINOR__) "." STRINGIZE(__GNUC_PATCHLEVEL__) # define __GNUC_PATCHLEVEL__ 0
# else
# define COMPILER_VERSION STRINGIZE(__GNUC__) "." STRINGIZE(__GNUC_MINOR__)
# endif # endif
# define COMPILER_VERSION_OUT "%s" # define COMPILER_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_OUT "%u"
// TODO: add more compilers here when necessary // TODO: add more compilers here when necessary
#else #else
# define COMPILER_NAME "unknown" # define COMPILER_NAME "unknown"