diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-02 04:41:23 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-12-02 04:41:23 +0000 |
commit | 7777bb2be759a3de32f5edbb53ae3d8b6396c563 (patch) | |
tree | fd8927f99d9ff87ad679749188136197becdedbe | |
parent | 0698f0b34299624e6ac535442b4e7b8894dd8167 (diff) | |
download | hercules-7777bb2be759a3de32f5edbb53ae3d8b6396c563.tar.gz hercules-7777bb2be759a3de32f5edbb53ae3d8b6396c563.tar.bz2 hercules-7777bb2be759a3de32f5edbb53ae3d8b6396c563.tar.xz hercules-7777bb2be759a3de32f5edbb53ae3d8b6396c563.zip |
- Added missing min/max definitions to cbasetypes.h, needed for the @send change.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9388 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 1 | ||||
-rw-r--r-- | src/common/cbasetypes.h | 540 | ||||
-rw-r--r-- | src/map/atcommand.c | 1 |
3 files changed, 276 insertions, 266 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index d4b5ebe64..c9c3eba7f 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/12/02 + * Added missing min/max definitions to cbasetypes.h, needed for the @send change. [FlavioJS] * Replaced @send with the version I use for testing packets. Can display the packet length. Supports dynamic packets, quoted strings with escaped characters and fixed/variable length, and normal/hex diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index fe31f4c8d..0f443192d 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -1,266 +1,274 @@ -#ifndef _CBASETYPES_H_
-#define _CBASETYPES_H_
-/* +--------+-----------+--------+---------+
- * | ILP32 | LP64 | ILP64 | (LL)P64 |
- * +------------+--------+-----------+--------+---------+
- * | ints | 32-bit | 32-bit | 64-bit | 32-bit |
- * | longs | 32-bit | 64-bit | 64-bit | 32-bit |
- * | long-longs | 64-bit | 64-bit | 64-bit | 64-bit |
- * | pointers | 32-bit | 64-bit | 64-bit | 64-bit |
- * +------------+--------+-----------+--------+---------+
- * | where | -- | Tiger | Alpha | Windows |
- * | used | | Unix | Cray | |
- * | | | Sun & SGI | | |
- * +------------+--------+-----------+--------+---------+
- * Taken from http://developer.apple.com/macosx/64bit.html
- */
-
-//////////////////////////////////////////////////////////////////////////
-// basic include for all basics
-// introduces types and global functions
-//////////////////////////////////////////////////////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////
-// setting some defines on platforms
-//////////////////////////////////////////////////////////////////////////
-#if (defined(__WIN32__) || defined(__WIN32) || defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(WIN32)
-#define WIN32
-#endif
-
-// __APPLE__ is the only predefined macro on MacOS X
-#if defined(__APPLE__)
-#define __DARWIN__
-#endif
-
-// 64bit OS
-#if defined(_M_IA64) || defined(_M_X64) || defined(_WIN64) || defined(_LP64) || defined(_ILP64) || defined(__LP64__) || defined(__ppc64__)
-#define __64BIT__
-#endif
-
-#if defined(_ILP64)
-#error "this specific 64bit architecture is not supported"
-#endif
-
-// debug mode
-#if defined(_DEBUG) && !defined(DEBUG)
-#define DEBUG
-#endif
-
-// disable attributed stuff on non-GNU
-#ifndef __GNUC__
-# define __attribute__(x)
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////
-// useful typedefs
-//////////////////////////////////////////////////////////////////////////
-#define HAVE_UCHAR
-typedef unsigned char uchar;
-typedef signed char schar;
-typedef signed short sshort;
-
-#if !defined(__FREEBSD__) && !defined(_SYS_TYPES_H)
- typedef unsigned short ushort;
-#endif
-typedef signed int sint; // don't use (only for ie. scanf)
-#if !defined(__FREEBSD__) && !defined(_SYS_TYPES_H)
- typedef unsigned int uint; // don't use
-#endif
-typedef signed long slong; // don't use (only for ie. file-io)
-#ifndef _SYS_TYPES_H
- typedef unsigned long ulong; // don't use
-#endif
-
-#ifndef WIN32
-typedef char* pchar;
-typedef unsigned char* puchar;
-#endif
-typedef const char* cchar;
-typedef void* ptr;
-typedef int* pint;
-
-
-//////////////////////////////////////////////////////////////////////////
-// typedefs to compensate type size change from 32bit to 64bit
-// MS implements LLP64 model, normal unix does LP64,
-// only Silicon Graphics/Cray goes ILP64 so don't care (and don't support)
-//////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////
-// Integers with guaranteed _exact_ size.
-//////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////
-#ifdef WIN32
-//////////////////////////////
-#define SIZEOF_LONG 4
-#define SIZEOF_INT 4
-#define HAVE_INT_8_16_32
-typedef __int8 int8;
-typedef __int16 int16;
-typedef __int32 int32;
-
-typedef signed __int8 sint8;
-typedef signed __int16 sint16;
-typedef signed __int32 sint32;
-
-typedef unsigned __int8 uint8;
-typedef unsigned __int16 uint16;
-typedef unsigned __int32 uint32;
-//////////////////////////////
-#else // GNU
-//////////////////////////////
-typedef char int8;
-typedef short int16;
-typedef int int32;
-
-typedef signed char sint8;
-typedef signed short sint16;
-typedef signed int sint32;
-
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-//////////////////////////////
-#endif
-//////////////////////////////
-
-#undef UINT8_MIN
-#undef UINT16_MIN
-#undef UINT32_MIN
-#define UINT8_MIN (uint8) 0
-#define UINT16_MIN (uint16)0
-#define UINT32_MIN (uint32)0
-
-#undef UINT8_MAX
-#undef UINT16_MAX
-#undef UINT32_MAX
-#define UINT8_MAX (uint8) 0xFF
-#define UINT16_MAX (uint16)0xFFFF
-#define UINT32_MAX (uint32)0xFFFFFFFF
-
-#undef SINT8_MIN
-#undef SINT16_MIN
-#undef SINT32_MIN
-#define SINT8_MIN (sint8) 0x80
-#define SINT16_MIN (sint16)0x8000
-#define SINT32_MIN (sint32)0x80000000
-
-#undef SINT8_MAX
-#undef SINT16_MAX
-#undef SINT32_MAX
-#define SINT8_MAX (sint8) 0x7F
-#define SINT16_MAX (sint16)0x7FFF
-#define SINT32_MAX (sint32)0x7FFFFFFF
-
-
-//////////////////////////////////////////////////////////////////////////
-// Integers with guaranteed _minimum_ size.
-// These could be larger than you expect,
-// they are designed for speed.
-//////////////////////////////////////////////////////////////////////////
-typedef long int ppint;
-typedef long int ppint8;
-typedef long int ppint16;
-typedef long int ppint32;
-
-typedef unsigned long int ppuint;
-typedef unsigned long int ppuint8;
-typedef unsigned long int ppuint16;
-typedef unsigned long int ppuint32;
-
-
-//////////////////////////////////////////////////////////////////////////
-// integer with exact processor width (and best speed)
-// size_t already defined in stdio.h
-//////////////////////////////
-#ifdef WIN32 // does not have a signed size_t
-//////////////////////////////
-#if defined(_WIN64) // naive 64bit windows platform
-typedef __int64 ssize_t;
-#else
-typedef int ssize_t;
-#endif
-//////////////////////////////
-#endif
-//////////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////
-// portable 64-bit integers
-//////////////////////////////////////////////////////////////////////////
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-typedef __int64 int64;
-typedef signed __int64 sint64;
-typedef unsigned __int64 uint64;
-#define LLCONST(a) (a##i64)
-#else
-typedef long long int64;
-typedef signed long long sint64;
-typedef unsigned long long uint64;
-#define LLCONST(a) (a##ll)
-#endif
-
-#ifndef INT64_MIN
-#define INT64_MIN (LLCONST(-9223372036854775807)-1)
-#endif
-#ifndef INT64_MAX
-#define INT64_MAX (LLCONST(9223372036854775807))
-#endif
-#ifndef UINT64_MAX
-#define UINT64_MAX (LLCONST(18446744073709551615u))
-#endif
-
-
-//////////////////////////////////////////////////////////////////////////
-// some redefine of function redefines for some Compilers
-//////////////////////////////////////////////////////////////////////////
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-#define strcasecmp stricmp
-#define strncasecmp strnicmp
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#endif
-
-// keyword replacement in windows
-#ifdef _WIN32
-#define inline __inline
-#endif
-
-/////////////////////////////
-// for those still not building c++
-#ifndef __cplusplus
-//////////////////////////////
-
-// boolean types for C
-typedef int bool;
-#define false (1==0)
-#define true (1==1)
-
-//////////////////////////////
-#endif // not cplusplus
-//////////////////////////////
-
-#ifdef swap // just to be sure
-#undef swap
-#endif
-// hmm only ints?
-//#define swap(a,b) { int temp=a; a=b; b=temp;}
-// if using macros then something that is type independent
-#define swap(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b)))
-
-//////////////////////////////////////////////////////////////////////////
-// should not happen
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
-//////////////////////////////////////////////////////////////////////////
-// number of bits in a byte
-#ifndef NBBY
-#define NBBY 8
-#endif
-
-#endif /* _CBASETYPES_H_ */
+#ifndef _CBASETYPES_H_ +#define _CBASETYPES_H_ +/* +--------+-----------+--------+---------+ + * | ILP32 | LP64 | ILP64 | (LL)P64 | + * +------------+--------+-----------+--------+---------+ + * | ints | 32-bit | 32-bit | 64-bit | 32-bit | + * | longs | 32-bit | 64-bit | 64-bit | 32-bit | + * | long-longs | 64-bit | 64-bit | 64-bit | 64-bit | + * | pointers | 32-bit | 64-bit | 64-bit | 64-bit | + * +------------+--------+-----------+--------+---------+ + * | where | -- | Tiger | Alpha | Windows | + * | used | | Unix | Cray | | + * | | | Sun & SGI | | | + * +------------+--------+-----------+--------+---------+ + * Taken from http://developer.apple.com/macosx/64bit.html + */ + +////////////////////////////////////////////////////////////////////////// +// basic include for all basics +// introduces types and global functions +////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////// +// setting some defines on platforms +////////////////////////////////////////////////////////////////////////// +#if (defined(__WIN32__) || defined(__WIN32) || defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(WIN32) +#define WIN32 +#endif + +// __APPLE__ is the only predefined macro on MacOS X +#if defined(__APPLE__) +#define __DARWIN__ +#endif + +// 64bit OS +#if defined(_M_IA64) || defined(_M_X64) || defined(_WIN64) || defined(_LP64) || defined(_ILP64) || defined(__LP64__) || defined(__ppc64__) +#define __64BIT__ +#endif + +#if defined(_ILP64) +#error "this specific 64bit architecture is not supported" +#endif + +// debug mode +#if defined(_DEBUG) && !defined(DEBUG) +#define DEBUG +#endif + +// disable attributed stuff on non-GNU +#ifndef __GNUC__ +# define __attribute__(x) +#endif + + +////////////////////////////////////////////////////////////////////////// +// useful typedefs +////////////////////////////////////////////////////////////////////////// +#define HAVE_UCHAR +typedef unsigned char uchar; +typedef signed char schar; +typedef signed short sshort; + +#if !defined(__FREEBSD__) && !defined(_SYS_TYPES_H) + typedef unsigned short ushort; +#endif +typedef signed int sint; // don't use (only for ie. scanf) +#if !defined(__FREEBSD__) && !defined(_SYS_TYPES_H) + typedef unsigned int uint; // don't use +#endif +typedef signed long slong; // don't use (only for ie. file-io) +#ifndef _SYS_TYPES_H + typedef unsigned long ulong; // don't use +#endif + +#ifndef WIN32 +typedef char* pchar; +typedef unsigned char* puchar; +#endif +typedef const char* cchar; +typedef void* ptr; +typedef int* pint; + + +////////////////////////////////////////////////////////////////////////// +// typedefs to compensate type size change from 32bit to 64bit +// MS implements LLP64 model, normal unix does LP64, +// only Silicon Graphics/Cray goes ILP64 so don't care (and don't support) +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Integers with guaranteed _exact_ size. +////////////////////////////////////////////////////////////////////////// + +////////////////////////////// +#ifdef WIN32 +////////////////////////////// +#define SIZEOF_LONG 4 +#define SIZEOF_INT 4 +#define HAVE_INT_8_16_32 +typedef __int8 int8; +typedef __int16 int16; +typedef __int32 int32; + +typedef signed __int8 sint8; +typedef signed __int16 sint16; +typedef signed __int32 sint32; + +typedef unsigned __int8 uint8; +typedef unsigned __int16 uint16; +typedef unsigned __int32 uint32; +////////////////////////////// +#else // GNU +////////////////////////////// +typedef char int8; +typedef short int16; +typedef int int32; + +typedef signed char sint8; +typedef signed short sint16; +typedef signed int sint32; + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned int uint32; +////////////////////////////// +#endif +////////////////////////////// + +#undef UINT8_MIN +#undef UINT16_MIN +#undef UINT32_MIN +#define UINT8_MIN (uint8) 0 +#define UINT16_MIN (uint16)0 +#define UINT32_MIN (uint32)0 + +#undef UINT8_MAX +#undef UINT16_MAX +#undef UINT32_MAX +#define UINT8_MAX (uint8) 0xFF +#define UINT16_MAX (uint16)0xFFFF +#define UINT32_MAX (uint32)0xFFFFFFFF + +#undef SINT8_MIN +#undef SINT16_MIN +#undef SINT32_MIN +#define SINT8_MIN (sint8) 0x80 +#define SINT16_MIN (sint16)0x8000 +#define SINT32_MIN (sint32)0x80000000 + +#undef SINT8_MAX +#undef SINT16_MAX +#undef SINT32_MAX +#define SINT8_MAX (sint8) 0x7F +#define SINT16_MAX (sint16)0x7FFF +#define SINT32_MAX (sint32)0x7FFFFFFF + + +////////////////////////////////////////////////////////////////////////// +// Integers with guaranteed _minimum_ size. +// These could be larger than you expect, +// they are designed for speed. +////////////////////////////////////////////////////////////////////////// +typedef long int ppint; +typedef long int ppint8; +typedef long int ppint16; +typedef long int ppint32; + +typedef unsigned long int ppuint; +typedef unsigned long int ppuint8; +typedef unsigned long int ppuint16; +typedef unsigned long int ppuint32; + + +////////////////////////////////////////////////////////////////////////// +// integer with exact processor width (and best speed) +// size_t already defined in stdio.h +////////////////////////////// +#ifdef WIN32 // does not have a signed size_t +////////////////////////////// +#if defined(_WIN64) // naive 64bit windows platform +typedef __int64 ssize_t; +#else +typedef int ssize_t; +#endif +////////////////////////////// +#endif +////////////////////////////// + + +////////////////////////////////////////////////////////////////////////// +// portable 64-bit integers +////////////////////////////////////////////////////////////////////////// +#if defined(_MSC_VER) || defined(__BORLANDC__) +typedef __int64 int64; +typedef signed __int64 sint64; +typedef unsigned __int64 uint64; +#define LLCONST(a) (a##i64) +#else +typedef long long int64; +typedef signed long long sint64; +typedef unsigned long long uint64; +#define LLCONST(a) (a##ll) +#endif + +#ifndef INT64_MIN +#define INT64_MIN (LLCONST(-9223372036854775807)-1) +#endif +#ifndef INT64_MAX +#define INT64_MAX (LLCONST(9223372036854775807)) +#endif +#ifndef UINT64_MAX +#define UINT64_MAX (LLCONST(18446744073709551615u)) +#endif + + +////////////////////////////////////////////////////////////////////////// +// some redefine of function redefines for some Compilers +////////////////////////////////////////////////////////////////////////// +#if defined(_MSC_VER) || defined(__BORLANDC__) +#define strcasecmp stricmp +#define strncasecmp strnicmp +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#endif + +// keyword replacement in windows +#ifdef _WIN32 +#define inline __inline +#endif + +///////////////////////////// +// for those still not building c++ +#ifndef __cplusplus +////////////////////////////// + +// boolean types for C +typedef int bool; +#define false (1==0) +#define true (1==1) + +////////////////////////////// +#endif // not cplusplus +////////////////////////////// + +#ifdef swap // just to be sure +#undef swap +#endif +// hmm only ints? +//#define swap(a,b) { int temp=a; a=b; b=temp;} +// if using macros then something that is type independent +#define swap(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b))) + +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + +////////////////////////////////////////////////////////////////////////// +// should not happen +#ifndef NULL +#define NULL (void *)0 +#endif + +////////////////////////////////////////////////////////////////////////// +// number of bits in a byte +#ifndef NBBY +#define NBBY 8 +#endif + +#endif /* _CBASETYPES_H_ */ diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a4badbaef..6289d6027 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8,6 +8,7 @@ #include <math.h> #include <limits.h> +#include "../common/cbasetypes.h" #include "../common/timer.h" #include "../common/nullpo.h" #include "../common/mmo.h" |