diff --git a/CMakeLists.txt b/CMakeLists.txt index 56781220..14c13f79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,7 @@ elseif (UNIX) -fno-signed-zeros -freciprocal-math -ffp-contract=fast \ -fno-threadsafe-statics -fslp-vectorize-aggressive -fslp-vectorize \ -fno-stack-protector -fstrict-enums -fstrict-vtable-pointers \ - -fno-coverage-mapping -fno-spell-checking -fshort-enums -finline-functions \ + -fno-coverage-mapping -fno-spell-checking -fint16_t-enums -finline-functions \ -finline-hint-functions -fno-unroll-loops") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb") @@ -117,13 +117,17 @@ elseif (UNIX) endif () # our "always on" flags - build by default for the system we're on but include all instruction sets - set(CMAKE_CXX_FLAGS "-m32 -pipe -march=native -mtune=native \ + set(CMAKE_CXX_FLAGS "-pipe -march=native -mtune=native \ -msse -msse2 -msse3 -mmmx -m3dnow \ -Wformat -Wno-overloaded-virtual -Wno-missing-braces -Wno-format \ -Wno-write-strings -Wno-unknown-pragmas \ -Wno-uninitialized -Wno-reorder -Wno-tautological-constant-out-of-range-compare") - add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE) + if (CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}") + endif () + + add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE -D_IS_LITTLE_ENDIAN) # release and debug are internal use only if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "Release") diff --git a/engine/client/application/CMakeLists.txt b/engine/client/application/CMakeLists.txt index b134dec8..06873149 100644 --- a/engine/client/application/CMakeLists.txt +++ b/engine/client/application/CMakeLists.txt @@ -1,2 +1,2 @@ -add_subdirectory(Miff) +#add_subdirectory(Miff) diff --git a/engine/client/application/Miff/src/lex_yy.c b/engine/client/application/Miff/src/lex_yy.c index df6de76d..1b931880 100644 --- a/engine/client/application/Miff/src/lex_yy.c +++ b/engine/client/application/Miff/src/lex_yy.c @@ -2,7 +2,7 @@ #line 4 "/swg/whitengold/src/engine/client/application/Miff/src/lex_yy.c" -#define YY_INT_ALIGNED short int +#define YY_INT_ALIGNED int16_t int /* A lexical scanner generated by flex */ @@ -49,10 +49,10 @@ typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; -typedef short int flex_int16_t; +typedef int16_t int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; +typedef uint16_t flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ @@ -5359,7 +5359,7 @@ static int yy_get_next_buffer (void) while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ - /* just a shorter name for the current buffer */ + /* just a int16_ter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = diff --git a/engine/client/application/Miff/src/linux/BISON.HAI b/engine/client/application/Miff/src/linux/BISON.HAI index 999b5559..7685309c 100644 --- a/engine/client/application/Miff/src/linux/BISON.HAI +++ b/engine/client/application/Miff/src/linux/BISON.HAI @@ -32,10 +32,10 @@ int yycost; /* If yyerror is set to a nonzero value by a */ #endif -short yyss[YYMAXDEPTH]; /* the state stack */ +int16_t yyss[YYMAXDEPTH]; /* the state stack */ YYSTYPE yyvs[YYMAXDEPTH]; /* the semantic value stack */ YYLTYPE yyls[YYMAXDEPTH]; /* the location stack */ -short yyrq[YYMAXRULES]; /* the rule queue */ +int16_t yyrq[YYMAXRULES]; /* the rule queue */ int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ @@ -56,11 +56,11 @@ YYLTYPE yytloc; /* location data for the state at the */ int yynunlexed; -short yyunchar[YYMAXBACKUP]; +int16_t yyunchar[YYMAXBACKUP]; YYSTYPE yyunval[YYMAXBACKUP]; YYLTYPE yyunloc[YYMAXBACKUP]; -short *yygssp; /* a pointer to the top of the state */ +int16_t *yygssp; /* a pointer to the top of the state */ /* stack; only set during error */ /* recovery. */ @@ -113,11 +113,11 @@ YYLTYPE loc; yyrestore(first, last) -register short *first; -register short *last; +register int16_t *first; +register int16_t *last; { - register short *ssp; - register short *rp; + register int16_t *ssp; + register int16_t *rp; register int symbol; register int state; register int tvalsaved; @@ -177,15 +177,15 @@ yyparse() { register int yystate; register int yyn; - register short *yyssp; - register short *yyrq0; - register short *yyptr; + register int16_t *yyssp; + register int16_t *yyrq0; + register int16_t *yyptr; register YYSTYPE *yyvsp; int yylen; YYLTYPE *yylsp; - short *yyrq1; - short *yyrq2; + int16_t *yyrq1; + int16_t *yyrq2; yystate = 0; yyssp = yyss - 1; diff --git a/engine/client/application/Miff/src/linux/bison.simple b/engine/client/application/Miff/src/linux/bison.simple index 27927e11..8bd65063 100644 --- a/engine/client/application/Miff/src/linux/bison.simple +++ b/engine/client/application/Miff/src/linux/bison.simple @@ -225,15 +225,15 @@ yyparse(YYPARSE_PARAM_ARG) { register int yystate; register int yyn; - register short *yyssp; + register int16_t *yyssp; register YYSTYPE *yyvsp; int yyerrstatus; /* number of tokens to shift before error messages enabled */ int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ + int16_t yyssa[YYINITDEPTH]; /* the state stack */ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + int16_t *yyss = yyssa; /* refer to the stacks thru separate pointers */ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED @@ -296,7 +296,7 @@ yynewstate: /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + int16_t *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif @@ -336,7 +336,7 @@ yynewstate: yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + yyss = (int16_t *) alloca (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); @@ -511,7 +511,7 @@ $ /* the action file gets copied in in place of this dollarsign */ #if YYDEBUG != 0 if (yydebug) { - short *ssp1 = yyss - 1; + int16_t *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); @@ -644,7 +644,7 @@ yyerrpop: /* pop the current state because it cannot handle the error token */ #if YYDEBUG != 0 if (yydebug) { - short *ssp1 = yyss - 1; + int16_t *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); diff --git a/engine/client/application/Miff/src/linux/miff.cpp b/engine/client/application/Miff/src/linux/miff.cpp index d1f18bfc..b96a34f7 100755 --- a/engine/client/application/Miff/src/linux/miff.cpp +++ b/engine/client/application/Miff/src/linux/miff.cpp @@ -96,7 +96,7 @@ char err_msg[256]; errorType errorFlag = ERR_NONE; // assume no error (default) -// long and short name definitions for command line options +// long and int16_t name definitions for command line options static const char * const LNAME_HELP = "help"; static const char * const LNAME_INPUT_FILE = "inputfile"; diff --git a/engine/client/application/Miff/src/linux/parser.yac b/engine/client/application/Miff/src/linux/parser.yac index 25feaf7e..1259f585 100644 --- a/engine/client/application/Miff/src/linux/parser.yac +++ b/engine/client/application/Miff/src/linux/parser.yac @@ -23,6 +23,7 @@ // #pragma warning (disable: 6311) /* compiler malloc.h: see previous definition of alloca() */ /* include files */ +#include #include /* for pow() and stuff */ #include #include /* for toupper() */ @@ -67,10 +68,10 @@ void checkPragmas(void); void includeBinary(char *fname); void write32(long i32); -void write16(short i16); +void write16(int16_t i16); void write8(char i8); void writeU32(unsigned long ui32); -void writeU16(unsigned short ui16); +void writeU16(uint16_t ui16); void writeU8(unsigned char u8); void writeDouble(double d); void writeFloat(float f); @@ -126,7 +127,7 @@ int usePragmas; **------------------------------------------------------------------------*/ int iTemp, jTemp; char byteTemp; -short wordTemp; +int16_t wordTemp; char tempStr[MAX_STRING_SIZE]; %} @@ -447,8 +448,8 @@ l32AllocExpr: exprL { write32($1); } | l32AllocExpr ',' exprL { write32($3); } ; -l16AllocExpr: exprL { write16((short) $1); } - | l16AllocExpr ',' exprL { write16((short) $3); } +l16AllocExpr: exprL { write16((int16_t) $1); } + | l16AllocExpr ',' exprL { write16((int16_t) $3); } ; l8AllocExpr: exprL { write8((char) $1); } @@ -459,8 +460,8 @@ lU32AllocExpr: exprL { writeU32($1); } | lU32AllocExpr ',' exprL { writeU32($3); } ; -lU16AllocExpr: exprL { writeU16((unsigned short) $1); } - | lU16AllocExpr ',' exprL { writeU16((unsigned short) $3); } +lU16AllocExpr: exprL { writeU16((uint16_t) $1); } + | lU16AllocExpr ',' exprL { writeU16((uint16_t) $3); } ; lU8AllocExpr: exprL { writeU8((unsigned char) $1); } @@ -632,9 +633,9 @@ void write32(long i32) MIFFinsertChunkData(&i32, sizeof(long)); } -void write16(short i16) +void write16(int16_t i16) { - MIFFinsertChunkData(&i16, sizeof(short)); + MIFFinsertChunkData(&i16, sizeof(int16_t)); } void write8(char i8) @@ -647,9 +648,9 @@ void writeU32(unsigned long ui32) MIFFinsertChunkData(&ui32, sizeof(long)); } -void writeU16(unsigned short ui16) +void writeU16(uint16_t ui16) { - MIFFinsertChunkData(&ui16, sizeof(short)); + MIFFinsertChunkData(&ui16, sizeof(int16_t)); } void writeU8(unsigned char ui8) diff --git a/engine/client/application/Miff/src/parser.c b/engine/client/application/Miff/src/parser.c index 22fdd21e..4a3f9904 100644 --- a/engine/client/application/Miff/src/parser.c +++ b/engine/client/application/Miff/src/parser.c @@ -135,10 +135,10 @@ void checkPragmas(void); void includeBinary(char *fname); void write32(long i32); -void write16(short i16); +void write16(int16_t i16); void write8(char i8); void writeU32(unsigned long ui32); -void writeU16(unsigned short ui16); +void writeU16(uint16_t ui16); void writeU8(unsigned char u8); void writeDouble(double d); void writeFloat(float f); @@ -194,7 +194,7 @@ int usePragmas; **------------------------------------------------------------------------*/ int iTemp, jTemp; char byteTemp; -short wordTemp; +int16_t wordTemp; char tempStr[MAX_STRING_SIZE]; @@ -300,8 +300,8 @@ typedef union YYSTYPE /* Line 343 of yacc.c */ #line 302 "/swg/whitengold/src/engine/client/application/Miff/src/parser.c" -#ifdef short -# undef short +#ifdef int16_t +# undef int16_t #endif #ifdef YYTYPE_UINT8 @@ -316,19 +316,19 @@ typedef YYTYPE_INT8 yytype_int8; || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef int16_t int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef uint16_t yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else -typedef short int yytype_int16; +typedef int16_t int yytype_int16; #endif #ifndef YYSIZE_T @@ -2145,14 +2145,14 @@ yyreduce: /* Line 1806 of yacc.c */ #line 450 "/swg/whitengold/src/engine/client/application/Miff/src/linux/parser.yac" - { write16((short) (yyvsp[(1) - (1)].ltype)); } + { write16((int16_t) (yyvsp[(1) - (1)].ltype)); } break; case 62: /* Line 1806 of yacc.c */ #line 451 "/swg/whitengold/src/engine/client/application/Miff/src/linux/parser.yac" - { write16((short) (yyvsp[(3) - (3)].ltype)); } + { write16((int16_t) (yyvsp[(3) - (3)].ltype)); } break; case 63: @@ -2187,14 +2187,14 @@ yyreduce: /* Line 1806 of yacc.c */ #line 462 "/swg/whitengold/src/engine/client/application/Miff/src/linux/parser.yac" - { writeU16((unsigned short) (yyvsp[(1) - (1)].ltype)); } + { writeU16((uint16_t) (yyvsp[(1) - (1)].ltype)); } break; case 68: /* Line 1806 of yacc.c */ #line 463 "/swg/whitengold/src/engine/client/application/Miff/src/linux/parser.yac" - { writeU16((unsigned short) (yyvsp[(3) - (3)].ltype)); } + { writeU16((uint16_t) (yyvsp[(3) - (3)].ltype)); } break; case 69: @@ -2834,9 +2834,9 @@ void write32(long i32) MIFFinsertChunkData(&i32, sizeof(long)); } -void write16(short i16) +void write16(int16_t i16) { - MIFFinsertChunkData(&i16, sizeof(short)); + MIFFinsertChunkData(&i16, sizeof(int16_t)); } void write8(char i8) @@ -2849,9 +2849,9 @@ void writeU32(unsigned long ui32) MIFFinsertChunkData(&ui32, sizeof(long)); } -void writeU16(unsigned short ui16) +void writeU16(uint16_t ui16) { - MIFFinsertChunkData(&ui16, sizeof(short)); + MIFFinsertChunkData(&ui16, sizeof(int16_t)); } void writeU8(unsigned char ui8) diff --git a/engine/client/application/Miff/src/win32/BISON.HAI b/engine/client/application/Miff/src/win32/BISON.HAI index 999b5559..7685309c 100644 --- a/engine/client/application/Miff/src/win32/BISON.HAI +++ b/engine/client/application/Miff/src/win32/BISON.HAI @@ -32,10 +32,10 @@ int yycost; /* If yyerror is set to a nonzero value by a */ #endif -short yyss[YYMAXDEPTH]; /* the state stack */ +int16_t yyss[YYMAXDEPTH]; /* the state stack */ YYSTYPE yyvs[YYMAXDEPTH]; /* the semantic value stack */ YYLTYPE yyls[YYMAXDEPTH]; /* the location stack */ -short yyrq[YYMAXRULES]; /* the rule queue */ +int16_t yyrq[YYMAXRULES]; /* the rule queue */ int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ @@ -56,11 +56,11 @@ YYLTYPE yytloc; /* location data for the state at the */ int yynunlexed; -short yyunchar[YYMAXBACKUP]; +int16_t yyunchar[YYMAXBACKUP]; YYSTYPE yyunval[YYMAXBACKUP]; YYLTYPE yyunloc[YYMAXBACKUP]; -short *yygssp; /* a pointer to the top of the state */ +int16_t *yygssp; /* a pointer to the top of the state */ /* stack; only set during error */ /* recovery. */ @@ -113,11 +113,11 @@ YYLTYPE loc; yyrestore(first, last) -register short *first; -register short *last; +register int16_t *first; +register int16_t *last; { - register short *ssp; - register short *rp; + register int16_t *ssp; + register int16_t *rp; register int symbol; register int state; register int tvalsaved; @@ -177,15 +177,15 @@ yyparse() { register int yystate; register int yyn; - register short *yyssp; - register short *yyrq0; - register short *yyptr; + register int16_t *yyssp; + register int16_t *yyrq0; + register int16_t *yyptr; register YYSTYPE *yyvsp; int yylen; YYLTYPE *yylsp; - short *yyrq1; - short *yyrq2; + int16_t *yyrq1; + int16_t *yyrq2; yystate = 0; yyssp = yyss - 1; diff --git a/engine/client/application/Miff/src/win32/bison.simple b/engine/client/application/Miff/src/win32/bison.simple index 5f8f386e..175ef8e7 100644 --- a/engine/client/application/Miff/src/win32/bison.simple +++ b/engine/client/application/Miff/src/win32/bison.simple @@ -225,15 +225,15 @@ yyparse(YYPARSE_PARAM_ARG) { register int yystate; register int yyn; - register short *yyssp; + register int16_t *yyssp; register YYSTYPE *yyvsp; int yyerrstatus; /* number of tokens to shift before error messages enabled */ int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ + int16_t yyssa[YYINITDEPTH]; /* the state stack */ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + int16_t *yyss = yyssa; /* refer to the stacks thru separate pointers */ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED @@ -296,7 +296,7 @@ yynewstate: /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; + int16_t *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif @@ -336,7 +336,7 @@ yynewstate: yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + yyss = (int16_t *) alloca (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); @@ -511,7 +511,7 @@ $ /* the action file gets copied in in place of this dollarsign */ #if YYDEBUG != 0 if (yydebug) { - short *ssp1 = yyss - 1; + int16_t *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); @@ -651,7 +651,7 @@ yyerrpop: /* pop the current state because it cannot handle the error token */ #if YYDEBUG != 0 if (yydebug) { - short *ssp1 = yyss - 1; + int16_t *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); diff --git a/engine/client/application/Miff/src/win32/miff.cpp b/engine/client/application/Miff/src/win32/miff.cpp index 1963c21c..a0e264a6 100644 --- a/engine/client/application/Miff/src/win32/miff.cpp +++ b/engine/client/application/Miff/src/win32/miff.cpp @@ -99,7 +99,7 @@ char err_msg[512]; errorType errorFlag = ERR_NONE; // assume no error (default) -// long and short name definitions for command line options +// long and int16_t name definitions for command line options static const char * const LNAME_HELP = "help"; static const char * const LNAME_INPUT_FILE = "inputfile"; diff --git a/engine/client/application/Miff/src/win32/parser.yac b/engine/client/application/Miff/src/win32/parser.yac index 1bfec252..5f2e7f3b 100644 --- a/engine/client/application/Miff/src/win32/parser.yac +++ b/engine/client/application/Miff/src/win32/parser.yac @@ -68,10 +68,10 @@ void checkPragmas(void); void includeBinary(char *fname); void write32(long i32); -void write16(short i16); +void write16(int16_t i16); void write8(char i8); void writeU32(unsigned long ui32); -void writeU16(unsigned short ui16); +void writeU16(uint16_t ui16); void writeU8(unsigned char u8); void writeDouble(double d); void writeFloat(float f); @@ -127,7 +127,7 @@ int usePragmas; **------------------------------------------------------------------------*/ int iTemp, jTemp; char byteTemp; -short wordTemp; +int16_t wordTemp; char tempStr[MAX_STRING_SIZE]; %} @@ -448,8 +448,8 @@ l32AllocExpr: exprL { write32($1); } | l32AllocExpr ',' exprL { write32($3); } ; -l16AllocExpr: exprL { write16((short) $1); } - | l16AllocExpr ',' exprL { write16((short) $3); } +l16AllocExpr: exprL { write16((int16_t) $1); } + | l16AllocExpr ',' exprL { write16((int16_t) $3); } ; l8AllocExpr: exprL { write8((char) $1); } @@ -460,8 +460,8 @@ lU32AllocExpr: exprL { writeU32($1); } | lU32AllocExpr ',' exprL { writeU32($3); } ; -lU16AllocExpr: exprL { writeU16((unsigned short) $1); } - | lU16AllocExpr ',' exprL { writeU16((unsigned short) $3); } +lU16AllocExpr: exprL { writeU16((uint16_t) $1); } + | lU16AllocExpr ',' exprL { writeU16((uint16_t) $3); } ; lU8AllocExpr: exprL { writeU8((unsigned char) $1); } @@ -633,9 +633,9 @@ void write32(long i32) MIFFinsertChunkData(&i32, sizeof(long)); } -void write16(short i16) +void write16(int16_t i16) { - MIFFinsertChunkData(&i16, sizeof(short)); + MIFFinsertChunkData(&i16, sizeof(int16_t)); } void write8(char i8) @@ -648,9 +648,9 @@ void writeU32(unsigned long ui32) MIFFinsertChunkData(&ui32, sizeof(long)); } -void writeU16(unsigned short ui16) +void writeU16(uint16_t ui16) { - MIFFinsertChunkData(&ui16, sizeof(short)); + MIFFinsertChunkData(&ui16, sizeof(int16_t)); } void writeU8(unsigned char ui8) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp index c7ddebeb..441bb27d 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.cpp @@ -3,7 +3,7 @@ #include "sharedLog/Log.h" -AuctionTransferClient::AuctionTransferClient(const char *hostName[], const short port[], int count, const char *identifier[], unsigned identifierCount) : +AuctionTransferClient::AuctionTransferClient(const char *hostName[], int16_t port[], int count, const char *identifier[], unsigned identifierCount) : AuctionTransferAPI( hostName, port, count, identifier, identifierCount ) { } @@ -14,12 +14,12 @@ AuctionTransferClient::~AuctionTransferClient() // Connection status callbacks -void AuctionTransferClient::onConnect(const char* host, unsigned short port, const short current, const short max) +void AuctionTransferClient::onConnect(const char* host, uint16_t port, int16_t current, int16_t max) { LOG("AuctionTransferClient", ("onConnect")); } -void AuctionTransferClient::onDisconnect(const char *host, const short port, const short current, const short max) +void AuctionTransferClient::onDisconnect(const char *host, int16_t port, int16_t current, int16_t max) { LOG("AuctionTransferClient", ("onDisconnect")); } diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.h b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.h index 176ec79e..6e0065d3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferClient.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferClient.h @@ -4,58 +4,56 @@ #ifndef _WIN32 #include "AuctionTransferGameAPI/AuctionTransferAPI.h" +#include #else - namespace AuctionTransfer { class AuctionTransferAPI { public: - AuctionTransferAPI( const char *[], const short [], int , const char *[], unsigned ) + AuctionTransferAPI( const char *[], int16_t [], int , const char *[], unsigned ) {}; virtual void process() {}; }; }; - #endif - class AuctionTransferClient : public AuctionTransfer::AuctionTransferAPI { public: - AuctionTransferClient(const char *hostName[], const short port[], int count, const char *identifier[], unsigned identifierCount); + AuctionTransferClient(const char *hostName[], int16_t port[], int count, const char *identifier[], unsigned identifierCount); virtual ~AuctionTransferClient(); // Connection status callbacks - virtual void onConnect(const char* host, unsigned short port, const short current, const short max); - virtual void onDisconnect(const char *host, const short port, const short current, const short max); + virtual void onConnect(const char* host, uint16_t port, int16_t current, int16_t max); + virtual void onDisconnect(const char *host, int16_t port, int16_t current, int16_t max); // Callbacks that are responses - void onSendPrepareTransaction(unsigned int, unsigned int, void *) {}; - void onSendPrepareTransactionCompressed(unsigned int, unsigned int, void *) {}; - void onSendCommitTransaction(unsigned int, unsigned int, void *) {}; - void onSendAbortTransaction(unsigned int, unsigned int, void *) {}; - void onSendAuditAssetTransfer(unsigned int, unsigned int, void *) {}; + void onSendPrepareTransaction(uint32_t, uint32_t, void *) {}; + void onSendPrepareTransactionCompressed(uint32_t, uint32_t, void *) {}; + void onSendCommitTransaction(uint32_t, uint32_t, void *) {}; + void onSendAbortTransaction(uint32_t, uint32_t, void *) {}; + void onSendAuditAssetTransfer(uint32_t, uint32_t, void *) {}; - void onGetNewTransactionID(unsigned int, unsigned int, int64, void *) {}; + void onGetNewTransactionID(uint32_t, uint32_t, int64, void *) {}; // Responses to reply requests - void onReplyReceivePrepareTransaction(unsigned int, unsigned int, void *) {}; - void onReplyReceiveCommitTransaction(unsigned int, unsigned int, void *) {}; - void onReplyReceiveAbortTransaction(unsigned int, unsigned int, void *) {}; - void onReplyReceiveGetCharacterList(unsigned int, unsigned int, void *) {}; + void onReplyReceivePrepareTransaction(uint32_t, uint32_t, void *) {}; + void onReplyReceiveCommitTransaction(uint32_t, uint32_t, void *) {}; + void onReplyReceiveAbortTransaction(uint32_t, uint32_t, void *) {}; + void onReplyReceiveGetCharacterList(uint32_t, uint32_t, void *) {}; // house keeping - void onIdentifyHost(unsigned int, unsigned int, void *) {}; + void onIdentifyHost(uint32_t, uint32_t, void *) {}; // callbacks initiated by auction - void onReceivePrepareTransaction(unsigned int, int64, unsigned int, unsigned int, int64, const char *) {}; - void onReceiveCommitTransaction(unsigned int, int64) {}; - void onReceiveAbortTransaction(unsigned int, int64) {}; - void onReceiveGetCharacterList(unsigned int, unsigned int, const char *) {}; + void onReceivePrepareTransaction(uint32_t, int64, uint32_t, uint32_t, int64, const char *) {}; + void onReceiveCommitTransaction(uint32_t, int64) {}; + void onReceiveAbortTransaction(uint32_t, int64) {}; + void onReceiveGetCharacterList(uint32_t, uint32_t, const char *) {}; private: diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp index d4b0941d..722c210f 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp @@ -26,7 +26,7 @@ namespace NAMESPACE //---------------------------------------- GenericAPICore::GenericAPICore(const char *host, - short port, + int16_t port, unsigned reqTimeout, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, @@ -51,7 +51,7 @@ namespace NAMESPACE //---------------------------------------- GenericAPICore::GenericAPICore(const char *game, const char *hosts[], - const short port[], + const int16_t port[], unsigned arraySize, unsigned reqTimeout, unsigned reconnectTimeout, diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.h index 91df0ff7..88e489d9 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.h @@ -51,7 +51,7 @@ public: friend class GenericConnection; GenericAPICore(const char *host, - short port, + int16_t port, unsigned reqTimeout, unsigned reconnectTimeout, unsigned noDataTimeoutSecs = 5, @@ -66,7 +66,7 @@ public: * ALSO: cannot specify a 0 array size. */ GenericAPICore(const char *game, const char *hosts[], - const short port[], + const int16_t port[], unsigned arraySize, unsigned reqTimeout, unsigned reconnectTimeout, @@ -80,7 +80,7 @@ public: virtual ~GenericAPICore(); void process(); - virtual void responseCallback(short type, Base::ByteStream::ReadIterator &iter, GenericConnection *con) = 0; + virtual void responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter, GenericConnection *con) = 0; virtual void responseCallback(GenericResponse *R) = 0; virtual void OnDisconnect(GenericConnection *con) = 0; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp index 88aa786b..c855cff3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.cpp @@ -22,7 +22,7 @@ namespace NAMESPACE using namespace std; using namespace Base; - GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) + GenericConnection::GenericConnection(const char *host, int16_t port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), m_con(nullptr), @@ -85,7 +85,7 @@ namespace NAMESPACE void GenericConnection::OnRoutePacket(TcpConnection *, const unsigned char *data, int dataLen) { - short type; + int16_t type; unsigned track; ByteStream msg(data, dataLen); @@ -151,7 +151,7 @@ namespace NAMESPACE // identifying us // m_apiCore->OnConnect(this); Base::ByteStream msg; - put(msg, (short)REQUEST_SET_API); + put(msg, (int16_t)REQUEST_SET_API); put(msg, (unsigned)0); // track put(msg, (unsigned)API_VERSION_CODE); put(msg, GAME_RESOURCE); // identify us as a game connection resource diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.h index f9b23586..1baaaeda 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericConnection.h @@ -46,7 +46,7 @@ class GenericConnection : public TcpConnectionHandler { public: GenericConnection(const char *host, - short port, + int16_t port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs = 5, @@ -62,7 +62,7 @@ class GenericConnection : public TcpConnectionHandler virtual void OnTerminated(TcpConnection *con); void Send(Base::ByteStream &msg); inline const char *getHost() const { return m_host.c_str(); } - inline const short getPort() const { return m_port; } + inline const int16_t getPort() const { return m_port; } inline eConnectStatus isConnected() { return m_bConnected; } void disconnect(); @@ -74,7 +74,7 @@ private: TcpManager *m_manager; TcpConnection *m_con; std::string m_host; - short m_port; + int16_t m_port; eConState m_conState; time_t m_conTimeout; unsigned m_reconnectTimeout; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.cpp index e97312fd..41c4e3ca 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.cpp @@ -16,14 +16,14 @@ namespace NAMESPACE using namespace Base; //------------------------------------------- - GenericRequest::GenericRequest(short type, unsigned server_track) + GenericRequest::GenericRequest(int16_t type, unsigned server_track) : m_type(type), m_server_track(server_track), m_track(0), m_timeout(0) //------------------------------------------- { } //------------------------------------------- - GenericResponse::GenericResponse(short type, unsigned result, void *user) + GenericResponse::GenericResponse(int16_t type, unsigned result, void *user) : m_type(type), m_result(result), m_user(user), m_track(0), m_timeout(0) //------------------------------------------- { diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.h index dec032a6..16a709f0 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericMessage.h @@ -22,11 +22,11 @@ class GenericRequest //------------------------------------------- { public: - GenericRequest(short type, unsigned server_track = 0); + GenericRequest(int16_t type, unsigned server_track = 0); virtual ~GenericRequest() {}; virtual void pack(Base::ByteStream &msg) = 0; - short getType() const { return m_type; } + int16_t getType() const { return m_type; } void setTimeout(time_t t) { m_timeout = t; } time_t getTimeout() { return m_timeout; } void setTrack(unsigned t) { m_track = t; } @@ -35,7 +35,7 @@ public: inline void setServerTrack(unsigned track) { m_server_track = track; } protected: - short m_type; + int16_t m_type; unsigned m_track; time_t m_timeout; unsigned m_server_track; @@ -49,11 +49,11 @@ class GenericResponse //------------------------------------------- { public: - GenericResponse(short type, unsigned result, void *user); + GenericResponse(int16_t type, unsigned result, void *user); virtual ~GenericResponse() {}; virtual void unpack(Base::ByteStream::ReadIterator &iter); - short getType() const { return m_type; } + int16_t getType() const { return m_type; } void setTimeout(time_t t) { m_timeout = t; } time_t getTimeout() { return m_timeout; } void setTrack(unsigned t) { m_track = t; } @@ -62,7 +62,7 @@ public: void setResult(unsigned res) { m_result = res; } void * getUser() const { return m_user; } protected: - short m_type; + int16_t m_type; unsigned m_track; unsigned m_result; void *m_user; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp index 7e716a00..e368bd66 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.cpp @@ -12,7 +12,7 @@ namespace AuctionTransfer { ////////////////////////////////////////////////////////////////////////////////////// -AuctionTransferAPI::AuctionTransferAPI(const char *hostName[], const short port[], int count, const char *identifier[], unsigned identifierCount, unsigned reqTimeout, unsigned maxRecvMessageSizeInKB) +AuctionTransferAPI::AuctionTransferAPI(const char *hostName[], const int16_t port[], int count, const char *identifier[], unsigned identifierCount, unsigned reqTimeout, unsigned maxRecvMessageSizeInKB) { m_apiCore = new AuctionTransferAPICore(hostName, port, count, this, identifier, identifierCount, reqTimeout, maxRecvMessageSizeInKB); } @@ -22,7 +22,7 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi { std::vector hostArray; std::vector identifierArray; - std::vector portArray; + std::vector portArray; char hostConfig[4096]; char identifierConfig[4096]; if (hostNames == nullptr) @@ -39,11 +39,11 @@ AuctionTransferAPI::AuctionTransferAPI(const char *hostNames, const char *identi { char * host = ptr; char * portStr = strchr(host, ':'); - unsigned short port = DEFAULT_PORT; + uint16_t port = DEFAULT_PORT; if (portStr) { *portStr++ = 0; - port = (short)atoi(portStr); + port = (int16_t)atoi(portStr); } if (::strlen(host) && port) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.h index a3d85096..add557f3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPI.h @@ -18,7 +18,7 @@ class AuctionTransferAPI { public: // constructor & destructor - AuctionTransferAPI(const char *hostName[], const short port[], int count, const char *identifier[], unsigned identifierCount, unsigned reqTimeout = 60, unsigned maxRecvMessageSizeInKB = 16000); + AuctionTransferAPI(const char *hostName[], const int16_t port[], int count, const char *identifier[], unsigned identifierCount, unsigned reqTimeout = 60, unsigned maxRecvMessageSizeInKB = 16000); /////////////////////////////////////////////////////////////////////////////////////////////////////////// // the identifier list does not have one entry for each connection, it is a simple list of world names that // are handled by this API connection, no matter how many servers are connected to. In the case of EQ2 this @@ -32,8 +32,8 @@ public: virtual ~AuctionTransferAPI(); // connect and disconnect call backs - virtual void onConnect(const char* hostname, unsigned short port, const short current, const short max) = 0; - virtual void onDisconnect(const char *host, const short port, const short current, const short max) = 0; + virtual void onConnect(const char* hostname, uint16_t port, const int16_t current, const int16_t max) = 0; + virtual void onDisconnect(const char *host, const int16_t port, const int16_t current, const int16_t max) = 0; //processing diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.cpp index c2ccccb0..f5556f29 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.cpp @@ -7,7 +7,7 @@ namespace AuctionTransfer { /*///////////////////////////////////////////////////////////////////////////////////// -AuctionTransferAPICore::AuctionTransferAPICore(const char *hostName[], const short port[], int count, AuctionTransferAPI *api, const char *identifier[], unsigned identifierCount) +AuctionTransferAPICore::AuctionTransferAPICore(const char *hostName[], const int16_t port[], int count, AuctionTransferAPI *api, const char *identifier[], unsigned identifierCount) : GenericAPICore(identifier[0], hostName, port, count, 45, 5, 0, 90, 32, 32), m_api(api), m_mappedServerTrack(1000) @@ -18,7 +18,7 @@ AuctionTransferAPICore::AuctionTransferAPICore(const char *hostName[], const sho } */ ////////////////////////////////////////////////////////////////////////////////////// -AuctionTransferAPICore::AuctionTransferAPICore(const char *hostName[], const short port[], int count, AuctionTransferAPI *api, const char *identifier[], unsigned identifierCount, unsigned reqTimeout, unsigned maxRecvMessageSizeInKB) +AuctionTransferAPICore::AuctionTransferAPICore(const char *hostName[], const int16_t port[], int count, AuctionTransferAPI *api, const char *identifier[], unsigned identifierCount, unsigned reqTimeout, unsigned maxRecvMessageSizeInKB) : GenericAPICore(identifier[0], hostName, port, count, reqTimeout, 5, 0, 90, 32, 32, 1, maxRecvMessageSizeInKB), m_api(api), m_mappedServerTrack(1000) @@ -39,7 +39,7 @@ void AuctionTransferAPICore::OnConnect(GenericConnection *connection) ////////////////////////////////////////////////////////////////////////////////////// { countOpenConnections(); - m_api->onConnect(connection->getHost(), connection->getPort(), (short)m_currentConnections, (short)m_maxConnections); + m_api->onConnect(connection->getHost(), connection->getPort(), (int16_t)m_currentConnections, (int16_t)m_maxConnections); } ////////////////////////////////////////////////////////////////////////////////////// @@ -47,7 +47,7 @@ void AuctionTransferAPICore::OnDisconnect(GenericConnection *connection) ////////////////////////////////////////////////////////////////////////////////////// { countOpenConnections(); - m_api->onDisconnect(connection->getHost(), connection->getPort(), (short)m_currentConnections, (short)m_maxConnections); + m_api->onDisconnect(connection->getHost(), connection->getPort(), (int16_t)m_currentConnections, (int16_t)m_maxConnections); } ////////////////////////////////////////////////////////////////////////////////////// @@ -123,7 +123,7 @@ void AuctionTransferAPICore::responseCallback(GenericResponse *response) } ////////////////////////////////////////////////////////////////////////////////////// -void AuctionTransferAPICore::responseCallback(short type, Base::ByteStream::ReadIterator &iter, GenericConnection *connection) +void AuctionTransferAPICore::responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter, GenericConnection *connection) ////////////////////////////////////////////////////////////////////////////////////// // these are the callbacks that are initiated from the Auction System. These callbacks // will be called to initiate a series of communication between the auction system and diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.h index d1fc41d9..3e7bdadc 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferAPICore.h @@ -15,13 +15,13 @@ class AuctionTransferAPI; class AuctionTransferAPICore : public GenericAPICore { public: - AuctionTransferAPICore(const char *hostName[], const short port[], int count, AuctionTransferAPI *api, const char *identifier[], unsigned identifierCount, unsigned timeout = 60, unsigned maxRecvMessageSizeInKB = 16000); + AuctionTransferAPICore(const char *hostName[], const int16_t port[], int count, AuctionTransferAPI *api, const char *identifier[], unsigned identifierCount, unsigned timeout = 60, unsigned maxRecvMessageSizeInKB = 16000); virtual ~AuctionTransferAPICore(); void OnConnect(GenericConnection *connection); void OnDisconnect(GenericConnection *connection); void responseCallback(GenericResponse *response); - void responseCallback(short type, Base::ByteStream::ReadIterator &iter, GenericConnection *connection); + void responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter, GenericConnection *connection); private: AuctionTransferAPI *m_api; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferGameAPI.ncb b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferGameAPI.ncb index 6868f84d..d00e056d 100644 Binary files a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferGameAPI.ncb and b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/AuctionTransferGameAPI.ncb differ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.h index a15f6cba..2269760a 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Archive.h @@ -323,71 +323,19 @@ const unsigned MAX_ARRAY_SIZE = 1024; //////////////////////////////////////////////////////////////////////////////// - inline void get(ByteStream::ReadIterator & source, ByteStream & target) { target.put(source.getBuffer(), source.getSize()); source.advance(source.getSize()); } - inline void get(ByteStream::ReadIterator & source, double & target) + template + inline void get(ByteStream::ReadIterator & source, T & target) { - source.get(&target, 8); + source.get(&target, sizeof(T)); target = byteSwap(target); } - inline void get(ByteStream::ReadIterator & source, float & target) - { - source.get(&target, 4); - target = byteSwap(target); - } - - inline void get(ByteStream::ReadIterator & source, uint64 & target) - { - source.get(&target, 8); - target = byteSwap(target); - } - - inline void get(ByteStream::ReadIterator & source, int64 & target) - { - source.get(&target, 8); - target = byteSwap(target); - } - - inline void get(ByteStream::ReadIterator & source, uint32 & target) - { - source.get(&target, 4); - target = byteSwap(target); - } - - inline void get(ByteStream::ReadIterator & source, int32 & target) - { - source.get(&target, 4); - target = byteSwap(target); - } - - inline void get(ByteStream::ReadIterator & source, uint16 & target) - { - source.get(&target, 2); - target = byteSwap(target); - } - - inline void get(ByteStream::ReadIterator & source, int16 & target) - { - source.get(&target, 2); - target = byteSwap(target); - } - - inline void get(ByteStream::ReadIterator & source, uint8 & target) - { - source.get(&target, 1); - } - - inline void get(ByteStream::ReadIterator & source, int8 & target) - { - source.get(&target, 1); - } - inline void get(ByteStream::ReadIterator & source, unsigned char * const target, const unsigned int targetSize) { source.get(target, targetSize); @@ -398,7 +346,6 @@ const unsigned MAX_ARRAY_SIZE = 1024; source.get(&target, 1); } - //////////////////////////////////////////////////////////////////////////////// @@ -408,70 +355,13 @@ const unsigned MAX_ARRAY_SIZE = 1024; source.advance(source.getSize()); } - inline void put(ByteStream & target, const double value) + template + inline void put(ByteStream & target, const T value) { - double temp = byteSwap(value); - target.put(&temp, 8); + T temp = byteSwap(value); + target.put(&temp, sizeof(T)); } - inline void put(ByteStream & target, const float value) - { - float temp = byteSwap(value); - target.put(&temp, 4); - } - - inline void put(ByteStream & target, const uint64 value) - { - uint64 temp = byteSwap(value); - target.put(&temp, 8); - } - - inline void put(ByteStream & target, const int64 value) - { - int64 temp = byteSwap(value); - target.put(&temp, 8); - } - - inline void put(ByteStream & target, const uint32 value) - { - uint32 temp = byteSwap(value); - target.put(&temp, 4); - } - - inline void put(ByteStream & target, const int32 value) - { - int32 temp = byteSwap(value); - target.put(&temp, 4); - } - - inline void put(ByteStream & target, const uint16 value) - { - uint16 temp = byteSwap(value); - target.put(&temp, 2); - } - - inline void put(ByteStream & target, const int16 value) - { - int16 temp = byteSwap(value); - target.put(&temp, 2); - } - - inline void put(ByteStream & target, const uint8 value) - { - target.put(&value, 1); - } - - inline void put(ByteStream & target, const int8 value) - { - target.put(&value, 1); - } - - inline void put(ByteStream & target, const bool & source) - { - target.put(&source, 1); - } - - inline void put(ByteStream & target, const unsigned char * const source, const unsigned int sourceSize) { target.put(source, sourceSize); @@ -488,68 +378,11 @@ const unsigned MAX_ARRAY_SIZE = 1024; //////////////////////////////////////////////////////////////////////////////// - - inline bool overwriteEnd(ByteStream & target, const double value) + template + inline bool overwriteEnd(ByteStream & target, const T value) { - double temp = byteSwap(value); - return target.overwriteEnd(&temp, 8); - } - - inline bool overwriteEnd(ByteStream & target, const float value) - { - float temp = byteSwap(value); - return target.overwriteEnd(&temp, 4); - } - - inline bool overwriteEnd(ByteStream & target, const uint64 value) - { - uint64 temp = byteSwap(value); - return target.overwriteEnd(&temp, 8); - } - - inline bool overwriteEnd(ByteStream & target, const int64 value) - { - int64 temp = byteSwap(value); - return target.overwriteEnd(&temp, 8); - } - - inline bool overwriteEnd(ByteStream & target, const uint32 value) - { - uint32 temp = byteSwap(value); - return target.overwriteEnd(&temp, 4); - } - - inline bool overwriteEnd(ByteStream & target, const int32 value) - { - int32 temp = byteSwap(value); - return target.overwriteEnd(&temp, 4); - } - - inline bool overwriteEnd(ByteStream & target, const uint16 value) - { - uint16 temp = byteSwap(value); - return target.overwriteEnd(&temp, 2); - } - - inline bool overwriteEnd(ByteStream & target, const int16 value) - { - int16 temp = byteSwap(value); - return target.overwriteEnd(&temp, 2); - } - - inline bool overwriteEnd(ByteStream & target, const uint8 value) - { - return target.overwriteEnd(&value, 1); - } - - inline bool overwriteEnd(ByteStream & target, const int8 value) - { - return target.overwriteEnd(&value, 1); - } - - inline bool overwriteEnd(ByteStream & target, const bool & source) - { - return target.overwriteEnd(&source, 1); + T temp = byteSwap(value); + return target.overwriteEnd(&temp, sizeof(T)); } inline bool overwriteEnd(ByteStream & target, const unsigned char * const source, const unsigned int sourceSize) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Platform.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Platform.h index 2bdb170b..fa7918d7 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Platform.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/Platform.h @@ -70,7 +70,7 @@ namespace Base // return (uint64(byteReverse(uint32(value))) << 32) | byteReverse(uint32(value>>32)); } - inline uint32 strlen(const unsigned short * string) + inline uint32 strlen(const uint16_t * string) { if (string == 0) return 0; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Archive.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Archive.h index bb623b49..8a4c6218 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Archive.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Archive.h @@ -23,16 +23,8 @@ namespace Base inline int16 byteSwap(int16 value) { byteReverse(&value); return value; } #else - - inline double byteSwap(double value) { return value; } - inline float byteSwap(float value) { return value; } - inline uint64 byteSwap(uint64 value) { return value; } - inline int64 byteSwap(int64 value) { return value; } - inline uint32 byteSwap(uint32 value) { return value; } - inline int32 byteSwap(int32 value) { return value; } - inline uint16 byteSwap(uint16 value) { return value; } - inline int16 byteSwap(int16 value) { return value; } - + template + inline T byteSwap(T value) { return value; } #endif diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Types.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Types.h index 69419a0f..c9f2e7f3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Types.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/linux/Types.h @@ -11,7 +11,7 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -28,15 +28,17 @@ namespace Base #define UINT32_MAX 0xFFFFFFFF #endif -typedef signed char int8; -typedef unsigned char uint8; -typedef signed short int16; -typedef unsigned short uint16; + + +typedef int8_t int8; +typedef uint8_t uint8; +typedef int16_t int16; +typedef uint16_t uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h index 0c64cb2c..24d0b66c 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Base/win32/Types.h @@ -25,8 +25,8 @@ namespace Base typedef signed char int8; typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; +typedef int16_t int16; +typedef uint16_t uint16; typedef int int32; typedef unsigned uint32; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp index ed2e0ad3..f48c8ffc 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Request.cpp @@ -63,7 +63,7 @@ void put(Base::ByteStream &msg, const Blob &source); ////////////////////////////////////////////////////////////////////////////////////// ReplyRequest::ReplyRequest( RequestTypes type, unsigned serverTrack, unsigned responseCode ) - : GenericRequest((short)type, serverTrack), m_responseCode(responseCode) + : GenericRequest((int16_t)type, serverTrack), m_responseCode(responseCode) { } @@ -77,7 +77,7 @@ void ReplyRequest::pack(Base::ByteStream &msg) ////////////////////////////////////////////////////////////////////////////////////// CommonRequest::CommonRequest( RequestTypes type, unsigned serverTrack, long long transactionID ) - : GenericRequest((short)type, serverTrack), m_transactionID(transactionID) + : GenericRequest((int16_t)type, serverTrack), m_transactionID(transactionID) { } @@ -90,7 +90,7 @@ void CommonRequest::pack(Base::ByteStream &msg) ////////////////////////////////////////////////////////////////////////////////////// GetIDRequest::GetIDRequest( RequestTypes type, unsigned serverTrack ) - : GenericRequest((short)type, serverTrack) + : GenericRequest((int16_t)type, serverTrack) { } @@ -102,7 +102,7 @@ void GetIDRequest::pack(Base::ByteStream &msg) ////////////////////////////////////////////////////////////////////////////////////// SendPrepareCompressedRequest::SendPrepareCompressedRequest(RequestTypes type, unsigned serverTrack, const char *serverID, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const unsigned char *xmlAsset, unsigned length) - : GenericRequest((short)type, serverTrack), + : GenericRequest((int16_t)type, serverTrack), m_transactionID(transactionID), m_stationID(stationID), m_characterID(characterID), @@ -126,7 +126,7 @@ void SendPrepareCompressedRequest::pack(Base::ByteStream &msg) ////////////////////////////////////////////////////////////////////////////////////// SendPrepareRequest::SendPrepareRequest( RequestTypes type, unsigned serverTrack, const char *serverID, long long transactionID, unsigned stationID, unsigned characterID, long long assetID, const char *xml ) - : GenericRequest((short)type, serverTrack), + : GenericRequest((int16_t)type, serverTrack), m_transactionID(transactionID), m_stationID(stationID), m_characterID(characterID), @@ -150,7 +150,7 @@ void SendPrepareRequest::pack(Base::ByteStream &msg) ////////////////////////////////////////////////////////////////////////////////////// ReplyGetCharacterListRequest::ReplyGetCharacterListRequest(RequestTypes type, unsigned serverTrack, unsigned responseCode, const Character characters[], unsigned numCharacters) -: GenericRequest((short)type, serverTrack), m_responseCode(responseCode) +: GenericRequest((int16_t)type, serverTrack), m_responseCode(responseCode) { for(unsigned i = 0; i < numCharacters; i++) { @@ -173,7 +173,7 @@ void ReplyGetCharacterListRequest::pack(Base::ByteStream &msg) ////////////////////////////////////////////////////////////////////////////////////// IdentifyServerRequest::IdentifyServerRequest(RequestTypes type, unsigned serverTrack, const char *serverID[], unsigned numIDs) -: GenericRequest((short)type, serverTrack) +: GenericRequest((int16_t)type, serverTrack) { for(unsigned i = 0; i < numIDs; i++) { @@ -195,7 +195,7 @@ void IdentifyServerRequest::pack(Base::ByteStream &msg) ////////////////////////////////////////////////////////////////////////////////////// SendAuditRequest::SendAuditRequest( RequestTypes type, unsigned serverTrack, const char *gameCode, const char *serverCode, long long inGameAssetID, unsigned stationID, const char *event, const char *message) -: GenericRequest((short)type, serverTrack), m_gameCode(gameCode), m_serverCode(serverCode), m_assetID(inGameAssetID), +: GenericRequest((int16_t)type, serverTrack), m_gameCode(gameCode), m_serverCode(serverCode), m_assetID(inGameAssetID), m_userID(stationID), m_event(event), m_message(message) { } diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.cpp index 781ec318..90e2eccc 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.cpp @@ -3,7 +3,7 @@ namespace AuctionTransfer { GetIDResponse::GetIDResponse(RequestTypes type, void *user) - : GenericResponse( (short)type, TRANSFER_SERVER_TIME_OUT, user), m_transactionID(-1) + : GenericResponse( (int16_t)type, TRANSFER_SERVER_TIME_OUT, user), m_transactionID(-1) { } diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.h index c7352fa2..5eadd9f3 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/Response.h @@ -12,7 +12,7 @@ namespace AuctionTransfer class CommonResponse : public GenericResponse { public: - CommonResponse(RequestTypes type, void *user) : GenericResponse((short)type, TRANSFER_SERVER_TIME_OUT, user) {} + CommonResponse(RequestTypes type, void *user) : GenericResponse((int16_t)type, TRANSFER_SERVER_TIME_OUT, user) {} virtual ~CommonResponse() {} }; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp index 20fdad78..57b6e279 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.cpp @@ -10,7 +10,7 @@ namespace NAMESPACE //used when want to open new connection with this socket -TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) +TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, int16_t destPort, unsigned timeout) : m_nextConnection(nullptr), m_prevConnection(nullptr), m_socket(INVALID_SOCKET), @@ -93,7 +93,7 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo } //used when server mode creates new connection object representing a connect request -TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) +TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, int16_t destPort) : m_nextConnection(nullptr), m_prevConnection(nullptr), m_socket(socket), diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h index 92d631d1..aff1b2be 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpConnection.h @@ -88,7 +88,7 @@ public: /** * @brief Returns the port on the other side of this conection. */ - short GetDestinationPort(){ return m_destPort; } + int16_t GetDestinationPort(){ return m_destPort; } /** * @brief Standard AddRef/Release scheme @@ -105,9 +105,9 @@ public: protected: friend class TcpManager; - TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout); + TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, int16_t destPort, unsigned timeout); int finishConnect();/**< returns < 0 if fatal error and connect will not work, =0 if need more time, >0 if connect completed */ - TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort); + TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, int16_t destPort); TcpConnection *m_nextConnection; /**< Double linked list imp. */ TcpConnection *m_prevConnection; /**< Double linked list imp. */ SOCKET m_socket; @@ -131,7 +131,7 @@ private: Status m_status; TcpConnectionHandler *m_handler; IPAddress m_destIP; - short m_destPort; + int16_t m_destPort; unsigned m_refCount; TcpBlockAllocator *m_sendAllocator; data_block *m_head; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp index 7202f4a3..731d87cb 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.cpp @@ -571,7 +571,7 @@ namespace NAMESPACE return processedIncoming; } - TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) + TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, uint16_t serverPort, unsigned timeout) { if (m_boundAsServer) { diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h index c4e8b1cf..5ee74506 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/TcpLibrary/TcpManager.h @@ -66,7 +66,7 @@ public: * do so in order to navigate company firewalls which may have specific port numbers open to them for this purpose. * default = 0 */ - unsigned short port; + uint16_t port; /** * @ brief Server bind ip. @@ -214,7 +214,7 @@ public: * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ - TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); + TcpConnection *EstablishConnection(const char *serverAddress, uint16_t serverPort, unsigned timeout = 0); /** * @brief Binds this manager as a server which will listen for and accept incoming connections. diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/deflate.c b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/deflate.c index 16ebdade..7560fa49 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/deflate.c +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/deflate.c @@ -395,7 +395,7 @@ int ZEXPORT deflateParams(strm, level, strategy) } /* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * Put a int16_t in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ @@ -711,7 +711,7 @@ local void lm_init (s) /* =========================================================================== * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, + * return its length. Matches int16_ter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current @@ -778,7 +778,7 @@ local uInt longest_match(s, cur_match) * or if the match length is less than 2: */ #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) - /* This code assumes sizeof(unsigned short) == 2. Do not use + /* This code assumes sizeof(uint16_t) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ if (*(ushf*)(match+best_len-1) != scan_end || @@ -1133,7 +1133,7 @@ local block_state deflate_stored(s, flush) * Compress as much as possible from the input stream, return the current * block state. * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short + * new strings in the dictionary only for unmatched strings or for int16_t * matches. It is used only for the fast compression options. */ local block_state deflate_fast(s, flush) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/deflate.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/deflate.h index b99a48a5..445860c9 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/deflate.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/deflate.h @@ -75,7 +75,7 @@ typedef ush Pos; typedef Pos FAR Posf; typedef unsigned IPos; -/* A Pos is an index in the character window. We use short instead of int to +/* A Pos is an index in the character window. We use int16_t instead of int to * save space in the various tables. IPos is used only for parameter passing. */ diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/infblock.c b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/infblock.c index dd7a6d40..92842fdc 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/infblock.c +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/infblock.c @@ -55,7 +55,7 @@ local const uInt border[] = { /* Order of the bit length code lengths */ only if BitLength(i) is not zero. (Pretty obvious.) 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) 12. Note: length code 284 can represent 227-258, but length code 285 - really is 258. The last length deserves its own, short code + really is 258. The last length deserves its own, int16_t code since it gets used a lot in very redundant files. The length 258 is special since 258 - 3 (the min match length) is 255. 13. The literal/length and distance code bit lengths are read as a diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/inftrees.c b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/inftrees.c index 5a5d6b66..783ed49b 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/inftrees.c +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/inftrees.c @@ -60,9 +60,9 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */ size is determined by the longest code. However, the time it takes to build this table can also be a factor if the data being decoded is not very long. The most common codes are necessarily the - shortest codes, so those codes dominate the decoding time, and hence - the speed. The idea is you can have a shorter table that decodes the - shorter, more probable codes, and then point to subsidiary tables for + int16_test codes, so those codes dominate the decoding time, and hence + the speed. The idea is you can have a int16_ter table that decodes the + int16_ter, more probable codes, and then point to subsidiary tables for the longer codes. The time it costs to decode the longer codes is then traded against the time it takes to make longer tables. @@ -71,9 +71,9 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */ length codes can decode in one step, and dbits is the same thing for the distance codes. Subsequent tables are also less than or equal to those sizes. These values may be adjusted either when all of the - codes are shorter than that, in which case the longest code length in - bits is used, or when the shortest code is *longer* than the requested - table size, in which case the length of the shortest code in bits is + codes are int16_ter than that, in which case the longest code length in + bits is used, or when the int16_test code is *longer* than the requested + table size, in which case the length of the int16_test code in bits is used. There are two different values for the two tables, since they code a @@ -198,7 +198,7 @@ uIntf *v; /* working area: values in order of bit length */ q = (inflate_huft *)Z_NULL; /* ditto */ z = 0; /* ditto */ - /* go through the bit lengths (k already is bits in shortest code) */ + /* go through the bit lengths (k already is bits in int16_test code) */ for (; k <= g; k++) { a = c[k]; diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/trees.c b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/trees.c index 0a984056..ccefdba2 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/trees.c +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/trees.c @@ -7,7 +7,7 @@ * ALGORITHM * * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. + * common source values are represented by int16_ter bit sequences. * * Each code tree is stored in a compressed form which is itself * a Huffman encoding of the lengths of all the code strings (in @@ -174,10 +174,10 @@ local void gen_trees_header OF((void)); #endif /* =========================================================================== - * Output a short LSB first on the stream. + * Output a int16_t LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ -#define put_short(s, w) { \ +#define put_int16_t(s, w) { \ put_byte(s, (uch)((w) & 0xff)); \ put_byte(s, (uch)((ush)(w) >> 8)); \ } @@ -204,7 +204,7 @@ local void send_bits(s, value, length) */ if (s->bi_valid > (int)Buf_size - length) { s->bi_buf |= (value << s->bi_valid); - put_short(s, s->bi_buf); + put_int16_t(s, s->bi_buf); s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); s->bi_valid += length - Buf_size; } else { @@ -219,7 +219,7 @@ local void send_bits(s, value, length) if (s->bi_valid > (int)Buf_size - len) {\ int val = value;\ s->bi_buf |= (val << s->bi_valid);\ - put_short(s, s->bi_buf);\ + put_int16_t(s, s->bi_buf);\ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ s->bi_valid += len - Buf_size;\ } else {\ @@ -1157,7 +1157,7 @@ local void bi_flush(s) deflate_state *s; { if (s->bi_valid == 16) { - put_short(s, s->bi_buf); + put_int16_t(s, s->bi_buf); s->bi_buf = 0; s->bi_valid = 0; } else if (s->bi_valid >= 8) { @@ -1174,7 +1174,7 @@ local void bi_windup(s) deflate_state *s; { if (s->bi_valid > 8) { - put_short(s, s->bi_buf); + put_int16_t(s, s->bi_buf); } else if (s->bi_valid > 0) { put_byte(s, (Byte)s->bi_buf); } @@ -1199,8 +1199,8 @@ local void copy_block(s, buf, len, header) s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { - put_short(s, (ush)len); - put_short(s, (ush)~len); + put_int16_t(s, (ush)len); + put_int16_t(s, (ush)~len); #ifdef DEBUG s->bits_sent += 2*16; #endif diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h index fb425a3b..7113beda 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zlib.h @@ -454,7 +454,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be + dictionary is most useful when the data to be compressed is int16_t and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h index fecd535d..d15876ff 100755 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/zip/Zip/zutil.h @@ -33,7 +33,7 @@ typedef unsigned char uch; typedef uch FAR uchf; -typedef unsigned short ush; +typedef uint16_t ush; typedef ush FAR ushf; typedef unsigned long ulg; diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 8e39542c..86ed6ad8 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2876,8 +2876,10 @@ void CentralServer::update() { if ( m_pAuctionTransferClient == nullptr ) { + // TODO: FIXME + /* const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; - const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; + const uint16_t port[1] = { (uint16_t)ConfigCentralServer::getAuctionPort() }; std::string s_id = ConfigCentralServer::getAuctionIDPrefix(); s_id += ConfigCentralServer::getClusterName(); @@ -2886,6 +2888,7 @@ void CentralServer::update() identifier[ 0 ] = s_id.c_str(); m_pAuctionTransferClient = new AuctionTransferClient( hostName, port, 1, identifier, 1 ); + */ } m_pAuctionTransferClient->process(); } diff --git a/engine/server/application/CentralServer/src/shared/ChatServerConnection.cpp b/engine/server/application/CentralServer/src/shared/ChatServerConnection.cpp index 5fa160f8..fb34cc69 100755 --- a/engine/server/application/CentralServer/src/shared/ChatServerConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/ChatServerConnection.cpp @@ -23,7 +23,7 @@ ChatServerConnection::~ChatServerConnection() //----------------------------------------------------------------------- -const unsigned short ChatServerConnection::getGameServicePort() const +const uint16_t ChatServerConnection::getGameServicePort() const { return gameServicePort; } @@ -55,7 +55,7 @@ void ChatServerConnection::onReceive(const Archive::ByteStream & message) //----------------------------------------------------------------------- -void ChatServerConnection::setGameServicePort(const unsigned short p) +void ChatServerConnection::setGameServicePort(const uint16_t p) { gameServicePort = p; } diff --git a/engine/server/application/CentralServer/src/shared/ChatServerConnection.h b/engine/server/application/CentralServer/src/shared/ChatServerConnection.h index 1ac213a1..fd63bb24 100755 --- a/engine/server/application/CentralServer/src/shared/ChatServerConnection.h +++ b/engine/server/application/CentralServer/src/shared/ChatServerConnection.h @@ -16,16 +16,16 @@ class ChatServerConnection : public ServerConnection public: explicit ChatServerConnection(UdpConnectionMT *, TcpClient *); ~ChatServerConnection(); - const unsigned short getGameServicePort () const; + const uint16_t getGameServicePort () const; void onConnectionClosed (); void onConnectionOpened (); void onReceive (const Archive::ByteStream & message); - void setGameServicePort (const unsigned short gameServicePort); + void setGameServicePort (const uint16_t gameServicePort); private: ChatServerConnection & operator = (const ChatServerConnection & rhs); ChatServerConnection(const ChatServerConnection & source); - unsigned short gameServicePort; + uint16_t gameServicePort; }; //lint !e1712 default constructor not defined diff --git a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h index 79e08d55..dafba35c 100755 --- a/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h +++ b/engine/server/application/CentralServer/src/shared/ConfigCentralServer.h @@ -76,18 +76,18 @@ public: int webUpdateIntervalSeconds; }; - static const unsigned short getChatServicePort (); - static const unsigned short getConnectionServicePort(); + static const uint16_t getChatServicePort (); + static const uint16_t getConnectionServicePort(); static const char * getConsoleServiceBindInterface(); - static const unsigned short getConsoleServicePort(); - static const unsigned short getCustomerServicePort (); + static const uint16_t getConsoleServicePort(); + static const uint16_t getCustomerServicePort (); static const char * getClusterName (); - static const unsigned short getGameServicePort (); + static const uint16_t getGameServicePort (); static const char * getLoginServerAddress (); - static const unsigned short getLoginServerPort (); + static const uint16_t getLoginServerPort (); static const char * getStartPlanet (); - static const unsigned short getTaskManagerPort (); - static const unsigned short getPlanetServicePort (); + static const uint16_t getTaskManagerPort (); + static const uint16_t getPlanetServicePort (); static const unsigned int getPlanetServerRestartDelayTimeSeconds(); static const unsigned int getConnectionServerRestartDelayTimeSeconds(); static const unsigned int getChatServerRestartDelayTimeSeconds(); @@ -99,7 +99,7 @@ public: static const char * getGameServiceBindInterface (); static const char * getLoginServiceBindInterface (); static const char * getPlanetServiceBindInterface (); - static const unsigned short getLoginServicePort (); + static const uint16_t getLoginServicePort (); static void install (); static void remove (); static uint16 getFirstPlanetWatcherPort(); @@ -115,13 +115,13 @@ public: static const int getCharacterCreationRateLimitSeconds(); static const int getCharacterCtsCreationRateLimitSeconds(); static const char * getTransferServerAddress(); - static unsigned short getTransferServerPort(); + static uint16_t getTransferServerPort(); static const char * getStationPlayersCollectorAddress(); - static unsigned short getStationPlayersCollectorPort(); + static uint16_t getStationPlayersCollectorPort(); static bool getAllowZeroConnectionServerPort(); static int getClusterWideDataLockTimeout(); static const char * getCommodityServerServiceBindInterface(); - static const unsigned short getCommodityServerServicePort(); + static const uint16_t getCommodityServerServicePort(); static int getNumberOfStartPlanets(); static char const * getStartPlanet(int index); @@ -152,9 +152,9 @@ private: //----------------------------------------------------------------------- -inline const unsigned short ConfigCentralServer::getChatServicePort() +inline const uint16_t ConfigCentralServer::getChatServicePort() { - return static_cast(data->chatServicePort); + return static_cast(data->chatServicePort); } //----------------------------------------------------------------------- @@ -166,16 +166,16 @@ inline bool ConfigCentralServer::getShouldSleep() //----------------------------------------------------------------------- -inline const unsigned short ConfigCentralServer::getConnectionServicePort() +inline const uint16_t ConfigCentralServer::getConnectionServicePort() { - return static_cast(data->connectionServicePort); + return static_cast(data->connectionServicePort); } //----------------------------------------------------------------------- -inline const unsigned short ConfigCentralServer::getCustomerServicePort() +inline const uint16_t ConfigCentralServer::getCustomerServicePort() { - return static_cast(data->customerServicePort); + return static_cast(data->customerServicePort); } //----------------------------------------------------------------------- @@ -314,9 +314,9 @@ inline uint16 ConfigCentralServer::getFirstPlanetWatcherPort() // ---------------------------------------------------------------------- -inline const unsigned short ConfigCentralServer::getLoginServicePort() +inline const uint16_t ConfigCentralServer::getLoginServicePort() { - return static_cast(data->loginServicePort); + return static_cast(data->loginServicePort); } // ---------------------------------------------------------------------- @@ -342,9 +342,9 @@ inline const char * ConfigCentralServer::getConsoleServiceBindInterface() //----------------------------------------------------------------------- -inline const unsigned short ConfigCentralServer::getConsoleServicePort() +inline const uint16_t ConfigCentralServer::getConsoleServicePort() { - return static_cast(data->consoleServicePort); + return static_cast(data->consoleServicePort); } // ---------------------------------------------------------------------- @@ -405,9 +405,9 @@ inline const char * ConfigCentralServer::getTransferServerAddress() // ---------------------------------------------------------------------- -inline unsigned short ConfigCentralServer::getTransferServerPort() +inline uint16_t ConfigCentralServer::getTransferServerPort() { - return static_cast(data->transferServerPort); + return static_cast(data->transferServerPort); } // ---------------------------------------------------------------------- @@ -419,9 +419,9 @@ inline const char * ConfigCentralServer::getStationPlayersCollectorAddress() // ---------------------------------------------------------------------- -inline unsigned short ConfigCentralServer::getStationPlayersCollectorPort() +inline uint16_t ConfigCentralServer::getStationPlayersCollectorPort() { - return static_cast(data->stationPlayersCollectorPort); + return static_cast(data->stationPlayersCollectorPort); } // ---------------------------------------------------------------------- @@ -447,9 +447,9 @@ inline const char * ConfigCentralServer::getCommodityServerServiceBindInterface( // ---------------------------------------------------------------------- -inline const unsigned short ConfigCentralServer::getCommodityServerServicePort() +inline const uint16_t ConfigCentralServer::getCommodityServerServicePort() { - return static_cast(data->commodityServerServicePort); + return static_cast(data->commodityServerServicePort); } // ---------------------------------------------------------------------- diff --git a/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.h b/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.h index a39d8346..396646e2 100755 --- a/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.h +++ b/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.h @@ -84,35 +84,35 @@ private: //----------------------------------------------------------------------- -inline const unsigned short ConnectionServerConnection::getChatServicePort() const +inline const uint16_t ConnectionServerConnection::getChatServicePort() const { return m_chatServicePort; } //----------------------------------------------------------------------- -inline const unsigned short ConnectionServerConnection::getVoiceChatServicePort() const +inline const uint16_t ConnectionServerConnection::getVoiceChatServicePort() const { return m_voiceChatServicePort; } //----------------------------------------------------------------------- -inline const unsigned short ConnectionServerConnection::getCustomerServicePort() const +inline const uint16_t ConnectionServerConnection::getCustomerServicePort() const { return m_csServicePort; } //----------------------------------------------------------------------- -inline const unsigned short ConnectionServerConnection::getClientServicePortPrivate() const +inline const uint16_t ConnectionServerConnection::getClientServicePortPrivate() const { return m_clientServicePortPrivate; } //----------------------------------------------------------------------- -inline const unsigned short ConnectionServerConnection::getClientServicePortPublic() const +inline const uint16_t ConnectionServerConnection::getClientServicePortPublic() const { return m_clientServicePortPublic; } @@ -124,7 +124,7 @@ inline int ConnectionServerConnection::getId() const } //---------------------------------------------------------------------- -inline const unsigned short ConnectionServerConnection::getGameServicePort() const +inline const uint16_t ConnectionServerConnection::getGameServicePort() const { return m_gameServicePort; } diff --git a/engine/server/application/CentralServer/src/shared/CustomerServiceConnection.cpp b/engine/server/application/CentralServer/src/shared/CustomerServiceConnection.cpp index 8aea8db9..a6eb8abf 100755 --- a/engine/server/application/CentralServer/src/shared/CustomerServiceConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/CustomerServiceConnection.cpp @@ -23,7 +23,7 @@ CustomerServiceConnection::~CustomerServiceConnection() //----------------------------------------------------------------------- -const unsigned short CustomerServiceConnection::getGameServicePort() const +const uint16_t CustomerServiceConnection::getGameServicePort() const { return gameServicePort; } @@ -55,7 +55,7 @@ void CustomerServiceConnection::onReceive(const Archive::ByteStream & message) //----------------------------------------------------------------------- -void CustomerServiceConnection::setGameServicePort(const unsigned short p) +void CustomerServiceConnection::setGameServicePort(const uint16_t p) { gameServicePort = p; } diff --git a/engine/server/application/CentralServer/src/shared/CustomerServiceConnection.h b/engine/server/application/CentralServer/src/shared/CustomerServiceConnection.h index e6ec0995..9c45dd84 100755 --- a/engine/server/application/CentralServer/src/shared/CustomerServiceConnection.h +++ b/engine/server/application/CentralServer/src/shared/CustomerServiceConnection.h @@ -16,16 +16,16 @@ class CustomerServiceConnection : public ServerConnection public: CustomerServiceConnection(UdpConnectionMT *, TcpClient *); ~CustomerServiceConnection(); - const unsigned short getGameServicePort () const; + const uint16_t getGameServicePort () const; void onConnectionClosed (); void onConnectionOpened (); void onReceive (const Archive::ByteStream & message); - void setGameServicePort (const unsigned short gameServicePort); + void setGameServicePort (const uint16_t gameServicePort); private: CustomerServiceConnection & operator = (const CustomerServiceConnection & rhs); CustomerServiceConnection(const CustomerServiceConnection & source); - unsigned short gameServicePort; + uint16_t gameServicePort; }; //lint !e1712 default constructor not defined diff --git a/engine/server/application/CentralServer/src/shared/LoginServerConnection.cpp b/engine/server/application/CentralServer/src/shared/LoginServerConnection.cpp index 968c8ecd..7d702ec5 100755 --- a/engine/server/application/CentralServer/src/shared/LoginServerConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/LoginServerConnection.cpp @@ -40,7 +40,7 @@ //----------------------------------------------------------------------- -LoginServerConnection::LoginServerConnection(const std::string & a, const unsigned short p) : +LoginServerConnection::LoginServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } @@ -112,7 +112,7 @@ void LoginServerConnection::onReceive(const Archive::ByteStream & message) // see if we need to send to transfer or connection server. if(reply.getValue().getCSToolId() > 0) { - // for CS admin login. send to DB. This just shortcuts what would normally + // for CS admin login. send to DB. This just int16_tcuts what would normally // happen at the transfer server. GenericValueTypeMessage login("TransferGetLoginLocationData", reply.getValue()); CentralServer::getInstance().sendToDBProcess(login, true); diff --git a/engine/server/application/CentralServer/src/shared/LoginServerConnection.h b/engine/server/application/CentralServer/src/shared/LoginServerConnection.h index 0e8bac6e..a248db05 100755 --- a/engine/server/application/CentralServer/src/shared/LoginServerConnection.h +++ b/engine/server/application/CentralServer/src/shared/LoginServerConnection.h @@ -16,7 +16,7 @@ class LoginServerCommandChannel; class LoginServerConnection : public ServerConnection { public: - LoginServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + LoginServerConnection(const std::string & remoteAddress, const uint16_t remotePort); LoginServerConnection(UdpConnectionMT *, TcpClient *); ~LoginServerConnection(); diff --git a/engine/server/application/CentralServer/src/shared/StationPlayersCollectorConnection.cpp b/engine/server/application/CentralServer/src/shared/StationPlayersCollectorConnection.cpp index ee5b5a01..c108fec6 100755 --- a/engine/server/application/CentralServer/src/shared/StationPlayersCollectorConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/StationPlayersCollectorConnection.cpp @@ -19,7 +19,7 @@ //----------------------------------------------------------------------- -StationPlayersCollectorConnection::StationPlayersCollectorConnection(const std::string & a, const unsigned short p) : +StationPlayersCollectorConnection::StationPlayersCollectorConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/application/CentralServer/src/shared/StationPlayersCollectorConnection.h b/engine/server/application/CentralServer/src/shared/StationPlayersCollectorConnection.h index 28bef308..f75aa678 100755 --- a/engine/server/application/CentralServer/src/shared/StationPlayersCollectorConnection.h +++ b/engine/server/application/CentralServer/src/shared/StationPlayersCollectorConnection.h @@ -14,7 +14,7 @@ class StationPlayersCollectorConnection : public ServerConnection { public: - StationPlayersCollectorConnection(const std::string & remoteAddress, const unsigned short remotePort); + StationPlayersCollectorConnection(const std::string & remoteAddress, const uint16_t remotePort); ~StationPlayersCollectorConnection(); void onConnectionClosed(); diff --git a/engine/server/application/CentralServer/src/shared/TaskConnection.cpp b/engine/server/application/CentralServer/src/shared/TaskConnection.cpp index 1194561d..47c2e883 100755 --- a/engine/server/application/CentralServer/src/shared/TaskConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/TaskConnection.cpp @@ -17,7 +17,7 @@ //----------------------------------------------------------------------- -TaskConnection::TaskConnection(const std::string & a, const unsigned short p) : +TaskConnection::TaskConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()), callback(new MessageDispatch::Callback), m_connected(false) diff --git a/engine/server/application/CentralServer/src/shared/TaskConnection.h b/engine/server/application/CentralServer/src/shared/TaskConnection.h index 46278b6d..4df75435 100755 --- a/engine/server/application/CentralServer/src/shared/TaskConnection.h +++ b/engine/server/application/CentralServer/src/shared/TaskConnection.h @@ -23,7 +23,7 @@ namespace MessageDispatch class TaskConnection : public ServerConnection { public: - TaskConnection(const std::string & remoteAddress, const unsigned short remotePort); + TaskConnection(const std::string & remoteAddress, const uint16_t remotePort); TaskConnection(UdpConnectionMT * u, TcpClient *); ~TaskConnection(); diff --git a/engine/server/application/CentralServer/src/shared/TransferServerConnection.cpp b/engine/server/application/CentralServer/src/shared/TransferServerConnection.cpp index a1999823..ccde269e 100755 --- a/engine/server/application/CentralServer/src/shared/TransferServerConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/TransferServerConnection.cpp @@ -28,7 +28,7 @@ //----------------------------------------------------------------------- -TransferServerConnection::TransferServerConnection(const std::string & a, const unsigned short p) : +TransferServerConnection::TransferServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/application/CentralServer/src/shared/TransferServerConnection.h b/engine/server/application/CentralServer/src/shared/TransferServerConnection.h index 7934930b..fd87bf54 100755 --- a/engine/server/application/CentralServer/src/shared/TransferServerConnection.h +++ b/engine/server/application/CentralServer/src/shared/TransferServerConnection.h @@ -14,7 +14,7 @@ class TransferServerConnection : public ServerConnection { public: - TransferServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + TransferServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~TransferServerConnection(); void onConnectionClosed(); diff --git a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp index 7b9c86a0..79c75929 100755 --- a/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/ChatServer/src/shared/CentralServerConnection.cpp @@ -27,7 +27,7 @@ //----------------------------------------------------------------------- -CentralServerConnection::CentralServerConnection(const std::string & a, const unsigned short p) : +CentralServerConnection::CentralServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { ChatServer::fileLog(true, "CentralServerConnection", "Connection created...listening on (%s:%d)", a.c_str(), static_cast(p)); @@ -78,7 +78,7 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message) } case constcrc("CustomerServiceServerChatServerServiceAddress") : { - GenericValueTypeMessage > msg(ri); + GenericValueTypeMessage > msg(ri); ChatServer::instance().connectToCustomerServiceServer(msg.getValue().first, msg.getValue().second); break; diff --git a/engine/server/application/ChatServer/src/shared/CentralServerConnection.h b/engine/server/application/ChatServer/src/shared/CentralServerConnection.h index e45d1842..ca7d71dc 100755 --- a/engine/server/application/ChatServer/src/shared/CentralServerConnection.h +++ b/engine/server/application/ChatServer/src/shared/CentralServerConnection.h @@ -14,7 +14,7 @@ class CentralServerConnection : public ServerConnection { public: - CentralServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + CentralServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~CentralServerConnection(); void onConnectionClosed (); diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp index c52044b8..3b768928 100755 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp @@ -355,7 +355,7 @@ void ChatInterface::OnGetRoom(unsigned track, unsigned result, const ChatRoom *r ChatServer::putSystemAvatarInRoom(roomName); } std::string lowerRoomName = toLower(roomName); - unsigned sequence = (unsigned)user; + unsigned sequence = (uintptr_t)user; std::unordered_map::iterator f = roomList.find(lowerRoomName); if (f != roomList.end() && room) { @@ -430,7 +430,7 @@ void ChatInterface::queryRoom(const NetworkId & id, ConnectionServerConnection * } Unicode::String wideName = Unicode::narrowToWide(tmpName); - unsigned track = RequestGetRoom(ChatUnicodeString(wideName.data(), wideName.size()), (void *)sequence); + unsigned track = RequestGetRoom(ChatUnicodeString(wideName.data(), wideName.size()), (void *)(uintptr_t)sequence); ChatServer::instance().pendingRequests[track] = id; } @@ -1579,7 +1579,7 @@ void ChatInterface::OnCreateRoom(unsigned track,unsigned result, const ChatRoom PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnCreateRoom"); UNREF(user); - unsigned sequence = (unsigned)user; + unsigned sequence = (uintptr_t)user; static Unicode::String wideSWG = Unicode::narrowToWide("SOE+SWG"); static Unicode::String wideFilter = Unicode::narrowToWide(""); static ChatUnicodeString swgNode(wideSWG.data(), wideSWG.size()); @@ -1882,7 +1882,7 @@ void ChatInterface::OnEnterRoom(unsigned track, unsigned result, const ChatAvata return; } - unsigned sequence = (unsigned)user; + unsigned sequence = (uintptr_t)user; ChatAvatarId srcId; if (srcAvatar) @@ -2559,7 +2559,7 @@ void ChatInterface::OnLeaveRoom(unsigned track, unsigned result, const ChatAvata return; } - unsigned sequence = (unsigned)user; + unsigned sequence = (uintptr_t)user; ChatAvatarId id; if (srcAvatar) @@ -2913,7 +2913,7 @@ void ChatInterface::OnSendRoomMessage(unsigned track, unsigned result, const Cha } UNREF(srcAvatar); UNREF(destRoom); - unsigned sequence = (unsigned)user; + unsigned sequence = (uintptr_t)user; ChatOnSendRoomMessage chat(sequence, result); IGNORE_RETURN(ChatServer::sendResponseForTrackId(track, chat)); } @@ -2998,7 +2998,7 @@ void ChatInterface::OnSendInstantMessage(unsigned track, unsigned result, const } UNREF(srcAvatar); - unsigned sequence = (unsigned)user; + unsigned sequence = (uintptr_t)user; ChatOnSendInstantMessage chat(sequence, result); IGNORE_RETURN(ChatServer::sendResponseForTrackId(track, chat)); @@ -3053,7 +3053,7 @@ void ChatInterface::OnSendPersistentMessage(unsigned track, unsigned result, con DEBUG_WARNING(true, ("We received an OnSendPersistentMessage with a success result code but nullptr data. This is an error that the API should never give.")); return; } - unsigned sequence = (unsigned)user; + unsigned sequence = (uintptr_t)user; UNREF(srcAvatar); ChatOnSendPersistentMessage chat(sequence, result); IGNORE_RETURN(ChatServer::sendResponseForTrackId(track, chat)); diff --git a/engine/server/application/ChatServer/src/shared/ChatServer.cpp b/engine/server/application/ChatServer/src/shared/ChatServer.cpp index 2bd3dc6e..0dd75d29 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServer.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServer.cpp @@ -83,7 +83,7 @@ namespace ChatServerNamespace bool s_loggingEnabled = false; std::set > s_pendingEntersByName; - std::set > > s_pendingEntersById; + std::set > > s_pendingEntersById; Unicode::String getRoomAddress(const std::string & roomName) { @@ -202,10 +202,10 @@ void ChatServer::update() { PROFILER_BLOCK_DEFINE(profileBlockMainLoop, "main loop"); PROFILER_BLOCK_ENTER(profileBlockMainLoop); - static unsigned int lastTime = 0; -unsigned int t1 = Clock::timeMs(); + static uint32_t lastTime = 0; +uint32_t t1 = Clock::timeMs(); NetworkHandler::update(); -unsigned int t2 = Clock::timeMs(); +uint32_t t2 = Clock::timeMs(); chatInterface->checkQueuedLogins(); chatInterface->sendQueuedHeadersToClient(); @@ -216,14 +216,14 @@ if ((t2 - t1) > (1000 * 5)) } NetworkHandler::dispatch(); -unsigned int t3 = Clock::timeMs(); +uint32_t t3 = Clock::timeMs(); if ((t3 - t2) > (1000 * 5)) { DEBUG_WARNING(true, ("\n\n\n\n\nNetworkHandler::dispatch() took %i ms\n\n\n\n\n", (t3 - t2))); } if (lastTime != 0) { - unsigned int time = Clock::timeMs(); + uint32_t time = Clock::timeMs(); if ((time - lastTime) > (1000)) { //DEBUG_WARNING(true, ("\n\n\n\n\n\nLong Chat Frame (%i ms)\n\n\n\n", (time - lastTime))); @@ -304,7 +304,7 @@ m_voiceChatIdMap() const std::string getGameCode = ConfigChatServer::getGameCode(); const std::string getGatewayServerIP = ConfigChatServer::getGatewayServerIP(); - chatInterface = new ChatInterface(getGameCode, getGatewayServerIP, ConfigChatServer::getGatewayServerPort(), ConfigChatServer::getRegistrarHost(), static_cast(ConfigChatServer::getRegistrarPort())); + chatInterface = new ChatInterface(getGameCode, getGatewayServerIP, ConfigChatServer::getGatewayServerPort(), ConfigChatServer::getRegistrarHost(), static_cast(ConfigChatServer::getRegistrarPort())); std::string vChatHost; @@ -593,10 +593,10 @@ void ChatServer::removeServices() //----------------------------------------------------------------------- -ChatAvatarId ChatServer::getAvatarIdForTrackId(unsigned trackId) +ChatAvatarId ChatServer::getAvatarIdForTrackId(uint32_t trackId) { ChatServer & server = instance(); - std::unordered_map::iterator f = server.pendingRequests.find(trackId); + std::unordered_map::iterator f = server.pendingRequests.find(trackId); if(f != server.pendingRequests.end()) { const ChatAvatar *avatar = getAvatarByNetworkId((*f).second); @@ -669,11 +669,11 @@ const NetworkId & ChatServer::getNetworkIdByAvatarId(const ChatAvatarId & id) //----------------------------------------------------------------------- -NetworkId ChatServer::sendResponseForTrackId(unsigned trackId, const GameNetworkMessage & response) +NetworkId ChatServer::sendResponseForTrackId(uint32_t trackId, const GameNetworkMessage & response) { NetworkId id; ChatServer & server = instance(); - std::unordered_map::iterator f = server.pendingRequests.find(trackId); + std::unordered_map::iterator f = server.pendingRequests.find(trackId); if(f != server.pendingRequests.end()) { id = (*f).second; @@ -690,10 +690,10 @@ NetworkId ChatServer::sendResponseForTrackId(unsigned trackId, const GameNetwork //----------------------------------------------------------------------- -GameServerConnection *ChatServer::getGameServerConnection(unsigned int sequence) +GameServerConnection *ChatServer::getGameServerConnection(uint32_t sequence) { GameServerConnection * result = 0; - std::unordered_map::iterator f = instance().gameServerConnectionMap.find(sequence); + std::unordered_map::iterator f = instance().gameServerConnectionMap.find(sequence); if(f != instance().gameServerConnectionMap.end()) { result = (*f).second; @@ -705,7 +705,7 @@ GameServerConnection *ChatServer::getGameServerConnection(unsigned int sequence) //----------------------------------------------------------------------- -void ChatServer::addGameServerConnection(unsigned int sequence, GameServerConnection *connection) +void ChatServer::addGameServerConnection(uint32_t sequence, GameServerConnection *connection) { IGNORE_RETURN(instance().gameServerConnectionMap.insert(std::make_pair(sequence, connection))); s_chatServerMetricsData->setGameServerConnectionCount(instance().gameServerConnectionMap.size()); @@ -715,8 +715,8 @@ void ChatServer::addGameServerConnection(unsigned int sequence, GameServerConnec void ChatServer::clearGameServerConnection(const GameServerConnection *connection) { - std::vector removeKeyList; - std::unordered_map::const_iterator i; + std::vector removeKeyList; + std::unordered_map::const_iterator i; for(i = instance().gameServerConnectionMap.begin(); i != instance().gameServerConnectionMap.end(); ++i) { if ((*i).second == connection) @@ -725,7 +725,7 @@ void ChatServer::clearGameServerConnection(const GameServerConnection *connectio } } - std::vector::const_iterator j; + std::vector::const_iterator j; for (j = removeKeyList.begin(); j != removeKeyList.end(); ++j) { IGNORE_RETURN(instance().gameServerConnectionMap.erase((*j))); @@ -766,7 +766,7 @@ void canonicalizeAvatarId(const ChatAvatarId &id) //----------------------------------------------------------------------- -void ChatServer::addFriend(const NetworkId & id, const unsigned int sequence, const ChatAvatarId & friendId) +void ChatServer::addFriend(const NetworkId & id, const uint32_t sequence, const ChatAvatarId & friendId) { UNREF(sequence); ChatServer::fileLog(false, "ChatServer", "addFriend() id(%s) sequence(%u) friendId(%s)", id.getValueString().c_str(), sequence, friendId.getFullName().c_str()); @@ -781,7 +781,7 @@ void ChatServer::addFriend(const NetworkId & id, const unsigned int sequence, co canonicalizeAvatarId(friendId); splitChatAvatarId(friendId, friendName, friendAddress); - unsigned track = instance().chatInterface->RequestAddFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), + uint32_t track = instance().chatInterface->RequestAddFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), ChatUnicodeString(friendAddress.data(), friendAddress.length()), false, nullptr); instance().pendingRequests[track] = id; @@ -794,7 +794,7 @@ void ChatServer::addFriend(const NetworkId & id, const unsigned int sequence, co //----------------------------------------------------------------------- -void ChatServer::removeFriend(const NetworkId & id, const unsigned int sequence, const ChatAvatarId & friendId) +void ChatServer::removeFriend(const NetworkId & id, const uint32_t sequence, const ChatAvatarId & friendId) { UNREF(sequence); ChatServer::fileLog(false, "ChatServer", "removeFriend() id(%s) sequence(%u) friendId(%s)", id.getValueString().c_str(), sequence, friendId.getFullName().c_str()); @@ -809,7 +809,7 @@ void ChatServer::removeFriend(const NetworkId & id, const unsigned int sequence, canonicalizeAvatarId(friendId); splitChatAvatarId(friendId, friendName, friendAddress); - unsigned track = instance().chatInterface->RequestRemoveFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), + uint32_t track = instance().chatInterface->RequestRemoveFriend(from, ChatUnicodeString(friendName.data(), friendName.length()), ChatUnicodeString(friendAddress.data(), friendAddress.length()), nullptr); instance().pendingRequests[track] = id; } @@ -829,7 +829,7 @@ void ChatServer::getFriendsList(const ChatAvatarId &characterName) const ChatAvatar *avatar = getAvatarByNetworkId(id); if (avatar) { - unsigned track = instance().chatInterface->RequestFriendStatus(avatar, nullptr); + uint32_t track = instance().chatInterface->RequestFriendStatus(avatar, nullptr); instance().pendingRequests[track] = id; } else @@ -840,7 +840,7 @@ void ChatServer::getFriendsList(const ChatAvatarId &characterName) //----------------------------------------------------------------------- -void ChatServer::addIgnore(const NetworkId & id, const unsigned int sequence, const ChatAvatarId & ignoreId) +void ChatServer::addIgnore(const NetworkId & id, const uint32_t sequence, const ChatAvatarId & ignoreId) { UNREF(sequence); ChatServer::fileLog(false, "ChatServer", "addIgnore() id(%s) sequence(%u) ignoreId(%s)", id.getValueString().c_str(), sequence, ignoreId.getFullName().c_str()); @@ -855,7 +855,7 @@ void ChatServer::addIgnore(const NetworkId & id, const unsigned int sequence, co canonicalizeAvatarId(ignoreId); splitChatAvatarId(ignoreId, ignoreName, ignoreAddress); - unsigned track = instance().chatInterface->RequestAddIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), + uint32_t track = instance().chatInterface->RequestAddIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), nullptr); instance().pendingRequests[track] = id; @@ -868,7 +868,7 @@ void ChatServer::addIgnore(const NetworkId & id, const unsigned int sequence, co //----------------------------------------------------------------------- -void ChatServer::removeIgnore(const NetworkId & id, const unsigned int sequence, const ChatAvatarId & ignoreId) +void ChatServer::removeIgnore(const NetworkId & id, const uint32_t sequence, const ChatAvatarId & ignoreId) { UNREF(sequence); ChatServer::fileLog(false, "ChatServer", "removeIgnore() id(%s) sequence(%u) ignoreId(%s)", id.getValueString().c_str(), sequence, ignoreId.getFullName().c_str()); @@ -883,7 +883,7 @@ void ChatServer::removeIgnore(const NetworkId & id, const unsigned int sequence, canonicalizeAvatarId(ignoreId); splitChatAvatarId(ignoreId, ignoreName, ignoreAddress); - unsigned track = instance().chatInterface->RequestRemoveIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), + uint32_t track = instance().chatInterface->RequestRemoveIgnore(from, ChatUnicodeString(ignoreName.data(), ignoreName.length()), ChatUnicodeString(ignoreAddress.data(), ignoreAddress.length()), nullptr); instance().pendingRequests[track] = id; } @@ -905,7 +905,7 @@ void ChatServer::getIgnoreList(const ChatAvatarId &characterName) if (avatar) { - unsigned track = instance().chatInterface->RequestIgnoreStatus(avatar, nullptr); + uint32_t track = instance().chatInterface->RequestIgnoreStatus(avatar, nullptr); instance().pendingRequests[track] = id; } else @@ -917,7 +917,7 @@ void ChatServer::getIgnoreList(const ChatAvatarId &characterName) //----------------------------------------------------------------------- -void ChatServer::addModeratorToRoom(const unsigned int sequenceId, const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName) +void ChatServer::addModeratorToRoom(const uint32_t sequenceId, const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName) { canonicalizeAvatarId(avatarId); ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "addModeratorToRoom() sequenceId(%u) id(%s) avatarId(%s) roomName(%s)", sequenceId, id.getValueString().c_str(), avatarId.getFullName().c_str(), roomName.c_str()); @@ -925,7 +925,7 @@ void ChatServer::addModeratorToRoom(const unsigned int sequenceId, const Network const ChatAvatar * from = getAvatarByNetworkId(id); if(from) { - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; const ChatServerRoomOwner *roomOwner = instance().chatInterface->getRoomOwner(roomName); if (roomOwner) @@ -938,14 +938,14 @@ void ChatServer::addModeratorToRoom(const unsigned int sequenceId, const Network { AvatarIdSequencePair *pair = new AvatarIdSequencePair(sequenceId, avatarId); - instance().chatInterface->RequestRemoveBan(from, moderatorName, moderatorAddress, roomOwner->getAddress(), (void *)pair); + instance().chatInterface->RequestRemoveBan(from, moderatorName, moderatorAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); } // Try to make the avatar a moderator { AvatarIdSequencePair *pair = new AvatarIdSequencePair(sequenceId, avatarId); - unsigned track = instance().chatInterface->RequestAddModerator(from, moderatorName, moderatorAddress, roomOwner->getAddress(), (void *)pair); + uint32_t track = instance().chatInterface->RequestAddModerator(from, moderatorName, moderatorAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); instance().pendingRequests[track] = id; } } @@ -967,7 +967,7 @@ void ChatServer::addModeratorToRoom(const unsigned int sequenceId, const Network //----------------------------------------------------------------------- -void ChatServer::removeModeratorFromRoom(const unsigned int sequenceId, const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName) +void ChatServer::removeModeratorFromRoom(const uint32_t sequenceId, const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName) { canonicalizeAvatarId(avatarId); ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeModeratorFromRoom() sequenceId(%u) id(%s) avatarId(%s) roomName(%s)", sequenceId, id.getValueString().c_str(), avatarId.getFullName().c_str(), roomName.c_str()); @@ -975,7 +975,7 @@ void ChatServer::removeModeratorFromRoom(const unsigned int sequenceId, const Ne const ChatAvatar * from = getAvatarByNetworkId(id); if(from) { - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; const ChatServerRoomOwner *roomOwner = instance().chatInterface->getRoomOwner(roomName); if (roomOwner) @@ -987,7 +987,7 @@ void ChatServer::removeModeratorFromRoom(const unsigned int sequenceId, const Ne // User data so that we remember who is being removed as a moderator AvatarIdSequencePair *pair = new AvatarIdSequencePair(sequenceId, avatarId); - unsigned track = instance().chatInterface->RequestRemoveModerator(from, moderatorName, moderatorAddress, roomOwner->getAddress(), (void *)pair); + uint32_t track = instance().chatInterface->RequestRemoveModerator(from, moderatorName, moderatorAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); instance().pendingRequests[track] = id; } else @@ -1027,7 +1027,7 @@ void ChatServer::chatConnectedAvatar(const NetworkId & id, const ChatAvatar & ne //----------------------------------------------------------------------- -void ChatServer::connectPlayer(ConnectionServerConnection * connection, const unsigned int suid, const std::string & characterName, const NetworkId & networkId, bool isSecure, bool isSubscribed) +void ChatServer::connectPlayer(ConnectionServerConnection * connection, const uint32_t suid, const std::string & characterName, const NetworkId & networkId, bool isSecure, bool isSubscribed) { ChatServer::fileLog(false, "ChatServer", "connectPlayer() address(%s) suid(%u) characterName(%s) networkId(%s)", getConnectionAddress(connection).c_str(), suid, characterName.c_str(), networkId.getValueString().c_str()); @@ -1071,7 +1071,7 @@ void ChatServer::connectPlayer(ConnectionServerConnection * connection, const un int countDots(const std::string &str) { int num = 0; - for (unsigned i = 0; i < str.length(); ++i) + for (uint32_t i = 0; i < str.length(); ++i) { if (str[i] == '.') { @@ -1083,7 +1083,7 @@ int countDots(const std::string &str) //----------------------------------------------------------------------- -void ChatServer::createRoom(const NetworkId & id, const unsigned int sequence, const std::string & roomName, const bool isModerated, const bool isPublic, const std::string & title) +void ChatServer::createRoom(const NetworkId & id, const uint32_t sequence, const std::string & roomName, const bool isModerated, const bool isPublic, const std::string & title) { if(roomName.empty()) return; @@ -1128,7 +1128,7 @@ void ChatServer::createRoom(const NetworkId & id, const unsigned int sequence, c //printf("Creating room %s\n", roomName.c_str()); - unsigned roomAttr = 0; + uint32_t roomAttr = 0; static Archive::ByteStream a; const ChatAvatar * owner = 0; @@ -1181,7 +1181,7 @@ void ChatServer::createRoom(const NetworkId & id, const unsigned int sequence, c //instance().voiceChatInterface->GetChannel(narrowRoomAddress,narrowRoomName,"text","",0,false,0); - unsigned track = instance().chatInterface->RequestCreateRoom(owner, roomParams, ChatUnicodeString(wideRoomAddress.data(), wideRoomAddress.size()), (void *)sequence); //lint !e641 Converting enum 'ChatRoomType' to int + uint32_t track = instance().chatInterface->RequestCreateRoom(owner, roomParams, ChatUnicodeString(wideRoomAddress.data(), wideRoomAddress.size()), (void *)(uintptr_t)sequence); //lint !e641 Converting enum 'ChatRoomType' to int if(id != NetworkId::cms_invalid) instance().pendingRequests[track] = id; } @@ -1218,7 +1218,7 @@ void ChatServer::deleteAllPersistentMessages(const NetworkId &sourceNetworkId, c //----------------------------------------------------------------------- -void ChatServer::deletePersistentMessage(const NetworkId &id, const unsigned int messageId) +void ChatServer::deletePersistentMessage(const NetworkId &id, const uint32_t messageId) { ChatServer::fileLog(false, "ChatServer", "deletePersistentMessage() id(%s) messageId(%u)", id.getValueString().c_str(), messageId); @@ -1239,7 +1239,7 @@ ChatInterface *ChatServer::getChatInterface() //----------------------------------------------------------------------- -void ChatServer::destroyRoom(const NetworkId & id, const unsigned int sequence, const unsigned int roomId) +void ChatServer::destroyRoom(const NetworkId & id, const uint32_t sequence, const uint32_t roomId) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "destroyRoom() id(%s) sequence(%u) roomId(%u)", id.getValueString().c_str(), sequence, roomId); @@ -1279,7 +1279,7 @@ void ChatServer::destroyRoom(const NetworkId & id, const unsigned int sequence, if (avatar && owner) { RoomOwnerSequencePair *pair = new RoomOwnerSequencePair(sequence, owner); - unsigned track = instance().chatInterface->RequestDestroyRoom(avatar, owner->getAddress(), (void *)pair); + uint32_t track = instance().chatInterface->RequestDestroyRoom(avatar, owner->getAddress(), (void *)(uintptr_t)pair); instance().pendingRequests[track] = id; } } @@ -1319,7 +1319,7 @@ void ChatServer::destroyRoom(const std::string & roomName) RoomOwnerSequencePair *pair = new RoomOwnerSequencePair(0, owner); static Unicode::String wideAddr = Unicode::narrowToWide(std::string("SWG") + "+" + ConfigChatServer::getClusterName()); static ChatUnicodeString chatAddr(wideAddr.data(), wideAddr.size()); - instance().chatInterface->RequestDestroyRoom(instance().ownerSystem, owner->getAddress(), (void *)pair); + instance().chatInterface->RequestDestroyRoom(instance().ownerSystem, owner->getAddress(), (void *)(uintptr_t)pair); } } @@ -1358,7 +1358,7 @@ void ChatServer::disconnectPlayer(const NetworkId & id) ChatAvatarId avatarId; makeAvatarId((*f).second.chatAvatar, avatarId); instance().chatInterface->disconnectPlayer(avatarId); - instance().chatInterface->RequestLogoutAvatar(&((*f).second.chatAvatar), (void *)owner); + instance().chatInterface->RequestLogoutAvatar(&((*f).second.chatAvatar), (void *)(uintptr_t)owner); instance().chatAvatars.erase(f); } @@ -1393,7 +1393,7 @@ void ChatServer::disconnectPlayer(const NetworkId & id) //----------------------------------------------------------------------- -void ChatServer::enterRoom(const NetworkId & id, const unsigned int sequence, const unsigned int roomId) +void ChatServer::enterRoom(const NetworkId & id, const uint32_t sequence, const uint32_t roomId) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "enterRoom() id(%s) sequence(%u) roomId(%u)", id.getValueString().c_str(), sequence, roomId); @@ -1403,7 +1403,7 @@ void ChatServer::enterRoom(const NetworkId & id, const unsigned int sequence, co if(avatar && room) { - unsigned track = instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), (void *)sequence); + uint32_t track = instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), (void *)(uintptr_t)sequence); instance().pendingRequests[track] = id; } else @@ -1456,7 +1456,7 @@ void ChatServer::putSystemAvatarInRoom(const std::string & roomName) //----------------------------------------------------------------------- -void ChatServer::enterRoom(const NetworkId & id, const unsigned int sequence, const std::string & roomName) +void ChatServer::enterRoom(const NetworkId & id, const uint32_t sequence, const std::string & roomName) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "enterRoom() id(%s) sequence(%u) roomName(%s)", id.getValueString().c_str(), sequence, roomName.c_str()); @@ -1464,8 +1464,8 @@ void ChatServer::enterRoom(const NetworkId & id, const unsigned int sequence, co const ChatAvatar * avatar = getAvatarByNetworkId(id); if(avatar) { - unsigned errorCode = CHATRESULT_SUCCESS; - unsigned roomId = 0; + uint32_t errorCode = CHATRESULT_SUCCESS; + uint32_t roomId = 0; const ChatServerRoomOwner *roomOwner = instance().chatInterface->getRoomOwner(roomName); if (roomOwner) @@ -1483,7 +1483,7 @@ void ChatServer::enterRoom(const NetworkId & id, const unsigned int sequence, co const ChatServerRoomOwner *room = instance().chatInterface->getRoomOwner(roomName); if (room) { - unsigned track = instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), (void *)sequence); + uint32_t track = instance().chatInterface->RequestEnterRoom(avatar, room->getAddress(), (void *)(uintptr_t)sequence); instance().pendingRequests[track] = id; return; @@ -1511,7 +1511,7 @@ void ChatServer::enterRoom(const NetworkId & id, const unsigned int sequence, co //----------------------------------------------------------------------- -void ChatServer::unbanFromRoom(const unsigned sequence, const NetworkId &banner, const ChatAvatarId &bannee, const std::string &roomName) +void ChatServer::unbanFromRoom(const uint32_t sequence, const NetworkId &banner, const ChatAvatarId &bannee, const std::string &roomName) { canonicalizeAvatarId(bannee); ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "unbanFromRoom() sequence(%u) banner(%s) bannee(%s) roomName(%s)", sequence, banner.getValueString().c_str(), bannee.getFullName().c_str(), roomName.c_str()); @@ -1519,7 +1519,7 @@ void ChatServer::unbanFromRoom(const unsigned sequence, const NetworkId &banner, const ChatAvatar *bannerAvatar = getAvatarByNetworkId(banner); if (bannerAvatar) { - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; const ChatServerRoomOwner *roomOwner = instance().chatInterface->getRoomOwner(roomName); if (roomOwner) @@ -1530,7 +1530,7 @@ void ChatServer::unbanFromRoom(const unsigned sequence, const NetworkId &banner, AvatarIdSequencePair *pair = new AvatarIdSequencePair(sequence, bannee); - unsigned track = instance().chatInterface->RequestRemoveBan(bannerAvatar, banName, banAddress, roomOwner->getAddress(), (void *)pair); + uint32_t track = instance().chatInterface->RequestRemoveBan(bannerAvatar, banName, banAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); instance().pendingRequests[track] = banner; } else @@ -1551,7 +1551,7 @@ void ChatServer::unbanFromRoom(const unsigned sequence, const NetworkId &banner, //----------------------------------------------------------------------- -void ChatServer::banFromRoom(const unsigned sequence, const NetworkId &banner, const ChatAvatarId &bannee, const std::string &roomName) +void ChatServer::banFromRoom(const uint32_t sequence, const NetworkId &banner, const ChatAvatarId &bannee, const std::string &roomName) { canonicalizeAvatarId(bannee); ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "banFromRoom() sequence(%u) banner(%s) bannee(%s) roomName(%s)", sequence, banner.getValueString().c_str(), bannee.getFullName().c_str(), roomName.c_str()); @@ -1566,7 +1566,7 @@ void ChatServer::banFromRoom(const unsigned sequence, const NetworkId &banner, c const ChatAvatar *bannerAvatar = getAvatarByNetworkId(banner); if (bannerAvatar) { - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; const ChatServerRoomOwner *roomOwner = instance().chatInterface->getRoomOwner(roomName); if (roomOwner) @@ -1578,20 +1578,20 @@ void ChatServer::banFromRoom(const unsigned sequence, const NetworkId &banner, c // Remove the bannee from the invited list { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, bannee); - instance().chatInterface->RequestRemoveInvite(bannerAvatar, banName, banAddress, roomOwner->getAddress(), (void *)pair); + instance().chatInterface->RequestRemoveInvite(bannerAvatar, banName, banAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); } // Remove the bannee from the moderator list { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, bannee); - instance().chatInterface->RequestRemoveModerator(bannerAvatar, banName, banAddress, roomOwner->getAddress(), (void *)pair); + instance().chatInterface->RequestRemoveModerator(bannerAvatar, banName, banAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); } // Ban the avatar { AvatarIdSequencePair *pair = new AvatarIdSequencePair(sequence, bannee); - unsigned track = instance().chatInterface->RequestAddBan(bannerAvatar, banName, banAddress, roomOwner->getAddress(), (void *)pair); + uint32_t track = instance().chatInterface->RequestAddBan(bannerAvatar, banName, banAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); instance().pendingRequests[track] = banner; } } @@ -1631,7 +1631,7 @@ void ChatServer::invite(const NetworkId & id, const ChatAvatarId & avatarId, con if (invitor) { - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; ChatServerRoomOwner const * const roomOwner = instance().chatInterface->getRoomOwner(roomName); if (roomOwner) @@ -1644,14 +1644,14 @@ void ChatServer::invite(const NetworkId & id, const ChatAvatarId & avatarId, con { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, avatarId); - instance().chatInterface->RequestRemoveBan(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)pair); + instance().chatInterface->RequestRemoveBan(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); } // Invite the avatar { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, avatarId); - unsigned track = instance().chatInterface->RequestAddInvite(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)pair); + uint32_t track = instance().chatInterface->RequestAddInvite(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); instance().pendingRequests[track] = id; } } @@ -1681,13 +1681,13 @@ void ChatServer::inviteGroupMembers(const NetworkId & id, const ChatAvatarId & a ChatAvatar const * const invitor = getAvatarByNetworkId(id); if (invitor) { - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; ChatServerRoomOwner const * const roomOwner = instance().chatInterface->getRoomOwner(roomName); if (roomOwner) { // Invite each member - for (unsigned i = 0; i < members.size(); ++i) + for (uint32_t i = 0; i < members.size(); ++i) { NetworkId const & memberNetworkId = members[i]; ChatAvatar const * const memberAvatar = getAvatarByNetworkId(memberNetworkId); @@ -1705,14 +1705,14 @@ void ChatServer::inviteGroupMembers(const NetworkId & id, const ChatAvatarId & a { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, memberId); - instance().chatInterface->RequestRemoveBan(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)pair); + instance().chatInterface->RequestRemoveBan(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); } // Invite the avatar { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, memberId); - unsigned track = instance().chatInterface->RequestAddInvite(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)pair); + uint32_t track = instance().chatInterface->RequestAddInvite(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); instance().pendingRequests[track] = id; } } @@ -1759,20 +1759,20 @@ void ChatServer::removeSystemAvatarFromRoom(const ChatRoom *room) //----------------------------------------------------------------------- -void ChatServer::leaveRoom(const NetworkId & id, const unsigned int sequence, const unsigned int roomId) +void ChatServer::leaveRoom(const NetworkId & id, const uint32_t sequence, const uint32_t roomId) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "leaveRoom() id(%s) sequence(%u) roomId(%u)", id.getValueString().c_str(), sequence, roomId); const ChatAvatar * avatar = getAvatarByNetworkId(id); if (avatar) { - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; // Try to get the room ChatServerRoomOwner const * const roomOwner = instance().chatInterface->getRoomOwner(roomId); if (roomOwner) { - unsigned track = instance().chatInterface->RequestLeaveRoom(avatar, roomOwner->getAddress(), (void *)sequence); + uint32_t track = instance().chatInterface->RequestLeaveRoom(avatar, roomOwner->getAddress(), (void *)(uintptr_t)sequence); instance().pendingRequests[track] = id; } else @@ -1895,7 +1895,7 @@ void ChatServer::kickAvatarFromRoom(const NetworkId & id, const ChatAvatarId & a canonicalizeAvatarId(avatarId); ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "kickAvatarFromRoom() moderator(%s) avatarName(%s) roomName(%s)", id.getValueString().c_str(), avatarId.getFullName().c_str(), roomName.c_str()); - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; ChatAvatar const * const moderatorChatAvatar = getAvatarByNetworkId(id); if (moderatorChatAvatar) @@ -1910,20 +1910,20 @@ void ChatServer::kickAvatarFromRoom(const NetworkId & id, const ChatAvatarId & a // Remove the avatar from the invited list { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, avatarId); - instance().chatInterface->RequestRemoveInvite(moderatorChatAvatar, kickName, kickAddress, roomOwner->getAddress(), (void *)pair); + instance().chatInterface->RequestRemoveInvite(moderatorChatAvatar, kickName, kickAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); } // Remove the avatar from the moderator list { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, avatarId); - instance().chatInterface->RequestRemoveModerator(moderatorChatAvatar, kickName, kickAddress, roomOwner->getAddress(), (void *)pair); + instance().chatInterface->RequestRemoveModerator(moderatorChatAvatar, kickName, kickAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); } // Kick the avatar from the room { AvatarIdSequencePair *pair = new AvatarIdSequencePair(0, avatarId); - unsigned track = instance().chatInterface->RequestKickAvatar(moderatorChatAvatar, kickName, kickAddress, roomOwner->getAddress(), (void*)pair); + uint32_t track = instance().chatInterface->RequestKickAvatar(moderatorChatAvatar, kickName, kickAddress, roomOwner->getAddress(), (void *)(uintptr_t)(uintptr_t)pair); instance().pendingRequests[track] = id; } } @@ -1945,7 +1945,7 @@ void ChatServer::kickAvatarFromRoom(const NetworkId & id, const ChatAvatarId & a //----------------------------------------------------------------------- -void ChatServer::queryRoom(const NetworkId & id, ConnectionServerConnection * connection, const unsigned int sequence, const std::string & roomName) +void ChatServer::queryRoom(const NetworkId & id, ConnectionServerConnection * connection, const uint32_t sequence, const std::string & roomName) { ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "queryRoom() id(%s) roomName(%s)", id.getValueString().c_str(), roomName.c_str()); @@ -1954,7 +1954,7 @@ void ChatServer::queryRoom(const NetworkId & id, ConnectionServerConnection * co //----------------------------------------------------------------------- -void ChatServer::requestPersistentMessage(const NetworkId &id, const unsigned int sequence, const unsigned int messageId) +void ChatServer::requestPersistentMessage(const NetworkId &id, const uint32_t sequence, const uint32_t messageId) { ChatServer::fileLog(false, "ChatServer", "requestPersistentMessage() id(%s) sequence(%u) messageId(%u)", id.getValueString().c_str(), sequence, messageId); @@ -1962,7 +1962,7 @@ void ChatServer::requestPersistentMessage(const NetworkId &id, const unsigned in if (avatar) { - IGNORE_RETURN(instance().chatInterface->RequestGetPersistentMessage(avatar, messageId, (void *)sequence)); + IGNORE_RETURN(instance().chatInterface->RequestGetPersistentMessage(avatar, messageId, (void *)(uintptr_t)sequence)); } else { @@ -2039,7 +2039,7 @@ void ChatServer::sendInstantMessage(const ChatAvatarId & from, const ChatAvatarI //----------------------------------------------------------------------- -void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int sequence, const ChatAvatarId & n, const Unicode::String & message, const Unicode::String & oob) +void ChatServer::sendInstantMessage(const NetworkId & fromId, const uint32_t sequence, const ChatAvatarId & n, const Unicode::String & message, const Unicode::String & oob) { canonicalizeAvatarId(n); ChatServer::fileLog(false, "ChatServer", "sendInstantMessage() fromId(%s) sequence(%u) toName(%s)", fromId.getValueString().c_str(), sequence, n.getFullName().c_str()); @@ -2064,7 +2064,7 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int } } - unsigned int const maxTellLength = 512; + uint32_t const maxTellLength = 512; if(message.length() < maxTellLength) { @@ -2114,10 +2114,10 @@ void ChatServer::sendInstantMessage(const NetworkId & fromId, const unsigned int splitChatAvatarId(n, friendName, friendAddress); - unsigned track = instance().chatInterface->RequestSendInstantMessage(from, + uint32_t track = instance().chatInterface->RequestSendInstantMessage(from, ChatUnicodeString(friendName.data(), friendName.size()), ChatUnicodeString(friendAddress.data(), friendAddress.size()), - ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(oob.data(), oob.size()), (void *)sequence); + ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(oob.data(), oob.size()), (void *)(uintptr_t)sequence); instance().pendingRequests[track] = fromId; } @@ -2177,7 +2177,7 @@ void ChatServer::sendPersistentMessage(const ChatAvatarId & from, const ChatAvat //----------------------------------------------------------------------- -void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned int sequenceId, const ChatAvatarId & to, const Unicode::String & subject, const Unicode::String & message, const Unicode::String & oob) +void ChatServer::sendPersistentMessage(const NetworkId & fromId, const uint32_t sequenceId, const ChatAvatarId & to, const Unicode::String & subject, const Unicode::String & message, const Unicode::String & oob) { canonicalizeAvatarId(to); @@ -2211,14 +2211,14 @@ void ChatServer::sendPersistentMessage(const NetworkId & fromId, const unsigned Unicode::String friendAddress; splitChatAvatarId(to, friendName, friendAddress); - unsigned track = instance().chatInterface->RequestSendPersistentMessage( + uint32_t track = instance().chatInterface->RequestSendPersistentMessage( from, ChatUnicodeString(friendName.data(), friendName.size()), ChatUnicodeString(friendAddress.data(), friendAddress.size()), ChatUnicodeString(subject.data(), subject.size()), ChatUnicodeString(message.data(), message.size()), ChatUnicodeString(oob.data(), oob.size()), - (void *)sequenceId + (void *)(uintptr_t)sequenceId ); instance().pendingRequests[track] = fromId; } @@ -2272,7 +2272,7 @@ void ChatServer::sendRoomMessage(const ChatAvatarId &id, const std::string & roo //----------------------------------------------------------------------- -void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequence, const unsigned int roomId, const Unicode::String &msg, const Unicode::String & oob) +void ChatServer::sendRoomMessage(const NetworkId & id, const uint32_t sequence, const uint32_t roomId, const Unicode::String &msg, const Unicode::String & oob) { if(!msg.empty() || !oob.empty()) { @@ -2336,7 +2336,7 @@ void ChatServer::sendRoomMessage(const NetworkId & id, const unsigned int sequen if (allowToSpeak) { // character allowed to talk - unsigned track = instance().chatInterface->RequestSendRoomMessage(sender, room->getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), (void *)sequence); + uint32_t track = instance().chatInterface->RequestSendRoomMessage(sender, room->getAddress(), ChatUnicodeString(msg.data(), msg.size()), ChatUnicodeString(oob.data(), oob.size()), (void *)(uintptr_t)sequence); instance().pendingRequests[track] = id; } else if (!squelched && (ConfigChatServer::getChatSpamNotifyPlayerWhenLimitedIntervalSeconds() > 0) && (timeNow >= aed->chatSpamNextTimeToNotifyPlayerWhenLimited)) @@ -2402,7 +2402,7 @@ void ChatServer::sendStandardRoomMessage(const ChatAvatarId &senderId, const std //----------------------------------------------------------------------- -void ChatServer::uninvite(const NetworkId &id , const unsigned int sequence, const ChatAvatarId &avatarId , const std::string &roomName ) +void ChatServer::uninvite(const NetworkId &id , const uint32_t sequence, const ChatAvatarId &avatarId , const std::string &roomName ) { canonicalizeAvatarId(avatarId); ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "uninvite() id(%s) sequence(%u) avatarId(%s) roomName(%s)", id.getValueString().c_str(), sequence, avatarId.getFullName().c_str(), roomName.c_str()); @@ -2411,7 +2411,7 @@ void ChatServer::uninvite(const NetworkId &id , const unsigned int sequence, con ChatAvatar const * invitor = getAvatarByNetworkId(id); if (invitor) { - unsigned errorCode = CHATRESULT_SUCCESS; + uint32_t errorCode = CHATRESULT_SUCCESS; // Try to get the room ChatServerRoomOwner const * const roomOwner = instance().chatInterface->getRoomOwner(roomName); @@ -2423,7 +2423,7 @@ void ChatServer::uninvite(const NetworkId &id , const unsigned int sequence, con AvatarIdSequencePair * pair = new AvatarIdSequencePair(sequence, avatarId); - unsigned track = instance().chatInterface->RequestRemoveInvite(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)pair); + uint32_t track = instance().chatInterface->RequestRemoveInvite(invitor, inviteName, inviteAddress, roomOwner->getAddress(), (void *)(uintptr_t)pair); instance().pendingRequests[track] = id; } else @@ -2525,7 +2525,7 @@ std::string ChatServer::toNarrowString(ChatUnicodeString const &chatUnicodeStrin { std::string result; - for (unsigned int index = 0; index < chatUnicodeString.string_length; ++index) + for (uint32_t index = 0; index < chatUnicodeString.string_length; ++index) { result += static_cast(chatUnicodeString.string_data[index]); } @@ -2592,7 +2592,7 @@ void ChatServer::clearCustomerServiceServerConnection() // ---------------------------------------------------------------------- -void ChatServer::connectToCustomerServiceServer(const std::string &address, const unsigned short port) +void ChatServer::connectToCustomerServiceServer(const std::string &address, const uint16_t port) { //DEBUG_REPORT_LOG(true, ("***ChatServer::connectToCustomerServiceServer() address(%s) port(%d)\n", address.c_str(), port)); @@ -2634,7 +2634,7 @@ bool ChatServer::isValidChatAvatarName(Unicode::String const &chatAvatarName) int dotCount = 0; - for (unsigned int i = 0; i < lowerNarrowName.length(); ++i) + for (uint32_t i = 0; i < lowerNarrowName.length(); ++i) { if (lowerNarrowName[i] == '.') { @@ -2766,7 +2766,7 @@ void ChatServer::requestTransferAvatar(const TransferCharacterData & request) // ---------------------------------------------------------------------- -void ChatServer::onCreateRoomSuccess(const std::string & lowerName, const unsigned int roomId) +void ChatServer::onCreateRoomSuccess(const std::string & lowerName, const uint32_t roomId) { std::set >::iterator nameIter; for(nameIter = s_pendingEntersByName.begin(); nameIter != s_pendingEntersByName.end();) @@ -2782,7 +2782,7 @@ void ChatServer::onCreateRoomSuccess(const std::string & lowerName, const unsign } } - std::set > >::iterator idIter; + std::set > >::iterator idIter; for(idIter = s_pendingEntersById.begin(); idIter != s_pendingEntersById.end();) { if(idIter->second.second == roomId) @@ -2865,9 +2865,9 @@ VChatInterface* ChatServer::getVChatInterface() // ---------------------------------------------------------------------- -unsigned ChatServer::registerGameServerConnection(GameServerConnection *connection) +uint32_t ChatServer::registerGameServerConnection(GameServerConnection *connection) { - static unsigned nextId = 0; + static uint32_t nextId = 0; ++nextId; m_gameServerConnectionRegistry.insert(std::make_pair(nextId, connection)); @@ -2876,7 +2876,7 @@ unsigned ChatServer::registerGameServerConnection(GameServerConnection *connecti //----------------------------------------------------------------------- -void ChatServer::unregisterGameServerConnection(unsigned const connectionId) +void ChatServer::unregisterGameServerConnection(uint32_t const connectionId) { GameServerMap::iterator i = m_gameServerConnectionRegistry.find(connectionId); if(i != m_gameServerConnectionRegistry.end()) @@ -2887,7 +2887,7 @@ void ChatServer::unregisterGameServerConnection(unsigned const connectionId) // ---------------------------------------------------------------------- -void ChatServer::sendToGameServerById(unsigned const connectionId, GameNetworkMessage const & message) +void ChatServer::sendToGameServerById(uint32_t const connectionId, GameNetworkMessage const & message) { GameServerConnection* connection = getGameServerConnectionFromId(connectionId); if(connection) @@ -2902,10 +2902,10 @@ void ChatServer::sendToGameServerById(unsigned const connectionId, GameNetworkMe //----------------------------------------------------------------------- -GameServerConnection *ChatServer::getGameServerConnectionFromId(unsigned int sequence) +GameServerConnection *ChatServer::getGameServerConnectionFromId(uint32_t sequence) { GameServerConnection * result = nullptr; - std::unordered_map::iterator f = m_gameServerConnectionRegistry.find(sequence); + std::unordered_map::iterator f = m_gameServerConnectionRegistry.find(sequence); if(f != m_gameServerConnectionRegistry.end()) { result = (*f).second; @@ -2987,7 +2987,7 @@ void ChatServer::requestRemoveClientFromChannel(const NetworkId & id, std::strin void ChatServer::requestChannelCommand(ReturnAddress const & requester, const std::string &srcUserName, const std::string &destUserName, const std::string &destChannelAddress, - unsigned command,unsigned banTimeout) + uint32_t command,uint32_t banTimeout) { getVChatInterface()->requestChannelCommand(requester, srcUserName, destUserName, destChannelAddress, command, banTimeout); } diff --git a/engine/server/application/ChatServer/src/shared/ChatServer.h b/engine/server/application/ChatServer/src/shared/ChatServer.h index 90e50c37..18f20da9 100755 --- a/engine/server/application/ChatServer/src/shared/ChatServer.h +++ b/engine/server/application/ChatServer/src/shared/ChatServer.h @@ -44,15 +44,15 @@ namespace MessageDispatch { struct AvatarSequencePair { - AvatarSequencePair(unsigned s, const ChatAvatar *a) : sequence(s), avatar(a) {} - unsigned sequence; + AvatarSequencePair(uint32_t s, const ChatAvatar *a) : sequence(s), avatar(a) {} + uint32_t sequence; const ChatAvatar *avatar; }; struct AvatarIdSequencePair { - AvatarIdSequencePair(unsigned s, const ChatAvatarId &a) : sequence(s), avatar(a) {} - unsigned sequence; + AvatarIdSequencePair(uint32_t s, const ChatAvatarId &a) : sequence(s), avatar(a) {} + uint32_t sequence; const ChatAvatarId avatar; private: @@ -62,8 +62,8 @@ private: struct RoomOwnerSequencePair { - RoomOwnerSequencePair(unsigned s, const ChatServerRoomOwner * r) : sequence(s), roomOwner(r) {} - unsigned sequence; + RoomOwnerSequencePair(uint32_t s, const ChatServerRoomOwner * r) : sequence(s), roomOwner(r) {} + uint32_t sequence; const ChatServerRoomOwner *roomOwner; }; @@ -80,10 +80,10 @@ public: void sendResponse(ReturnAddress const & requester, const GameNetworkMessage & response); - GameServerConnection * getGameServerConnectionFromId(unsigned int connectionId); - unsigned registerGameServerConnection(GameServerConnection * connection); - void unregisterGameServerConnection(unsigned const connectionId); - void sendToGameServerById(unsigned const connectionId, GameNetworkMessage const & message); + GameServerConnection * getGameServerConnectionFromId(uint32_t connectionId); + uint32_t registerGameServerConnection(GameServerConnection * connection); + void unregisterGameServerConnection(uint32_t const connectionId); + void sendToGameServerById(uint32_t const connectionId, GameNetworkMessage const & message); static VChatInterface* getVChatInterface(); @@ -94,7 +94,7 @@ public: static void requestAddClientToChannel(const NetworkId & id, std::string const & playerName, std::string const &roomName, bool forceShortlist); static void requestRemoveClientFromChannel(const NetworkId & id, std::string const & playerName, std::string const &roomName); static void requestChannelCommand(ReturnAddress const & requester, const std::string &srcUserName, const std::string &destUserName, - const std::string &destChannelAddress, unsigned command, unsigned banTimeout); + const std::string &destChannelAddress, uint32_t command, uint32_t banTimeout); static void requestBroadcastChannelMessage(std::string const & channelName, std::string const & textMessage, bool isRemove); @@ -111,7 +111,7 @@ public: //----------------------------------------------------------------------- - std::unordered_map pendingRequests; + std::unordered_map pendingRequests; static ChatServer & instance (); static bool isValidChatAvatarName(Unicode::String const &chatName); @@ -124,25 +124,25 @@ public: static const ChatAvatar * getAvatarByNetworkId (const NetworkId & id); static const NetworkId & getNetworkIdByAvatarId(const ChatAvatarId & id); - static NetworkId sendResponseForTrackId (unsigned trackId, const GameNetworkMessage & msg); + static NetworkId sendResponseForTrackId (uint32_t trackId, const GameNetworkMessage & msg); static ChatInterface * getChatInterface(); static void setOwnerSystem (const ChatAvatar * ownerSystem); static ConnectionServerConnection * getConnectionForCharacter(const NetworkId & characterId); static const ChatAvatarId & getSystemAvatarId (); static const Service * getGameService (); - static GameServerConnection * getGameServerConnection(unsigned int sequence); - static void addGameServerConnection(unsigned int sequence, GameServerConnection *connection); + static GameServerConnection * getGameServerConnection(uint32_t sequence); + static void addGameServerConnection(uint32_t sequence, GameServerConnection *connection); static void clearGameServerConnection(const GameServerConnection *connection); static void clearCustomerServiceServerConnection(); - static void connectToCustomerServiceServer(const std::string &address, const unsigned short port); + static void connectToCustomerServiceServer(const std::string &address, const uint16_t port); static void sendToClient (const NetworkId & id, const GameNetworkMessage & msg); static void deferChatMessageFor (const NetworkId &, const Archive::ByteStream &); - static ChatAvatarId getAvatarIdForTrackId (unsigned trackId); + static ChatAvatarId getAvatarIdForTrackId (uint32_t trackId); static void reconnectToCentralServer (); static void onCentralServerConnectionClosed(); @@ -151,46 +151,46 @@ public: static void quit (); static void chatConnectedAvatar (const NetworkId & id, const ChatAvatar & avatar); - static void connectPlayer (ConnectionServerConnection * connection, const unsigned int suid, const std::string & characterName, const NetworkId & networkId, const bool isSecure, const bool isSubscribed); - static void createRoom (const NetworkId & id, const unsigned int sequence, const std::string & name, const bool isModerated, const bool isPublic, const std::string & title); + static void connectPlayer (ConnectionServerConnection * connection, const uint32_t suid, const std::string & characterName, const NetworkId & networkId, const bool isSecure, const bool isSubscribed); + static void createRoom (const NetworkId & id, const uint32_t sequence, const std::string & name, const bool isModerated, const bool isPublic, const std::string & title); static void putSystemAvatarInRoom (const std::string & roomName); - static void enterRoom (const NetworkId & id, const unsigned int sequence, const std::string & roomName); - static void enterRoom (const NetworkId & id, const unsigned int sequence, const unsigned int roomId); + static void enterRoom (const NetworkId & id, const uint32_t sequence, const std::string & roomName); + static void enterRoom (const NetworkId & id, const uint32_t sequence, const uint32_t roomId); static void enterRoom (const ChatAvatarId & id, const std::string & roomName, bool forceCreate, bool createPrivate); - static void sendInstantMessage (const NetworkId & fromId, const unsigned int sequence, const ChatAvatarId & to, const Unicode::String & message, const Unicode::String & oob); + static void sendInstantMessage (const NetworkId & fromId, const uint32_t sequence, const ChatAvatarId & to, const Unicode::String & message, const Unicode::String & oob); static void sendInstantMessage (const ChatAvatarId & from, const ChatAvatarId & to, const Unicode::String & message, const Unicode::String & oob); - static void leaveRoom (const NetworkId & id, const unsigned int sequence, const unsigned int roomId); + static void leaveRoom (const NetworkId & id, const uint32_t sequence, const uint32_t roomId); static void removeAvatarFromRoom (const NetworkId & requestor, const ChatAvatarId & avatarId, const std::string & roomName); static void removeSystemAvatarFromRoom(const ChatRoom *room); static void removeAvatarFromRoom (const ChatAvatarId & avatarId, const std::string & roomName); static void kickAvatarFromRoom (const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName); - static void sendRoomMessage (const NetworkId & id, const unsigned int sequence, const unsigned int roomId, const Unicode::String & message, const Unicode::String & oob); + static void sendRoomMessage (const NetworkId & id, const uint32_t sequence, const uint32_t roomId, const Unicode::String & message, const Unicode::String & oob); static void sendRoomMessage (const ChatAvatarId & from, const std::string & roomName, const Unicode::String & message, const Unicode::String & oob); static void sendStandardRoomMessage (const ChatAvatarId & from, const std::string & roomName, const Unicode::String & message, const Unicode::String & oob); - static void destroyRoom (const NetworkId & id, const unsigned int sequence, const unsigned int roomId); + static void destroyRoom (const NetworkId & id, const uint32_t sequence, const uint32_t roomId); static void destroyRoom (const std::string & roomName); - static void addFriend (const NetworkId & id, const unsigned int sequence, const ChatAvatarId & friendName); - static void removeFriend (const NetworkId & id, const unsigned int sequence, const ChatAvatarId & friendName); + static void addFriend (const NetworkId & id, const uint32_t sequence, const ChatAvatarId & friendName); + static void removeFriend (const NetworkId & id, const uint32_t sequence, const ChatAvatarId & friendName); static void getFriendsList (const ChatAvatarId & characterName); - static void addIgnore (const NetworkId & id, const unsigned int sequence, const ChatAvatarId & ignoreName); - static void removeIgnore (const NetworkId & id, const unsigned int sequence, const ChatAvatarId & ignoreName); + static void addIgnore (const NetworkId & id, const uint32_t sequence, const ChatAvatarId & ignoreName); + static void removeIgnore (const NetworkId & id, const uint32_t sequence, const ChatAvatarId & ignoreName); static void getIgnoreList (const ChatAvatarId & characterName); static void disconnectAvatar (const ChatAvatar &); static void disconnectPlayer (const NetworkId &); static void invite (const NetworkId & id, const ChatAvatarId & avatar, const std::string & roomName); static void inviteGroupMembers (const NetworkId & id, const ChatAvatarId & avatar, const std::string & roomName, const std::vector & members); - static void uninvite (const NetworkId & id, const unsigned int sequence, const ChatAvatarId & avatar, const std::string & roomName); - static void queryRoom (const NetworkId & id, ConnectionServerConnection * connection, const unsigned int sequence, const std::string & roomName); + static void uninvite (const NetworkId & id, const uint32_t sequence, const ChatAvatarId & avatar, const std::string & roomName); + static void queryRoom (const NetworkId & id, ConnectionServerConnection * connection, const uint32_t sequence, const std::string & roomName); static void requestRoomList (const NetworkId & id, ConnectionServerConnection * connection); - static void addModeratorToRoom (const unsigned int sequenceId, const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName); - static void removeModeratorFromRoom (const unsigned int sequenceId, const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName); - static void deletePersistentMessage (const NetworkId & ownerId, const unsigned int messageId); + static void addModeratorToRoom (const uint32_t sequenceId, const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName); + static void removeModeratorFromRoom (const uint32_t sequenceId, const NetworkId & id, const ChatAvatarId & avatarId, const std::string & roomName); + static void deletePersistentMessage (const NetworkId & ownerId, const uint32_t messageId); static void deleteAllPersistentMessages(const NetworkId &sourceNetworkId, const NetworkId &targetNetworkId); - static void sendPersistentMessage (const NetworkId & fromId, const unsigned int sequence, const ChatAvatarId & to, const Unicode::String & subject, const Unicode::String & message, const Unicode::String & oob); + static void sendPersistentMessage (const NetworkId & fromId, const uint32_t sequence, const ChatAvatarId & to, const Unicode::String & subject, const Unicode::String & message, const Unicode::String & oob); static void sendPersistentMessage (const ChatAvatarId & from, const ChatAvatarId & to, const Unicode::String & subject, const Unicode::String & message, const Unicode::String & oob); - static void requestPersistentMessage (const NetworkId &id, const unsigned int sequence, const unsigned int messageId); - static void banFromRoom (const unsigned sequence, const NetworkId &banner, const ChatAvatarId &bannee, const std::string &roomName); - static void unbanFromRoom (const unsigned sequence, const NetworkId &banner, const ChatAvatarId &bannee, const std::string &roomName); + static void requestPersistentMessage (const NetworkId &id, const uint32_t sequence, const uint32_t messageId); + static void banFromRoom (const uint32_t sequence, const NetworkId &banner, const ChatAvatarId &bannee, const std::string &roomName); + static void unbanFromRoom (const uint32_t sequence, const NetworkId &banner, const ChatAvatarId &bannee, const std::string &roomName); static void removeConnectionServerConnection(ConnectionServerConnection * target); static void sendToAllConnectionServers(const GameNetworkMessage &message); @@ -203,7 +203,7 @@ public: static void fileLog(bool const forceLog, char const * const label, char const * const format, ...); static void requestTransferAvatar(const TransferCharacterData & request); - static void onCreateRoomSuccess(const std::string & lowerName, const unsigned int roomId); + static void onCreateRoomSuccess(const std::string & lowerName, const uint32_t roomId); static bool isGod(const NetworkId & networkId); static void setUnsquelchTime(NetworkId const & character, time_t unsquelchTime); @@ -244,7 +244,7 @@ private: ChatInterface * chatInterface; VChatInterface * voiceChatInterface; std::unordered_map clientMap; - std::unordered_map gameServerConnectionMap; + std::unordered_map gameServerConnectionMap; std::set connectionServerConnections; bool done; @@ -255,7 +255,7 @@ private: static ChatServer * m_instance; CustomerServiceServerConnection *customerServiceServerConnection; - typedef std::unordered_map GameServerMap; + typedef std::unordered_map GameServerMap; GameServerMap m_gameServerConnectionRegistry; VoiceChatAvatarList m_voiceChatIdMap; std::map m_voiceChatNameToIdMap; @@ -284,14 +284,14 @@ private: std::hash_map chatAvatars; ChatInterface * chatInterface; std::hash_map clientMap; - std::hash_map gameServerConnectionMap; + std::hash_map gameServerConnectionMap; std::set connectionServerConnections; bool done; Service * gameService; Service * planetService; const ChatAvatar * ownerSystem; ChatAvatarId systemAvatarId; - std::hash_map pendingRequests; + std::hash_map pendingRequests; static ChatServer * m_instance; };*/ diff --git a/engine/server/application/ChatServer/src/shared/ConfigChatServer.h b/engine/server/application/ChatServer/src/shared/ConfigChatServer.h index 9c6d8303..e2410f38 100755 --- a/engine/server/application/ChatServer/src/shared/ConfigChatServer.h +++ b/engine/server/application/ChatServer/src/shared/ConfigChatServer.h @@ -40,13 +40,13 @@ public: }; static const char * getBackupGatewayServerIP (); - static const unsigned short getBackupGatewayServerPort (); + static const uint16_t getBackupGatewayServerPort (); static const char * getCentralServerAddress (); - static const unsigned short getCentralServerPort (); + static const uint16_t getCentralServerPort (); static const char * getClusterName (); static const char * getGameCode (); static const char * getGatewayServerIP (); - static const unsigned short getGatewayServerPort (); + static const uint16_t getGatewayServerPort (); static const time_t getRoomInactivityTimeout (); static const time_t getRoomUnpopulatedTimeout (); static const char * getGameServiceBindInterface (); @@ -85,9 +85,9 @@ inline const char * ConfigChatServer::getBackupGatewayServerIP() //----------------------------------------------------------------------- -inline const unsigned short ConfigChatServer::getBackupGatewayServerPort() +inline const uint16_t ConfigChatServer::getBackupGatewayServerPort() { - return static_cast(data->backupGatewayServerPort); + return static_cast(data->backupGatewayServerPort); } //----------------------------------------------------------------------- @@ -99,9 +99,9 @@ inline const char * ConfigChatServer::getCentralServerAddress() //----------------------------------------------------------------------- -inline const unsigned short ConfigChatServer::getCentralServerPort() +inline const uint16_t ConfigChatServer::getCentralServerPort() { - return static_cast(data->centralServerPort); + return static_cast(data->centralServerPort); } //----------------------------------------------------------------------- @@ -127,9 +127,9 @@ inline const char * ConfigChatServer::getGatewayServerIP() //----------------------------------------------------------------------- -inline const unsigned short ConfigChatServer::getGatewayServerPort() +inline const uint16_t ConfigChatServer::getGatewayServerPort() { - return static_cast(data->gatewayServerPort); + return static_cast(data->gatewayServerPort); } //----------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.cpp b/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.cpp index 4eb676ec..7df9c55b 100755 --- a/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.cpp +++ b/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.cpp @@ -50,7 +50,7 @@ //----------------------------------------------------------------------- -ConnectionServerConnection::ConnectionServerConnection(const std::string & a, const unsigned short p) : +ConnectionServerConnection::ConnectionServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()), m_avatars() { @@ -146,7 +146,7 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) if (!avatar && cmtype == constcrc("ChatInstantMessageToCharacter")) { PROFILER_AUTO_BLOCK_DEFINE("ConnectionServer - ChatInstantMessageToCharacter"); - //printf("!Sending via the shortcut\n"); + //printf("!Sending via the int16_tcut\n"); cri = c.getByteStream().begin(); // deliver IM to character diff --git a/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.h b/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.h index cf6866b6..48d65c69 100755 --- a/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.h +++ b/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.h @@ -18,7 +18,7 @@ class GameNetworkMessage; class ConnectionServerConnection : public ServerConnection { public: - ConnectionServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + ConnectionServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~ConnectionServerConnection(); void addAvatar (ChatServerAvatarOwner * avatar); diff --git a/engine/server/application/ChatServer/src/shared/CustomerServiceServerConnection.cpp b/engine/server/application/ChatServer/src/shared/CustomerServiceServerConnection.cpp index 7ca8d87e..562f3616 100755 --- a/engine/server/application/ChatServer/src/shared/CustomerServiceServerConnection.cpp +++ b/engine/server/application/ChatServer/src/shared/CustomerServiceServerConnection.cpp @@ -12,7 +12,7 @@ #include "sharedNetworkMessages/ChatOnRequestLog.h" //---------------------------------------------------------------------- -CustomerServiceServerConnection::CustomerServiceServerConnection(const std::string & a, const unsigned short p) +CustomerServiceServerConnection::CustomerServiceServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { ChatServer::fileLog(true, "CSServerConnection", "Connection created...listening on (%s:%d)", a.c_str(), static_cast(p)); diff --git a/engine/server/application/ChatServer/src/shared/CustomerServiceServerConnection.h b/engine/server/application/ChatServer/src/shared/CustomerServiceServerConnection.h index 66c0691d..88b4c360 100755 --- a/engine/server/application/ChatServer/src/shared/CustomerServiceServerConnection.h +++ b/engine/server/application/ChatServer/src/shared/CustomerServiceServerConnection.h @@ -14,7 +14,7 @@ class CustomerServiceServerConnection : public ServerConnection { public: - CustomerServiceServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + CustomerServiceServerConnection(const std::string & remoteAddress, const uint16_t remotePort); virtual ~CustomerServiceServerConnection(); void onConnectionClosed(); diff --git a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp index b98704bc..89828741 100755 --- a/engine/server/application/ChatServer/src/shared/VChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/VChatInterface.cpp @@ -328,12 +328,12 @@ unsigned VChatInterface::internalGetChannel(const std::string &channelName, info->moderators = moderators; //This is dumb. vchat should be consistant about qualifying channel names. - std::string shortName, server, game; - VChatSystem::GetChannelComponents(channelName,shortName,server,game); + std::string int16_tName, server, game; + VChatSystem::GetChannelComponents(channelName,int16_tName,server,game); DEBUG_WARNING(game != ConfigChatServer::getGameCode(),("Channel create request with mismatched game code %s (should be %s)", game.c_str(), ConfigChatServer::getGameCode())); DEBUG_WARNING(server != ConfigChatServer::getClusterName(),("Channel create request with mismatched cluster name %s (should be %s)", server.c_str(), ConfigChatServer::getClusterName())); - unsigned track = VChatAPI::GetChannelV2(shortName, game, server, description, password, limit, persistent, (void*)info); + unsigned track = VChatAPI::GetChannelV2(int16_tName, game, server, description, password, limit, persistent, (void*)info); ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "requestGetChannel track(%d) requester(%s) name(%s) desc(%s) pass(%s) public(%s) persist(%s)", track, requester.debugString().c_str(), channelName.c_str(), description.c_str(), password.c_str(), isPublic?"true":"false", persistent?"true":"false"); @@ -353,12 +353,12 @@ unsigned VChatInterface::requestDeleteChannel(std::string const &channelName, Re info->channelName = channelName; //dumb - std::string shortName, server, game; - VChatSystem::GetChannelComponents(channelName,shortName,server,game); + std::string int16_tName, server, game; + VChatSystem::GetChannelComponents(channelName,int16_tName,server,game); DEBUG_WARNING(game != ConfigChatServer::getGameCode(),("Channel delete request with mismatched game code %s (should be %s)", game.c_str(), ConfigChatServer::getGameCode())); DEBUG_WARNING(server != ConfigChatServer::getClusterName(),("Channel delete request with mismatched cluster name %s (should be %s)", server.c_str(), ConfigChatServer::getClusterName())); - unsigned track = VChatAPI::DeleteChannel(shortName, game, server, info); + unsigned track = VChatAPI::DeleteChannel(int16_tName, game, server, info); ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "requestDeleteChannel track(%d) requester(%s) name(%s)", track, requester.debugString().c_str(), channelName.c_str()); @@ -417,10 +417,10 @@ unsigned VChatInterface::requestChannelInfo(std::string const & channelName, Ret info->textMessage = broadcastMessage; //split the name since we can't request any random channel... - std::string shortName, server, game; - VChatSystem::GetChannelComponents(info->channelName, shortName, server, game); + std::string int16_tName, server, game; + VChatSystem::GetChannelComponents(info->channelName, int16_tName, server, game); - uint32 track = VChatAPI::GetChannelInfo(shortName, game, server, (void*)info); + uint32 track = VChatAPI::GetChannelInfo(int16_tName, game, server, (void*)info); ChatServer::fileLog(ms_voiceLoggingEnabled, ms_logLable, "requestChannelInfo: track(%d) channel(%s) requester(%s)", track, info->channelName.c_str(), info->requester.debugString().c_str()); diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp index 328f189e..295df22a 100644 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp @@ -4323,7 +4323,7 @@ void static decodeOOB(const std::string & UTF8String, Unicode::String & UniStrin { std::string::const_iterator c = UTF8String.begin(); std::string tempstring; - unsigned short unicharvalue; + uint16_t unicharvalue; char * pEnd; while (c != UTF8String.end()) @@ -4331,10 +4331,10 @@ void static decodeOOB(const std::string & UTF8String, Unicode::String & UniStrin tempstring.push_back(*c); if (tempstring.length() == 4) { - unicharvalue = static_cast(strtoul(tempstring.c_str(), &pEnd, 16)); + unicharvalue = static_cast(strtoul(tempstring.c_str(), &pEnd, 16)); if (pEnd) { - // WARNING(true, ("[Commodities Server ] : Conversion of string hex values to unsigned short failed in: TaskGetAuctionList::decodeOOB.\n")); + // WARNING(true, ("[Commodities Server ] : Conversion of string hex values to uint16_t failed in: TaskGetAuctionList::decodeOOB.\n")); } UniString.push_back(unicharvalue); tempstring.clear(); diff --git a/engine/server/application/CommoditiesServer/src/shared/CentralServerConnection.cpp b/engine/server/application/CommoditiesServer/src/shared/CentralServerConnection.cpp index 45e87326..5de4f74a 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/CentralServerConnection.cpp @@ -8,7 +8,7 @@ #include "sharedNetwork/NetworkSetupData.h" //----------------------------------------------------------------------- -CentralServerConnection::CentralServerConnection(const std::string & address, const unsigned short port) : +CentralServerConnection::CentralServerConnection(const std::string & address, const uint16_t port) : ServerConnection(address, port, NetworkSetupData()) { } diff --git a/engine/server/application/CommoditiesServer/src/shared/CentralServerConnection.h b/engine/server/application/CommoditiesServer/src/shared/CentralServerConnection.h index a29199b5..4897c0dc 100755 --- a/engine/server/application/CommoditiesServer/src/shared/CentralServerConnection.h +++ b/engine/server/application/CommoditiesServer/src/shared/CentralServerConnection.h @@ -14,7 +14,7 @@ class CentralServerConnection : public ServerConnection { public: - CentralServerConnection (const std::string & address, const unsigned short port); + CentralServerConnection (const std::string & address, const uint16_t port); CentralServerConnection(UdpConnectionMT *, TcpClient *); ~CentralServerConnection(); void onConnectionClosed(); diff --git a/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.h b/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.h index 9bdff873..dd2c5744 100755 --- a/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.h +++ b/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.h @@ -88,14 +88,14 @@ class ConfigCommodityServer //----------------------------------------------------------------------- -inline unsigned short ConfigCommodityServer::getCMServerServiceBindPort() +inline uint16_t ConfigCommodityServer::getCMServerServiceBindPort() { return data->cmServerServiceBindPort; } //----------------------------------------------------------------------- -inline unsigned short ConfigCommodityServer::getDatabaseServerPort() +inline uint16_t ConfigCommodityServer::getDatabaseServerPort() { return data->databaseServerPort; } @@ -144,7 +144,7 @@ inline const char * ConfigCommodityServer::getDatabaseSchema() //----------------------------------------------------------------------- -inline unsigned short ConfigCommodityServer::getSecondsBetweenDBReconnect() +inline uint16_t ConfigCommodityServer::getSecondsBetweenDBReconnect() { return data->secondsBetweenDBReconnect; } @@ -228,7 +228,7 @@ inline bool ConfigCommodityServer::getShowAllDebugInfo() //----------------------------------------------------------------------- -inline unsigned short ConfigCommodityServer::getCentralServerPort() +inline uint16_t ConfigCommodityServer::getCentralServerPort() { return data->centralServerPort; } diff --git a/engine/server/application/CommoditiesServer/src/shared/DatabaseServerConnection.cpp b/engine/server/application/CommoditiesServer/src/shared/DatabaseServerConnection.cpp index 20b9a9cd..4e50f021 100755 --- a/engine/server/application/CommoditiesServer/src/shared/DatabaseServerConnection.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/DatabaseServerConnection.cpp @@ -25,7 +25,7 @@ //----------------------------------------------------------------------- -DatabaseServerConnection::DatabaseServerConnection(const std::string & a, const unsigned short p) : +DatabaseServerConnection::DatabaseServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { LOG("DatabaseServerConnection", ("Connection with the database server created")); diff --git a/engine/server/application/CommoditiesServer/src/shared/DatabaseServerConnection.h b/engine/server/application/CommoditiesServer/src/shared/DatabaseServerConnection.h index 4359f9f9..8b3dfcc8 100755 --- a/engine/server/application/CommoditiesServer/src/shared/DatabaseServerConnection.h +++ b/engine/server/application/CommoditiesServer/src/shared/DatabaseServerConnection.h @@ -14,7 +14,7 @@ class DatabaseServerConnection : public ServerConnection { public: - DatabaseServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + DatabaseServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~DatabaseServerConnection(); void onConnectionClosed(); diff --git a/engine/server/application/ConnectionServer/src/shared/CentralConnection.cpp b/engine/server/application/ConnectionServer/src/shared/CentralConnection.cpp index 5ca0cca1..ba176f81 100755 --- a/engine/server/application/ConnectionServer/src/shared/CentralConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/CentralConnection.cpp @@ -18,7 +18,7 @@ //----------------------------------------------------------------------- -CentralConnection::CentralConnection(const std::string & address, const unsigned short port) : +CentralConnection::CentralConnection(const std::string & address, const uint16_t port) : ServerConnection(address, port, NetworkSetupData()) { } diff --git a/engine/server/application/ConnectionServer/src/shared/CentralConnection.h b/engine/server/application/ConnectionServer/src/shared/CentralConnection.h index 103520f8..df03c358 100755 --- a/engine/server/application/ConnectionServer/src/shared/CentralConnection.h +++ b/engine/server/application/ConnectionServer/src/shared/CentralConnection.h @@ -14,7 +14,7 @@ class CentralConnection : public ServerConnection { public: - CentralConnection (const std::string & address, const unsigned short port); + CentralConnection (const std::string & address, const uint16_t port); CentralConnection(UdpConnectionMT *, TcpClient *); ~CentralConnection(); void onConnectionClosed(); diff --git a/engine/server/application/ConnectionServer/src/shared/Client.cpp b/engine/server/application/ConnectionServer/src/shared/Client.cpp index f7dadc0c..37044b33 100755 --- a/engine/server/application/ConnectionServer/src/shared/Client.cpp +++ b/engine/server/application/ConnectionServer/src/shared/Client.cpp @@ -163,7 +163,7 @@ void Client::receiveMessage(const MessageDispatch::Emitter & source, const Messa if(messageType == constcrc("GameConnectionClosed")) { - // Game server has crashed. With luck, we'll get transferred to a new server shortly + // Game server has crashed. With luck, we'll get transferred to a new server int16_tly // So, clear our connection and put us on a queue. If we don't get transferred in a // reasonable about of time, we'll be dropped. diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index e30109b2..c5ac5390 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -925,7 +925,7 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) { default : { //Forward on to Game Server DEBUG_REPORT_LOG((!m_client || - !m_client->getGameConnection()), ("Warn, received game message with no game connection. This may happen for a short time after a GameServer crashes. If it continues to happen, it indicates a bug.\n")); + !m_client->getGameConnection()), ("Warn, received game message with no game connection. This may happen for a int16_t time after a GameServer crashes. If it continues to happen, it indicates a bug.\n")); if (m_client && m_client->getGameConnection()) { static std::vector v; @@ -992,7 +992,7 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) { Unicode::String biography(clientCreate.getBiography()); if (biography.length() > 1024) { IGNORE_RETURN(biography.erase(1024)); - DEBUG_REPORT_LOG(true, ("Biography shortened to 1024 characters.\n")); + DEBUG_REPORT_LOG(true, ("Biography int16_tened to 1024 characters.\n")); } if (m_isAdminAccount) { diff --git a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp index ab5bc281..c854bed6 100755 --- a/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/GameConnection.cpp @@ -35,7 +35,7 @@ //----------------------------------------------------------------------- -GameConnection::GameConnection(const std::string & a, const unsigned short p) : +GameConnection::GameConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()), gameServerId(0), sceneName() diff --git a/engine/server/application/ConnectionServer/src/shared/GameConnection.h b/engine/server/application/ConnectionServer/src/shared/GameConnection.h index 30fc3265..e63c121f 100755 --- a/engine/server/application/ConnectionServer/src/shared/GameConnection.h +++ b/engine/server/application/ConnectionServer/src/shared/GameConnection.h @@ -16,7 +16,7 @@ class GameCommandChannel; class GameConnection : public ServerConnection { public: - GameConnection(const std::string & remoteAddress, const unsigned short port); + GameConnection(const std::string & remoteAddress, const uint16_t port); GameConnection(UdpConnectionMT *, TcpClient *); virtual ~GameConnection(); diff --git a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp index 8e74a876..f18cebb7 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.cpp @@ -17,7 +17,7 @@ //----------------------------------------------------------------------- -CentralServerConnection::CentralServerConnection(const std::string & a, const unsigned short p) : +CentralServerConnection::CentralServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { LOG("CentralServerConnection", ("Connection created...listening on (%s:%d)", a.c_str(), static_cast(p))); @@ -56,7 +56,7 @@ void CentralServerConnection::onConnectionOpened() //DEBUG_REPORT_LOG(true, ("CustServ: sending chat server service address(%s:%d)\n", address.c_str(), port)); - const GenericValueTypeMessage > message("CustomerServiceServerChatServerServiceAddress", std::make_pair(address, port)); + const GenericValueTypeMessage > message("CustomerServiceServerChatServerServiceAddress", std::make_pair(address, port)); send(message, true); } @@ -78,7 +78,7 @@ void CentralServerConnection::onConnectionOpened() //DEBUG_REPORT_LOG(true, ("CustServ: sending game server service address(%s:%d)\n", address.c_str(), port)); - const GenericValueTypeMessage > message("CustomerServiceServerGameServerServiceAddress", std::make_pair(address, port)); + const GenericValueTypeMessage > message("CustomerServiceServerGameServerServiceAddress", std::make_pair(address, port)); send(message, true); } diff --git a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.h b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.h index 86db9b51..fa563aa7 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.h +++ b/engine/server/application/CustomerServiceServer/src/shared/CentralServerConnection.h @@ -14,7 +14,7 @@ class CentralServerConnection : public ServerConnection { public: - CentralServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + CentralServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~CentralServerConnection(); void onConnectionClosed (); diff --git a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp index d0e93110..d0b49879 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.cpp @@ -89,9 +89,9 @@ const char * ConfigCustomerServiceServer::getCustomerServiceServerAddress() //----------------------------------------------------------------------- -unsigned short ConfigCustomerServiceServer::getCustomerServiceServerPort() +uint16_t ConfigCustomerServiceServer::getCustomerServiceServerPort() { - return static_cast(s_csServerPort); + return static_cast(s_csServerPort); } //----------------------------------------------------------------------- @@ -103,9 +103,9 @@ const char * ConfigCustomerServiceServer::getCentralServerAddress() //----------------------------------------------------------------------- -unsigned short ConfigCustomerServiceServer::getCentralServerPort() +uint16_t ConfigCustomerServiceServer::getCentralServerPort() { - return static_cast(s_centralServerPort); + return static_cast(s_centralServerPort); } //----------------------------------------------------------------------- @@ -131,16 +131,16 @@ int ConfigCustomerServiceServer::getMaxAllowedNumberOfTickets() //----------------------------------------------------------------------- -unsigned short ConfigCustomerServiceServer::getGameServicePort() +uint16_t ConfigCustomerServiceServer::getGameServicePort() { - return static_cast(s_gameServicePort); + return static_cast(s_gameServicePort); } //----------------------------------------------------------------------- -unsigned short ConfigCustomerServiceServer::getChatServicePort() +uint16_t ConfigCustomerServiceServer::getChatServicePort() { - return static_cast(s_chatServicePort); + return static_cast(s_chatServicePort); } //----------------------------------------------------------------------- diff --git a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.h b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.h index 4ed8136d..088bd8fb 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.h +++ b/engine/server/application/CustomerServiceServer/src/shared/ConfigCustomerServiceServer.h @@ -14,16 +14,16 @@ public: static void remove(); static const char * getCustomerServiceServerAddress(); - static unsigned short getCustomerServiceServerPort(); + static uint16_t getCustomerServiceServerPort(); static const char * getCentralServerAddress(); - static unsigned short getCentralServerPort(); + static uint16_t getCentralServerPort(); static const char * getClusterName(); static const char * getGameCode(); static int getMaxPacketsPerSecond(); static unsigned int getRequestTimeoutSeconds(); static int getMaxAllowedNumberOfTickets(); - static unsigned short getGameServicePort(); - static unsigned short getChatServicePort(); + static uint16_t getGameServicePort(); + static uint16_t getChatServicePort(); static const char* getChatServiceBindInterface(); static const char* getGameServiceBindInterface(); static bool getWriteTicketToBugLog(); diff --git a/engine/server/application/CustomerServiceServer/src/shared/ConnectionServerConnection.cpp b/engine/server/application/CustomerServiceServer/src/shared/ConnectionServerConnection.cpp index 1e70e7a5..55c6359e 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ConnectionServerConnection.cpp +++ b/engine/server/application/CustomerServiceServer/src/shared/ConnectionServerConnection.cpp @@ -28,7 +28,7 @@ //----------------------------------------------------------------------- -ConnectionServerConnection::ConnectionServerConnection(const std::string & a, const unsigned short p) : +ConnectionServerConnection::ConnectionServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { LOG("ConnectionServerConnection", ("Connection created...listening on (%s:%d)", a.c_str(), static_cast(p))); diff --git a/engine/server/application/CustomerServiceServer/src/shared/ConnectionServerConnection.h b/engine/server/application/CustomerServiceServer/src/shared/ConnectionServerConnection.h index bb0975f7..8e0e9775 100755 --- a/engine/server/application/CustomerServiceServer/src/shared/ConnectionServerConnection.h +++ b/engine/server/application/CustomerServiceServer/src/shared/ConnectionServerConnection.h @@ -15,7 +15,7 @@ class GameNetworkMessage; class ConnectionServerConnection : public ServerConnection { public: - ConnectionServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + ConnectionServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~ConnectionServerConnection(); void onConnectionClosed (); diff --git a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp index c2429a76..1c7af7bc 100755 --- a/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp +++ b/engine/server/application/LogServer/src/shared/LoggingServerApi.cpp @@ -283,7 +283,7 @@ void LoggingServerApi::PacketSend(LogicalPacket *lp) } } -void LoggingServerApi::Log16(const char *filename, int typeCode, const unsigned short *ucs2String) +void LoggingServerApi::Log16(const char *filename, int typeCode, const uint16_t *ucs2String) { char buffer[32768]; char * const ptr_end_buffer = &buffer[sizeof(buffer)]; @@ -293,7 +293,7 @@ void LoggingServerApi::Log16(const char *filename, int typeCode, const unsigned strcpy(ptr, filename); ptr += strlen(ptr) + 1; - const unsigned short *rawPtr = ucs2String; + const uint16_t *rawPtr = ucs2String; char *startPtr = ptr; for (;;) { diff --git a/engine/server/application/LogServer/src/shared/LoggingServerApi.h b/engine/server/application/LogServer/src/shared/LoggingServerApi.h index d0ed2ef3..e4c0fd33 100755 --- a/engine/server/application/LogServer/src/shared/LoggingServerApi.h +++ b/engine/server/application/LogServer/src/shared/LoggingServerApi.h @@ -35,7 +35,7 @@ class LoggingServerApi : public UdpConnectionHandler Status GetStatus() const; void GiveTime(); - void Log16(const char *filename, int typeCode, const unsigned short *ucs2String); // no formatting support, application will have to do that on it's own + void Log16(const char *filename, int typeCode, const uint16_t *ucs2String); // no formatting support, application will have to do that on it's own void Log(const char *filename, int typeCode, const char *message, ...); // printf style formatting void StartTransaction(); diff --git a/engine/server/application/LoginPing/src/shared/LoginConnection.cpp b/engine/server/application/LoginPing/src/shared/LoginConnection.cpp index a985883e..3ccf4bcc 100755 --- a/engine/server/application/LoginPing/src/shared/LoginConnection.cpp +++ b/engine/server/application/LoginPing/src/shared/LoginConnection.cpp @@ -11,7 +11,7 @@ //----------------------------------------------------------------------- -LoginConnection::LoginConnection(const std::string & a, const unsigned short p) : +LoginConnection::LoginConnection(const std::string & a, const uint16_t p) : Connection(a, p, NetworkSetupData()) { REPORT_LOG(true, ("Waiting for loginserver connection %s:%d\n", a.c_str(), p)); diff --git a/engine/server/application/LoginPing/src/shared/LoginConnection.h b/engine/server/application/LoginPing/src/shared/LoginConnection.h index 8ebbc340..e80a5aac 100755 --- a/engine/server/application/LoginPing/src/shared/LoginConnection.h +++ b/engine/server/application/LoginPing/src/shared/LoginConnection.h @@ -14,7 +14,7 @@ class LoginConnection : public Connection { public: - LoginConnection(const std::string & remoteAddress, const unsigned short port); + LoginConnection(const std::string & remoteAddress, const uint16_t port); ~LoginConnection(); virtual void onConnectionClosed (); diff --git a/engine/server/application/LoginServer/src/shared/CSToolConnection.h b/engine/server/application/LoginServer/src/shared/CSToolConnection.h index 08651f09..44c1276c 100755 --- a/engine/server/application/LoginServer/src/shared/CSToolConnection.h +++ b/engine/server/application/LoginServer/src/shared/CSToolConnection.h @@ -19,7 +19,7 @@ public: CSToolConnection( const std::string & address, - const unsigned short port); + const uint16_t port); virtual ~CSToolConnection(); diff --git a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp index 443e187e..43b3d9e8 100755 --- a/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/CentralServerConnection.cpp @@ -55,7 +55,7 @@ CentralServerConnection::CentralServerConnection(UdpConnectionMT * u, TcpClient CentralServerConnection::CentralServerConnection( const std::string & address, - const unsigned short port, + const uint16_t port, const std::string &clusterName, const uint32 clusterId) : ServerConnection(address,port, NetworkSetupData()), diff --git a/engine/server/application/LoginServer/src/shared/CentralServerConnection.h b/engine/server/application/LoginServer/src/shared/CentralServerConnection.h index 75d657b2..688f1979 100755 --- a/engine/server/application/LoginServer/src/shared/CentralServerConnection.h +++ b/engine/server/application/LoginServer/src/shared/CentralServerConnection.h @@ -22,7 +22,7 @@ public: CentralServerConnection( const std::string & address, - const unsigned short port, + const uint16_t port, const std::string &clusterName, const uint32 clusterId); diff --git a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp index 73ff91ae..db444089 100755 --- a/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp +++ b/engine/server/application/LoginServer/src/shared/SessionApiClient.cpp @@ -120,7 +120,7 @@ void SessionApiClient::OnSessionValidate(const apiTrackingNumber trackingNumber, else { // attempt to validate a CS Tool associated with this request. - CSToolConnection::validateCSTool( ( uint32 )userData, result, session ); + CSToolConnection::validateCSTool( ( uintptr_t )userData, result, session ); } } diff --git a/engine/server/application/MetricsServer/src/shared/TaskConnection.cpp b/engine/server/application/MetricsServer/src/shared/TaskConnection.cpp index 3ec3e534..a4a0a868 100755 --- a/engine/server/application/MetricsServer/src/shared/TaskConnection.cpp +++ b/engine/server/application/MetricsServer/src/shared/TaskConnection.cpp @@ -16,7 +16,7 @@ //----------------------------------------------------------------------- -TaskConnection::TaskConnection(const std::string & a, const unsigned short p) : +TaskConnection::TaskConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/application/MetricsServer/src/shared/TaskConnection.h b/engine/server/application/MetricsServer/src/shared/TaskConnection.h index 4372fa92..86340a95 100755 --- a/engine/server/application/MetricsServer/src/shared/TaskConnection.h +++ b/engine/server/application/MetricsServer/src/shared/TaskConnection.h @@ -16,7 +16,7 @@ class TaskCommandChannel; class TaskConnection : public ServerConnection { public: - TaskConnection(const std::string & remoteAddress, const unsigned short remotePort); + TaskConnection(const std::string & remoteAddress, const uint16_t remotePort); TaskConnection(UdpConnectionMT * u, TcpClient *); ~TaskConnection(); diff --git a/engine/server/application/PlanetServer/src/shared/CentralServerConnection.cpp b/engine/server/application/PlanetServer/src/shared/CentralServerConnection.cpp index e9866455..93873835 100755 --- a/engine/server/application/PlanetServer/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/PlanetServer/src/shared/CentralServerConnection.cpp @@ -19,7 +19,7 @@ //----------------------------------------------------------------------- -CentralServerConnection::CentralServerConnection(const std::string & a, const unsigned short p) : +CentralServerConnection::CentralServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/application/PlanetServer/src/shared/CentralServerConnection.h b/engine/server/application/PlanetServer/src/shared/CentralServerConnection.h index 5784a14e..0d77f5c7 100755 --- a/engine/server/application/PlanetServer/src/shared/CentralServerConnection.h +++ b/engine/server/application/PlanetServer/src/shared/CentralServerConnection.h @@ -17,7 +17,7 @@ class CentralServerConnection : public ServerConnection { public: - CentralServerConnection (const std::string & remoteAddress, const unsigned short port); + CentralServerConnection (const std::string & remoteAddress, const uint16_t port); ~CentralServerConnection (); void onConnectionClosed (); diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp index acec5ecf..67a5c315 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.cpp @@ -271,9 +271,9 @@ const Service * PlanetServer::getGameService() const //----------------------------------------------------------------------- -const unsigned short PlanetServer::getGameServicePort() const +const uint16_t PlanetServer::getGameServicePort() const { - unsigned short result = 0; + uint16_t result = 0; if(m_gameService) result = m_gameService->getBindPort(); return result; diff --git a/engine/server/application/PlanetServer/src/shared/PlanetServer.h b/engine/server/application/PlanetServer/src/shared/PlanetServer.h index 592e3ff2..76be1bf5 100755 --- a/engine/server/application/PlanetServer/src/shared/PlanetServer.h +++ b/engine/server/application/PlanetServer/src/shared/PlanetServer.h @@ -51,7 +51,7 @@ public: void mainLoop(void); void setDone(char const *reasonfmt, ...); - const unsigned short getGameServicePort() const; + const uint16_t getGameServicePort() const; const Service * getGameService() const; int getNumberOfGameServers() const; int getObjectCountForServer(uint32 serverId) const; diff --git a/engine/server/application/PlanetServer/src/shared/TaskConnection.cpp b/engine/server/application/PlanetServer/src/shared/TaskConnection.cpp index 15636b14..d9f7e651 100755 --- a/engine/server/application/PlanetServer/src/shared/TaskConnection.cpp +++ b/engine/server/application/PlanetServer/src/shared/TaskConnection.cpp @@ -14,7 +14,7 @@ //----------------------------------------------------------------------- -TaskConnection::TaskConnection(const std::string & a, const unsigned short p) : +TaskConnection::TaskConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/application/PlanetServer/src/shared/TaskConnection.h b/engine/server/application/PlanetServer/src/shared/TaskConnection.h index 1c20e1df..96716927 100755 --- a/engine/server/application/PlanetServer/src/shared/TaskConnection.h +++ b/engine/server/application/PlanetServer/src/shared/TaskConnection.h @@ -18,7 +18,7 @@ class TaskCommandChannel; class TaskConnection : public ServerConnection { public: - TaskConnection(const std::string & remoteAddress, const unsigned short remotePort); + TaskConnection(const std::string & remoteAddress, const uint16_t remotePort); TaskConnection(UdpConnectionMT * u, TcpClient *); ~TaskConnection(); diff --git a/engine/server/application/ServerConsole/src/shared/ConfigServerConsole.cpp b/engine/server/application/ServerConsole/src/shared/ConfigServerConsole.cpp index 53955275..19efafc6 100755 --- a/engine/server/application/ServerConsole/src/shared/ConfigServerConsole.cpp +++ b/engine/server/application/ServerConsole/src/shared/ConfigServerConsole.cpp @@ -45,9 +45,9 @@ const char * const ConfigServerConsole::getServerAddress() //----------------------------------------------------------------------- -unsigned short ConfigServerConsole::getServerPort() +uint16_t ConfigServerConsole::getServerPort() { - return static_cast(serverPort); + return static_cast(serverPort); } //----------------------------------------------------------------------- diff --git a/engine/server/application/ServerConsole/src/shared/ConfigServerConsole.h b/engine/server/application/ServerConsole/src/shared/ConfigServerConsole.h index d1e84199..6a45124b 100755 --- a/engine/server/application/ServerConsole/src/shared/ConfigServerConsole.h +++ b/engine/server/application/ServerConsole/src/shared/ConfigServerConsole.h @@ -14,7 +14,7 @@ public: ~ConfigServerConsole(); static const char * const getServerAddress (); - static unsigned short getServerPort (); + static uint16_t getServerPort (); static void install(); static void remove(); diff --git a/engine/server/application/ServerConsole/src/shared/ServerConsoleConnection.cpp b/engine/server/application/ServerConsole/src/shared/ServerConsoleConnection.cpp index 68d7686b..736a95dd 100755 --- a/engine/server/application/ServerConsole/src/shared/ServerConsoleConnection.cpp +++ b/engine/server/application/ServerConsole/src/shared/ServerConsoleConnection.cpp @@ -14,7 +14,7 @@ //----------------------------------------------------------------------- -ServerConsoleConnection::ServerConsoleConnection(const std::string & address, const unsigned short port) : +ServerConsoleConnection::ServerConsoleConnection(const std::string & address, const uint16_t port) : Connection(address, port, NetworkSetupData()) { } diff --git a/engine/server/application/ServerConsole/src/shared/ServerConsoleConnection.h b/engine/server/application/ServerConsole/src/shared/ServerConsoleConnection.h index 9a881141..3a0ca1da 100755 --- a/engine/server/application/ServerConsole/src/shared/ServerConsoleConnection.h +++ b/engine/server/application/ServerConsole/src/shared/ServerConsoleConnection.h @@ -15,7 +15,7 @@ class ServerConsoleConnection : public Connection { public: - ServerConsoleConnection(const std::string & address, const unsigned short port); + ServerConsoleConnection(const std::string & address, const uint16_t port); ~ServerConsoleConnection(); void onConnectionClosed (); diff --git a/engine/server/application/StationPlayersCollector/src/shared/CentralServerConnection.cpp b/engine/server/application/StationPlayersCollector/src/shared/CentralServerConnection.cpp index 372241a3..9d540349 100755 --- a/engine/server/application/StationPlayersCollector/src/shared/CentralServerConnection.cpp +++ b/engine/server/application/StationPlayersCollector/src/shared/CentralServerConnection.cpp @@ -38,7 +38,7 @@ CentralServerConnection::CentralServerConnection(UdpConnectionMT * u, TcpClient //----------------------------------------------------------------------- -CentralServerConnection::CentralServerConnection(const std::string & a, const unsigned short p) : +CentralServerConnection::CentralServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/application/StationPlayersCollector/src/shared/CentralServerConnection.h b/engine/server/application/StationPlayersCollector/src/shared/CentralServerConnection.h index 81dc28e0..b4f521b5 100755 --- a/engine/server/application/StationPlayersCollector/src/shared/CentralServerConnection.h +++ b/engine/server/application/StationPlayersCollector/src/shared/CentralServerConnection.h @@ -19,7 +19,7 @@ class CentralServerConnection : public ServerConnection { public: CentralServerConnection(UdpConnectionMT *, TcpClient * t); - CentralServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + CentralServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~CentralServerConnection(); virtual void onConnectionClosed (); virtual void onConnectionOpened (); diff --git a/engine/server/application/StationPlayersCollector/src/shared/ConfigStationPlayersCollector.cpp b/engine/server/application/StationPlayersCollector/src/shared/ConfigStationPlayersCollector.cpp index 19c20417..cbf462d1 100755 --- a/engine/server/application/StationPlayersCollector/src/shared/ConfigStationPlayersCollector.cpp +++ b/engine/server/application/StationPlayersCollector/src/shared/ConfigStationPlayersCollector.cpp @@ -58,7 +58,7 @@ void ConfigStationPlayersCollector::remove(void) //----------------------------------------------------------------------- -unsigned short ConfigStationPlayersCollector::getCentralServerServiceBindPort() +uint16_t ConfigStationPlayersCollector::getCentralServerServiceBindPort() { return data->centralServerServiceBindPort; } @@ -101,7 +101,7 @@ const char * ConfigStationPlayersCollector::getDatabaseSchema() //----------------------------------------------------------------------- -unsigned short ConfigStationPlayersCollector::getSecondsBetweenDBReconnect() +uint16_t ConfigStationPlayersCollector::getSecondsBetweenDBReconnect() { return data->secondsBetweenDBReconnect; } diff --git a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp index 3aa53136..2a4b7cff 100755 --- a/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/ManagerConnection.cpp @@ -37,7 +37,7 @@ using namespace ManagerConnectionNamespace; //----------------------------------------------------------------------- -ManagerConnection::ManagerConnection(const std::string & a, const unsigned short p) : +ManagerConnection::ManagerConnection(const std::string & a, const uint16_t p) : Connection(a,p, NetworkSetupData()), m_nodeLabel(0), m_remoteUtilAvg(100000.0f) diff --git a/engine/server/application/TaskManager/src/shared/ManagerConnection.h b/engine/server/application/TaskManager/src/shared/ManagerConnection.h index 5c4922ca..a1fb632b 100755 --- a/engine/server/application/TaskManager/src/shared/ManagerConnection.h +++ b/engine/server/application/TaskManager/src/shared/ManagerConnection.h @@ -19,7 +19,7 @@ class TaskConnection; class ManagerConnection : public Connection { public: - ManagerConnection(const std::string & remoteAddres, const unsigned short remotePort); + ManagerConnection(const std::string & remoteAddres, const uint16_t remotePort); ManagerConnection(UdpConnectionMT*, TcpClient *); ~ManagerConnection(); diff --git a/engine/server/application/TaskManager/src/shared/TaskConnection.cpp b/engine/server/application/TaskManager/src/shared/TaskConnection.cpp index b1751e29..8ad18fc9 100755 --- a/engine/server/application/TaskManager/src/shared/TaskConnection.cpp +++ b/engine/server/application/TaskManager/src/shared/TaskConnection.cpp @@ -24,7 +24,7 @@ //----------------------------------------------------------------------- -TaskConnection::TaskConnection(const std::string & a, const unsigned short p) : +TaskConnection::TaskConnection(const std::string & a, const uint16_t p) : Connection(a, p, NetworkSetupData()), closed(), failed(), diff --git a/engine/server/application/TaskManager/src/shared/TaskConnection.h b/engine/server/application/TaskManager/src/shared/TaskConnection.h index f427756c..81683f05 100755 --- a/engine/server/application/TaskManager/src/shared/TaskConnection.h +++ b/engine/server/application/TaskManager/src/shared/TaskConnection.h @@ -34,7 +34,7 @@ class TaskConnection : public Connection public: public: - TaskConnection(const std::string & remoteAddress, const unsigned short remotePort); + TaskConnection(const std::string & remoteAddress, const uint16_t remotePort); TaskConnection(UdpConnectionMT *, TcpClient *); ~TaskConnection(); diff --git a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp index ca5d0845..2506d8c7 100755 --- a/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp +++ b/engine/server/application/TransferServer/src/shared/CTSAPIClient.cpp @@ -237,7 +237,7 @@ void CTSAPIClient::onRequestDestinationServerList(const unsigned server_track, c //----------------------------------------------------------------------- -void CTSAPIClient::onConnect(const char *host, const short port, const short current, const short max) +void CTSAPIClient::onConnect(const char *host, const int16_t port, const int16_t current, const int16_t max) { LOG("CTSAPI", ("CTSAPIClient::onConnect(%s, %d, %d, %d)", host, port, current, max)); REPORT_LOG(true, ("CTSAPIClient::onConnect(%s, %d, %d, %d)\n", host, port, current, max)); @@ -246,7 +246,7 @@ void CTSAPIClient::onConnect(const char *host, const short port, const short cur //----------------------------------------------------------------------- -void CTSAPIClient::onDisconnect(const char *host, const short port, const short current, const short max) +void CTSAPIClient::onDisconnect(const char *host, const int16_t port, const int16_t current, const int16_t max) { LOG("CTSAPI", ("CTSAPIClient::onDisconnect(%s, %d, %d, %d)", host, port, current, max)); REPORT_LOG(true, ("CTSAPIClient::onDisconnect(%s, %d, %d, %d)\n", host, port, current, max)); diff --git a/engine/server/application/TransferServer/src/shared/CTSAPIClient.h b/engine/server/application/TransferServer/src/shared/CTSAPIClient.h index 1e150ad0..e28e6d2c 100755 --- a/engine/server/application/TransferServer/src/shared/CTSAPIClient.h +++ b/engine/server/application/TransferServer/src/shared/CTSAPIClient.h @@ -18,8 +18,8 @@ public: CTSAPIClient(const std::string & hostName, const std::string & game); virtual ~CTSAPIClient(); - virtual void onConnect(const char *host, const short port, const short current, const short max); - virtual void onDisconnect(const char *host, const short port, const short current, const short max); + virtual void onConnect(const char *host, const int16_t port, const int16_t current, const int16_t max); + virtual void onDisconnect(const char *host, const int16_t port, const int16_t current, const int16_t max); // ----- Normal Callbacks as a response to requests sent ----- diff --git a/engine/server/application/TransferServer/src/shared/ConfigTransferServer.cpp b/engine/server/application/TransferServer/src/shared/ConfigTransferServer.cpp index fcff5b32..5a6b8ee2 100755 --- a/engine/server/application/TransferServer/src/shared/ConfigTransferServer.cpp +++ b/engine/server/application/TransferServer/src/shared/ConfigTransferServer.cpp @@ -94,9 +94,9 @@ void ConfigTransferServer::remove(void) //----------------------------------------------------------------------- -unsigned short ConfigTransferServer::getCentralServerServiceBindPort() +uint16_t ConfigTransferServer::getCentralServerServiceBindPort() { - return static_cast(data->centralServerServiceBindPort); + return static_cast(data->centralServerServiceBindPort); } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverDatabase/src/shared/CentralServerConnection.cpp b/engine/server/library/serverDatabase/src/shared/CentralServerConnection.cpp index 9873c649..121aece5 100755 --- a/engine/server/library/serverDatabase/src/shared/CentralServerConnection.cpp +++ b/engine/server/library/serverDatabase/src/shared/CentralServerConnection.cpp @@ -29,7 +29,7 @@ // ====================================================================== -CentralServerConnection::CentralServerConnection(const std::string & a, const unsigned short p) : +CentralServerConnection::CentralServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()), MessageDispatch::Receiver() { diff --git a/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h b/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h index 3c8bfd56..20d5c9e8 100755 --- a/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/CentralServerConnection.h @@ -18,7 +18,7 @@ class CentralServerConnection : public ServerConnection, public MessageDispatch::Receiver { public: - CentralServerConnection(const std::string & remoteAddress, const unsigned short port); + CentralServerConnection(const std::string & remoteAddress, const uint16_t port); ~CentralServerConnection(); void onConnectionClosed (); diff --git a/engine/server/library/serverDatabase/src/shared/ChatServerConnection.cpp b/engine/server/library/serverDatabase/src/shared/ChatServerConnection.cpp index e8a6a5a4..15c082ff 100755 --- a/engine/server/library/serverDatabase/src/shared/ChatServerConnection.cpp +++ b/engine/server/library/serverDatabase/src/shared/ChatServerConnection.cpp @@ -10,7 +10,7 @@ //----------------------------------------------------------------------- -ChatServerConnection::ChatServerConnection(const std::string & a, const unsigned short p) : +ChatServerConnection::ChatServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/library/serverDatabase/src/shared/ChatServerConnection.h b/engine/server/library/serverDatabase/src/shared/ChatServerConnection.h index d522d356..a645e5b3 100755 --- a/engine/server/library/serverDatabase/src/shared/ChatServerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/ChatServerConnection.h @@ -14,7 +14,7 @@ class ChatServerConnection : public ServerConnection { public: - ChatServerConnection(const std::string & address, const unsigned short port); + ChatServerConnection(const std::string & address, const uint16_t port); ~ChatServerConnection(); void onConnectionClosed(); diff --git a/engine/server/library/serverDatabase/src/shared/CommoditiesServerConnection.cpp b/engine/server/library/serverDatabase/src/shared/CommoditiesServerConnection.cpp index cbc39eb0..f174404c 100755 --- a/engine/server/library/serverDatabase/src/shared/CommoditiesServerConnection.cpp +++ b/engine/server/library/serverDatabase/src/shared/CommoditiesServerConnection.cpp @@ -27,7 +27,7 @@ using namespace CommoditiesServerConnectionNamespace; //----------------------------------------------------------------------- -CommoditiesServerConnection::CommoditiesServerConnection(const std::string & a, const unsigned short p) : +CommoditiesServerConnection::CommoditiesServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()), MessageDispatch::Receiver() { diff --git a/engine/server/library/serverDatabase/src/shared/CommoditiesServerConnection.h b/engine/server/library/serverDatabase/src/shared/CommoditiesServerConnection.h index f3afaeac..072ca7ee 100755 --- a/engine/server/library/serverDatabase/src/shared/CommoditiesServerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/CommoditiesServerConnection.h @@ -20,7 +20,7 @@ class CommoditiesServerConnection : public ServerConnection, public MessageDispatch::Receiver { public: - CommoditiesServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + CommoditiesServerConnection(const std::string & remoteAddress, const uint16_t remotePort); explicit CommoditiesServerConnection(UdpConnectionMT *, TcpClient * t); ~CommoditiesServerConnection(); diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp index 5b097f2c..1695f42f 100755 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp @@ -353,8 +353,8 @@ void DatabaseProcess::connectToGameServer(const char *address, uint16 port, uint { DEBUG_REPORT_LOG(true,("connectToGameServer is still getting invoked.\n")); - std::pair a(std::make_pair(std::string(address), port)); - std::set >::const_iterator i = pendingGameServerConnections.find(a); + std::pair a(std::make_pair(std::string(address), port)); + std::set >::const_iterator i = pendingGameServerConnections.find(a); if(i == pendingGameServerConnections.end()) { // check to see if there is already a connection active diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.h b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.h index a9558a7d..3fe3a0f8 100755 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.h +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.h @@ -89,7 +89,7 @@ class DatabaseProcess : public MessageDispatch::Receiver DatabaseMetricsData * m_metricsData; std::unordered_map gameServerConnections; - std::set > pendingGameServerConnections; + std::set > pendingGameServerConnections; int m_queryExecCount; int m_queryFetchCount; diff --git a/engine/server/library/serverDatabase/src/shared/GameServerConnection.cpp b/engine/server/library/serverDatabase/src/shared/GameServerConnection.cpp index 201ce2e1..359958fc 100755 --- a/engine/server/library/serverDatabase/src/shared/GameServerConnection.cpp +++ b/engine/server/library/serverDatabase/src/shared/GameServerConnection.cpp @@ -16,7 +16,7 @@ //----------------------------------------------------------------------- -GameServerConnection::GameServerConnection(const std::string & a, const unsigned short p) : +GameServerConnection::GameServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()), m_chunkCompleteQueue(new ChunkCompleteQueueType) { diff --git a/engine/server/library/serverDatabase/src/shared/GameServerConnection.h b/engine/server/library/serverDatabase/src/shared/GameServerConnection.h index dda3563b..86e25df7 100755 --- a/engine/server/library/serverDatabase/src/shared/GameServerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/GameServerConnection.h @@ -14,7 +14,7 @@ class GameServerConnection : public ServerConnection { public: - GameServerConnection (const std::string & remoteAddress, const unsigned short remotePort); + GameServerConnection (const std::string & remoteAddress, const uint16_t remotePort); explicit GameServerConnection (UdpConnectionMT *, TcpClient *); virtual ~GameServerConnection (); diff --git a/engine/server/library/serverDatabase/src/shared/Snapshot.cpp b/engine/server/library/serverDatabase/src/shared/Snapshot.cpp index c61520c0..5db411dd 100755 --- a/engine/server/library/serverDatabase/src/shared/Snapshot.cpp +++ b/engine/server/library/serverDatabase/src/shared/Snapshot.cpp @@ -94,7 +94,7 @@ void Snapshot::handleDeltasMessage(NetworkId & objectId, const DeltasMessage &ms DEBUG_REPORT_LOG(count==0,("Deltas package was empty.\n")); for (uint16 i=0; i< count; ++i) { - unsigned short int index; + uint16_t index; Archive::get(bs,index); switch (packageId) { diff --git a/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.cpp b/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.cpp index 30b7a19a..24d3a799 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.cpp @@ -12,7 +12,7 @@ //----------------------------------------------------------------------- -TaskManagerConnection::TaskManagerConnection(const std::string & a, const unsigned short p) : +TaskManagerConnection::TaskManagerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h b/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h index 4a5cd576..1ffd86f6 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h +++ b/engine/server/library/serverDatabase/src/shared/TaskManagerConnection.h @@ -14,7 +14,7 @@ class TaskManagerConnection : public ServerConnection { public: - TaskManagerConnection(const std::string & remoteAddress, const unsigned short remotePort); + TaskManagerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~TaskManagerConnection(); void onConnectionClosed (); void onConnectionOpened (); diff --git a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp index 54e165fb..88501555 100755 --- a/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp +++ b/engine/server/library/serverGame/src/shared/command/CommandCppFuncs.cpp @@ -1713,7 +1713,7 @@ static void commandFuncSpatialChatInternal(Command const &, NetworkId const &act return; } - const size_t nullpos = params.find(static_cast(0), curpos); + const size_t nullpos = params.find(static_cast(0), curpos); Unicode::String text; Unicode::String oob; @@ -1861,7 +1861,7 @@ static void commandFuncSpatialChat(Command const &, NetworkId const &actor, Netw return; } - size_t nullpos = params.find(static_cast(0), curpos); + size_t nullpos = params.find(static_cast(0), curpos); Unicode::String text; Unicode::String oob; diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp index e7ec036b..7d00c46e 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarket.cpp @@ -1058,7 +1058,7 @@ void CommoditiesMarket::getCommoditiesServerConnection() // will FATAL() if (ObjectIdManager::hasAvailableObjectId()) { - s_market = new CommoditiesServerConnection(ConfigServerGame::getCommoditiesServerServiceBindInterface(), static_cast(ConfigServerGame::getCommoditiesServerServiceBindPort())); + s_market = new CommoditiesServerConnection(ConfigServerGame::getCommoditiesServerServiceBindInterface(), static_cast(ConfigServerGame::getCommoditiesServerServiceBindPort())); s_timeMarketConnectionCreated = ::time(nullptr); } } diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarketListener.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarketListener.cpp index 9f3d2790..800e1c28 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarketListener.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesMarketListener.cpp @@ -73,7 +73,7 @@ void CommoditiesMarketListener::OnAddAuction(int requestId, int result, const Ne } - CommoditiesMarket::onAddAuction(requestId, result, auctionOwnerId, ownerName, itemId, vendorId, vendorName, NetworkId(atoll(findNetworkId(location.c_str())))); + CommoditiesMarket::onAddAuction(requestId, result, auctionOwnerId, ownerName, itemId, vendorId, vendorName, NetworkId((int64_t) atoll(findNetworkId(location.c_str())))); } // ---------------------------------------------------------------------- @@ -93,7 +93,7 @@ void CommoditiesMarketListener::OnAddBid(int requestId, int result, const Networ // toolow - CommoditiesMarket::onAddBid(result, itemId, bidPlayerId, previousBidderId, maxProxyBidAmount, previousBid, NetworkId(atoll(findNetworkId(location.c_str()))), success, auctionOwnerId, ownerName, previousBidderName, itemNameLength, itemName, salesTaxAmount, salesTaxBankId); + CommoditiesMarket::onAddBid(result, itemId, bidPlayerId, previousBidderId, maxProxyBidAmount, previousBid, NetworkId((int64_t) atoll(findNetworkId(location.c_str()))), success, auctionOwnerId, ownerName, previousBidderName, itemNameLength, itemName, salesTaxAmount, salesTaxBankId); } // ---------------------------------------------------------------------- @@ -219,7 +219,7 @@ void CommoditiesMarketListener::OnCreateVendorMarket(int requestId, int result, UNREF(requestId); UNREF(ownerId); - CommoditiesMarket::onCreateVendorMarket(result, ownerId, NetworkId(atoll(findNetworkId(location.c_str())))); + CommoditiesMarket::onCreateVendorMarket(result, ownerId, NetworkId((int64_t) atoll(findNetworkId(location.c_str())))); } // ---------------------------------------------------------------------- diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp index 9489929e..6ee61bb1 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.cpp @@ -78,7 +78,7 @@ // ====================================================================== -CommoditiesServerConnection::CommoditiesServerConnection(const std::string & a, const unsigned short p) : +CommoditiesServerConnection::CommoditiesServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()), m_nextRequest(0), listener(), diff --git a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.h b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.h index f7e9958a..f4bc59ac 100755 --- a/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.h +++ b/engine/server/library/serverGame/src/shared/commoditiesMarket/CommoditiesServerConnection.h @@ -22,7 +22,7 @@ class CommoditiesServerConnection : public ServerConnection { public: - CommoditiesServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + CommoditiesServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~CommoditiesServerConnection(); void onConnectionClosed(); diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp index eafa6994..a917f001 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserObject.cpp @@ -164,7 +164,7 @@ namespace ConsoleCommandParserObjectNamespace // decrement the string index so it starts at 0 --stringIndex; - // if no shortcut number was entered, return the original string + // if no int16_tcut number was entered, return the original string if (stringIndex < 0) return tmpString; @@ -579,7 +579,7 @@ bool ConsoleCommandParserObject::performParsing (const NetworkId & userId, const Unicode::String tmpString = Unicode::narrowToWide("create "); - // append the creature name which may be a shortcut + // append the creature name which may be a int16_tcut std::string creatureName = getCreatureNameShortcut(userId, Unicode::wideToNarrow(argv[1])); tmpString.append(Unicode::narrowToWide(creatureName)); diff --git a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp index 1097566c..563affcb 100755 --- a/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/PlayerCreatureController.cpp @@ -686,7 +686,7 @@ bool PlayerCreatureController::checkValidMove(MoveSnapshot const &m, float const } // check if moving from last verified location to goal location exceeds max speed - // we should never be dealing with moves that are shorter than 1 ms + // we should never be dealing with moves that are int16_ter than 1 ms if (timeDiffMs < 1) timeDiffMs = 1; // We enforce a maximum check distance of twice the check interval, to disallow 'saving up' movement diff --git a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp index 89668966..3633d88d 100755 --- a/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/CharacterMatchManager.cpp @@ -507,7 +507,7 @@ void CharacterMatchManager::requestMatch(NetworkId const &networkId, MatchMaking // for a matching character, this contains the attributes that // resulted in the match; it is not necessarily *ALL* the - // matching attributes, because we're doing short-circuit + // matching attributes, because we're doing int16_t-circuit // evaluation here BitArray matchingAttributes; diff --git a/engine/server/library/serverGame/src/shared/core/ChatServerConnection.cpp b/engine/server/library/serverGame/src/shared/core/ChatServerConnection.cpp index 50d20614..f1ad50ef 100755 --- a/engine/server/library/serverGame/src/shared/core/ChatServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/core/ChatServerConnection.cpp @@ -29,7 +29,7 @@ //----------------------------------------------------------------------- -ChatServerConnection::ChatServerConnection(const std::string & a, const unsigned short p) : +ChatServerConnection::ChatServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/library/serverGame/src/shared/core/ChatServerConnection.h b/engine/server/library/serverGame/src/shared/core/ChatServerConnection.h index e077d6dc..9ee49d93 100755 --- a/engine/server/library/serverGame/src/shared/core/ChatServerConnection.h +++ b/engine/server/library/serverGame/src/shared/core/ChatServerConnection.h @@ -14,7 +14,7 @@ class ChatServerConnection : public ServerConnection { public: - ChatServerConnection(const std::string & address, const unsigned short port); + ChatServerConnection(const std::string & address, const uint16_t port); ~ChatServerConnection(); void onConnectionClosed(); diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 80009486..610462f7 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -914,7 +914,7 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M } case constcrc("CustomerServiceServerGameServerServiceAddress"): { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); - GenericValueTypeMessage > const address(ri); + GenericValueTypeMessage > const address(ri); DEBUG_REPORT_LOG(true, ("GameServer: Creating customer service server connection @ (%s:%d)\n", address .getValue().first.c_str(), address.getValue().second)); diff --git a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp index e3c56b3e..6f1414bc 100755 --- a/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp +++ b/engine/server/library/serverGame/src/shared/core/NpcConversation.cpp @@ -144,7 +144,7 @@ void NpcConversation::sendMessage(const Response & npcMessage, const Unicode::St if (!localOob.empty ()) { - text.append (static_cast(1), static_cast(0)); + text.append (static_cast(1), static_cast(0)); text.append (localOob); } @@ -255,7 +255,7 @@ void NpcConversation::sendResponses() if (!localOob.empty ()) { - text.append (static_cast(1), static_cast(0)); + text.append (static_cast(1), static_cast(0)); text.append (localOob); } diff --git a/engine/server/library/serverGame/src/shared/network/CentralConnection.cpp b/engine/server/library/serverGame/src/shared/network/CentralConnection.cpp index 464924b7..2ffddb39 100755 --- a/engine/server/library/serverGame/src/shared/network/CentralConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/CentralConnection.cpp @@ -37,7 +37,7 @@ //----------------------------------------------------------------------- -CentralServerConnection::CentralServerConnection(const std::string & a, const unsigned short p) : +CentralServerConnection::CentralServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()), m_centralCommandParser(new ConsoleCommandParserDefault) { diff --git a/engine/server/library/serverGame/src/shared/network/CentralConnection.h b/engine/server/library/serverGame/src/shared/network/CentralConnection.h index 782863bf..158c30a0 100755 --- a/engine/server/library/serverGame/src/shared/network/CentralConnection.h +++ b/engine/server/library/serverGame/src/shared/network/CentralConnection.h @@ -16,7 +16,7 @@ class ConsoleCommandParserDefault; class CentralServerConnection : public ServerConnection { public: - CentralServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + CentralServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~CentralServerConnection(); void onConnectionClosed (); void onConnectionOpened (); diff --git a/engine/server/library/serverGame/src/shared/network/Chat.cpp b/engine/server/library/serverGame/src/shared/network/Chat.cpp index 0e3f4f91..104aa4aa 100755 --- a/engine/server/library/serverGame/src/shared/network/Chat.cpp +++ b/engine/server/library/serverGame/src/shared/network/Chat.cpp @@ -484,7 +484,7 @@ void Chat::sendSystemMessage (const std::string & to, const ProsePackage & pp) void Chat::sendSystemMessage (const ServerObject & to, const ProsePackage & pp) { - //MLS shortcut me + //MLS int16_tcut me //Chat::sendSystemMessage(Unicode::wideToNarrow(to.getAssignedObjectFirstName()), pp); Unicode::String oob; OutOfBandPackager::pack (pp, -1, oob); diff --git a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp index 9c3f31e5..56f70c84 100755 --- a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.cpp @@ -67,7 +67,7 @@ ConnectionServerConnectionNamespace::ConnectionServerNetworkSetupData::Connectio // ====================================================================== -ConnectionServerConnection::ConnectionServerConnection(const std::string & a, const unsigned short p) : +ConnectionServerConnection::ConnectionServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, ConnectionServerNetworkSetupData()), m_syncStampShort(0), m_syncStampLong(0) diff --git a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.h b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.h index a3565e67..6b991690 100755 --- a/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.h +++ b/engine/server/library/serverGame/src/shared/network/ConnectionServerConnection.h @@ -13,7 +13,7 @@ class ConnectionServerConnection : public ServerConnection { public: - ConnectionServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + ConnectionServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~ConnectionServerConnection(); void onConnectionClosed (); void onConnectionOpened (); diff --git a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp index cb1df8fd..fe3b2087 100755 --- a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.cpp @@ -17,7 +17,7 @@ #include "sharedObject/Object.h" //---------------------------------------------------------------------- -CustomerServiceServerConnection::CustomerServiceServerConnection(const std::string & a, const unsigned short p) +CustomerServiceServerConnection::CustomerServiceServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { LOG("CSServerConnection", ("Connection created...listening on (%s:%d)", a.c_str(), static_cast(p))); diff --git a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.h b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.h index 66c0691d..88b4c360 100755 --- a/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.h +++ b/engine/server/library/serverGame/src/shared/network/CustomerServiceServerConnection.h @@ -14,7 +14,7 @@ class CustomerServiceServerConnection : public ServerConnection { public: - CustomerServiceServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + CustomerServiceServerConnection(const std::string & remoteAddress, const uint16_t remotePort); virtual ~CustomerServiceServerConnection(); void onConnectionClosed(); diff --git a/engine/server/library/serverGame/src/shared/network/DatabaseProcessConnection.cpp b/engine/server/library/serverGame/src/shared/network/DatabaseProcessConnection.cpp index 432f6841..0d06751b 100755 --- a/engine/server/library/serverGame/src/shared/network/DatabaseProcessConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/DatabaseProcessConnection.cpp @@ -18,7 +18,7 @@ // ====================================================================== -DatabaseProcessConnection::DatabaseProcessConnection(std::string const &remoteAddress, unsigned short remotePort, uint32 pid) : +DatabaseProcessConnection::DatabaseProcessConnection(std::string const &remoteAddress, uint16_t remotePort, uint32 pid) : ServerConnection(remoteAddress, remotePort, NetworkSetupData()), m_pid(pid) { diff --git a/engine/server/library/serverGame/src/shared/network/DatabaseProcessConnection.h b/engine/server/library/serverGame/src/shared/network/DatabaseProcessConnection.h index 64326534..d9f0975e 100755 --- a/engine/server/library/serverGame/src/shared/network/DatabaseProcessConnection.h +++ b/engine/server/library/serverGame/src/shared/network/DatabaseProcessConnection.h @@ -18,7 +18,7 @@ class DatabaseProcessConnection: public ServerConnection { public: - DatabaseProcessConnection(std::string const &remoteAddress, unsigned short remotePort, uint32 pid); + DatabaseProcessConnection(std::string const &remoteAddress, uint16_t remotePort, uint32 pid); ~DatabaseProcessConnection(); void onConnectionClosed(); diff --git a/engine/server/library/serverGame/src/shared/network/PlanetServerConnection.cpp b/engine/server/library/serverGame/src/shared/network/PlanetServerConnection.cpp index a0acd55d..65380468 100755 --- a/engine/server/library/serverGame/src/shared/network/PlanetServerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/PlanetServerConnection.cpp @@ -17,7 +17,7 @@ // ====================================================================== -PlanetServerConnection::PlanetServerConnection(const std::string & a, const unsigned short p) : +PlanetServerConnection::PlanetServerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/library/serverGame/src/shared/network/PlanetServerConnection.h b/engine/server/library/serverGame/src/shared/network/PlanetServerConnection.h index 6f0c8aa7..c105e129 100755 --- a/engine/server/library/serverGame/src/shared/network/PlanetServerConnection.h +++ b/engine/server/library/serverGame/src/shared/network/PlanetServerConnection.h @@ -17,7 +17,7 @@ class PlanetServerConnection : public ServerConnection { public: - PlanetServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + PlanetServerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~PlanetServerConnection(); void onConnectionClosed (); void onConnectionOpened (); diff --git a/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.cpp b/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.cpp index e26ee1f6..7e2cca4b 100755 --- a/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.cpp +++ b/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.cpp @@ -13,7 +13,7 @@ //----------------------------------------------------------------------- -TaskManagerConnection::TaskManagerConnection(const std::string & a, const unsigned short p) : +TaskManagerConnection::TaskManagerConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h b/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h index 66cb36ae..3e941fe4 100755 --- a/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h +++ b/engine/server/library/serverGame/src/shared/network/TaskManagerConnection.h @@ -14,7 +14,7 @@ class TaskManagerConnection : public ServerConnection { public: - TaskManagerConnection(const std::string & remoteAddress, const unsigned short remotePort); + TaskManagerConnection(const std::string & remoteAddress, const uint16_t remotePort); ~TaskManagerConnection(); void onConnectionClosed (); void onConnectionOpened (); diff --git a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp index 0ecbb8d6..f5575d2a 100755 --- a/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlanetObject.cpp @@ -2349,7 +2349,7 @@ void PlanetObject::adjustGcwImperialScore(std::string const & source, CreatureOb // grant GCW Region Defender bonus float bonus = 0.0f; if (gcwCategoryData->gcwRegionDefender && PvpData::isImperialFactionId(sourceObject->getPvpFaction()) && (adjustment > 0) && (playerObject->getCurrentGcwRegion() == gcwCategory) && Pvp::getGcwDefenderRegionBonus(*sourceObject, *playerObject, bonus) && (bonus > 0.0f)) - adjustment += std::max(1ll, static_cast(static_cast(bonus) * static_cast(adjustment) / static_cast(100))); + adjustment += std::max((int64)1ll, static_cast(static_cast(bonus) * static_cast(adjustment) / static_cast(100))); } LOG("CustomerService", ("GcwScore: imperial %s %d (from %s - %s)", gcwCategory.c_str(), static_cast(adjustment), source.c_str(), sourceObject->getNetworkId().getValueString().c_str())); @@ -2394,7 +2394,7 @@ void PlanetObject::adjustGcwRebelScore(std::string const & source, CreatureObjec // grant GCW Region Defender bonus float bonus = 0.0f; if (gcwCategoryData->gcwRegionDefender && PvpData::isRebelFactionId(sourceObject->getPvpFaction()) && (adjustment > 0) && (playerObject->getCurrentGcwRegion() == gcwCategory) && Pvp::getGcwDefenderRegionBonus(*sourceObject, *playerObject, bonus) && (bonus > 0.0f)) - adjustment += std::max(1ll, static_cast(static_cast(bonus) * static_cast(adjustment) / static_cast(100))); + adjustment += std::max((int64)1ll, static_cast(static_cast(bonus) * static_cast(adjustment) / static_cast(100))); } LOG("CustomerService", ("GcwScore: rebel %s %d (from %s - %s)", gcwCategory.c_str(), static_cast(adjustment), source.c_str(), sourceObject->getNetworkId().getValueString().c_str())); diff --git a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp index 615c8824..453db806 100755 --- a/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/PlayerObject.cpp @@ -6115,7 +6115,8 @@ void PlayerObject::getByteStreamFromAutoVariable(const std::string & name, Archi { if(name == "quests") { - Archive::AutoDeltaMap(m_quests).pack(target); + //TODO: fixme + //Archive::AutoDeltaMap(m_quests).pack(target); } else if(name == "completedQuests") { @@ -6206,7 +6207,8 @@ void PlayerObject::setAutoVariableFromByteStream(const std::string & name, const std::vector quests; m_quests.clear(); - Archive::AutoDeltaMap(m_quests).unpack(ri, quests); + //TODO: fixme wtf + //Archive::AutoDeltaMap(m_quests).unpack(ri, quests); for (std::vector::const_iterator questIter = quests.begin(); questIter != quests.end(); ++questIter) { diff --git a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp index 82e2a710..0234f3e0 100755 --- a/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ResourcePoolObject.cpp @@ -54,7 +54,17 @@ ResourcePoolObject::~ResourcePoolObject() */ float ResourcePoolObject::harvest(float installedEfficiency, uint32 lastHarvestTime) const { - int elapsedTime=static_cast(std::min(ServerClock::getInstance().getGameTimeSeconds(),m_depletedTimestamp) - lastHarvestTime); + int gameTime = ServerClock::getInstance().getGameTimeSeconds(); + int ctor; + + if (gameTime < m_depletedTimestamp) { + ctor = gameTime; + } else { + ctor = m_depletedTimestamp; + } + + int elapsedTime = (ctor-lastHarvestTime); + if (elapsedTime < 0) return 0; float elapsedTicks =static_cast(elapsedTime) / static_cast(ConfigServerGame::getSecondsPerResourceTick()); diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index 78839fcf..750dbab4 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -5254,7 +5254,7 @@ void ServerObject::handleCMessageTo(const MessageToPayload &message) if (splitPos) { *splitPos = 0; - NetworkId recipient(atoll(params)); + NetworkId recipient((int64)atoll(params)); int amount = atoi(splitPos+1); transferCashTo(recipient, amount); } @@ -5269,7 +5269,7 @@ void ServerObject::handleCMessageTo(const MessageToPayload &message) if (splitPos) { *splitPos = 0; - NetworkId recipient(atoll(params)); + NetworkId recipient((int64)atoll(params)); int amount = atoi(splitPos+1); transferBankCreditsTo(recipient, amount); } diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.h b/engine/server/library/serverGame/src/shared/object/ServerObject.h index c0c320bd..6966c2fd 100755 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.h +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.h @@ -550,7 +550,8 @@ public: virtual bool isVisibleOnClient (const Client & client) const = 0; virtual void kill (); - void performSocial (const NetworkId & target, unsigned long socialType, bool animationOk, bool textOk); + + void performSocial (const NetworkId & target, uint32 socialType, bool animationOk, bool textOk); void performSocial (const MessageQueueSocial & socialMsg); void performCombatSpam (const MessageQueueCombatSpam & combatSpam, bool sendToSelf, bool sendToTarget, bool sendToBystanders); @@ -582,7 +583,7 @@ public: virtual void setOwnerId(const NetworkId &id); void setSceneIdOnThisAndContents (const std::string & sceneId); void setPlayerControlled (bool newValue); - void speakText (NetworkId const &target, unsigned long chatType, unsigned long mood, unsigned long flags, Unicode::String const &speech, int language, Unicode::String const &oob); + void speakText (NetworkId const &target, uint32 chatType, uint32 mood, uint32 flags, Unicode::String const &speech, int language, Unicode::String const &oob); virtual void speakText (MessageQueueSpatialChat const &spatialChat); virtual void hearText (ServerObject const &source, MessageQueueSpatialChat const &spatialChat, int chatMessageIndex); void teleportObject (Vector const & position_w, NetworkId const &targetContainer, std::string const &targetCellName, Vector const &position_p, std::string const &scriptCallback, bool forceLoadScreen = false); diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp index 34d2ce8b..8bb8a922 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject.cpp @@ -5338,7 +5338,7 @@ int TangibleObject::getNumberOfLots() const bool TangibleObject::isOnAdminList(const CreatureObject& player) const { - //shortcut for owners + //int16_tcut for owners if (getOwnerId() == player.getNetworkId()) return true; diff --git a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp index d6e291ae..a81fa7d2 100755 --- a/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp +++ b/engine/server/library/serverGame/src/shared/pvp/Pvp.cpp @@ -611,7 +611,7 @@ void Pvp::updateTimedFlags(const void *context) { UNREF(context); - unsigned long const updateTimeMs = static_cast(ConfigServerGame::getPvpUpdateTimeMs()); + uint32_t const updateTimeMs = static_cast(ConfigServerGame::getPvpUpdateTimeMs()); PvpInternal::updateTimedFlags(updateTimeMs); getScheduler().setCallback(Pvp::updateTimedFlags, nullptr, updateTimeMs); } @@ -843,14 +843,14 @@ int Pvp::calculateGcwImperialScorePercentile(std::string const & gcwCategory, st { std::map >::const_iterator const iterImperial = gcwImperialScore.find(gcwCategory); if (iterImperial != gcwImperialScore.end()) - totalImperial = static_cast(std::max(0ll, iterImperial->second.first)) + static_cast(std::max(0ll, iterImperial->second.second)); + totalImperial = static_cast(std::max((int64)0ll, iterImperial->second.first)) + static_cast(std::max((int64)0ll, iterImperial->second.second)); } uint64 total = totalImperial; { std::map >::const_iterator const iterRebel = gcwRebelScore.find(gcwCategory); if (iterRebel != gcwRebelScore.end()) - total += (static_cast(std::max(0ll, iterRebel->second.first)) + static_cast(std::max(0ll, iterRebel->second.second))); + total += (static_cast(std::max((int64)0ll, iterRebel->second.first)) + static_cast(std::max((int64)0ll, iterRebel->second.second))); } // if the score is less than 1, treat it as a tie; note that score is scaled by 1000 diff --git a/engine/server/library/serverGame/src/shared/space/ShipClientUpdateTracker.cpp b/engine/server/library/serverGame/src/shared/space/ShipClientUpdateTracker.cpp index cec5525b..e8d16428 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipClientUpdateTracker.cpp +++ b/engine/server/library/serverGame/src/shared/space/ShipClientUpdateTracker.cpp @@ -280,12 +280,12 @@ void ShipClientUpdateTracker::update(float elapsedTime) // static + 4 // syncstamp ; - Archive::put(bs, static_cast(4/*gcmMemberCount*/)); + Archive::put(bs, static_cast(4/*gcmMemberCount*/)); Archive::put(bs, s_gcmname.getCrc()); Archive::put(bs, (*k).second); Archive::put(bs, false); Archive::put(bs, s_sutmByteStreamLength); - Archive::put(bs, static_cast(5/*sutmMemberCount*/)); + Archive::put(bs, static_cast(5/*sutmMemberCount*/)); Archive::put(bs, s_sutmname.getCrc()); Archive::put(bs, ship->getShipId()); PackedTransform const packedTransform(controller->getTransform()); diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataArmor.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataArmor.h index eb4aa902..54b87fdd 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataArmor.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataArmor.h @@ -37,7 +37,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. }; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataBooster.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataBooster.h index 68f9d376..886610bc 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataBooster.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataBooster.h @@ -37,7 +37,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. float m_boosterEnergyCurrent; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataBridge.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataBridge.h index 5de642e2..fe5f53d5 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataBridge.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataBridge.h @@ -37,7 +37,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. }; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCapacitor.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCapacitor.h index 181e20fa..0e3586fd 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCapacitor.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCapacitor.h @@ -35,7 +35,7 @@ private: ShipComponentDataCapacitor & operator= (const ShipComponentDataCapacitor & rhs); public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. float m_capacitorEnergyCurrent; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.h index 545cedb5..4e7eec8c 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataCargoHold.h @@ -38,7 +38,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. int m_cargoHoldContentsMaximum; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataDroidInterface.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataDroidInterface.h index 73a4e357..c9f71cd3 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataDroidInterface.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataDroidInterface.h @@ -35,7 +35,7 @@ private: ShipComponentDataDroidInterface & operator= (const ShipComponentDataDroidInterface & rhs); public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. float m_droidInterfaceCommandSpeed; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataEngine.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataEngine.h index 2b8b0116..f2c93ae9 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataEngine.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataEngine.h @@ -37,7 +37,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. float m_engineAccelerationRate; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataHangar.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataHangar.h index ab67b815..3198da8f 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataHangar.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataHangar.h @@ -36,7 +36,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. }; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataModification.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataModification.h index de38a6af..a5d58d6c 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataModification.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataModification.h @@ -37,7 +37,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. }; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataReactor.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataReactor.h index 1ddc25ee..741eba18 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataReactor.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataReactor.h @@ -36,7 +36,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. float m_energyGenerationRate; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataShield.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataShield.h index e09b61e5..1c35b26a 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataShield.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataShield.h @@ -36,7 +36,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. float m_shieldHitpointsFrontCurrent; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataTargetingStation.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataTargetingStation.h index 4a267404..59e00f32 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataTargetingStation.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataTargetingStation.h @@ -36,7 +36,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. }; diff --git a/engine/server/library/serverGame/src/shared/space/ShipComponentDataWeapon.h b/engine/server/library/serverGame/src/shared/space/ShipComponentDataWeapon.h index fb09ac15..c9df49a7 100755 --- a/engine/server/library/serverGame/src/shared/space/ShipComponentDataWeapon.h +++ b/engine/server/library/serverGame/src/shared/space/ShipComponentDataWeapon.h @@ -37,7 +37,7 @@ private: public: - //-- these members are public because this instances of this class are short-lived temporary objects, + //-- these members are public because this instances of this class are int16_t-lived temporary objects, //-- to simplify the conversion from the ShipObject & shipt representation of components. float m_weaponDamageMaximum; diff --git a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp index 4e4a9821..fa156c60 100755 --- a/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp +++ b/engine/server/library/serverGame/src/shared/space/SpaceDockingManager.cpp @@ -194,19 +194,19 @@ float SpaceDockingManagerNamespace::getShortExtentAxisLength(Object const & obje if ( (axialBox.getWidth() < axialBox.getHeight()) && (axialBox.getWidth() < axialBox.getDepth())) { - // Width is the short axis + // Width is the int16_t axis result = axialBox.getMax().x; } else if (axialBox.getHeight() < axialBox.getDepth()) { - // Height is the short axis + // Height is the int16_t axis result = axialBox.getMax().y; } else { - // Depth is the short axis + // Depth is the int16_t axis result = axialBox.getMax().z; } @@ -221,26 +221,26 @@ Transform SpaceDockingManagerNamespace::getDockHardPoint(Object const & object) CollisionProperty const * const collisionProperty = NON_NULL(object.getCollisionProperty()); AxialBox const axialBox = collisionProperty->getExtent_l()->getBoundingBox(); - // Find the short axis of the object's extent + // Find the int16_t axis of the object's extent if ( (axialBox.getWidth() < axialBox.getHeight()) && (axialBox.getWidth() < axialBox.getDepth())) { - // Width is the short axis + // Width is the int16_t axis result.yaw_l(-PI_OVER_2); result.move_l(Vector(0.0f, 0.0f, -axialBox.getMax().x)); } else if (axialBox.getHeight() < axialBox.getDepth()) { - // Height is the short axis + // Height is the int16_t axis result.pitch_l(PI_OVER_2); result.move_l(Vector(0.0f, 0.0f, -axialBox.getMax().y)); } else { - // Depth is the short axis + // Depth is the int16_t axis result.yaw_l(PI); result.move_l(Vector(0.0f, 0.0f, -axialBox.getMax().z)); diff --git a/engine/server/library/serverMetrics/src/shared/MetricsConnection.cpp b/engine/server/library/serverMetrics/src/shared/MetricsConnection.cpp index 8aa88412..6e8d7b04 100755 --- a/engine/server/library/serverMetrics/src/shared/MetricsConnection.cpp +++ b/engine/server/library/serverMetrics/src/shared/MetricsConnection.cpp @@ -14,7 +14,7 @@ //----------------------------------------------------------------------- -MetricsConnection::MetricsConnection(const std::string & a, const unsigned short p) : +MetricsConnection::MetricsConnection(const std::string & a, const uint16_t p) : ServerConnection(a, p, NetworkSetupData()) { } diff --git a/engine/server/library/serverMetrics/src/shared/MetricsConnection.h b/engine/server/library/serverMetrics/src/shared/MetricsConnection.h index 24d4c496..06e3bd38 100755 --- a/engine/server/library/serverMetrics/src/shared/MetricsConnection.h +++ b/engine/server/library/serverMetrics/src/shared/MetricsConnection.h @@ -14,7 +14,7 @@ class MetricsConnection : public ServerConnection { public: - MetricsConnection(const std::string & remoteAddress, const unsigned short remotePort); + MetricsConnection(const std::string & remoteAddress, const uint16_t remotePort); MetricsConnection(UdpConnectionMT * u, TcpClient * t); virtual ~MetricsConnection(); diff --git a/engine/server/library/serverNetworkMessages/src/shared/ChatServerOnline.cpp b/engine/server/library/serverNetworkMessages/src/shared/ChatServerOnline.cpp index 7e75b914..0897b44f 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/ChatServerOnline.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/ChatServerOnline.cpp @@ -9,7 +9,7 @@ //----------------------------------------------------------------------- -ChatServerOnline::ChatServerOnline(const std::string & a, const unsigned short p) : +ChatServerOnline::ChatServerOnline(const std::string & a, const uint16_t p) : GameNetworkMessage("ChatServerOnline"), address(a), port(p) diff --git a/engine/server/library/serverNetworkMessages/src/shared/ChatServerOnline.h b/engine/server/library/serverNetworkMessages/src/shared/ChatServerOnline.h index 809339f9..75a4d81c 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/ChatServerOnline.h +++ b/engine/server/library/serverNetworkMessages/src/shared/ChatServerOnline.h @@ -12,19 +12,19 @@ class ChatServerOnline : public GameNetworkMessage { public: - ChatServerOnline(const std::string & address, const unsigned short port); + ChatServerOnline(const std::string & address, const uint16_t port); ChatServerOnline(Archive::ReadIterator & source); ~ChatServerOnline(); const std::string & getAddress () const; - const unsigned short getPort () const; + const uint16_t getPort () const; private: ChatServerOnline & operator = (const ChatServerOnline & rhs); ChatServerOnline(const ChatServerOnline & source); Archive::AutoVariable address; - Archive::AutoVariable port; + Archive::AutoVariable port; }; //----------------------------------------------------------------------- @@ -36,7 +36,7 @@ inline const std::string & ChatServerOnline::getAddress() const //----------------------------------------------------------------------- -inline const unsigned short ChatServerOnline::getPort() const +inline const uint16_t ChatServerOnline::getPort() const { return port.get(); } diff --git a/engine/server/library/serverNetworkMessages/src/shared/EnumerateServers.cpp b/engine/server/library/serverNetworkMessages/src/shared/EnumerateServers.cpp index 8bbc83b2..d88843c5 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/EnumerateServers.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/EnumerateServers.cpp @@ -9,7 +9,7 @@ //----------------------------------------------------------------------- -EnumerateServers::EnumerateServers(const bool a, const std::string &addr, const unsigned short p, const int t) : +EnumerateServers::EnumerateServers(const bool a, const std::string &addr, const uint16_t p, const int t) : GameNetworkMessage("EnumerateServers"), add(a), address(addr), diff --git a/engine/server/library/serverNetworkMessages/src/shared/EnumerateServers.h b/engine/server/library/serverNetworkMessages/src/shared/EnumerateServers.h index 23fd3253..5b2b56fd 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/EnumerateServers.h +++ b/engine/server/library/serverNetworkMessages/src/shared/EnumerateServers.h @@ -21,13 +21,13 @@ public: PLANET_SERVER }; - EnumerateServers(const bool add, const std::string &address, const unsigned short port, const int serverType); + EnumerateServers(const bool add, const std::string &address, const uint16_t port, const int serverType); explicit EnumerateServers(Archive::ReadIterator & source); ~EnumerateServers(); const bool getAdd () const; const std::string & getAddress () const; - const unsigned short getPort () const; + const uint16_t getPort () const; const int getServerType () const; private: @@ -36,7 +36,7 @@ private: Archive::AutoVariable add; Archive::AutoVariable address; - Archive::AutoVariable port; + Archive::AutoVariable port; Archive::AutoVariable serverType; }; @@ -56,7 +56,7 @@ inline const std::string & EnumerateServers::getAddress() const //----------------------------------------------------------------------- -inline const unsigned short EnumerateServers::getPort() const +inline const uint16_t EnumerateServers::getPort() const { return port.get(); } diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/CentralGameServerMessages.cpp b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/CentralGameServerMessages.cpp index d552e87a..7f34e03f 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/CentralGameServerMessages.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/CentralGameServerMessages.cpp @@ -99,7 +99,7 @@ CentralGameServerProxyObject::CentralGameServerProxyObject(const NetworkId &newO const char * const newTemplateName, const uint32 newGameServerProcessId, const std::string & newGameServerAddress, - const unsigned short newGameServerPort) : + const uint16_t newGameServerPort) : GameNetworkMessage("CentralGameServerProxyObject"), gameServerAddress(newGameServerAddress), gameServerPort(newGameServerPort), diff --git a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/CentralGameServerMessages.h b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/CentralGameServerMessages.h index 9af89141..75b9498c 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/CentralGameServerMessages.h +++ b/engine/server/library/serverNetworkMessages/src/shared/centralGameServer/CentralGameServerMessages.h @@ -148,7 +148,7 @@ public: const char * const newTemplateName, const uint32 newGameServerProcessId, const std::string & newGameServerAddress, - const unsigned short newGameServerPort); + const uint16_t newGameServerPort); CentralGameServerProxyObject(Archive::ReadIterator & source); ~CentralGameServerProxyObject(); diff --git a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp index 8ec08af5..d73fd266 100755 --- a/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp +++ b/engine/server/library/serverPathfinding/src/shared/CityPathGraph.cpp @@ -60,7 +60,7 @@ public: // ====================================================================== -CityPathGraph::CityPathGraph ( int cityToken ) +CityPathGraph::CityPathGraph ( int32_t cityToken ) : DynamicPathGraph(PGT_City), m_nodeTree( new PathNodeTree ), m_namedNodes( new std::map >), @@ -83,13 +83,13 @@ CityPathGraph::~CityPathGraph() // ---------------------------------------------------------------------- -int CityPathGraph::addNode ( DynamicPathNode * newNode ) +int32_t CityPathGraph::addNode ( DynamicPathNode * newNode ) { CityPathNode * cityNode = dynamic_cast(newNode); NOT_NULL(cityNode); - int index = DynamicPathGraph::addNode(newNode); + int32_t index = DynamicPathGraph::addNode(newNode); SpatialHandle * handle = m_nodeTree->addObject( cityNode ); if (handle != nullptr) @@ -127,7 +127,7 @@ int CityPathGraph::addNode ( DynamicPathNode * newNode ) // ---------------------------------------------------------------------- -void CityPathGraph::removeNode ( int nodeIndex ) +void CityPathGraph::removeNode ( int32_t nodeIndex ) { CityPathNode * cityNode = _getNode(nodeIndex); NOT_NULL(cityNode); @@ -152,11 +152,11 @@ void CityPathGraph::removeNode ( int nodeIndex ) } // ---------------------------------------------------------------------- -// When a waypoint is permanently destroyed from a city graph, we need to +// When a waypoint32_t is permanently destroyed from a city graph, we need to // make sure that all neighboring nodes are relinked and thatthe edge // lists on the objvars are updated as well. -void CityPathGraph::destroyNode ( int nodeIndex ) +void CityPathGraph::destroyNode ( int32_t nodeIndex ) { CityPathNode * cityNode = _getNode(nodeIndex); @@ -167,13 +167,13 @@ void CityPathGraph::destroyNode ( int nodeIndex ) std::vector neighborList; - int edgeCount = cityNode->getEdgeCount(); + int32_t edgeCount = cityNode->getEdgeCount(); - int i; + int32_t i; for(i = 0; i < edgeCount; i++) { - int neighborIndex = cityNode->getNeighbor(i); + int32_t neighborIndex = cityNode->getNeighbor(i); neighborList.push_back( neighborIndex ); } @@ -213,7 +213,7 @@ void CityPathGraph::destroyNode ( int nodeIndex ) // ---------------------------------------------------------------------- -void CityPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) +void CityPathGraph::moveNode ( int32_t nodeIndex, Vector const & newPosition ) { CityPathNode * cityNode = _getNode(nodeIndex); @@ -224,13 +224,13 @@ void CityPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) std::vector oldNeighborList; - int oldEdgeCount = cityNode->getEdgeCount(); + int32_t oldEdgeCount = cityNode->getEdgeCount(); - int i; + int32_t i; for(i = 0; i < oldEdgeCount; i++) { - int neighborIndex = cityNode->getNeighbor(i); + int32_t neighborIndex = cityNode->getNeighbor(i); oldNeighborList.push_back( neighborIndex ); } @@ -268,7 +268,7 @@ void CityPathGraph::moveNode ( int nodeIndex, Vector const & newPosition ) // ---------------------------------------------------------------------- -void CityPathGraph::relinkNode ( int nodeIndex ) +void CityPathGraph::relinkNode ( int32_t nodeIndex ) { CityPathNode * nodeA = _getNode(nodeIndex); @@ -276,7 +276,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) // ---------- - //int oldNeighborCode = getNeighborCode(nodeIndex); + //int32_t oldNeighborCode = getNeighborCode(nodeIndex); unlinkNode(nodeIndex); @@ -287,9 +287,9 @@ void CityPathGraph::relinkNode ( int nodeIndex ) if(typeA == PNT_CityBuilding) { - int listSize = getNodeCount(); + int32_t listSize = getNodeCount(); - for(int i = 0; i < listSize; i++) + for(int32_t i = 0; i < listSize; i++) { CityPathNode * nodeB = _getNode(i); @@ -324,9 +324,9 @@ void CityPathGraph::relinkNode ( int nodeIndex ) if(typeA == PNT_CityBuildingEntrance) { - int listSize = getNodeCount(); + int32_t listSize = getNodeCount(); - for(int i = 0; i < listSize; i++) + for(int32_t i = 0; i < listSize; i++) { CityPathNode * nodeB = _getNode(i); @@ -359,9 +359,9 @@ void CityPathGraph::relinkNode ( int nodeIndex ) m_nodeTree->findInRange( nodeA->getPosition_p(), g_linkDistance, results ); - int resultCount = results.size(); + int32_t resultCount = results.size(); - int i; + int32_t i; for(i = 0; i < resultCount; i++) { @@ -409,7 +409,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) neighborList.clear(); - int edgeCount = nodeA->getEdgeCount(); + int32_t edgeCount = nodeA->getEdgeCount(); for(i = 0; i < edgeCount; i++) { @@ -430,7 +430,7 @@ void CityPathGraph::relinkNode ( int nodeIndex ) // ---------- /* - int newNeighborCode = getNeighborCode(nodeIndex); + int32_t newNeighborCode = getNeighborCode(nodeIndex); if(oldNeighborCode == newNeighborCode) { @@ -445,14 +445,14 @@ void CityPathGraph::relinkNode ( int nodeIndex ) // ---------------------------------------------------------------------- -CityPathNode * CityPathGraph::_getNode ( int whichNode ) +CityPathNode * CityPathGraph::_getNode ( int32_t whichNode ) { return safe_cast(getNode(whichNode)); } // ---------- -CityPathNode const * CityPathGraph::_getNode ( int whichNode ) const +CityPathNode const * CityPathGraph::_getNode ( int32_t whichNode ) const { return safe_cast(getNode(whichNode)); } @@ -461,9 +461,9 @@ CityPathNode const * CityPathGraph::_getNode ( int whichNode ) const CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) { - int nodeCount = getNodeCount(); + int32_t nodeCount = getNodeCount(); - for (int i = 0; i < nodeCount; i++) + for (int32_t i = 0; i < nodeCount; i++) { CityPathNode * node = _getNode(i); @@ -486,9 +486,9 @@ CityPathNode * CityPathGraph::findNodeForObject ( ServerObject const & object ) CityPathNode const * CityPathGraph::findNodeForObject ( ServerObject const & object ) const { - int nodeCount = getNodeCount(); + int32_t nodeCount = getNodeCount(); - for(int i = 0; i < nodeCount; i++) + for(int32_t i = 0; i < nodeCount; i++) { CityPathNode const * node = _getNode(i); @@ -571,7 +571,7 @@ CityPathNode const * CityPathGraph::findNearestNodeForName( Unicode::String cons // ---------------------------------------------------------------------- -int CityPathGraph::findNearestNode ( Vector const & position ) const +int32_t CityPathGraph::findNearestNode ( Vector const & position ) const { PathNode * temp = nullptr; @@ -590,7 +590,7 @@ int CityPathGraph::findNearestNode ( Vector const & position ) const //@todo - I have no idea why, but the compiler bitches if this isn't here. -int CityPathGraph::findNearestNode ( PathNodeType type, Vector const & position_p ) const +int32_t CityPathGraph::findNearestNode ( PathNodeType type, Vector const & position_p ) const { return PathGraph::findNearestNode(type,position_p); } @@ -606,9 +606,9 @@ void CityPathGraph::findNodesInRange ( Vector const & position_p, float range, void CityPathGraph::saveGraph ( void ) { - int nodeCount = getNodeCount(); + int32_t nodeCount = getNodeCount(); - for(int i = 0; i < nodeCount; i++) + for(int32_t i = 0; i < nodeCount; i++) { CityPathNode * node = _getNode(i); @@ -622,9 +622,9 @@ bool CityPathGraph::sanityCheck ( bool doWarnings ) const { bool sane = true; - int nodeCount = getNodeCount(); + int32_t nodeCount = getNodeCount(); - for(int i = 0; i < nodeCount; i++) + for(int32_t i = 0; i < nodeCount; i++) { CityPathNode const * node = _getNode(i); @@ -641,9 +641,9 @@ bool CityPathGraph::sanityCheck ( bool doWarnings ) const void CityPathGraph::reloadPathNodes ( void ) { - int nodeCount = getNodeCount(); + int32_t nodeCount = getNodeCount(); - for(int i = 0; i < nodeCount; i++) + for(int32_t i = 0; i < nodeCount; i++) { CityPathNode * node = _getNode(i); @@ -677,9 +677,9 @@ void CityPathGraph::addDirtyBox ( AxialBox const & box ) bool CityPathGraph::isDirty ( Vector const & point_w ) const { - int count = m_dirtyBoxes->size(); + int32_t count = m_dirtyBoxes->size(); - for(int i = 0; i < count; i++) + for(int32_t i = 0; i < count; i++) { AxialBox const & box = m_dirtyBoxes->at(i); @@ -709,27 +709,27 @@ void CityPathGraph::setLinkDistance ( float dist ) // we cast the addresses of all the neighbors to ints, multiply them // by a random large prime number, then xor the bits together. -int CityPathGraph::getNeighborCode ( int whichNode ) const +int32_t CityPathGraph::getNeighborCode ( int32_t whichNode ) const { CityPathNode const * node = _getNode(whichNode); if(node == nullptr) return 0; - int edgeCount = node->getEdgeCount(); + int32_t edgeCount = node->getEdgeCount(); - int code = 0; + int32_t code = 0; - for(int i = 0; i < edgeCount; i++) + for(int32_t i = 0; i < edgeCount; i++) { - int neighborId = node->getNeighbor(i); + int32_t neighborId = node->getNeighbor(i); CityPathNode const * neighbor = _getNode(neighborId); if(neighbor == nullptr) continue; - int neighborInt = reinterpret_cast(neighbor); + int32_t neighborInt = reinterpret_cast(neighbor); - int mungedInt = neighborInt * 1295183; + int32_t mungedInt = neighborInt * 1295183; code ^= mungedInt; } diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index 75f83e68..0852acd3 100755 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -790,7 +790,7 @@ void JavaLibrary::fatalHandler(int signum) char lib1[BUFLEN], lib2[BUFLEN]; char file1[BUFLEN], file2[BUFLEN]; int line1, line2; - bool result1 = DebugHelp::lookupAddress(reinterpret_cast(crashAddress1), lib1, file1, BUFLEN, line1); + bool result1 = DebugHelp::lookupAddress(reinterpret_cast(crashAddress1), lib1, file1, BUFLEN, line1); // do a second test based on the return address // it turns out that in some java crashes we don't even have 2 return @@ -801,25 +801,25 @@ void JavaLibrary::fatalHandler(int signum) void *crashAddress2c = nullptr; void *frameAddressA = nullptr; void *frameAddressB = nullptr; - uint32 frameAddressHigh = (reinterpret_cast(frameAddress) >> 16); + uint32 frameAddressHigh = (reinterpret_cast(frameAddress) >> 16); crashAddress2a = __builtin_return_address(0); if (crashAddress2a != nullptr) { frameAddressA = __builtin_frame_address(1); if (frameAddressA != nullptr && - (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) + (reinterpret_cast(frameAddressA) >> 16 == frameAddressHigh)) { crashAddress2b = __builtin_return_address(1); if (crashAddress2b != nullptr) { frameAddressB = __builtin_frame_address(2); if (frameAddressB != nullptr && - (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) + (reinterpret_cast(frameAddressB) >> 16 == frameAddressHigh)) { crashAddress2c = __builtin_return_address(2); if (crashAddress2c != nullptr) { - result2 = DebugHelp::lookupAddress(reinterpret_cast( + result2 = DebugHelp::lookupAddress(reinterpret_cast( crashAddress2c), lib2, file2, BUFLEN, line2); } } diff --git a/engine/server/library/serverUtility/src/shared/RecentMaxSyncedValue.cpp b/engine/server/library/serverUtility/src/shared/RecentMaxSyncedValue.cpp index c40768f7..c536a214 100755 --- a/engine/server/library/serverUtility/src/shared/RecentMaxSyncedValue.cpp +++ b/engine/server/library/serverUtility/src/shared/RecentMaxSyncedValue.cpp @@ -80,7 +80,7 @@ void RecentMaxSyncedValue::setValue(float value, uint32 curSyncStamp) { // We're reducing our maximum, so we need to preserve our old maximum to // deal with usage in the time following the change. We also need to - // deal with reducing the maximum multiple times in a short interval. + // deal with reducing the maximum multiple times in a int16_t interval. // m_maximum is our previous maximum. We know that the new maximum being // set is less than this value from the previous check, so the maximum diff --git a/engine/server/library/serverUtility/src/shared/ServerConnection.cpp b/engine/server/library/serverUtility/src/shared/ServerConnection.cpp index 2ea7eeb0..f8e81ba5 100755 --- a/engine/server/library/serverUtility/src/shared/ServerConnection.cpp +++ b/engine/server/library/serverUtility/src/shared/ServerConnection.cpp @@ -143,7 +143,7 @@ const unsigned int ServerConnection::MessageConnectionOverflowing::getBytesPendi // ---------------------------------------------------------------------- -ServerConnection::ServerConnection(const std::string & a, const unsigned short p, const NetworkSetupData & setup) : +ServerConnection::ServerConnection(const std::string & a, const uint16_t p, const NetworkSetupData & setup) : Connection(a, p, setup), MessageDispatch::Emitter(), processId(0), diff --git a/engine/server/library/serverUtility/src/shared/ServerConnection.h b/engine/server/library/serverUtility/src/shared/ServerConnection.h index d7fd6519..6c136a93 100755 --- a/engine/server/library/serverUtility/src/shared/ServerConnection.h +++ b/engine/server/library/serverUtility/src/shared/ServerConnection.h @@ -23,7 +23,7 @@ class GameNetworkMessage; class ServerConnection: public Connection, public MessageDispatch::Emitter { public: - ServerConnection (const std::string & address, const unsigned short port, const NetworkSetupData &); + ServerConnection (const std::string & address, const uint16_t port, const NetworkSetupData &); ServerConnection (UdpConnectionMT *, TcpClient * t); virtual ~ServerConnection (); @@ -41,7 +41,7 @@ public: virtual void reportReceive (const Archive::ByteStream & bs); virtual void reportSend (const Archive::ByteStream & bs); virtual void send (const GameNetworkMessage & message, const bool reliable); - virtual void setProcessId (const unsigned long newProcessId); + virtual void setProcessId (const uint32 newProcessId); public: class MessageConnectionCallback: public MessageDispatch::MessageBase diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp index b8cc9332..0e6ca0b9 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionProperty.cpp @@ -475,7 +475,7 @@ void CollisionProperty::addToCollisionWorld ( void ) modifyFlags(F_inCollisionWorld, true); setIdle(false); - m_idleCounter = -10; // Make AI collision not be flagged as idle for a short while after being added to the world. + m_idleCounter = -10; // Make AI collision not be flagged as idle for a int16_t while after being added to the world. storePosition(); diff --git a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp index 5d8192b5..d7dacfce 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/CollisionUtils.cpp @@ -405,7 +405,7 @@ inline bool vectorLess ( Vector const & A, Vector const & B ) } -// This is the original version of the test. It's short, simple, and wrong. +// This is the original version of the test. It's int16_t, simple, and wrong. // It doesn't handle degenerate cases and can return inconsistent results if // the lines are swapped or the line directions are negated. diff --git a/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp b/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp index 83611cce..f9b7cc6d 100755 --- a/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp +++ b/engine/shared/library/sharedCollision/src/shared/core/SpaceAvoidanceManager.cpp @@ -141,7 +141,7 @@ bool SpaceAvoidanceManager::getAvoidancePosition(Transform const & objectTransfo const Vector & avoidancePositionOption1_w = collisionSphereCenter_w + (perpendiculara * collisionOffset); const Vector & avoidancePositionOption2_w = collisionSphereCenter_w + (perpendicularb * collisionOffset); - // Make sure the ship takes the shortest path around the sphere + // Make sure the ship takes the int16_test path around the sphere float const distance1 = avoidancePositionOption1_w.magnitudeBetweenSquared(targetPosition_w); float const distance2 = avoidancePositionOption2_w.magnitudeBetweenSquared(targetPosition_w); if (distance1 < distance2) @@ -172,7 +172,7 @@ bool SpaceAvoidanceManager::getAvoidancePosition(Transform const & objectTransfo Vector const & avoidancePositionOption1_w = collisionPosition_w + (perpendiculara * collisionOffset); Vector const & avoidancePositionOption2_w = collisionPosition_w + (perpendicularb * collisionOffset); - // Ensure the ship takes the shortest path around the sphere. + // Ensure the ship takes the int16_test path around the sphere. float const distance1 = avoidancePositionOption1_w.magnitudeBetweenSquared(targetPosition_w); float const distance2 = avoidancePositionOption2_w.magnitudeBetweenSquared(targetPosition_w); avoidancePosition_w = (distance1 < distance2) ? avoidancePositionOption1_w : avoidancePositionOption2_w; diff --git a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp index 248e54f1..efcdc447 100755 --- a/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp +++ b/engine/shared/library/sharedCollision/src/shared/extent/Extent.cpp @@ -245,7 +245,7 @@ bool Extent::testSphereOnly(Vector const & begin, Vector const & end, Vector * s Vector direction(end - begin); if (!direction.normalize()) { - // handle the line segment being very short to avoid a divide-by-zero + // handle the line segment being very int16_t to avoid a divide-by-zero if (testSphereOnly(begin)) { if (surfaceNormal) diff --git a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp index 54d2a244..ccba27d2 100755 --- a/engine/shared/library/sharedCompression/src/shared/BitStream.cpp +++ b/engine/shared/library/sharedCompression/src/shared/BitStream.cpp @@ -253,7 +253,7 @@ void BitFile::outputBits(uint32 code, uint32 count) if (!mask) { - uint32 bytesWritten; + long unsigned int bytesWritten; if (!WriteFile(hFile, &rack, sizeof(rack), &bytesWritten, nullptr)) { DEBUG_FATAL(true,("BitFile::outputBits error %d.", GetLastError())); @@ -276,7 +276,7 @@ void BitFile::outputBits(uint32 code, uint32 count) void BitFile::outputRack(void) { - uint32 bytesWritten; + long unsigned int bytesWritten; if (mask != INITIAL_MASK_VALUE) { @@ -310,7 +310,7 @@ uint32 BitFile::inputBits(uint32 count) { if (mask == INITIAL_MASK_VALUE ) { - uint32 bytesRead; + long unsigned int bytesRead; const BOOL result = ReadFile(hFile, &rack, sizeof(rack), &bytesRead, nullptr); @@ -495,7 +495,7 @@ void ByteFile::output(byte b) DEBUG_FATAL(isInput,("ByteFile::output called on input stream.")); byte out = b; - uint32 bytesWritten; + long unsigned int bytesWritten; if (!WriteFile(hFile, &out, sizeof(byte), &bytesWritten, nullptr)) { @@ -517,7 +517,7 @@ bool ByteFile::input(byte *b) { DEBUG_FATAL(!isInput,("ByteFile::input called on output stream.")); - uint32 bytesRead; + long unsigned int bytesRead; BOOL result = ReadFile(hFile, b, sizeof(byte), &bytesRead, nullptr); // check for EOS diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/BufferString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/BufferString.h index b1ae33cc..b8f95165 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/BufferString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/BufferString.h @@ -26,7 +26,7 @@ namespace DB /** * A nullable string class similar to DB::BindableString, but uses std::string * internally. Unlike DB::BindableString, it does not allocate the maximum - * size for the buffer if the data is shorter. This class will save memory + * size for the buffer if the data is int16_ter. This class will save memory * over DB::BindableString if used in a buffer that stores a lot of rows. * However, it cannot be bound directly in a query. It must be copied * to a varray or a DB::BindableString first. diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h index c9552f0c..b9f488df 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableString.h @@ -222,7 +222,7 @@ namespace DB else { //-- Justin Randall [4/11/2001 5:56:56 PM] -- - // @todo : value is currently a char, should be an short or Unicode::String::value_type or wchar_t + // @todo : value is currently a char, should be an int16_t or Unicode::String::value_type or wchar_t return Unicode::String(Unicode::narrowToWide(m_value)); } } diff --git a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h index d8c761fc..d5c8d603 100755 --- a/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h +++ b/engine/shared/library/sharedDatabaseInterface/src/shared/core/DbBindableUnicode.h @@ -184,7 +184,7 @@ namespace DB return str; //-- Justin Randall [4/11/2001 5:56:56 PM] -- - // @todo : value is currently a char, should be an short or Unicode::String::value_type or wchar_t + // @todo : value is currently a char, should be an int16_t or Unicode::String::value_type or wchar_t //return Unicode::String(Unicode::narrowToWide(m_value)); } } diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp index b0cec73d..d2d9b53f 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.cpp @@ -138,6 +138,7 @@ bool BindableVarrayNumber::push_back(int value) // ---------------------------------------------------------------------- +#if not __x86_64__ bool BindableVarrayNumber::push_back(long int value) { OCINumber buffer; @@ -153,9 +154,10 @@ bool BindableVarrayNumber::push_back(long int value) return true; } +#endif // ---------------------------------------------------------------------- -bool BindableVarrayNumber::push_back(int64 value) +bool BindableVarrayNumber::push_back(int64_t value) { OCINumber buffer; @@ -230,6 +232,7 @@ bool BindableVarrayNumber::push_back(bool IsNULL, int value) // ---------------------------------------------------------------------- +#if not __x86_64__ bool BindableVarrayNumber::push_back(bool IsNULL, long int value) { OCINumber buffer; @@ -254,9 +257,11 @@ bool BindableVarrayNumber::push_back(bool IsNULL, long int value) return true; } +#endif + // ---------------------------------------------------------------------- -bool BindableVarrayNumber::push_back(bool IsNULL, int64 value) +bool BindableVarrayNumber::push_back(bool IsNULL, int64_t value) { OCINumber buffer; diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.h b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.h index a9233b6f..3ba402dc 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.h +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/DbBindableVarray.h @@ -59,12 +59,18 @@ namespace DB public: bool push_back(bool IsNULL, int value); bool push_back(bool IsNULL, double value); + +#if not __x86_64__ bool push_back(bool IsNULL, long int value); - bool push_back(bool IsNULL, int64 value); +#endif + bool push_back(bool IsNULL, int64_t value); bool push_back(int value); bool push_back(double value); + +#if not __x86_64__ bool push_back(long int value); - bool push_back(int64 value); +#endif + bool push_back(int64_t value); virtual std::string outputValue() const; }; diff --git a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp index b4486dc8..61ba988f 100755 --- a/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp +++ b/engine/shared/library/sharedDatabaseInterface/src_oci/OciQueryImplementation.cpp @@ -127,7 +127,7 @@ void DB::OCIQueryImpl::preprocessBinds() (*i)->indicator=-1; else { - (*i)->length=(unsigned short)*((*i)->owner->getIndicator()); //TODO: something better + (*i)->length=(uint16_t)*((*i)->owner->getIndicator()); //TODO: something better (*i)->indicator=1; if ((*i)->stringAdjust) ++(*i)->length; //TODO: This feels like a hack diff --git a/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp b/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp index 8e3ba4bc..e748b49e 100755 --- a/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp @@ -379,8 +379,8 @@ static bool dwarfSearch(char const *dwarfLines, unsigned int linesLength, void c if (valid) { unsigned int addrOffset = 0; - if (progAddr < reinterpret_cast(info.dli_fbase)) - addrOffset = reinterpret_cast(info.dli_fbase); + if (progAddr < reinterpret_cast(info.dli_fbase)) + addrOffset = reinterpret_cast(info.dli_fbase); const void *testAddr = reinterpret_cast(progAddr+addrOffset); if (testAddr >= addr) { @@ -461,7 +461,7 @@ struct Stab unsigned int n_strx; // index into string table unsigned char n_type; // type of stab entry char n_other; - unsigned short n_desc; // for N_SLINE entries, line number + uint16_t n_desc; // for N_SLINE entries, line number unsigned int n_value; // value of symbol }; @@ -503,12 +503,12 @@ static bool stabSearch(Stab const *stab, unsigned int stabSize, char const *stab if (reinterpret_cast(stab->n_value) > info.dli_fbase) funcBase = reinterpret_cast(stab->n_value); else - funcBase = reinterpret_cast(reinterpret_cast(info.dli_fbase)+stab->n_value); + funcBase = reinterpret_cast(reinterpret_cast(info.dli_fbase)+stab->n_value); foundSrcLine = -1; } else if (stab->n_type == N_SLINE && addr >= funcBase) // source line { - if (stab->n_value < reinterpret_cast(addr)-reinterpret_cast(funcBase)) + if (stab->n_value < reinterpret_cast(addr)-reinterpret_cast(funcBase)) foundSrcLine = stab->n_desc; else { diff --git a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp index 62716893..6748e8b7 100755 --- a/engine/shared/library/sharedDebug/src/shared/DataLint.cpp +++ b/engine/shared/library/sharedDebug/src/shared/DataLint.cpp @@ -582,10 +582,10 @@ void DataLint::addFilePath(char const *filePath) ++longPath; ++longPath; ++longPath; - char *shortPath = &text[0]; + char *int16_tPath = &text[0]; *seperator = '\0'; - m_assetList->push_back(std::make_pair(shortPath, longPath)); + m_assetList->push_back(std::make_pair(int16_tPath, longPath)); } } diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h index bdb5e62a..ce7cc22a 100755 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.h @@ -8,6 +8,8 @@ #ifndef REMOTE_DEBUG_H #define REMOTE_DEBUG_H +#include + // ====================================================================== /** This class is both a platform and network-protocol independent way of @@ -69,9 +71,9 @@ public: protected: //define typdefs of function types typedef void (*RemoveFunction)(); - typedef void (*OpenFunction)(const char *server, uint16 port); + typedef void (*OpenFunction)(const char *server, uint16_t port); typedef void (*CloseFunction)(); - typedef void (*SendFunction)(void *buffer, uint32 bufferLen); + typedef void (*SendFunction)(void *buffer, uint32_t bufferLen); typedef void (*IsReadyFunction)(); typedef void (*UpFunction)(); @@ -92,7 +94,7 @@ public: static void install(RemoveFunction, OpenFunction, CloseFunction, SendFunction, IsReadyFunction); ///open a session - static void open(const char *server = nullptr, uint16 port = 0); + static void open(const char *server = nullptr, uint16_t port = 0); ///packs the data into a packet, and sends it using the client-defined SendFunction static void send(MESSAGE_TYPE type, const char* name = ""); @@ -101,7 +103,7 @@ public: static void translateVarArgs(const char *format, ...); ///register a variable with the system - static uint32 registerVariable(const char* variableName, void *memLoc, VARIABLE_TYPES type, bool sendToClients); + static uint32_t registerVariable(const char* variableName, void *memLoc, VARIABLE_TYPES type, bool sendToClients); ///send the variable value to the clients static void updateVariable(const char* variableName); @@ -135,10 +137,10 @@ protected: static void remove(); ///store the stream in a map, use an int for network communication - static uint32 registerStream(const std::string& streamName); + static uint32_t registerStream(const std::string& streamName); ///store the static view in a map, use an int for network communication - static uint32 registerStaticView(const std::string& staticViewName); + static uint32_t registerStaticView(const std::string& staticViewName); ///find and return the stream number for a given stream name, -1 if not found static int32 findStream(const std::string& name); @@ -159,15 +161,15 @@ protected: static SendFunction ms_sendFunction; static IsReadyFunction ms_isReadyFunction; - typedef std::map StreamMap; + typedef std::map StreamMap; ///stream names static StreamMap *ms_streams; - typedef std::map VariableMap; + typedef std::map VariableMap; ///What variables are registered static VariableMap *ms_variables; - typedef std::map StaticViewMap; + typedef std::map StaticViewMap; ///StaticView names static StaticViewMap *ms_staticViews; @@ -184,24 +186,24 @@ protected: static bool ms_opened; ///What streaming channels are squelched (i.e. don't send to client at all) - static std::map *ms_squelchedStream; + static std::map *ms_squelchedStream; ///What static channels are squelched (i.e. don't send to client at all) - static std::map *ms_squelchedStatic; + static std::map *ms_squelchedStatic; ///the next stream number - static uint32 ms_nextStream; + static uint32_t ms_nextStream; ///the next variable number - static uint32 ms_nextVariable; + static uint32_t ms_nextVariable; ///the next staticView number - static uint32 ms_nextStaticView; + static uint32_t ms_nextStaticView; - typedef std::map VariableValueMap; + typedef std::map VariableValueMap; static VariableValueMap *ms_variableValues; - typedef std::map MovementFunctionMap; + typedef std::map MovementFunctionMap; static MovementFunctionMap *ms_upFunctionMap; static MovementFunctionMap *ms_downFunctionMap; static MovementFunctionMap *ms_leftFunctionMap; diff --git a/engine/shared/library/sharedDebug/src/win32/DebugHelp.cpp b/engine/shared/library/sharedDebug/src/win32/DebugHelp.cpp index b80a6a45..a3d60374 100755 --- a/engine/shared/library/sharedDebug/src/win32/DebugHelp.cpp +++ b/engine/shared/library/sharedDebug/src/win32/DebugHelp.cpp @@ -626,19 +626,19 @@ bool DebugHelp::writeMiniDump(char const *miniDumpFileName, PEXCEPTION_POINTERS return false; // get the file name without the path - const char *shortProgramName = strrchr(programName, '\\'); - if (shortProgramName) - ++shortProgramName; + const char *int16_tProgramName = strrchr(programName, '\\'); + if (int16_tProgramName) + ++int16_tProgramName; else - shortProgramName = programName; + int16_tProgramName = programName; // lop off the extension - char *dot = const_cast(strchr(shortProgramName, '.')); + char *dot = const_cast(strchr(int16_tProgramName, '.')); if (dot) *dot = '\0'; // create a reasonable minidump filename - snprintf(buffer, sizeof(buffer), "%s_%d.mdmp", shortProgramName, static_cast(GetCurrentProcessId())); + snprintf(buffer, sizeof(buffer), "%s_%d.mdmp", int16_tProgramName, static_cast(GetCurrentProcessId())); miniDumpFileName = buffer; } diff --git a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp index a0789e5b..6583e27e 100755 --- a/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileStreamerThread.cpp @@ -166,7 +166,7 @@ void FileStreamerThread::processRead(volatile Request *request) { NOT_NULL(request); - // shortcut to the file + // int16_tcut to the file OsFile *osFile = request->osFile; // seek to the requested offset diff --git a/engine/shared/library/sharedFile/src/shared/Iff.cpp b/engine/shared/library/sharedFile/src/shared/Iff.cpp index 48eaeed1..57e25895 100755 --- a/engine/shared/library/sharedFile/src/shared/Iff.cpp +++ b/engine/shared/library/sharedFile/src/shared/Iff.cpp @@ -1551,7 +1551,7 @@ void Iff::read_string(char *string, int maxLength) for ( ; *source; ++string, ++source, ++s.used, --maxLength) { DEBUG_FATAL(s.used >= s.length, ("hit end of chunk before string terminator")); - DEBUG_FATAL(maxLength <= 0, ("destination string too short")); + DEBUG_FATAL(maxLength <= 0, ("destination string too int16_t")); *string = *source; } @@ -1559,7 +1559,7 @@ void Iff::read_string(char *string, int maxLength) ++s.used; // nullptr terminate the output string - DEBUG_FATAL(maxLength <= 0, ("destination string too short")); + DEBUG_FATAL(maxLength <= 0, ("destination string too int16_t")); *string = '\0'; } @@ -1667,7 +1667,7 @@ std::string Iff::read_stdstring() void Iff::read_string(Unicode::String &str) { const int32 count = read_int32 (); - unsigned short * data = new unsigned short [count]; + uint16_t * data = new uint16_t [count]; read_uint16 (count, data); str.assign (data, static_cast(count)); delete [] data; diff --git a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp index 6c53bff5..b7fc9e4a 100755 --- a/engine/shared/library/sharedFile/src/shared/TreeFile.cpp +++ b/engine/shared/library/sharedFile/src/shared/TreeFile.cpp @@ -505,7 +505,7 @@ int TreeFile::getFileSize(const char *fileName) // ---------------------------------------------------------------------- /** * This function assumes the output buffer is large enough. - * The output path will be the same length or shorter than the input path. + * The output path will be the same length or int16_ter than the input path. */ void TreeFile::fixUpFileName(char *output, const char *fileName, bool warning) @@ -800,7 +800,7 @@ const char *TreeFile::getSearchPath(int index) //----------------------------------------------------------------- /** - * This function will return the shortest trailing path of its input that + * This function will return the int16_test trailing path of its input that * can be loaded by the TreeFile. If no files can be loaded, this routine * will return nullptr. */ diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.cpp b/engine/shared/library/sharedFoundation/src/linux/Os.cpp index fd3ee6c2..7340890a 100755 --- a/engine/shared/library/sharedFoundation/src/linux/Os.cpp +++ b/engine/shared/library/sharedFoundation/src/linux/Os.cpp @@ -31,7 +31,7 @@ bool Os::wasPaused; bool Os::gameOver; bool Os::shouldReturnFromAbort; char Os::programName[PROGRAM_NAME_SIZE]; -char *Os::shortProgramName; +char *Os::int16_tProgramName; pthread_t Os::mainThreadId; bool Os::threadDied; @@ -100,11 +100,11 @@ void Os::installCommon(void) FATAL(result == 0, ("GetModuleFileName failed")); // get the file name without the path - shortProgramName = strrchr(programName, '\\'); - if (shortProgramName) - ++shortProgramName; + int16_tProgramName = strrchr(programName, '\\'); + if (int16_tProgramName) + ++int16_tProgramName; else - shortProgramName = programName; + int16_tProgramName = programName; // determine the number of processors by parsing /proc/cpuinfo processorCount = 1; diff --git a/engine/shared/library/sharedFoundation/src/linux/Os.h b/engine/shared/library/sharedFoundation/src/linux/Os.h index 972a93b7..ece7b87d 100755 --- a/engine/shared/library/sharedFoundation/src/linux/Os.h +++ b/engine/shared/library/sharedFoundation/src/linux/Os.h @@ -69,7 +69,7 @@ private: static bool shouldReturnFromAbort; static bool wantPopupDebugMenu; static char programName[PROGRAM_NAME_SIZE]; - static char *shortProgramName; + static char *int16_tProgramName; static pthread_t mainThreadId; static bool threadDied; static bool isMp; @@ -145,17 +145,17 @@ inline const char *Os::getProgramName(void) // ---------------------------------------------------------------------- /** - * Return the short name of the running executable. + * Return the int16_t name of the running executable. * * The program name will not include the path, but will just be the file name. * - * @return The short name of the running executable + * @return The int16_t name of the running executable * @see Os::getProgramName() */ inline const char *Os::getShortProgramName(void) { - return shortProgramName; + return int16_tProgramName; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h index 867d7086..75668897 100755 --- a/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h +++ b/engine/shared/library/sharedFoundation/src/linux/PlatformGlue.h @@ -9,7 +9,7 @@ #include #include -typedef unsigned short int WORD; +typedef uint16_t WORD; typedef unsigned long int DWORD; typedef bool BOOL; typedef long long __int64; //lint !e13 !e19 // Error: 13 (Bad type), Error: 19 (Useless declaration) // -TRF- Lint preprocessor discrepency, @todo look into this. diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp index 5209d788..4e33ccd3 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.cpp @@ -31,11 +31,11 @@ CommandLine::Option::Option( const char *newLongName, ArgumentPolicy newArgumentPolicy ) : - shortName(newShortName), + int16_tName(newShortName), longName(0), argumentPolicy(newArgumentPolicy) { - DEBUG_FATAL(shortName && !(isalnum(shortName) || (shortName == OP_SNAME_UNTAGGED)), ("specified shortname must satisfy isalnum() test or be special untagged character")); + DEBUG_FATAL(int16_tName && !(isalnum(int16_tName) || (int16_tName == OP_SNAME_UNTAGGED)), ("specified int16_tname must satisfy isalnum() test or be special untagged character")); if (newLongName) { @@ -125,8 +125,8 @@ CommandLine::Option *CommandLine::Option::createOption( CommandLine::MatchCode CommandLine::Option::match(void) { - // we match if we find an unmatched short or long command line option - // matching this short or long name. If the arg specs don't match, we've + // we match if we find an unmatched int16_t or long command line option + // matching this int16_t or long name. If the arg specs don't match, we've // got an argument matching error. DEBUG_FATAL(!optionTable, ("internal error: nullptr option table")); @@ -134,10 +134,10 @@ CommandLine::MatchCode CommandLine::Option::match(void) OptionTable::Record *record = 0; // get the option info record for this option - if (shortName) + if (int16_tName) { - record = optionTable->findOptionRecord(shortName); - DEBUG_FATAL(!record, ("failed to find option info record for option -%c", shortName)); + record = optionTable->findOptionRecord(int16_tName); + DEBUG_FATAL(!record, ("failed to find option info record for option -%c", int16_tName)); } else if (longName) { @@ -145,7 +145,7 @@ CommandLine::MatchCode CommandLine::Option::match(void) DEBUG_FATAL(!record, ("failed to find option info record for option --%s", longName)); } else - DEBUG_FATAL(true, ("corrupted option? both short and long name are nullptr")); + DEBUG_FATAL(true, ("corrupted option? both int16_t and long name are nullptr")); // attempt to match against this option against commandline-specified options @@ -788,7 +788,7 @@ CommandLine::OptionTable::Record::Record( const char *newLongName, ArgumentPolicy newArgumentPolicy ) : - shortName(newShortName), + int16_tName(newShortName), longName(0), writeCount(0), matchCount(0), @@ -865,15 +865,15 @@ CommandLine::OptionTable::~OptionTable(void) // ---------------------------------------------------------------------- CommandLine::OptionTable::Record *CommandLine::OptionTable::createOptionRecord( - char shortName, + char int16_tName, const char *longName, ArgumentPolicy newArgumentPolicy ) { - DEBUG_FATAL(shortName && findOptionRecord(shortName), ("short name %c already exists in list", shortName)); + DEBUG_FATAL(int16_tName && findOptionRecord(int16_tName), ("int16_t name %c already exists in list", int16_tName)); DEBUG_FATAL(longName && findOptionRecord(longName), ("long name \"%s\" already exists in list", longName)); - Record *record = new Record(shortName, longName, newArgumentPolicy); + Record *record = new Record(int16_tName, longName, newArgumentPolicy); record->setNext(firstRecord); firstRecord = record; @@ -883,15 +883,15 @@ CommandLine::OptionTable::Record *CommandLine::OptionTable::createOptionRecord( // ---------------------------------------------------------------------- CommandLine::OptionTable::Record *CommandLine::OptionTable::findOptionRecord( - char shortName + char int16_tName ) const { - DEBUG_FATAL(!shortName, ("nullptr shortName arg")); + DEBUG_FATAL(!int16_tName, ("nullptr int16_tName arg")); // walk the list for (Record *record = firstRecord; record; record = record->getNext()) { - if (record->getShortName() == shortName) + if (record->getShortName() == int16_tName) return record; } @@ -1245,7 +1245,7 @@ CommandLine::MatchCode CommandLine::parseCommandLineBuffer(void) return MC_MATCH; case Lexer::TT_ShortOption: - // we've found a short option, make sure specified short option exists + // we've found a int16_t option, make sure specified int16_t option exists { DEBUG_FATAL(!optionTable, ("internal error: nullptr optionTable")); OptionTable::Record *record = optionTable->findOptionRecord(token.getShortName()); @@ -1516,7 +1516,7 @@ const char *CommandLine::getPostCommandLineString(void) * * Short options are formed by a hyphen followed immediately by an alphanumeric * character (e.g. -c, -h, -i). If an argument is associated with the - * short option, it follows the short option with optional whitespace + * int16_t option, it follows the int16_t option with optional whitespace * separating them. * * Long options are formed by two hyphens followed immediately by a text @@ -1590,23 +1590,23 @@ CommandLine::MatchCode CommandLine::parseOptions(const OptionSpec *optionTree, i * To check if a second occurrence of the "-i" was specified, use * CommandLine::getOptionExists('i', 1) * - * The client may use either the short or long name version of this + * The client may use either the int16_t or long name version of this * command. They will return the same value regardless of the form * of the option specified by the user on the command line. * - * @param shortName [IN] short name of the option + * @param int16_tName [IN] int16_t name of the option * @param occurrenceIndex [IN] zero-based occurrence number to check * @return true if the option with the given was specified on the command line. * false if the option was not specified on the command line. */ -bool CommandLine::getOptionExists(char shortName, int occurrenceIndex) +bool CommandLine::getOptionExists(char int16_tName, int occurrenceIndex) { DEBUG_FATAL(!installed, ("CommandLine not installed")); DEBUG_FATAL(!wasParsed, ("commandline not parsed successfully")); - DEBUG_FATAL(!shortName, ("invalid shortName arg")); + DEBUG_FATAL(!int16_tName, ("invalid int16_tName arg")); - OptionTable::Record *record = optionTable->findOptionRecord(shortName); + OptionTable::Record *record = optionTable->findOptionRecord(int16_tName); if (!record) return false; else @@ -1620,7 +1620,7 @@ bool CommandLine::getOptionExists(char shortName, int occurrenceIndex) * To check if an occurrence of the "-inputfile" was specified, use * CommandLine::getOptionExists("inputfile", 0) * - * The client may use either the short or long name version of this + * The client may use either the int16_t or long name version of this * command. They will return the same value regardless of the form * of the option specified by the user on the command line. * @@ -1647,21 +1647,21 @@ bool CommandLine::getOptionExists(const char *longName, int occurrenceIndex) /** * Retrieve the number of times a given option occurred on the command line. * - * The client may use either the short or long name version of this + * The client may use either the int16_t or long name version of this * command. They will return the same value regardless of the form * of the option specified by the user on the command line. * - * @param shortName [IN] short name of the option to check + * @param int16_tName [IN] int16_t name of the option to check * @return The number of times the specified option appeared on the command line. */ -int CommandLine::getOccurrenceCount(char shortName) +int CommandLine::getOccurrenceCount(char int16_tName) { DEBUG_FATAL(!installed, ("CommandLine not installed")); DEBUG_FATAL(!wasParsed, ("commandline not parsed successfully")); - DEBUG_FATAL(!shortName, ("invalid shortName arg")); + DEBUG_FATAL(!int16_tName, ("invalid int16_tName arg")); - OptionTable::Record *record = optionTable->findOptionRecord(shortName); + OptionTable::Record *record = optionTable->findOptionRecord(int16_tName); if (!record) return 0; else @@ -1672,7 +1672,7 @@ int CommandLine::getOccurrenceCount(char shortName) /** * Retrieve the number of times a given option occurred on the command line. * - * The client may use either the short or long name version of this + * The client may use either the int16_t or long name version of this * command. They will return the same value regardless of the form * of the option specified by the user on the command line. * @@ -1697,24 +1697,24 @@ int CommandLine::getOccurrenceCount(const char *longName) /** * Retrieve the argument associated with the given option occurrence. * - * The client may use either the short or long name version of this + * The client may use either the int16_t or long name version of this * command. They will return the same value regardless of the form * of the option specified by the user on the command line. * - * @param shortName [IN] short name of the option + * @param int16_tName [IN] int16_t name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return The read-only argument string associated with the specified option occurrence. * May be nullptr if no argument was associated with the specified option. */ -const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) +const char *CommandLine::getOptionString(char int16_tName, int occurrenceIndex) { DEBUG_FATAL(!installed, ("CommandLine not installed")); DEBUG_FATAL(!wasParsed, ("commandline not parsed successfully")); - DEBUG_FATAL(!shortName, ("invalid shortName arg")); + DEBUG_FATAL(!int16_tName, ("invalid int16_tName arg")); - OptionTable::Record *record = optionTable->findOptionRecord(shortName); - DEBUG_FATAL(!record, ("requested option string for non-existant option '%c'", shortName)); + OptionTable::Record *record = optionTable->findOptionRecord(int16_tName); + DEBUG_FATAL(!record, ("requested option string for non-existant option '%c'", int16_tName)); return record->getString(occurrenceIndex); } @@ -1723,7 +1723,7 @@ const char *CommandLine::getOptionString(char shortName, int occurrenceIndex) /** * Retrieve the argument associated with the given option occurrence. * - * The client may use either the short or long name version of this + * The client may use either the int16_t or long name version of this * command. They will return the same value regardless of the form * of the option specified by the user on the command line. * @@ -1749,24 +1749,24 @@ const char *CommandLine::getOptionString(const char *longName, int occurrenceInd /** * Retrieve the argument associated with the given option occurrence. * - * The client may use either the short or long name version of this + * The client may use either the int16_t or long name version of this * command. They will return the same value regardless of the form * of the option specified by the user on the command line. * - * @param shortName [IN] short name of the option + * @param int16_tName [IN] int16_t name of the option * @param occurrenceIndex [IN] zero-based occurrence number * @return An integerized version of the option string associated with the specified option occurrence. * Will return zero if the argument string could not be converted to an integer. */ -int CommandLine::getOptionInt(char shortName, int occurrenceIndex) +int CommandLine::getOptionInt(char int16_tName, int occurrenceIndex) { DEBUG_FATAL(!installed, ("CommandLine not installed")); DEBUG_FATAL(!wasParsed, ("commandline not parsed successfully")); - DEBUG_FATAL(!shortName, ("invalid shortName arg")); + DEBUG_FATAL(!int16_tName, ("invalid int16_tName arg")); - OptionTable::Record *record = optionTable->findOptionRecord(shortName); - DEBUG_FATAL(!record, ("requested option string for non-existant option '%c'", shortName)); + OptionTable::Record *record = optionTable->findOptionRecord(int16_tName); + DEBUG_FATAL(!record, ("requested option string for non-existant option '%c'", int16_tName)); return atoi(record->getString(occurrenceIndex)); } @@ -1775,7 +1775,7 @@ int CommandLine::getOptionInt(char shortName, int occurrenceIndex) /** * Retrieve the argument associated with the given option occurrence. * - * The client may use either the short or long name version of this + * The client may use either the int16_t or long name version of this * command. They will return the same value regardless of the form * of the option specified by the user on the command line. * diff --git a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h index 04b4d10d..34f4f516 100755 --- a/engine/shared/library/sharedFoundation/src/shared/CommandLine.h +++ b/engine/shared/library/sharedFoundation/src/shared/CommandLine.h @@ -28,10 +28,10 @@ enum OP_ListType #define OP_END_LIST_NODE() { CommandLine::OST_EndListNode, 0, 0, 0, 0 } #define OP_BEGIN_SWITCH_NODE(multipleIsAllowed) { CommandLine::OST_BeginSwitchNode, multipleIsAllowed, 0, 0, 0 } #define OP_END_SWITCH_NODE() { CommandLine::OST_EndSwitchNode, 0, 0, 0, 0 } -#define OP_OPTION(shortName, longName, argumentPolicy) { CommandLine::OST_Option, argumentPolicy, 0, shortName, longName } +#define OP_OPTION(int16_tName, longName, argumentPolicy) { CommandLine::OST_Option, argumentPolicy, 0, int16_tName, longName } -#define OP_SINGLE_LIST_NODE(shortName, longName, argMode, multipleIsAllowed, isRequiredNode) OP_BEGIN_LIST_NODE(multipleIsAllowed, isRequiredNode), OP_OPTION(shortName, longName, argMode), OP_END_LIST_NODE() -#define OP_SINGLE_SWITCH_NODE(shortName, longName, argMode, multipleIsAllowed) OP_BEGIN_SWITCH_NODE(multipleIsAllowed), OP_OPTION(shortName, longName, argMode), OP_END_SWITCH_NODE() +#define OP_SINGLE_LIST_NODE(int16_tName, longName, argMode, multipleIsAllowed, isRequiredNode) OP_BEGIN_LIST_NODE(multipleIsAllowed, isRequiredNode), OP_OPTION(int16_tName, longName, argMode), OP_END_LIST_NODE() +#define OP_SINGLE_SWITCH_NODE(int16_tName, longName, argMode, multipleIsAllowed) OP_BEGIN_SWITCH_NODE(multipleIsAllowed), OP_OPTION(int16_tName, longName, argMode), OP_END_SWITCH_NODE() //lint -save -e1923 // #define could become const @@ -126,7 +126,7 @@ public: { private: - char shortName; + char int16_tName; char *longName; ArgumentPolicy argumentPolicy; @@ -336,7 +336,7 @@ private: private: - char shortName; + char int16_tName; char *longName; int writeCount; int matchCount; @@ -389,9 +389,9 @@ private: OptionTable(void); ~OptionTable(void); - Record *createOptionRecord(char shortName, const char *longName, ArgumentPolicy newArgumentPolicy); + Record *createOptionRecord(char int16_tName, const char *longName, ArgumentPolicy newArgumentPolicy); - Record *findOptionRecord(char shortName) const; + Record *findOptionRecord(char int16_tName) const; Record *findOptionRecord(const char *longName) const; bool getAllOptionsMatched(void) const; @@ -488,10 +488,10 @@ private: private: - static bool findNextOccurence(char shortName, int *occurrenceIndex); + static bool findNextOccurence(char int16_tName, int *occurrenceIndex); static bool findNextOccurence(const char *longName, int *occurrenceIndex); - static bool getOptionArgExists(char shortName, int occurrenceIndex); + static bool getOptionArgExists(char int16_tName, int occurrenceIndex); static bool getOptionArgExists(const char *longName, int occurrenceIndex); static void buildOptionTree(const OptionSpec *specList, int specCount); @@ -509,16 +509,16 @@ public: static MatchCode parseOptions(const OptionSpec *optionTree, int optionSpecCount); - static bool getOptionExists(char shortName, int occurrenceIndex = 0); + static bool getOptionExists(char int16_tName, int occurrenceIndex = 0); static bool getOptionExists(const char *longName, int occurrenceIndex = 0); - static int getOccurrenceCount(char shortName); + static int getOccurrenceCount(char int16_tName); static int getOccurrenceCount(const char *longName); - static const char *getOptionString(char shortName, int occurrenceIndex = 0); + static const char *getOptionString(char int16_tName, int occurrenceIndex = 0); static const char *getOptionString(const char *longName, int occurrenceIndex = 0); - static int getOptionInt(char shortName, int occurrenceIndex = 0); + static int getOptionInt(char int16_tName, int occurrenceIndex = 0); static int getOptionInt(const char *longName, int occurrenceIndex = 0); static int getUntaggedOccurrenceCount(void); @@ -531,7 +531,7 @@ public: inline char CommandLine::Option::getShortName(void) const { - return shortName; + return int16_tName; } // ---------------------------------------------------------------------- @@ -631,7 +631,7 @@ inline void CommandLine::Switch::Node::setNext( inline char CommandLine::OptionTable::Record::getShortName(void) const { - return shortName; + return int16_tName; } // ---------------------------------------------------------------------- @@ -714,7 +714,7 @@ inline CommandLine::Lexer::TokenType CommandLine::Lexer::Token::getTokenType(voi inline char CommandLine::Lexer::Token::getShortName(void) const { - DEBUG_FATAL(tokenType != TT_ShortOption, ("attempted to get short name for token type %d", tokenType)); + DEBUG_FATAL(tokenType != TT_ShortOption, ("attempted to get int16_t name for token type %d", tokenType)); return name[0]; } diff --git a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h index d778be27..445e301c 100755 --- a/engine/shared/library/sharedFoundation/src/shared/FormattedString.h +++ b/engine/shared/library/sharedFoundation/src/shared/FormattedString.h @@ -11,7 +11,7 @@ #include // ---------------------------------------------------------------------- -template +template class FormattedString { public: @@ -19,7 +19,7 @@ public: FormattedString(); char const * sprintf(char const * format, ...); - char const * vsprintf(char const * format, va_list const & va); + char const * vsprintf(char const * format, va_list & va); private: @@ -32,14 +32,14 @@ private: }; // ---------------------------------------------------------------------- -template +template inline FormattedString::FormattedString() { m_text[0] = '\0'; } //----------------------------------------------------------------------------- -template +template inline char const * FormattedString::sprintf(char const * const format, ...) { char const * result = nullptr; @@ -55,8 +55,8 @@ inline char const * FormattedString::sprintf(char const * const form } // ---------------------------------------------------------------------- -template -inline char const * FormattedString::vsprintf(char const * const format, va_list const & va) +template +inline char const * FormattedString::vsprintf(char const * const format, va_list & va) { // Format the string diff --git a/engine/shared/library/sharedFoundation/src/shared/Misc.h b/engine/shared/library/sharedFoundation/src/shared/Misc.h index 1c29b6ed..5d5b0f07 100755 --- a/engine/shared/library/sharedFoundation/src/shared/Misc.h +++ b/engine/shared/library/sharedFoundation/src/shared/Misc.h @@ -146,7 +146,7 @@ inline char *DuplicateString(const char *source) if (!source) return nullptr; - const uint length = strlen(source)+1; + const uint32 length = strlen(source)+1; char *result = NON_NULL (new char[length]); memcpy(result, source, length); return result; @@ -171,10 +171,10 @@ inline char *DuplicateStringWithToLower(const char *source) if (!source) return nullptr; - const uint length = strlen(source)+1; + const uint32 length = strlen(source)+1; char *result = NON_NULL (new char[length]); - for (uint i = 0; i < length; ++i) + for (uint32 i = 0; i < length; ++i) result[i] = static_cast(tolower(source[i])); return result; @@ -194,7 +194,7 @@ inline char *DuplicateStringWithToLower(const char *source) inline void imemset(void *data, int value, int length) { DEBUG_FATAL(!data, ("nullptr data arg")); - memset(data, value, static_cast(length)); + memset(data, value, static_cast(length)); } // ---------------------------------------------------------------------- @@ -212,25 +212,7 @@ inline void imemcpy(void *destination, const void *source, int length) { DEBUG_FATAL(!destination, ("nullptr destination arg")); DEBUG_FATAL(!source, ("nullptr source arg")); - memcpy(destination, source, static_cast(length)); -} - -// ---------------------------------------------------------------------- -/** - * memmove with a integer length. - * - * This routine will - * - * @param destination Location to copy to - * @param source Location to copy from - * @param length Number of bytes to copy - */ - -inline void *memmove(void *destination, const void *source, int length) -{ - DEBUG_FATAL(!destination, ("nullptr destination arg")); - DEBUG_FATAL(!source, ("nullptr source arg")); - return memmove(destination, source, static_cast(length)); + memcpy(destination, source, static_cast(length)); } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundation/src/shared/StlForwardDeclaration.h b/engine/shared/library/sharedFoundation/src/shared/StlForwardDeclaration.h index cd1b0e75..140e6f4c 100755 --- a/engine/shared/library/sharedFoundation/src/shared/StlForwardDeclaration.h +++ b/engine/shared/library/sharedFoundation/src/shared/StlForwardDeclaration.h @@ -18,7 +18,7 @@ namespace Unicode { - typedef unsigned short unicode_char_t; + typedef uint16_t unicode_char_t; typedef std::basic_string, std::allocator > String; } diff --git a/engine/shared/library/sharedFoundation/src/win32/ByteOrder.cpp b/engine/shared/library/sharedFoundation/src/win32/ByteOrder.cpp index 12add8e5..4666e113 100755 --- a/engine/shared/library/sharedFoundation/src/win32/ByteOrder.cpp +++ b/engine/shared/library/sharedFoundation/src/win32/ByteOrder.cpp @@ -33,7 +33,7 @@ __declspec(naked) ulong htonl(ulong hostLong) } } //lint !e533 !e715 // function should return a value, argument not referenced -__declspec(naked) ushort ntohs(ushort netShort) +__declspec(naked) uint16_t ntohs(uint16_t netShort) { _asm { @@ -44,7 +44,7 @@ __declspec(naked) ushort ntohs(ushort netShort) } } //lint !e533 !e715 // function should return a value, argument not referenced -__declspec(naked) ushort htons(ushort hostShort) +__declspec(naked) uint16_t htons(uint16_t hostShort) { _asm { diff --git a/engine/shared/library/sharedFoundation/src/win32/ByteOrder.h b/engine/shared/library/sharedFoundation/src/win32/ByteOrder.h index 4e478703..cbb1f56c 100755 --- a/engine/shared/library/sharedFoundation/src/win32/ByteOrder.h +++ b/engine/shared/library/sharedFoundation/src/win32/ByteOrder.h @@ -12,10 +12,10 @@ // ====================================================================== ulong __cdecl ntohl(ulong netLong); -ushort __cdecl ntohs(ushort netShort); +uint16_t __cdecl ntohs(uint16_t netShort); ulong __cdecl htonl(ulong hostLong); -ushort __cdecl htons(ushort hostShort); +uint16_t __cdecl htons(uint16_t hostShort); // ====================================================================== diff --git a/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.cpp b/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.cpp index f303e0eb..74e804fd 100755 --- a/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.cpp +++ b/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.cpp @@ -14,7 +14,7 @@ // ====================================================================== int FloatingPointUnit::updateNumber; -ushort FloatingPointUnit::status; +uint16_t FloatingPointUnit::status; FloatingPointUnit::Precision FloatingPointUnit::precision; FloatingPointUnit::Rounding FloatingPointUnit::rounding; bool FloatingPointUnit::exceptionEnabled[E_max]; diff --git a/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.h b/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.h index 9cda070d..4c6ab2be 100755 --- a/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.h +++ b/engine/shared/library/sharedFoundation/src/win32/FloatingPointUnit.h @@ -16,7 +16,7 @@ class FloatingPointUnit { public: - typedef unsigned short WORD; + typedef uint16_t WORD; enum Precision { diff --git a/engine/shared/library/sharedFoundation/src/win32/Os.cpp b/engine/shared/library/sharedFoundation/src/win32/Os.cpp index 9c828361..66151f16 100755 --- a/engine/shared/library/sharedFoundation/src/win32/Os.cpp +++ b/engine/shared/library/sharedFoundation/src/win32/Os.cpp @@ -61,7 +61,7 @@ namespace OsNamespace bool ms_mouseMoveInClient; bool ms_clickToMove; char ms_programName[PROGRAM_NAME_SIZE]; - char *ms_shortProgramName; + char *ms_int16_tProgramName; char ms_programStartupDirectory[MAX_PATH]; Os::ThreadId ms_mainThreadId; Os::IsGdiVisibleHookFunction ms_isGdiVisibleHookFunction; @@ -235,11 +235,11 @@ void Os::installCommon() FATAL(result == 0, ("GetModuleFileName failed")); // get the file name without the path - ms_shortProgramName = strrchr(ms_programName, '\\'); - if (ms_shortProgramName) - ++ms_shortProgramName; + ms_int16_tProgramName = strrchr(ms_programName, '\\'); + if (ms_int16_tProgramName) + ++ms_int16_tProgramName; else - ms_shortProgramName = ms_programName; + ms_int16_tProgramName = ms_programName; // switch into single-precision floating point mode FloatingPointUnit::install(); @@ -376,17 +376,17 @@ const char *Os::getProgramName() // ---------------------------------------------------------------------- /** - * Return the short name of the running executable. + * Return the int16_t name of the running executable. * * The program name will not include the path, but will just be the file name. * - * @return The short name of the running executable + * @return The int16_t name of the running executable * @see Os::getProgramName() */ const char *Os::getShortProgramName() { - return ms_shortProgramName; + return ms_int16_tProgramName; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h b/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h index 386c4ffb..cb26bce3 100755 --- a/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h +++ b/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h @@ -9,19 +9,20 @@ #define PLATFORM_UNIX #define PLATFORM_LINUX +#include #include // ====================================================================== // basic types that we assume to be around typedef unsigned int uint; typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned long uint32; +typedef uint16_t uint16; +typedef uint32_t uint32; typedef signed char int8; -typedef signed short int16; -typedef signed long int32; -typedef signed long long int int64; -typedef unsigned long long int uint64; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; +typedef uint64_t uint64; typedef float real; typedef FILE* FILE_HANDLE; diff --git a/engine/shared/library/sharedFoundationTypes/src/shared/FoundationTypes.h b/engine/shared/library/sharedFoundationTypes/src/shared/FoundationTypes.h index 04017bce..78ddb68c 100755 --- a/engine/shared/library/sharedFoundationTypes/src/shared/FoundationTypes.h +++ b/engine/shared/library/sharedFoundationTypes/src/shared/FoundationTypes.h @@ -21,9 +21,8 @@ // ====================================================================== typedef unsigned char byte; -typedef unsigned int uint; -typedef unsigned long ulong; -typedef unsigned short ushort; +typedef uint32_t uint; +typedef uint16_t uint16_t; // ====================================================================== diff --git a/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h b/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h index 622039d8..f836fb7b 100755 --- a/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h +++ b/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h @@ -19,11 +19,11 @@ // basic types that we assume to be around typedef unsigned char uint8; -typedef unsigned short uint16; +typedef uint16_t uint16; typedef unsigned long uint32; typedef unsigned __int64 uint64; typedef signed char int8; -typedef signed short int16; +typedef int16_t int16; typedef signed long int32; typedef signed __int64 int64; typedef int FILE_HANDLE; diff --git a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp index 77dc02eb..4c54bf4b 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.cpp @@ -560,8 +560,8 @@ CustomizationManager::PaletteColumns CustomizationManager::getPaletteColumnDataS */ CustomizationManager::PaletteColumns CustomizationManager::getPaletteColumnDataLongName(std::string const & paletteName) { - std::string const & shortPaletteName = shortenPaletteName(paletteName); - return ms_paletteColumnData[shortPaletteName]; + std::string const & int16_tPaletteName = int16_tenPaletteName(paletteName); + return ms_paletteColumnData[int16_tPaletteName]; } //---------------------------------------------------------------------- @@ -573,7 +573,7 @@ std::map const & Customizatio //---------------------------------------------------------------------- -std::string CustomizationManager::shortenPaletteName(std::string const & longPaletteName) +std::string CustomizationManager::int16_tenPaletteName(std::string const & longPaletteName) { std::string result; std::string::size_type startingPos = longPaletteName.find_last_of("/"); diff --git a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.h b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.h index 40cf4b72..db6d3dad 100755 --- a/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.h +++ b/engine/shared/library/sharedGame/src/shared/core/CustomizationManager.h @@ -124,7 +124,7 @@ private: private: static void clearData(); - static std::string shortenPaletteName(std::string const & longPaletteName); + static std::string int16_tenPaletteName(std::string const & longPaletteName); }; // ====================================================================== diff --git a/engine/shared/library/sharedGame/src/shared/core/OutOfBandPackager.cpp b/engine/shared/library/sharedGame/src/shared/core/OutOfBandPackager.cpp index f9b71c77..7fe9b5b1 100755 --- a/engine/shared/library/sharedGame/src/shared/core/OutOfBandPackager.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/OutOfBandPackager.cpp @@ -45,7 +45,7 @@ void OutOfBandPackager::pack(const Archive::ByteStream & source, const unsigned DEBUG_FATAL (ubufSize * sizeof (Unicode::unicode_char_t) != package.getSize (), ("bad packing logic")); //-- note the size of the skip remainder padding so the unpacking function can advance over it - target.append (1, static_cast(skipRemainder)); + target.append (1, static_cast(skipRemainder)); target.append (ubuf, ubuf + ubufSize); } @@ -130,7 +130,7 @@ OutOfBandPackager::OutOfBandBaseVector OutOfBandPackager::unpack(const Unicode:: if (count > 0 && numUnpacked >= count) break; - unsigned short skipRemainder = 0; + uint16_t skipRemainder = 0; Archive::get(ri, skipRemainder); Archive::get(ri, typeId); diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlotType.cpp b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlotType.cpp index ef379099..6d171849 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlotType.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlotType.cpp @@ -19,7 +19,7 @@ namespace ShipChassisSlotTypeNamespace { // The following must be kept in sync: - // scst_short_n.stf + // scst_int16_t_n.stf // ShipChassisSlotType::Type (ShipChassisSlotType.h) // ShipChassisSlotTypeNamespace::s_slotTypeNames (ShipChassisSlotType.cpp) // ShipChassisSlotTypeNamespace::s_slotTypeComponentTypeMapping (ShipChassisSlotType.cpp) @@ -148,7 +148,7 @@ namespace ShipChassisSlotTypeNamespace Unicode::String s_slotTypeShortNames [ShipChassisSlotType::SCST_num_types]; // The following must be kept in sync: - // scst_short_n.stf + // scst_int16_t_n.stf // ShipChassisSlotType::Type (ShipChassisSlotType.h) // ShipChassisSlotTypeNamespace::s_slotTypeNames (ShipChassisSlotType.cpp) // ShipChassisSlotTypeNamespace::s_slotTypeComponentTypeMapping (ShipChassisSlotType.cpp) @@ -289,7 +289,7 @@ namespace ShipChassisSlotTypeNamespace { IGNORE_RETURN (s_slotNameTypeMap.insert (std::make_pair (s_slotTypeNames [i], static_cast(i)))); - s_slotTypeShortNames [i] = StringId("space/scst_short_n", s_slotTypeNames [i]).localize(); + s_slotTypeShortNames [i] = StringId("space/scst_int16_t_n", s_slotTypeNames [i]).localize(); } } } diff --git a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlotType.h b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlotType.h index 2f6f67cc..e3382492 100755 --- a/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlotType.h +++ b/engine/shared/library/sharedGame/src/shared/space/ShipChassisSlotType.h @@ -13,7 +13,7 @@ namespace ShipChassisSlotType { // The following must be kept in sync: - // scst_short_n.stf + // scst_int16_t_n.stf // ShipChassisSlotType::Type (ShipChassisSlotType.h) // ShipChassisSlotTypeNamespace::s_slotTypeNames (ShipChassisSlotType.cpp) // ShipChassisSlotTypeNamespace::s_slotTypeComponentTypeMapping (ShipChassisSlotType.cpp) diff --git a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp index 882919b9..8b6210d9 100755 --- a/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp +++ b/engine/shared/library/sharedImage/src/shared/TargaFormat.cpp @@ -955,7 +955,7 @@ void TargaFormatNamespace::_readRleColorMapped( uint8 *lineIter=line; while (rle) { - index = (fileBytesPerPixel==1) ? unsigned(*lineIter) : unsigned(*(unsigned short *)lineIter); + index = (fileBytesPerPixel==1) ? unsigned(*lineIter) : unsigned(*(uint16_t *)lineIter); lookup = cmap + index*bytesPerColorEntry; switch (bytesPerColorEntry) { @@ -1180,8 +1180,8 @@ bool TargaFormat::saveImage(const Image &image, const char *filename) header.m_colorMapDepth = 0; // number of bits per palette entry header.m_xOriginOffset = 0; // horiz pixel coordinate of lower left of image header.m_yOriginOffset = 0; // vert pixel coordinate of lower left of image - header.m_width = static_cast(width); // image width in pixels - header.m_height = static_cast(height); // image height in pixels + header.m_width = static_cast(width); // image width in pixels + header.m_height = static_cast(height); // image height in pixels header.m_pixelDepth = static_cast(bitDepth); // image color depth (bits per pixel) header.m_imageDescriptor = 0; // image attribute flags (lower-left origin) //------------------------------------------ diff --git a/engine/shared/library/sharedLog/src/shared/NetLogObserver.cpp b/engine/shared/library/sharedLog/src/shared/NetLogObserver.cpp index c928d964..ee619c7f 100755 --- a/engine/shared/library/sharedLog/src/shared/NetLogObserver.cpp +++ b/engine/shared/library/sharedLog/src/shared/NetLogObserver.cpp @@ -36,7 +36,7 @@ LogObserver *NetLogObserver::create(std::string const &spec) if (pos != std::string::npos) { std::string address = spec.substr(0, pos); - unsigned short port = static_cast(atoi(spec.c_str()+pos+1)); + uint16_t port = static_cast(atoi(spec.c_str()+pos+1)); // create a NetLogObserver to forward to the specified address/port return new NetLogObserver(address, port); } @@ -45,7 +45,7 @@ LogObserver *NetLogObserver::create(std::string const &spec) // ---------------------------------------------------------------------- -NetLogObserver::NetLogObserver(const std::string &remoteAddress, unsigned short remotePort) : +NetLogObserver::NetLogObserver(const std::string &remoteAddress, uint16_t remotePort) : LogObserver(), m_mutex(), m_remoteAddress(remoteAddress), diff --git a/engine/shared/library/sharedLog/src/shared/NetLogObserver.h b/engine/shared/library/sharedLog/src/shared/NetLogObserver.h index 1fc86b28..996d50c2 100755 --- a/engine/shared/library/sharedLog/src/shared/NetLogObserver.h +++ b/engine/shared/library/sharedLog/src/shared/NetLogObserver.h @@ -29,7 +29,7 @@ public: static void install(); static LogObserver *create(std::string const &spec); - NetLogObserver(std::string const &remoteAddress, unsigned short remotePort); + NetLogObserver(std::string const &remoteAddress, uint16_t remotePort); virtual ~NetLogObserver(); virtual void log(LogMessage const &msg); @@ -40,7 +40,7 @@ public: virtual void update(); std::string const &getRemoteAddress() const; - unsigned short getRemotePort() const; + uint16_t getRemotePort() const; private: NetLogObserver(); @@ -52,7 +52,7 @@ private: Mutex m_mutex; std::string m_remoteAddress; - unsigned short m_remotePort; + uint16_t m_remotePort; NetLogConnection * m_connection; bool m_connectionOpen; unsigned long m_connectTime; @@ -69,7 +69,7 @@ inline std::string const &NetLogObserver::getRemoteAddress() const // ---------------------------------------------------------------------- -inline unsigned short NetLogObserver::getRemotePort() const +inline uint16_t NetLogObserver::getRemotePort() const { return m_remotePort; } diff --git a/engine/shared/library/sharedMath/src/shared/IndexedTriangleList.cpp b/engine/shared/library/sharedMath/src/shared/IndexedTriangleList.cpp index 06a0229c..78cb0cb3 100755 --- a/engine/shared/library/sharedMath/src/shared/IndexedTriangleList.cpp +++ b/engine/shared/library/sharedMath/src/shared/IndexedTriangleList.cpp @@ -354,7 +354,7 @@ bool IndexedTriangleList::collide(Vector const & start, Vector const & end, std: { bool found = false; - Vector shortenedEnd(end); + Vector int16_tenedEnd(end); Vector const direction(end - start); Vector normal; @@ -381,13 +381,13 @@ bool IndexedTriangleList::collide(Vector const & start, Vector const & end, std: plane.set(normal, v0); //-- See if the end points intersect the plane the polygon lies on, lies within the polygon, and is closer to start than the previous point - if ((plane.findDirectedIntersection(start, shortenedEnd, intersection)) && - (start.magnitudeBetweenSquared(intersection) < start.magnitudeBetweenSquared(shortenedEnd)) && + if ((plane.findDirectedIntersection(start, int16_tenedEnd, intersection)) && + (start.magnitudeBetweenSquared(intersection) < start.magnitudeBetweenSquared(int16_tenedEnd)) && (intersection.inPolygon(v0, v1, v2))) { found = true; result = intersection; - shortenedEnd = intersection; + int16_tenedEnd = intersection; } } } diff --git a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp index 15b349a5..10715c31 100755 --- a/engine/shared/library/sharedMath/src/shared/Quaternion.cpp +++ b/engine/shared/library/sharedMath/src/shared/Quaternion.cpp @@ -247,7 +247,7 @@ void Quaternion::normalize(void) */ const Quaternion Quaternion::slerp(const Quaternion & otherOriginal, float fractionOfOther) const { - // rls - check ensure interpolation using the shortest path around the "hypersphere." + // rls - check ensure interpolation using the int16_test path around the "hypersphere." float const dotOriginal = dot(otherOriginal); Quaternion const otherClosest(dotOriginal < 0.0f ? -otherOriginal : otherOriginal); diff --git a/engine/shared/library/sharedNetwork/src/linux/Address.cpp b/engine/shared/library/sharedNetwork/src/linux/Address.cpp index 4032f6d5..c2ebea39 100755 --- a/engine/shared/library/sharedNetwork/src/linux/Address.cpp +++ b/engine/shared/library/sharedNetwork/src/linux/Address.cpp @@ -21,7 +21,7 @@ hostAddress("0.0.0.0") //--------------------------------------------------------------------- -Address::Address(const std::string & newHostAddress, unsigned short newHostPort) : +Address::Address(const std::string & newHostAddress, uint16_t newHostPort) : addr4(new struct sockaddr_in), hostAddress(newHostAddress) { @@ -179,7 +179,7 @@ const std::string & Address::getHostAddress() const @author Justin Randall */ -const unsigned short Address::getHostPort() const +const uint16_t Address::getHostPort() const { return ntohs(addr4->sin_port); } diff --git a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp index 8acf1289..de2a5b5c 100755 --- a/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp +++ b/engine/shared/library/sharedNetwork/src/linux/TcpClient.cpp @@ -73,7 +73,7 @@ m_rawTCP( false ) // ---------------------------------------------------------------------- -TcpClient::TcpClient (const std::string & a, const unsigned short port) : +TcpClient::TcpClient (const std::string & a, const uint16_t port) : m_socket(-1), m_tcpServer(0), m_connection(0), @@ -124,7 +124,7 @@ std::string const &TcpClient::getRemoteAddress() const //--------------------------------------------------------------------- -unsigned short TcpClient::getRemotePort() const +uint16_t TcpClient::getRemotePort() const { return m_remoteAddress.getHostPort(); } @@ -268,7 +268,7 @@ void TcpClient::flushPendingWrites() //--------------------------------------------------------------------- -unsigned short TcpClient::getBindPort() const +uint16_t TcpClient::getBindPort() const { return m_bindPort; } diff --git a/engine/shared/library/sharedNetwork/src/linux/TcpClient.h b/engine/shared/library/sharedNetwork/src/linux/TcpClient.h index dce06df5..eb3ccec9 100755 --- a/engine/shared/library/sharedNetwork/src/linux/TcpClient.h +++ b/engine/shared/library/sharedNetwork/src/linux/TcpClient.h @@ -22,7 +22,7 @@ class TcpClient { public: TcpClient(int sock, TcpServer *); - TcpClient(const std::string & address, const unsigned short port); + TcpClient(const std::string & address, const uint16_t port); void addRef(); static void install(); @@ -30,9 +30,9 @@ public: static void remove(); void send(const unsigned char * const buffer, const int length); - unsigned short getBindPort() const; + uint16_t getBindPort() const; std::string const &getRemoteAddress() const; - unsigned short getRemotePort() const; + uint16_t getRemotePort() const; void setPendingSendAllocatedSizeLimit(unsigned int limit); // only used by clients @@ -72,7 +72,7 @@ private: int m_refCount; bool m_connected; unsigned long m_lastSendTime; - unsigned short m_bindPort; + uint16_t m_bindPort; bool m_rawTCP; }; diff --git a/engine/shared/library/sharedNetwork/src/linux/TcpServer.cpp b/engine/shared/library/sharedNetwork/src/linux/TcpServer.cpp index 2ca1b53b..272284ae 100755 --- a/engine/shared/library/sharedNetwork/src/linux/TcpServer.cpp +++ b/engine/shared/library/sharedNetwork/src/linux/TcpServer.cpp @@ -20,7 +20,7 @@ //--------------------------------------------------------------------- -TcpServer::TcpServer(Service * service, const std::string & a, const unsigned short port) : +TcpServer::TcpServer(Service * service, const std::string & a, const uint16_t port) : m_bindAddress(a, port), m_handle(-1), m_service(service), @@ -78,7 +78,7 @@ const std::string & TcpServer::getBindAddress() const //--------------------------------------------------------------------- -const unsigned short TcpServer::getBindPort() const +const uint16_t TcpServer::getBindPort() const { return m_bindAddress.getHostPort(); } diff --git a/engine/shared/library/sharedNetwork/src/linux/TcpServer.h b/engine/shared/library/sharedNetwork/src/linux/TcpServer.h index 50bccb00..5e827cf4 100755 --- a/engine/shared/library/sharedNetwork/src/linux/TcpServer.h +++ b/engine/shared/library/sharedNetwork/src/linux/TcpServer.h @@ -23,11 +23,11 @@ class TcpClient; class TcpServer { public: - TcpServer(Service * service, const std::string & bindAddress, const unsigned short bindPort); + TcpServer(Service * service, const std::string & bindAddress, const uint16_t bindPort); ~TcpServer(); const std::string & getBindAddress () const; - const unsigned short getBindPort () const; + const uint16_t getBindPort () const; void onConnectionClosed (TcpClient *); void removeClient (TcpClient *); void update (); diff --git a/engine/shared/library/sharedNetwork/src/shared/Address.h b/engine/shared/library/sharedNetwork/src/shared/Address.h index d995fb36..99f823cb 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Address.h +++ b/engine/shared/library/sharedNetwork/src/shared/Address.h @@ -25,7 +25,7 @@ class Address { public: Address(); - Address(const std::string & dottedDecimalIPv4Address, unsigned short hostPort); + Address(const std::string & dottedDecimalIPv4Address, uint16_t hostPort); Address(const Address & source); Address(const struct sockaddr_in & ipv4sockaddr); ~Address(); @@ -36,7 +36,7 @@ public: const bool operator!=(const Address & rhs) const; const bool operator>(const Address & rhs) const; const std::string & getHostAddress() const; - const unsigned short getHostPort() const; + const uint16_t getHostPort() const; size_t hashFunction() const; const struct sockaddr_in & getSockAddr4() const; diff --git a/engine/shared/library/sharedNetwork/src/shared/BroadcastSock.cpp b/engine/shared/library/sharedNetwork/src/shared/BroadcastSock.cpp index 60409351..e6e2603a 100755 --- a/engine/shared/library/sharedNetwork/src/shared/BroadcastSock.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/BroadcastSock.cpp @@ -28,7 +28,7 @@ udp(new UdpSock) //----------------------------------------------------------------------- -const bool BroadcastSock::bind(const unsigned short port) +const bool BroadcastSock::bind(const uint16_t port) { return udp->bind(Address("", port)); } @@ -54,7 +54,7 @@ const unsigned int BroadcastSock::recvFrom(Address & a, void * targetBuffer, con //----------------------------------------------------------------------- -const unsigned int BroadcastSock::sendTo(const std::string & a, const unsigned short p, const void * b, const unsigned int l) const +const unsigned int BroadcastSock::sendTo(const std::string & a, const uint16_t p, const void * b, const unsigned int l) const { return udp->sendTo(Address(a, p), b, l); } diff --git a/engine/shared/library/sharedNetwork/src/shared/BroadcastSock.h b/engine/shared/library/sharedNetwork/src/shared/BroadcastSock.h index 02fe227d..7b61eb2b 100755 --- a/engine/shared/library/sharedNetwork/src/shared/BroadcastSock.h +++ b/engine/shared/library/sharedNetwork/src/shared/BroadcastSock.h @@ -45,8 +45,8 @@ class BroadcastSock public: BroadcastSock(); virtual ~BroadcastSock(); - const bool bind(const unsigned short port); - const unsigned int sendTo(const std::string & address, const unsigned short port, const void * sourceBuffer, const unsigned int sourceBufferLength) const; + const bool bind(const uint16_t port); + const unsigned int sendTo(const std::string & address, const uint16_t port, const void * sourceBuffer, const unsigned int sourceBufferLength) const; const bool canRecv() const; const unsigned int recvFrom(Address & outAddress, void * targetBuffer, const unsigned int targetBufferSize) const; diff --git a/engine/shared/library/sharedNetwork/src/shared/ConfigSharedNetwork.cpp b/engine/shared/library/sharedNetwork/src/shared/ConfigSharedNetwork.cpp index 663852bb..ee768a4d 100755 --- a/engine/shared/library/sharedNetwork/src/shared/ConfigSharedNetwork.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/ConfigSharedNetwork.cpp @@ -76,7 +76,7 @@ namespace ConfigSharedNetworkNamespace bool logConnectionOpenedClosed; int logConnectionDeferredMessagesWarningInterval; - typedef unsigned short ReservedPortInt; + typedef uint16_t ReservedPortInt; typedef std::set ReservedPortSet; ReservedPortSet reservedPorts; @@ -473,7 +473,7 @@ int ConfigSharedNetwork::getMaxTCPRetries() //----------------------------------------------------------------------- -bool ConfigSharedNetwork::getIsPortReserved(unsigned short p) +bool ConfigSharedNetwork::getIsPortReserved(uint16_t p) { ReservedPortSet::const_iterator f = reservedPorts.find(p); return (f != reservedPorts.end()); diff --git a/engine/shared/library/sharedNetwork/src/shared/ConfigSharedNetwork.h b/engine/shared/library/sharedNetwork/src/shared/ConfigSharedNetwork.h index 982be453..0731831a 100755 --- a/engine/shared/library/sharedNetwork/src/shared/ConfigSharedNetwork.h +++ b/engine/shared/library/sharedNetwork/src/shared/ConfigSharedNetwork.h @@ -62,7 +62,7 @@ public: static bool getLogConnectionOpenedClosed(); static bool getLogConnectionDeferredMessagesWarning(); static int getLogConnectionDeferredMessagesWarningInterval(); - static bool getIsPortReserved(unsigned short p); + static bool getIsPortReserved(uint16_t p); static bool getNetworkHandlerDispatchThrottle(); static int getNetworkHandlerDispatchThrottleTimeMilliseconds(); static int getNetworkHandlerDispatchQueueSize(); diff --git a/engine/shared/library/sharedNetwork/src/shared/Connection.cpp b/engine/shared/library/sharedNetwork/src/shared/Connection.cpp index 04770848..f664cdbb 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Connection.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/Connection.cpp @@ -159,7 +159,7 @@ const int DeferredSendLogicalPacket::getSize() const //----------------------------------------------------------------------- -Connection::Connection(const std::string & a, const unsigned short p, const NetworkSetupData & setup) : +Connection::Connection(const std::string & a, const uint16_t p, const NetworkSetupData & setup) : udpConnection(0), m_pendingPackets(), m_currentFrame(0), @@ -234,7 +234,7 @@ m_disconnectReason() { UdpManagerMT *m = new UdpManagerMT(&p); m_udpManager = m; - setBindPort(static_cast(m_udpManager->GetLocalPort())); + setBindPort(static_cast(m_udpManager->GetLocalPort())); if (isPortReserved(getBindPort())) { m_udpManager->Release(); @@ -321,7 +321,7 @@ m_disconnectReason() char addrBuf[1024] = {"\0"}; newConnection->GetDestinationIp().GetAddress(addrBuf); m_remoteAddress = addrBuf; - m_remotePort = static_cast(newConnection->GetDestinationPort()); + m_remotePort = static_cast(newConnection->GetDestinationPort()); } } else @@ -522,7 +522,7 @@ const std::string & Connection::getRemoteAddress() const //----------------------------------------------------------------------- -const unsigned short Connection::getRemotePort() const +const uint16_t Connection::getRemotePort() const { return m_remotePort; } diff --git a/engine/shared/library/sharedNetwork/src/shared/Connection.h b/engine/shared/library/sharedNetwork/src/shared/Connection.h index b1f7a4d9..ba8f31d4 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Connection.h +++ b/engine/shared/library/sharedNetwork/src/shared/Connection.h @@ -31,7 +31,7 @@ class UdpConnectionMT; class Connection : public NetworkHandler { public: - Connection (const std::string & remoteAddress, const unsigned short remotePort, const NetworkSetupData & setup); + Connection (const std::string & remoteAddress, const uint16_t remotePort, const NetworkSetupData & setup); explicit Connection (UdpConnectionMT * newConnection, TcpClient * t = 0); virtual ~Connection (); @@ -39,7 +39,7 @@ public: void describeConnection (const std::string &); const std::string & getConnectionDescription () const; const std::string & getRemoteAddress () const; - const unsigned short getRemotePort () const; + const uint16_t getRemotePort () const; const UdpConnectionMT * getUdpConnection () const; UdpConnectionMT * getUdpConnection (); WatchedByList &getWatchedByList () const; @@ -105,7 +105,7 @@ protected: private: std::string m_remoteAddress; - unsigned short m_remotePort; + uint16_t m_remotePort; std::vector m_deferredMessages; int m_deferredDataSize; mutable WatchedByList m_watchedByList; diff --git a/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.cpp b/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.cpp index a013651e..18872b40 100755 --- a/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.cpp @@ -208,7 +208,7 @@ const std::string & NetworkHandler::getBindAddress() const //----------------------------------------------------------------------- -const unsigned short NetworkHandler::getBindPort() const +const uint16_t NetworkHandler::getBindPort() const { return m_bindPort; } @@ -338,7 +338,7 @@ void NetworkHandler::setBindAddress(const std::string & address) //----------------------------------------------------------------------- -void NetworkHandler::setBindPort(const unsigned short p) +void NetworkHandler::setBindPort(const uint16_t p) { m_bindPort = p; } @@ -593,7 +593,7 @@ bool NetworkHandler::removing() //----------------------------------------------------------------------- -bool NetworkHandler::isPortReserved(unsigned short p) +bool NetworkHandler::isPortReserved(uint16_t p) { return(ConfigSharedNetwork::getIsPortReserved(p)); } diff --git a/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.h b/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.h index 12140805..7efaedf2 100755 --- a/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.h +++ b/engine/shared/library/sharedNetwork/src/shared/NetworkHandler.h @@ -51,14 +51,14 @@ public: virtual void onConnectionOpened (UdpConnectionMT *) = 0; const std::string & getBindAddress () const; - const unsigned short getBindPort () const; + const uint16_t getBindPort () const; virtual void onConnectionClosed (Connection *) = 0; void setBindAddress (const std::string & address); - void setBindPort (const unsigned short port); + void setBindPort (const uint16_t port); static bool removing (); LogicalPacket const * createPacket (unsigned char const *data, int size); void releasePacket (LogicalPacket const *p); - static bool isPortReserved (unsigned short port); + static bool isPortReserved (uint16_t port); static void onTerminate (Connection * c); protected: @@ -84,7 +84,7 @@ private: NetworkHandler(const NetworkHandler & source); private: - unsigned short m_bindPort; + uint16_t m_bindPort; std::string m_bindAddress; protected: diff --git a/engine/shared/library/sharedNetwork/src/shared/NetworkSetupData.h b/engine/shared/library/sharedNetwork/src/shared/NetworkSetupData.h index a483055b..5eac488f 100755 --- a/engine/shared/library/sharedNetwork/src/shared/NetworkSetupData.h +++ b/engine/shared/library/sharedNetwork/src/shared/NetworkSetupData.h @@ -44,7 +44,7 @@ public: int reliableOverflowBytes; int icmpErrorRetryPeriod; int maxDataHoldSize; - unsigned short port; + uint16_t port; std::string bindInterface; bool compress; bool allowPortRemapping; diff --git a/engine/shared/library/sharedNetwork/src/shared/Service.cpp b/engine/shared/library/sharedNetwork/src/shared/Service.cpp index 49f6cb12..67af2f11 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Service.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/Service.cpp @@ -23,7 +23,7 @@ ConnectionAllocatorBase::~ConnectionAllocatorBase() //----------------------------------------------------------------------- -//Service::Service(const ConnectionAllocatorBase & c, const unsigned short port, const int m, const int keepAliveDelay, const std::string & interfaceAddress, const bool compress) : +//Service::Service(const ConnectionAllocatorBase & c, const uint16_t port, const int m, const int keepAliveDelay, const std::string & interfaceAddress, const bool compress) : Service::Service(const ConnectionAllocatorBase & c, const NetworkSetupData & setup) : connectionAllocator(c.clone()), m_callback(new MessageDispatch::Callback), @@ -130,7 +130,7 @@ m_tcpServer(0) } m_udpManager = m; - setBindPort(static_cast(m_udpManager->GetLocalPort())); + setBindPort(static_cast(m_udpManager->GetLocalPort())); if(isPortReserved(getBindPort())) { m = new UdpManagerMT(&p); @@ -142,7 +142,7 @@ m_tcpServer(0) else { m_udpManager = new UdpManagerMT(&p); - setBindPort(static_cast(m_udpManager->GetLocalPort())); + setBindPort(static_cast(m_udpManager->GetLocalPort())); } newManager(m_udpManager); diff --git a/engine/shared/library/sharedNetwork/src/shared/Service.h b/engine/shared/library/sharedNetwork/src/shared/Service.h index c300c0bb..a06defb6 100755 --- a/engine/shared/library/sharedNetwork/src/shared/Service.h +++ b/engine/shared/library/sharedNetwork/src/shared/Service.h @@ -58,7 +58,7 @@ struct ConnectionAllocator : public ConnectionAllocatorBase class Service : public NetworkHandler { public: - //Service(const ConnectionAllocatorBase & connectionAllocator, const unsigned short listenPort, const int maxConnections, const int keepAliveDelay = 1000, const std::string & interfaceAddress = std::string(""), const bool compress=false); + //Service(const ConnectionAllocatorBase & connectionAllocator, const uint16_t listenPort, const int maxConnections, const int keepAliveDelay = 1000, const std::string & interfaceAddress = std::string(""), const bool compress=false); Service(const ConnectionAllocatorBase & connectionAllocator, const NetworkSetupData & setupData); virtual ~Service(); diff --git a/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.cpp b/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.cpp index 9b7b7282..4aa020ad 100755 --- a/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.cpp @@ -252,7 +252,7 @@ int UdpConnectionMT::TotalPendingBytes() const // ---------------------------------------------------------------------- -unsigned short UdpConnectionMT::ServerSyncStampShort() const +uint16_t UdpConnectionMT::ServerSyncStampShort() const { // TODO: is there a cleaner way to deal with this? Guard lock(UdpLibraryMT::getMutex()); diff --git a/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.h b/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.h index 172f8763..1f230ccf 100755 --- a/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.h +++ b/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.h @@ -38,7 +38,7 @@ public: void *GetPassThroughData() const; UdpConnection::Status GetStatus() const; int TotalPendingBytes() const; - unsigned short ServerSyncStampShort() const; + uint16_t ServerSyncStampShort() const; unsigned long ServerSyncStampLong() const; UdpIpAddress GetDestinationIp() const; int GetDestinationPort() const; diff --git a/engine/shared/library/sharedNetwork/src/win32/Address.cpp b/engine/shared/library/sharedNetwork/src/win32/Address.cpp index 0d4b0b2a..d6871947 100755 --- a/engine/shared/library/sharedNetwork/src/win32/Address.cpp +++ b/engine/shared/library/sharedNetwork/src/win32/Address.cpp @@ -37,7 +37,7 @@ hostAddress("0.0.0.0") @todo Add a static resolver cache to Address to reduce potential calls to gethostbyname() */ -Address::Address(const std::string & newHostAddress, const unsigned short newHostPort) : +Address::Address(const std::string & newHostAddress, const uint16_t newHostPort) : addr4(new struct sockaddr_in), hostAddress(newHostAddress) { @@ -220,7 +220,7 @@ const std::string & Address::getHostAddress() const @author Justin Randall */ -const unsigned short Address::getHostPort() const +const uint16_t Address::getHostPort() const { return ntohs(addr4->sin_port); } diff --git a/engine/shared/library/sharedNetwork/src/win32/TcpClient.cpp b/engine/shared/library/sharedNetwork/src/win32/TcpClient.cpp index 22c9d992..12dd2920 100755 --- a/engine/shared/library/sharedNetwork/src/win32/TcpClient.cpp +++ b/engine/shared/library/sharedNetwork/src/win32/TcpClient.cpp @@ -76,7 +76,7 @@ m_rawTCP( false ) //----------------------------------------------------------------------- -TcpClient::TcpClient(const std::string & remoteAddress, const unsigned short remotePort) : +TcpClient::TcpClient(const std::string & remoteAddress, const uint16_t remotePort) : m_connectEvent(INVALID_HANDLE_VALUE), m_socket(), m_localIOCP(INVALID_HANDLE_VALUE), @@ -146,7 +146,7 @@ void TcpClient::addRef() //----------------------------------------------------------------------- -unsigned short TcpClient::getBindPort() const +uint16_t TcpClient::getBindPort() const { return m_bindPort; } @@ -162,7 +162,7 @@ std::string const &TcpClient::getRemoteAddress() const //----------------------------------------------------------------------- -unsigned short TcpClient::getRemotePort() const +uint16_t TcpClient::getRemotePort() const { // TODO: implement this return 0; diff --git a/engine/shared/library/sharedNetwork/src/win32/TcpClient.h b/engine/shared/library/sharedNetwork/src/win32/TcpClient.h index a83ec780..bf9c8e75 100755 --- a/engine/shared/library/sharedNetwork/src/win32/TcpClient.h +++ b/engine/shared/library/sharedNetwork/src/win32/TcpClient.h @@ -21,15 +21,15 @@ class TcpClient { public: explicit TcpClient(HANDLE parentIOCP); - TcpClient(const std::string & address, const unsigned short port); + TcpClient(const std::string & address, const uint16_t port); ~TcpClient(); static void install(); static void remove(); void send(const unsigned char * const buffer, const int length); - unsigned short getBindPort() const; + uint16_t getBindPort() const; std::string const &getRemoteAddress() const; - unsigned short getRemotePort() const; + uint16_t getRemotePort() const; void setPendingSendAllocatedSizeLimit(unsigned int limit); // only used by clients @@ -70,7 +70,7 @@ private: bool m_connected; bool m_ownHandle; unsigned long m_lastSendTime; - unsigned short m_bindPort; + uint16_t m_bindPort; bool m_rawTCP; }; diff --git a/engine/shared/library/sharedNetwork/src/win32/TcpServer.cpp b/engine/shared/library/sharedNetwork/src/win32/TcpServer.cpp index 17a8f5da..70ed5dde 100755 --- a/engine/shared/library/sharedNetwork/src/win32/TcpServer.cpp +++ b/engine/shared/library/sharedNetwork/src/win32/TcpServer.cpp @@ -15,7 +15,7 @@ //----------------------------------------------------------------------- -TcpServer::TcpServer(Service * service, const std::string & bindAddress, const unsigned short bindPort) : +TcpServer::TcpServer(Service * service, const std::string & bindAddress, const uint16_t bindPort) : m_handle(), m_localIOCP(), m_pendingConnections(), @@ -70,7 +70,7 @@ TcpClient * TcpServer::accept() //----------------------------------------------------------------------- -const unsigned short TcpServer::getBindPort() const +const uint16_t TcpServer::getBindPort() const { return m_bindPort; } diff --git a/engine/shared/library/sharedNetwork/src/win32/TcpServer.h b/engine/shared/library/sharedNetwork/src/win32/TcpServer.h index 2ae6b934..35737cfd 100755 --- a/engine/shared/library/sharedNetwork/src/win32/TcpServer.h +++ b/engine/shared/library/sharedNetwork/src/win32/TcpServer.h @@ -21,12 +21,12 @@ class TcpClient; class TcpServer { public: - TcpServer(Service * service, const std::string & bindAddress, const unsigned short bindPort); + TcpServer(Service * service, const std::string & bindAddress, const uint16_t bindPort); ~TcpServer(); TcpClient * accept (); const std::string & getBindAddress () const; - const unsigned short getBindPort () const; + const uint16_t getBindPort () const; void onConnectionClosed (TcpClient *); void update (); @@ -41,7 +41,7 @@ private: HANDLE m_localIOCP; std::vector m_pendingConnections; std::string m_bindAddress; - unsigned short m_bindPort; + uint16_t m_bindPort; Service * m_service; }; diff --git a/engine/shared/library/sharedNetworkMessages/src/shared/customerService/CustomerServiceSearchResult.cpp b/engine/shared/library/sharedNetworkMessages/src/shared/customerService/CustomerServiceSearchResult.cpp index 5d2b0fa2..e9f64757 100755 --- a/engine/shared/library/sharedNetworkMessages/src/shared/customerService/CustomerServiceSearchResult.cpp +++ b/engine/shared/library/sharedNetworkMessages/src/shared/customerService/CustomerServiceSearchResult.cpp @@ -11,7 +11,7 @@ CustomerServiceSearchResult::CustomerServiceSearchResult( const Unicode::String &title, const std::string &id, - short matchPercent + int16_t matchPercent ) : m_title(title), m_id(id), diff --git a/engine/shared/library/sharedNetworkMessages/src/shared/customerService/CustomerServiceSearchResult.h b/engine/shared/library/sharedNetworkMessages/src/shared/customerService/CustomerServiceSearchResult.h index cc165731..ef8c71b3 100755 --- a/engine/shared/library/sharedNetworkMessages/src/shared/customerService/CustomerServiceSearchResult.h +++ b/engine/shared/library/sharedNetworkMessages/src/shared/customerService/CustomerServiceSearchResult.h @@ -17,16 +17,16 @@ protected: public: CustomerServiceSearchResult(); - CustomerServiceSearchResult(const Unicode::String &title, const std::string &id, short matchPercent); + CustomerServiceSearchResult(const Unicode::String &title, const std::string &id, int16_t matchPercent); ~CustomerServiceSearchResult(); const Unicode::String &getTitle() const {return m_title;} const std::string & getId() const {return m_id;} - short getMatchPercent() const {return m_matchPercent;} + int16_t getMatchPercent() const {return m_matchPercent;} Unicode::String m_title; std::string m_id; - short m_matchPercent; + int16_t m_matchPercent; }; #endif //_INCLUDED_CustomerServiceSearchResult_H diff --git a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.h b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.h index ded6dde2..b1f55211 100755 --- a/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.h +++ b/engine/shared/library/sharedObject/src/shared/container/SlottedContainer.h @@ -69,7 +69,7 @@ private: private: - /** shortened find on the map. Returns -1 if not found. + /** int16_tened find on the map. Returns -1 if not found. */ int find(const SlotId &slot) const; diff --git a/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.cpp b/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.cpp index 2373dfb2..f23f93fb 100755 --- a/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.cpp +++ b/engine/shared/library/sharedObject/src/shared/customization/RangedIntCustomizationVariable.cpp @@ -117,7 +117,7 @@ bool RangedIntCustomizationVariable::restoreFromByteVector(ByteVector const &dat // Check range. if (startIndex + 1 >= static_cast(data.size())) { - WARNING(true, ("restoreFromByteVector(): attempting to restore short signed int but not enough data.")); + WARNING(true, ("restoreFromByteVector(): attempting to restore int16_t signed int but not enough data.")); return false; } diff --git a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp index dc2a932c..cefc418d 100755 --- a/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp +++ b/engine/shared/library/sharedObject/src/shared/object/AlterScheduler.cpp @@ -313,7 +313,7 @@ void AlterSchedulerNamespace::validateObject(Object const *object) } catch (...) { //lint !e1775 // catch block does not declare any exception // that's right: I want to catch it all. - WARNING(true, ("validateObject(): Object-derived class with address [%x] failed to return valid C++ type info; likely a deleted Object.", reinterpret_cast(object))); + WARNING(true, ("validateObject(): Object-derived class with address [%x] failed to return valid C++ type info; likely a deleted Object.", reinterpret_cast(object))); isInvalid = true; } } diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp index a21c39b5..f98101aa 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.cpp @@ -1033,7 +1033,7 @@ PortalPropertyTemplate::PortalPropertyTemplate(const CrcString &name) : m_referenceCount(0), m_name(name), - m_shortName(), + m_int16_tName(), m_portalGeometryList(new PortalGeometryList), m_portalOwnersList(new PortalOwnersList), m_cellList(new CellList), @@ -1042,9 +1042,9 @@ PortalPropertyTemplate::PortalPropertyTemplate(const CrcString &name) m_pathGraph(nullptr), m_radarPortalGeometry(0) { - FileName shortName(name.getString()); - shortName.stripPathAndExt(); - m_shortName.set(shortName, true); + FileName int16_tName(name.getString()); + int16_tName.stripPathAndExt(); + m_int16_tName.set(int16_tName, true); Iff iff(m_name.getString()); load(iff); @@ -1761,7 +1761,7 @@ void PortalPropertyTemplate::buildRadarPortalGeometry() const CrcString &PortalPropertyTemplate::getShortName() const { - return m_shortName; + return m_int16_tName; } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h index 248eb5fe..3f4ce7b4 100755 --- a/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h +++ b/engine/shared/library/sharedObject/src/shared/portal/PortalPropertyTemplate.h @@ -258,7 +258,7 @@ private: mutable int m_referenceCount; PersistentCrcString m_name; - PersistentCrcString m_shortName; + PersistentCrcString m_int16_tName; PortalGeometryList *m_portalGeometryList; PortalOwnersList *m_portalOwnersList; CellList *m_cellList; diff --git a/engine/shared/library/sharedObject/src/shared/world/World.cpp b/engine/shared/library/sharedObject/src/shared/world/World.cpp index ce2ab931..78352b05 100755 --- a/engine/shared/library/sharedObject/src/shared/world/World.cpp +++ b/engine/shared/library/sharedObject/src/shared/world/World.cpp @@ -467,7 +467,7 @@ Object* World::findClosestObjectTo (const Object* object, int listIndex) NOT_NULL (object); Object* closestObject = 0; - float shortestDistance = REAL_MAX; + float int16_testDistance = REAL_MAX; int i; for (i = 0; i < ms_objectList [listIndex]->getNumberOfObjects (); i++) @@ -479,9 +479,9 @@ Object* World::findClosestObjectTo (const Object* object, int listIndex) const Vector position2 = objectToCheck->getAppearance () ? objectToCheck->getAppearanceSphereCenter_w () : objectToCheck->getPosition_w (); const float magnitudeBetweenSquared = position1.magnitudeBetweenSquared (position2); - if (magnitudeBetweenSquared < shortestDistance) + if (magnitudeBetweenSquared < int16_testDistance) { - shortestDistance = magnitudeBetweenSquared; + int16_testDistance = magnitudeBetweenSquared; closestObject = objectToCheck; } } diff --git a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp index e09a5cab..2c679370 100755 --- a/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp +++ b/engine/shared/library/sharedPathfinding/src/shared/PathSearch.cpp @@ -40,19 +40,19 @@ public: PathSearchNode( PathSearch * search, PathGraph const * graph, PathNode const * node ); - int getNeighborCount ( void ); + int32_t getNeighborCount ( void ); PathNode const * getPathNode ( void ) const { return m_node; } - int getPathNodeIndex ( void ) const + int32_t getPathNodeIndex ( void ) const { return m_node->getIndex(); } - PathSearchNode * getNeighbor ( int whichNeighbor ); + PathSearchNode * getNeighbor ( int32_t whichNeighbor ); // ---------- @@ -98,12 +98,12 @@ public: // ---------- - void setPathIndex ( int index ) + void setPathIndex ( int32_t index ) { m_pathIndex = index; } - int getPathIndex ( void ) const + int32_t getPathIndex ( void ) const { return m_pathIndex; } @@ -128,7 +128,7 @@ protected: float m_heuristic; float m_total; - int m_pathIndex; + int32_t m_pathIndex; }; MEMORY_BLOCK_MANAGER_IMPLEMENTATION_WITH_INSTALL(PathSearchNode, true, 0, 0, 0); @@ -151,16 +151,16 @@ PathSearchNode::PathSearchNode ( PathSearch * search, PathGraph const * graph, P // ---------------------------------------------------------------------- -int PathSearchNode::getNeighborCount ( void ) +int32_t PathSearchNode::getNeighborCount ( void ) { return m_graph->getEdgeCount( m_node->getIndex() ); } // ---------- -PathSearchNode * PathSearchNode::getNeighbor ( int whichNeighbor ) +PathSearchNode * PathSearchNode::getNeighbor ( int32_t whichNeighbor ) { - int neighborIndex = m_graph->getEdge( m_node->getIndex(), whichNeighbor )->getIndexB(); + int32_t neighborIndex = m_graph->getEdge( m_node->getIndex(), whichNeighbor )->getIndexB(); PathNode const * neighborNode = m_graph->getNode(neighborIndex); @@ -182,18 +182,18 @@ PathSearchNode * PathSearchNode::createSearchNode( PathNode const * node ) PathSearchNode * oldNode = nullptr; - int mark = node->getMark(3); + int32_t mark = node->getMark(3); if(mark != -1) { - oldNode = (PathSearchNode*)((void*)mark); + oldNode = (PathSearchNode*)((void *)(uintptr_t)mark); } delete oldNode; PathSearchNode * searchNode = new PathSearchNode(m_search,m_graph,node); - node->setMark( 3, (int)((void*)searchNode) ); + node->setMark( 3, ((int64_t) searchNode) ); m_search->m_visitedNodes->push_back(node); @@ -208,11 +208,11 @@ PathSearchNode * PathSearchNode::getSearchNode( PathNode const * node ) PathSearchNode * searchNode = nullptr; - int mark = node->getMark(3); + int32_t mark = node->getMark(3); if(mark != -1) { - searchNode = (PathSearchNode*)((void*)mark); + searchNode = (PathSearchNode*)((void *)(uintptr_t)mark); } if(searchNode == nullptr) @@ -263,7 +263,7 @@ public: { if(node->isQueued()) { - for(uint i = 0; i < m_nodes.size(); i++) + for(uint32_t i = 0; i < m_nodes.size(); i++) { if(m_nodes[i] == node) { @@ -355,9 +355,9 @@ PathSearchNode * PathSearch::search ( void ) // ---------- - int neighborCount = node->getNeighborCount(); + int32_t neighborCount = node->getNeighborCount(); - for(int i = 0; i < neighborCount; i++) + for(int32_t i = 0; i < neighborCount; i++) { PathSearchNode * neighbor = node->getNeighbor(i); @@ -384,7 +384,7 @@ PathSearchNode * PathSearch::search ( void ) extern float pathSearchTime; -bool PathSearch::search ( PathGraph const * graph, int startIndex, int goalIndex ) +bool PathSearch::search ( PathGraph const * graph, int32_t startIndex, int32_t goalIndex ) { PerformanceTimer timer; @@ -415,7 +415,7 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, int goalIndex // ---------------------------------------------------------------------- -bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList const & goalIndices ) +bool PathSearch::search ( PathGraph const * graph, int32_t startIndex, IndexList const & goalIndices ) { PerformanceTimer timer; @@ -426,14 +426,14 @@ bool PathSearch::search ( PathGraph const * graph, int startIndex, IndexList con m_multiGoal = true; - int goalCount = goalIndices.size(); + int32_t goalCount = goalIndices.size(); if(goalCount == 0) return false; if(m_start == nullptr) return false; m_goals->resize(goalCount); - for(int i = 0; i < goalCount; i++) + for(int32_t i = 0; i < goalCount; i++) { m_goals->at(i) = graph->getNode(goalIndices[i]); } @@ -463,7 +463,7 @@ bool PathSearch::buildPath ( PathSearchNode * endNode ) // ---------- - int pathLength = endNode->getPathIndex() + 1; + int32_t pathLength = endNode->getPathIndex() + 1; m_path->resize(pathLength); @@ -471,8 +471,8 @@ bool PathSearch::buildPath ( PathSearchNode * endNode ) while(cursor) { - int pathIndex = cursor->getPathIndex(); - int nodeIndex = cursor->getPathNodeIndex(); + int32_t pathIndex = cursor->getPathIndex(); + int32_t nodeIndex = cursor->getPathNodeIndex(); m_path->at(pathIndex) = nodeIndex; @@ -487,17 +487,17 @@ bool PathSearch::buildPath ( PathSearchNode * endNode ) void PathSearch::cleanup ( void ) { - int visitedCount = m_visitedNodes->size(); + int32_t visitedCount = m_visitedNodes->size(); - for(int i = 0; i < visitedCount; i++) + for(int32_t i = 0; i < visitedCount; i++) { PathNode const * visitedNode = m_visitedNodes->at(i); - int mark = visitedNode->getMark(3); + int32_t mark = visitedNode->getMark(3); if(mark != -1) { - PathSearchNode * searchNode = (PathSearchNode*)((void*)mark); + PathSearchNode * searchNode = (PathSearchNode*)((void *)(uintptr_t)mark); delete searchNode; } @@ -552,12 +552,12 @@ float PathSearch::calcHeuristic ( PathNode const * A ) const if(m_multiGoal) { - int minGoal = -1; + int32_t minGoal = -1; float minHeuristic = REAL_MAX; - int goalCount = m_goals->size(); + int32_t goalCount = m_goals->size(); - for(int i = 0; i < goalCount; i++) + for(int32_t i = 0; i < goalCount; i++) { PathNode const * goal = m_goals->at(i); diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp index f33204ef..ae9c80c3 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServer.cpp @@ -36,7 +36,7 @@ void SharedRemoteDebugServer::install() DEBUG_FATAL(ms_installed, ("sharedRemoteDebugServer already installed")); NetworkSetupData setup; - setup.port = static_cast(ConfigSharedFoundation::getDefaultRemoteDebugPort()); + setup.port = static_cast(ConfigSharedFoundation::getDefaultRemoteDebugPort()); setup.maxConnections = 5; ms_serviceHandle = new Service(ConnectionAllocator(), setup); diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp index ac6fcd1b..fd8e75cc 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.cpp @@ -14,7 +14,7 @@ //----------------------------------------------------------------------- -SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(const std::string & a, const unsigned short p) : +SharedRemoteDebugServerConnection::SharedRemoteDebugServerConnection(const std::string & a, const uint16_t p) : Connection(a, p, NetworkSetupData()), m_remotedebugCommandChannel (nullptr) { diff --git a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.h b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.h index b8cfdff5..0176c10c 100755 --- a/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.h +++ b/engine/shared/library/sharedRemoteDebugServer/src/shared/SharedRemoteDebugServerConnection.h @@ -19,7 +19,7 @@ class SharedRemoteDebugServerCommandChannel; class SharedRemoteDebugServerConnection : public Connection { public: - SharedRemoteDebugServerConnection(const std::string & remoteAddress, const unsigned short remotePort); + SharedRemoteDebugServerConnection(const std::string & remoteAddress, const uint16_t remotePort); SharedRemoteDebugServerConnection(UdpConnectionMT *, TcpClient *); virtual ~SharedRemoteDebugServerConnection(); void onConnectionClosed (); diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp index be65e8a2..a659b415 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/SamplerProceduralTerrainAppearance.cpp @@ -695,7 +695,7 @@ void SamplerProceduralTerrainAppearance::generateBetween(Vector const & start_o, generateList.push_back(GenerateList::value_type(startX, startZ)); generateList.push_back(GenerateList::value_type(endX, endZ)); } - // we only want to do the complicated calculations on the shorter side + // we only want to do the complicated calculations on the int16_ter side else if (abs(endX - startX) < abs(endZ - startZ)) { Line2d const line(start_o.x, start_o.z, end_o.x, end_o.z); diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp index 938c4f2f..9f0517cf 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/ServerProceduralTerrainAppearance.cpp @@ -714,7 +714,7 @@ void ServerProceduralTerrainAppearance::generateBetween(Vector const & start_o, generateList.push_back(GenerateList::value_type(startX, startZ)); generateList.push_back(GenerateList::value_type(endX, endZ)); } - // we only want to do the complicated calculations on the shorter side + // we only want to do the complicated calculations on the int16_ter side else if (abs(endX - startX) < abs(endZ - startZ)) { Line2d const line(start_o.x, start_o.z, end_o.x, end_o.z); diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp index 08cd30a7..7fca2c6e 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.cpp @@ -155,9 +155,9 @@ void TerrainQuadTree::Node::remove () * @param newSize the width/height of the node in chunkspace. */ TerrainQuadTree::Node::Node (const int x, const int z, const int size, const float minChunkWidthInMeters) : - m_x(static_cast(x)), - m_z(static_cast(z)), - m_size(static_cast(size)), + m_x(static_cast(x)), + m_z(static_cast(z)), + m_size(static_cast(size)), m_childIndex (0), m_worldExtentInitialized (false), m_selectedForRender (false), diff --git a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h index a48d759e..2be5fadd 100755 --- a/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h +++ b/engine/shared/library/sharedTerrain/src/shared/appearance/TerrainQuadTree.h @@ -251,20 +251,20 @@ public: /** * The chunkspace coordinates of the node. */ - const short m_x; - const short m_z; + const int16_t m_x; + const int16_t m_z; /** * The chunkspace size (width & height) of this node. Size is always a power of 2. * The maximum number of chunks contained under a node is size*size. */ - const short m_size; + const int16_t m_size; - unsigned short m_childIndex : 2; // The index of this child node as a subnode of its parent. - unsigned short m_worldExtentInitialized : 1; - unsigned short hasLargerNeighborFlags : 4; - unsigned short m_selectedForRender : 1; - unsigned short m_outsideBuildRange : 1; + uint16_t m_childIndex : 2; // The index of this child node as a subnode of its parent. + uint16_t m_worldExtentInitialized : 1; + uint16_t hasLargerNeighborFlags : 4; + uint16_t m_selectedForRender : 1; + uint16_t m_outsideBuildRange : 1; /** * This is the width of the smallest chunk on the map. REDUNDANT, store elsewhere? diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp index 9c2994aa..87053e94 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.cpp @@ -187,10 +187,10 @@ bool MonitorObject::processAuthRequest(const unsigned char * data, int /* dataLe memset(sendBuf, 0, sizeof(sendBuf)); len = 0; - packShort(sendBuf + len, len, (short)MON_MSG_AUTHREPLY); + packShort(sendBuf + len, len, (int16_t)MON_MSG_AUTHREPLY); packShort(sendBuf + len, len, mSequence); - packShort(sendBuf + len, len, (short)3); - packShort(sendBuf + len, len, (short)CURRENT_API_VERSION); + packShort(sendBuf + len, len, (int16_t)3); + packShort(sendBuf + len, len, (int16_t)CURRENT_API_VERSION); packByte(sendBuf + len, len, reply); mConnection->Send(cUdpChannelReliable1, sendBuf, 9); @@ -202,7 +202,7 @@ void MonitorObject::DescriptionMark(int x, int mode) if (mode == 0) set_bit(mMark, x); else unset_bit(mMark, x); } -char * getErrorString(unsigned short errorCode) +char * getErrorString(uint16_t errorCode) { if (errorCode == 0) { @@ -242,7 +242,7 @@ char * getErrorString(unsigned short errorCode) bool MonitorObject::processError(const unsigned char * data) { stringMessage strMsg(data); - unsigned short errCode = (unsigned short)atoi(strMsg.getData()); + uint16_t errCode = (uint16_t)atoi(strMsg.getData()); fprintf(stderr, "MONITOR API Error: %s\n", getErrorString(errCode)); return true; } @@ -390,7 +390,7 @@ bool MonitorManager::loadAuthData(const char * filename) // ****************************************************************************************************** // ****************************************************************************************************** -CMonitorAPI::CMonitorAPI(const char *configFile, unsigned short Port, bool _bprint, char *address, UdpManager * mang) +CMonitorAPI::CMonitorAPI(const char *configFile, uint16_t Port, bool _bprint, char *address, UdpManager * mang) { mbprint = _bprint; mPort = Port; @@ -476,7 +476,7 @@ void CMonitorAPI::dump() { mMonitorData->dump(); } monMessage::monMessage() :command(0), sequence(0), size(0) {} //---------------------------------------------------------------- -monMessage::monMessage(short cmd, short seq, short s) : command(cmd), sequence(seq), size(s) {} +monMessage::monMessage(int16_t cmd, int16_t seq, int16_t s) : command(cmd), sequence(seq), size(s) {} //---------------------------------------------------------------- monMessage::monMessage(const unsigned char * source) : command(0), sequence(0), size(0) @@ -503,7 +503,7 @@ stringMessage::stringMessage(const unsigned char * source) :monMessage(source) } //---------------------------------------------------------------- -stringMessage::stringMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, char * newData) : +stringMessage::stringMessage(const uint16_t command, const uint16_t sequence, const uint16_t size, char * newData) : monMessage(command, sequence, size) { data = new char[strlen(newData) + 1]; @@ -527,9 +527,9 @@ authReplyMessage::authReplyMessage(const unsigned char * source) : } //---------------------------------------------------------------- -authReplyMessage::authReplyMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size, +authReplyMessage::authReplyMessage(const uint16_t command, + const uint16_t sequence, + const uint16_t size, unsigned char newData) : monMessage(command, sequence, size), data(newData), version() {} @@ -544,9 +544,9 @@ dataReplyMessage::dataReplyMessage(const unsigned char * source) : } //---------------------------------------------------------------- -dataReplyMessage::dataReplyMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size, +dataReplyMessage::dataReplyMessage(const uint16_t command, + const uint16_t sequence, + const uint16_t size, unsigned char * newData, int newDataLen) : monMessage(command, sequence, size) @@ -565,9 +565,9 @@ dataReplyMessage::~dataReplyMessage() //---------------------------------------------------------------- simpleMessage::simpleMessage(const unsigned char * source) :monMessage(source) {} //---------------------------------------------------------------- -simpleMessage::simpleMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size) : +simpleMessage::simpleMessage(const uint16_t command, + const uint16_t sequence, + const uint16_t size) : monMessage(command, sequence, size) {} //---------------------------------------------------------------- simpleMessage::~simpleMessage() {} @@ -589,7 +589,7 @@ dataBlockReplyMessage::dataBlockReplyMessage(const unsigned char * source) : if (Z_OK != err) { free(p); return; } data = new unsigned char[S + 1]; memcpy(data, p, S); - setSize((unsigned short)S); + setSize((uint16_t)S); free(p); } //---------------------------------------------------------------- diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h index 975e2429..fe454a55 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorAPI.h @@ -26,7 +26,7 @@ private: UdpManager *mManager; MonitorManager *mObjectManager; char *mAddress; - unsigned short mPort; + uint16_t mPort; bool mbprint; public: @@ -49,7 +49,7 @@ public: * // GenericNotifier *notifier = (NOT USED) Leave as nullptr * */ - CMonitorAPI( const char *configFile, unsigned short port, bool debug = false , char * address = nullptr, UdpManager * mang = nullptr ); + CMonitorAPI( const char *configFile, uint16_t port, bool debug = false , char * address = nullptr, UdpManager * mang = nullptr ); ~CMonitorAPI(); diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorAPISample.ncb b/external/3rd/library/platform/projects/MonAPI2/MonitorAPISample.ncb index 68d34aa8..14f0d580 100644 Binary files a/external/3rd/library/platform/projects/MonAPI2/MonitorAPISample.ncb and b/external/3rd/library/platform/projects/MonAPI2/MonitorAPISample.ncb differ diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp index 5740d61e..4f17cada 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.cpp @@ -113,13 +113,13 @@ void CMonitorData::resize_buffer(int new_size) } } -void CMonitorData::send(UdpConnection *con, short & sequence, short msg, char *data) +void CMonitorData::send(UdpConnection *con, int16_t & sequence, int16_t msg, char *data) { int len; - unsigned short size; + uint16_t size; char *p; - size = (unsigned short)strlen(data) + 1; + size = (uint16_t)strlen(data) + 1; p = (char *)malloc(size + 6); len = 0; packShort(p + len, len, msg); @@ -131,11 +131,11 @@ void CMonitorData::send(UdpConnection *con, short & sequence, short msg, char *d sequence++; } -void CMonitorData::send(UdpConnection *con, short & sequence, short msg, char *data, int size) +void CMonitorData::send(UdpConnection *con, int16_t & sequence, int16_t msg, char *data, int size) { unsigned long compress_len; int len; - unsigned short usize; + uint16_t usize; char *p; int rnt; @@ -156,7 +156,7 @@ void CMonitorData::send(UdpConnection *con, short & sequence, short msg, char *d return; } - usize = (unsigned short)compress_len; + usize = (uint16_t)compress_len; packShort(p + len, len, usize); usize += 6; con->Send(cUdpChannelReliable1, p, usize); @@ -164,7 +164,7 @@ void CMonitorData::send(UdpConnection *con, short & sequence, short msg, char *d sequence++; } -bool CMonitorData::processHierarchyRequestBlock(UdpConnection *con, short & sequence) +bool CMonitorData::processHierarchyRequestBlock(UdpConnection *con, int16_t & sequence) { int x, size, count, len; char temp[512]; @@ -214,7 +214,7 @@ bool CMonitorData::processHierarchyRequestBlock(UdpConnection *con, short & sequ } bool CMonitorData::processElementsRequest( - UdpConnection *con, short & sequence, char * data, int /* dataLen */, long lastUpdateTime) + UdpConnection *con, int16_t & sequence, char * data, int /* dataLen */, long lastUpdateTime) { char tmp[200]; int x, id; @@ -303,7 +303,7 @@ bool CMonitorData::processElementsRequest( return 0; } -bool CMonitorData::processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int, unsigned char *mark) +bool CMonitorData::processDescriptionRequest(UdpConnection *con, int16_t & sequence, char * userData, int, unsigned char *mark) { char line[4096]; char tmp[400]; @@ -639,7 +639,7 @@ int packByte(char *buffer, int & len, char value) return 1; } -int packShort(char *buffer, int & len, short value) +int packShort(char *buffer, int & len, int16_t value) { char *p; @@ -657,7 +657,7 @@ int packShort(char *buffer, int & len, short value) return 2; } -int packShort(char *buffer, int & len, unsigned short value) +int packShort(char *buffer, int & len, uint16_t value) { char *p; @@ -675,7 +675,7 @@ int packShort(char *buffer, int & len, unsigned short value) return 2; } -int unpackShort(char *buffer, int & len, short & value) +int unpackShort(char *buffer, int & len, int16_t & value) { char *p; p = (char *)&value; @@ -693,7 +693,7 @@ int unpackShort(char *buffer, int & len, short & value) return 2; } -int unpackShort(char *buffer, int & len, unsigned short & value) +int unpackShort(char *buffer, int & len, uint16_t & value) { char *p; p = (char *)&value; diff --git a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h index 56e3f0b9..3be29a9f 100755 --- a/external/3rd/library/platform/projects/MonAPI2/MonitorData.h +++ b/external/3rd/library/platform/projects/MonAPI2/MonitorData.h @@ -7,6 +7,8 @@ // ********************************************************************************************** // ********************************************************************************************** //#include + +#include #include #define CURRENT_API_VERSION 3 @@ -34,7 +36,7 @@ Usage 'l' - long int (4) 'L' - long long int (8) 'i' - int (4) - 's' - short int (2) + 's' - int16_t int (2) 'S' - C-style, nullptr-terminated string (n + nullptr) 'Bn' - buffer, of size n. Used for non-terminated strings, or other binary data. @@ -42,9 +44,9 @@ Usage extern int packString(char *buffer, int & len, char * value); extern int packByte(char *buffer, int & len, char value); -extern int packShort(char *buffer, int & len, short value); -extern int unpackShort(char *buffer, int & len, short & value); -extern int unpackShort(char *buffer, int & len, unsigned short & value); +extern int packShort(char *buffer, int & len, int16_t value); +extern int unpackShort(char *buffer, int & len, int16_t & value); +extern int unpackShort(char *buffer, int & len, uint16_t & value); extern int unpackByte( char *buffer, int & len, char & value); @@ -97,20 +99,20 @@ enum MON_ERRORS class monMessage { public: - monMessage(short command, short sequence, short size); + monMessage(int16_t command, int16_t sequence, int16_t size); monMessage(const unsigned char * source); monMessage(const monMessage ©); monMessage(); - inline const unsigned short getCommand() const {return command;} - inline const unsigned short getSequence() const {return sequence;} - inline const unsigned short getSize() const {return size;} - inline void setSize(unsigned short _size ) {size=_size;} + inline const uint16_t getCommand() const {return command;} + inline const uint16_t getSequence() const {return sequence;} + inline const uint16_t getSize() const {return size;} + inline void setSize(uint16_t _size ) {size=_size;} private: - short command; - short sequence; - unsigned short size; + int16_t command; + int16_t sequence; + uint16_t size; }; //---------------------------------------------------------------- @@ -119,7 +121,7 @@ private: class stringMessage : public monMessage { public: - stringMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, char * data); + stringMessage(const uint16_t command, const uint16_t sequence, const uint16_t size, char * data); stringMessage(const unsigned char * source); virtual ~stringMessage(); @@ -137,16 +139,16 @@ private: class authReplyMessage : public monMessage { public: - authReplyMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, byte data); + authReplyMessage(const uint16_t command, const uint16_t sequence, const uint16_t size, byte data); authReplyMessage(const unsigned char * source); inline const unsigned char getData() const {return data;}; - inline const short getVersion() const { return version; }; + inline const int16_t getVersion() const { return version; }; inline void setData(const unsigned char newData) {data = newData;} private: char data; - short version; + int16_t version; }; //---------------------------------------------------------------- @@ -156,7 +158,7 @@ private: class dataReplyMessage : public monMessage { public: - dataReplyMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, unsigned char *data, int dataLen); + dataReplyMessage(const uint16_t command, const uint16_t sequence, const uint16_t size, unsigned char *data, int dataLen); dataReplyMessage(const unsigned char * source); virtual ~dataReplyMessage(); @@ -192,7 +194,7 @@ private: class simpleMessage : public monMessage { public: - simpleMessage(const unsigned short command, const unsigned short sequence, const unsigned short size); + simpleMessage(const uint16_t command, const uint16_t sequence, const uint16_t size); simpleMessage(const unsigned char * source); virtual ~simpleMessage(); @@ -242,13 +244,13 @@ class CMonitorData { int m_max; char *m_buffer; int m_nbuffer; - short m_sequence; + int16_t m_sequence; // GenericNotifier *m_notifier; int parseList( char **list, char *data, char tok , int max ); void resize_buffer(int new_size); - void send( UdpConnection *mConnection, short & sequence, short msg, char *data ); - void send( UdpConnection *mConnection, short & sequence, short msg, char *data , int size); + void send( UdpConnection *mConnection, int16_t & sequence, int16_t msg, char *data ); + void send( UdpConnection *mConnection, int16_t & sequence, int16_t msg, char *data , int size); public: @@ -260,10 +262,10 @@ public: int DataMax(){ return m_max; } void setMax(int _max); - // bool processHierarchyRequest(UdpConnection *con, short & sequence); - bool processHierarchyRequestBlock(UdpConnection *con, short & sequence); - bool processElementsRequest( UdpConnection *con, short & sequence, char * userData, int dataLen , long lastUpdateTime); - bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark); + // bool processHierarchyRequest(UdpConnection *con, int16_t & sequence); + bool processHierarchyRequestBlock(UdpConnection *con, int16_t & sequence); + bool processElementsRequest( UdpConnection *con, int16_t & sequence, char * userData, int dataLen , long lastUpdateTime); + bool processDescriptionRequest(UdpConnection *con, int16_t & sequence, char * userData, int dataLen,unsigned char *mark); int add(const char *label, int id, int ping, const char *des ); int setDescription( int Id, const char *Description , int & mode); char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} @@ -283,7 +285,7 @@ public: class MonitorObject : public UdpConnectionHandler { CMonitorData *mMonitorData; - short mSequence; + int16_t mSequence; char *mPasswd; char **mAddressList; unsigned char *mMark; diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp index f61f6464..0a56192d 100755 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.cpp @@ -87,8 +87,8 @@ void CConnectionHandler::OnTerminated(UdpConnection *) void CConnectionHandler::OnRoutePacket(UdpConnection *, const uchar *data, int dataLen) { - unsigned short itemCount; - unsigned short messageId = 0; + uint16_t itemCount; + uint16_t messageId = 0; unsigned trackingNumber = 0; if (dataLen < 8) @@ -518,12 +518,12 @@ void apiCore::OnConnectionFailed(const std::string & address, unsigned connectio mParent->OnConnectionFailed(address.c_str(),connectionCount); } -bool apiCore::IsTrackedMessage(const unsigned short messageId) +bool apiCore::IsTrackedMessage(const uint16_t messageId) { return mTrackedMessages.find(messageId) != mTrackedMessages.end(); } -void apiCore::RegisterTrackedMessage(const unsigned short messageId) +void apiCore::RegisterTrackedMessage(const uint16_t messageId) { mTrackedMessages.insert(messageId); } @@ -674,8 +674,8 @@ void apiCore::Process() // Process Tracked Callback Queue while (!mTrackedCallbackQueue.empty()) { - unsigned short itemCount; - unsigned short messageId = 0; + uint16_t itemCount; + uint16_t messageId = 0; Base::ByteStream & stream = mTrackedCallbackQueue.front(); Base::ByteStream::ReadIterator streamIterator = stream.begin(); @@ -712,7 +712,7 @@ void apiCore::Process() const int DEFAULT_TIMEOUT = 20; -apiTrackedRequest::apiTrackedRequest(apiTrackingNumber trackingNumber, const unsigned short messageId, const void * userData, unsigned duration) : +apiTrackedRequest::apiTrackedRequest(apiTrackingNumber trackingNumber, const uint16_t messageId, const void * userData, unsigned duration) : mTrackingNumber(trackingNumber), mMessageId(messageId), mUserData(userData), @@ -743,7 +743,7 @@ apiTrackingNumber apiTrackedRequest::GetTrackingNumber() return mTrackingNumber; } -unsigned short apiTrackedRequest::GetMessageId() +uint16_t apiTrackedRequest::GetMessageId() { return mMessageId; } diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.h b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.h index d8b78809..cf7c3a0f 100755 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.h +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonClient.h @@ -95,19 +95,19 @@ class CConnectionManager class apiTrackedRequest { public: - apiTrackedRequest(apiTrackingNumber trackingNumber, const unsigned short messageId, const void * userData, unsigned duration = 20); + apiTrackedRequest(apiTrackingNumber trackingNumber, const uint16_t messageId, const void * userData, unsigned duration = 20); apiTrackedRequest(const apiTrackedRequest & copy); ~apiTrackedRequest(); apiTrackingNumber GetTrackingNumber(); - unsigned short GetMessageId(); + uint16_t GetMessageId(); const void * GetUserData(); bool Expired(); private: apiTrackingNumber mTrackingNumber; - unsigned short mMessageId; + uint16_t mMessageId; const void * mUserData; unsigned mTimeout; unsigned mDuration; @@ -131,8 +131,8 @@ class apiCore void Process(); - void RegisterTrackedMessage(const unsigned short messageId); - bool IsTrackedMessage(const unsigned short messageId); + void RegisterTrackedMessage(const uint16_t messageId); + bool IsTrackedMessage(const uint16_t messageId); virtual int GetKeepAliveDelay(); virtual int GetPortAliveDelay(); @@ -147,7 +147,7 @@ class apiCore apiTrackingNumber SubmitRequest(Message::Tracked & input, Message::TrackedReply & output, const void * userData, unsigned timeout=0); virtual bool Callback(Base::ByteStream & stream, void * userData) = 0; - virtual void Timeout(unsigned short messageId, apiTrackingNumber trackingNumber, void * userData) = 0; + virtual void Timeout(uint16_t messageId, apiTrackingNumber trackingNumber, void * userData) = 0; private: void OnConnectionOpened(const std::string & address, unsigned connectionCount); @@ -178,7 +178,7 @@ class apiCore apiTrackingNumber mTrackingIndex; - std::set mTrackedMessages; + std::set mTrackedMessages; std::map mRequestMap; std::list mCallbackQueue; diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonMessages.cpp b/external/3rd/library/platform/projects/Session/CommonAPI/CommonMessages.cpp index 7a5ce159..8894fe89 100755 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonMessages.cpp +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonMessages.cpp @@ -228,7 +228,7 @@ namespace Message } */ - Basic::Basic(const unsigned short newMessageId) : + Basic::Basic(const uint16_t newMessageId) : AutoByteStream(), mMessageID(newMessageId) { diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonMessages.h b/external/3rd/library/platform/projects/Session/CommonAPI/CommonMessages.h index 537e430b..d5b42653 100755 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonMessages.h +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonMessages.h @@ -59,19 +59,19 @@ namespace Message Basic(); Basic(const unsigned char * const buffer, const unsigned int bufferSize); - explicit Basic(const unsigned short messageId); + explicit Basic(const uint16_t messageId); explicit Basic(Base::ByteStream::ReadIterator & source); Basic(const Basic & source); Basic & operator=(const Basic & rhs); virtual ~Basic(); - const unsigned short GetMessageID() const; + const uint16_t GetMessageID() const; private: - Base::AutoVariable mMessageID; + Base::AutoVariable mMessageID; }; - inline const unsigned short Basic::GetMessageID() const + inline const uint16_t Basic::GetMessageID() const { return mMessageID.get(); //lint !e1037 choosing a const or non const conversion is NOT ambiguous } @@ -93,7 +93,7 @@ namespace Message private: \ void InitializeMembers(); \ public: \ - ClassName(const unsigned short messageId = MESSAGE_ID); \ + ClassName(const uint16_t messageId = MESSAGE_ID); \ ClassName(Base::ByteStream::ReadIterator & source); #define DefineMessageMember(MemberName,Type) \ @@ -127,7 +127,7 @@ namespace Message }; #define BeginImplementMessage(ClassName,BaseClass) \ - ClassName::ClassName(const unsigned short messageId) : BaseClass(messageId) \ + ClassName::ClassName(const uint16_t messageId) : BaseClass(messageId) \ { \ InitializeMembers(); \ } \ @@ -214,7 +214,7 @@ namespace Message //////////////////////////////////////// // Unknown BeginDefineMessage(Unknown, Basic, MESSAGE_UNKNOWN) - DefineMessageMember(UnknownMessageID, unsigned short) + DefineMessageMember(UnknownMessageID, uint16_t) EndDefineMessage diff --git a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp index 1cabca55..451d50f7 100755 --- a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp +++ b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.cpp @@ -1893,7 +1893,7 @@ namespace LoginAPI return true; } - void ClientCore::Timeout(unsigned short messageId, apiTrackingNumber trackingNumber, void * userData) + void ClientCore::Timeout(uint16_t messageId, apiTrackingNumber trackingNumber, void * userData) { switch (messageId) { diff --git a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.h b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.h index e2bb2efc..885ae0fc 100755 --- a/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.h +++ b/external/3rd/library/platform/projects/Session/LoginAPI/ClientCore.h @@ -229,7 +229,7 @@ namespace LoginAPI virtual bool Callback(Base::ByteStream & stream, void * userData); - virtual void Timeout(unsigned short messageId, apiTrackingNumber trackingNumber, void * userData); + virtual void Timeout(uint16_t messageId, apiTrackingNumber trackingNumber, void * userData); }; diff --git a/external/3rd/library/platform/utils/Base/BlockAllocator.h b/external/3rd/library/platform/utils/Base/BlockAllocator.h index bbfbf273..778331da 100755 --- a/external/3rd/library/platform/utils/Base/BlockAllocator.h +++ b/external/3rd/library/platform/utils/Base/BlockAllocator.h @@ -1,9 +1,16 @@ #if !defined (BLOCKALLOCATOR_H_) #define BLOCKALLOCATOR_H_ +#include #include #include +#if __x86_64__ +typedef long unsigned int baType; +#else +typedef uint baType; +#endif + #ifdef EXTERNAL_DISTRO namespace NAMESPACE { @@ -16,11 +23,11 @@ namespace Base public: BlockAllocator(); ~BlockAllocator(); - void *getBlock(unsigned accum); - void returnBlock(unsigned *handle); + void *getBlock(baType accum); + void returnBlock(baType *handle); private: - uintptr_t *m_blocks[31]; + uintptr_t *m_blocks[31]; }; }; #ifdef EXTERNAL_DISTRO diff --git a/external/3rd/library/platform/utils/Base/Platform.h b/external/3rd/library/platform/utils/Base/Platform.h index 2ae0580f..d926d91a 100755 --- a/external/3rd/library/platform/utils/Base/Platform.h +++ b/external/3rd/library/platform/utils/Base/Platform.h @@ -70,7 +70,7 @@ namespace Base // return (uint64(byteReverse(uint32(value))) << 32) | byteReverse(uint32(value>>32)); } - inline uint32 strlen(const unsigned short * string) + inline uint32 strlen(const uint16_t * string) { if (string == 0) return 0; diff --git a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp index 29d91074..41ea545f 100755 --- a/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/platform/utils/Base/linux/BlockAllocator.cpp @@ -10,7 +10,7 @@ namespace Base { BlockAllocator::BlockAllocator() { - for(unsigned i = 0; i < 31; i++) + for(baType i = 0; i < 31; i++) { m_blocks[i] = nullptr; } @@ -19,12 +19,12 @@ namespace Base BlockAllocator::~BlockAllocator() { // free all allocated memory blocks - for(unsigned i = 0; i < 31; i++) + for(baType i = 0; i < 31; i++) { while(m_blocks[i] != nullptr) { - unsigned *tmp = m_blocks[i]; - m_blocks[i] = (unsigned *)*m_blocks[i]; + baType *tmp = m_blocks[i]; + m_blocks[i] = (baType *)*m_blocks[i]; free(tmp); } } @@ -33,10 +33,10 @@ namespace Base // Allocate a block that is the next power of two greater than the # of bytes passed. // 33 bytes yields a 64 byte block of memory and so forth. - void *BlockAllocator::getBlock(unsigned bytes) + void *BlockAllocator::getBlock(baType bytes) { - unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + baType accum = 16, bits = 16; + baType *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -44,14 +44,14 @@ namespace Base { // If bytes is less than the bit we're testing for, subtract half // from the bit value and repeat - if(bytes < (unsigned)(1 << accum)) + if(bytes < (baType)(1 << accum)) { bits /= 2; accum -= bits; } // If bytes is greater than the bit we're testing for, add half // from the but value and repeat - else if(bytes > (unsigned)(1 << accum)) + else if(bytes > (baType)(1 << accum)) { bits /= 2; accum += bits; @@ -79,7 +79,7 @@ namespace Base if(m_blocks[accum] == 0) { // remove the pre allocated block from the linked list - handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle = (baType *)calloc(((1 << accum) / 4) + 2, sizeof(baType)); handle[1] = accum; handle[0] = 0; } @@ -87,20 +87,20 @@ namespace Base { // Allocate a new block handle = m_blocks[accum]; - m_blocks[accum] = (unsigned *)handle[0]; + m_blocks[accum] = (baType *)handle[0]; handle[0] = 0; } // return a pointer that skips over the header used for the allocator's purposes return(handle + 2); } - void BlockAllocator::returnBlock(unsigned *handle) + void BlockAllocator::returnBlock(baType *handle) { // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head - *(handle - 2) = (unsigned)m_blocks[*(handle - 1)]; + *(handle - 2) = (baType)m_blocks[*(handle - 1)]; // Add this entry to the proper linked list node m_blocks[*(handle - 1)] = (handle - 2); } diff --git a/external/3rd/library/platform/utils/Base/linux/Types.h b/external/3rd/library/platform/utils/Base/linux/Types.h index 6ee50450..c9f2e7f3 100755 --- a/external/3rd/library/platform/utils/Base/linux/Types.h +++ b/external/3rd/library/platform/utils/Base/linux/Types.h @@ -11,7 +11,7 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -21,19 +21,24 @@ namespace NAMESPACE namespace Base { -//#define INT32_MAX 0x7FFFFFFF -//#define INT32_MIN 0x80000000 -//#define UINT32_MAX 0xFFFFFFFF -typedef signed char int8; -typedef unsigned char uint8; -typedef signed short int16; -typedef unsigned short uint16; +#ifndef INT32_MAX +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN 0x80000000 +#define UINT32_MAX 0xFFFFFFFF +#endif + + + +typedef int8_t int8; +typedef uint8_t uint8; +typedef int16_t int16; +typedef uint16_t uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/external/3rd/library/platform/utils/Base/win32/BlockAllocator.cpp b/external/3rd/library/platform/utils/Base/win32/BlockAllocator.cpp index 029946b4..3a685748 100755 --- a/external/3rd/library/platform/utils/Base/win32/BlockAllocator.cpp +++ b/external/3rd/library/platform/utils/Base/win32/BlockAllocator.cpp @@ -10,7 +10,7 @@ namespace Base BlockAllocator::BlockAllocator() { - for(unsigned i = 0; i < 31; i++) + for(long unsigned int i = 0; i < 31; i++) { m_blocks[i] = NULL; } @@ -19,7 +19,7 @@ namespace Base BlockAllocator::~BlockAllocator() { // free all allocated memory blocks - for(unsigned i = 0; i < 31; i++) + for(long unsigned int i = 0; i < 31; i++) { while(m_blocks[i] != NULL) { @@ -33,9 +33,9 @@ namespace Base // Allocate a block that is the next power of two greater than the # of bytes passed. // 33 bytes yields a 64 byte block of memory and so forth. - void *BlockAllocator::getBlock(unsigned bytes) + void *BlockAllocator::getBlock(long unsigned int bytes) { - unsigned accum = 16, bits = 16; + long unsigned int accum = 16, bits = 16; uintptr_t *handle = NULL; // Perform a binary search looking for the highest bit. @@ -44,14 +44,14 @@ namespace Base { // If bytes is less than the bit we're testing for, subtract half // from the bit value and repeat - if(bytes < (unsigned)(1 << accum)) + if(bytes < (long unsigned int)(1 << accum)) { bits /= 2; accum -= bits; } // If bytes is greater than the bit we're testing for, add half // from the but value and repeat - else if(bytes > (unsigned)(1 << accum)) + else if(bytes > (long unsigned int)(1 << accum)) { bits /= 2; accum += bits; @@ -79,7 +79,7 @@ namespace Base if(m_blocks[accum] == 0) { // remove the pre allocated block from the linked list - handle = (uintptr_t *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle = (uintptr_t *)calloc(((1 << accum) / 4) + 2, sizeof(long unsigned int)); handle[1] = accum; handle[0] = 0; } @@ -94,7 +94,7 @@ namespace Base return(handle + 2); } - void BlockAllocator::returnBlock(unsigned *handle) + void BlockAllocator::returnBlock(long unsigned int *handle) { // C++ allows for safe deletion of a NULL pointer if(handle) diff --git a/external/3rd/library/platform/utils/Base/win32/Types.h b/external/3rd/library/platform/utils/Base/win32/Types.h index 0c64cb2c..24d0b66c 100755 --- a/external/3rd/library/platform/utils/Base/win32/Types.h +++ b/external/3rd/library/platform/utils/Base/win32/Types.h @@ -25,8 +25,8 @@ namespace Base typedef signed char int8; typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; +typedef int16_t int16; +typedef uint16_t uint16; typedef int int32; typedef unsigned uint32; diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistGameAPIDll/CSAssistGameAPIDll.ncb b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistGameAPIDll/CSAssistGameAPIDll.ncb index 5ba09aff..fd1e9460 100644 Binary files a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistGameAPIDll/CSAssistGameAPIDll.ncb and b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistGameAPIDll/CSAssistGameAPIDll.ncb differ diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp index dae431dd..4d769cbd 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistStressTest/test.cpp @@ -412,7 +412,7 @@ unsigned randomTicketID() std::string GetHostName(unsigned port) //----------------------------------------------- { - const short hostLen(512); + const int16_t hostLen(512); char hostName[hostLen] = {0}; char hostAndPort[hostLen+10] = {0}; std::string serverID; @@ -427,16 +427,16 @@ std::string GetHostName(unsigned port) sprintf(hostName,"localhost-%u", port); } //#endif - std::string shortName = hostName; - unsigned dot = shortName.find_first_of("."); + std::string int16_tName = hostName; + unsigned dot = int16_tName.find_first_of("."); if (dot != std::string::npos) { - shortName = shortName.substr(0,dot); + int16_tName = int16_tName.substr(0,dot); } #ifdef WIN32 - _snprintf(hostAndPort, hostLen+10, "%s", shortName.c_str()); + _snprintf(hostAndPort, hostLen+10, "%s", int16_tName.c_str()); #else - snprintf(hostAndPort, hostLen+10, "%s", shortName.c_str()); + snprintf(hostAndPort, hostLen+10, "%s", int16_tName.c_str()); #endif return (std::string)hostAndPort; } diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapi.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapi.h index 29dcd885..117de70c 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapi.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapi.h @@ -22,8 +22,11 @@ #endif +#include #include "time.h" + + namespace CSAssist { @@ -34,7 +37,7 @@ namespace CSAssist typedef unsigned CSAssistGameAPITrack; // An API tracking number typedef unsigned CSAssistGameAPIUID; // A station UID typedef unsigned CSAssistGameAPITicketID; // A ticket ID -typedef unsigned short CSAssistUnicodeChar; // base type for unicode strings (uint16) +typedef uint16_t CSAssistUnicodeChar; // base type for unicode strings (uint16) typedef CSAssistUnicodeChar *CSAssistGameAPIXML;// A pointer to an XML block //------------------------------------------------------------------------------ @@ -149,7 +152,7 @@ static const unsigned CSASSIST_TICKET_LENGTH_COMMENT = 4000; static const unsigned CSASSIST_TICKET_LENGTH_NAME = 64; static const unsigned CSASSIST_TICKET_LENGTH_LOCATION = 128; -static const short CSASSIST_NUM_CATEGORIES = 4; +static const int16_t CSASSIST_NUM_CATEGORIES = 4; static const unsigned CSASSIST_DOCUMENT_LENGTH_NAME = 25; static const unsigned CSASSIST_DOCUMENT_LENGTH_LANGUAGE = 2; diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapi.ncb b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapi.ncb index 767e9cf3..b456e406 100644 Binary files a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapi.ncb and b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapi.ncb differ diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.cpp index ca933433..c4690045 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.cpp @@ -946,7 +946,7 @@ namespace CSAssist } //------------------------------------------------------------- - Response *CSAssistGameAPIcore::createServerResponse(short msgtype) + Response *CSAssistGameAPIcore::createServerResponse(int16_t msgtype) //------------------------------------------------------------- { Response *res = nullptr; @@ -988,7 +988,7 @@ namespace CSAssist int CSAssistGameAPIcore::GetConnectedPort() { return m_connectedPort; - /* short port(0); + /* int16_t port(0); #ifdef USE_UDP_LIBRARY #else port = m_connection->GetDestinationPort(); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h index d7dc8ac4..8770c750 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.h @@ -157,7 +157,7 @@ private: void SubmitImmediateError(Response *res); Response *getPending(CSAssistGameAPITrack track); Response *getResponse(CSAssistGameAPITrack track); - Response *createServerResponse(short msgtype); + Response *createServerResponse(int16_t msgtype); void SubmitRequestInt(Request *req, Response *res); Response *getPendingInt(CSAssistGameAPITrack track); Response *getResponseInt(CSAssistGameAPITrack track); @@ -175,9 +175,9 @@ private: TcpConnection *m_connection; #endif - short m_port; - short m_oldPort; - short m_connectedPort; + int16_t m_port; + int16_t m_oldPort; + int16_t m_connectedPort; std::string m_ip; // this is supposed to be non-internationalised std::string m_oldIP; // this is supposed to be non-internationalised std::string m_connectedIP; // this is supposed to be non-internationalised diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.cpp index 1ce4b5cf..59738a45 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.cpp @@ -44,7 +44,7 @@ bugstatus(BUG_STATUS_NONE), isRead(0) Plat_Unicode::String lang = narrowToWide("en"); copy_c_str(lang, language); location[0] = 0; - for (short i=0; i < CSASSIST_NUM_CATEGORIES; i++) + for (int16_t i=0; i < CSASSIST_NUM_CATEGORIES; i++) category[i] = 0; } @@ -128,7 +128,7 @@ CSAssistGameAPIResult CSAssistGameAPITicket::setLocation(const CSAssistUnicodeCh CSAssistGameAPIResult CSAssistGameAPITicket::setCategory(int index, unsigned value) //----------------------------------------------------------- { - if (index < 0 || index >= (short)CSASSIST_NUM_CATEGORIES) + if (index < 0 || index >= (int16_t)CSASSIST_NUM_CATEGORIES) return CSASSIST_RESULT_BADPARAMS; category[index] = value; return CSASSIST_RESULT_SUCCESS; diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.h index b6535350..0d9475fa 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.h @@ -107,7 +107,7 @@ public: CSAssistUnicodeChar title[CSASSIST_KBSEARCH_LENGTH_TITLE+1]; CSAssistUnicodeChar idstring[CSASSIST_KBSEARCH_LENGTH_ID+1]; - short matchPercent; + int16_t matchPercent; }; } // namespace CSAssist diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp index a1b03cf9..0df0786a 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistreceiver.cpp @@ -133,12 +133,12 @@ void CSAssistReceiver::OnRoutePacket(TcpConnection *con, const uchar *data, int //-------------------------------------------------- { unsigned track, result; - short type; + int16_t type; Response *res = 0; ByteStream msg(data, dataLen); ByteStream::ReadIterator iter = msg.begin(); - iter.advance(2); // skip short num_args + iter.advance(2); // skip int16_t num_args get(iter, type); get(iter, track); get(iter, result); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp index efbc0db4..6c6b6e69 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssisttest/test.cpp @@ -86,7 +86,7 @@ void DisplayTicket(const CSAssistGameAPITicket *t) std::cout << " Modified: " << date2 << " Game/Server: " << wideToNarrow(game) << ", " << wideToNarrow(server); std::cout << "\n Character: " << wideToNarrow(character) << "\n Status: " << t->status << "," << t->bugstatus; std::cout << "\n UID: " << t->uid << "\n Category: "; - for (short i=0; i < CSASSIST_NUM_CATEGORIES; i++) + for (int16_t i=0; i < CSASSIST_NUM_CATEGORIES; i++) std::cout << t->category[i] << ","; std::cout << "\n Language: " << wideToNarrow(language); std::cout << "\n Location: " << wideToNarrow(location); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp index 9a8ef45e..d39ae0fe 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/packdata.cpp @@ -72,7 +72,7 @@ void put(Base::ByteStream & target, const CSAssistGameAPITicket & source) put(target, scharacter); put(target, (unsigned)source.status); put(target, (unsigned)source.bugstatus); - for (short i=0; i < CSASSIST_NUM_CATEGORIES; i++) + for (int16_t i=0; i < CSASSIST_NUM_CATEGORIES; i++) put(target, source.category[i]); put(target, sdetails); put(target, slanguage); @@ -101,7 +101,7 @@ void get(ByteStream::ReadIterator & source, CSAssistGameAPITicket & target) get(source, scharacter); get(source, gstatus); get(source, bstatus); - for (short i=0; i < CSASSIST_NUM_CATEGORIES; i++) + for (int16_t i=0; i < CSASSIST_NUM_CATEGORIES; i++) get(source, target.category[i]); get(source, sdetails); get(source, slanguage); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/request.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/request.cpp index fff9ef31..e9d36fd6 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/request.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/request.cpp @@ -26,7 +26,7 @@ const static unsigned CSASSIST_VERSION_MAGIC = (4 + (256 * 3) + (65536 * 2) + (6 const static unsigned API_VERSION = 201; //------------------------------------------------ -Request::Request(short type, unsigned track) : +Request::Request(int16_t type, unsigned track) : mType(type), mTrack(track), timeout(0) //---------------------------------------------- { @@ -36,7 +36,7 @@ mType(type), mTrack(track), timeout(0) void Request::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 2; + int16_t num_args = 2; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -62,7 +62,7 @@ RConnectCSAssist::RConnectCSAssist(unsigned track, Plat_Unicode::String GameName void RConnectCSAssist::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 4; + int16_t num_args = 4; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -92,7 +92,7 @@ void RConnectCSAssist::pack(ByteStream &msg) void RNewTicketActivity::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 4; + int16_t num_args = 4; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -114,7 +114,7 @@ void RNewTicketActivity::pack(ByteStream &msg) void RRegisterCharacter::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 5; + int16_t num_args = 5; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -136,7 +136,7 @@ void RRegisterCharacter::pack(ByteStream &msg) void RUnRegisterCharacter::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 4; + int16_t num_args = 4; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -157,7 +157,7 @@ void RUnRegisterCharacter::pack(ByteStream &msg) void RGetIssueHierarchy::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 4; + int16_t num_args = 4; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -178,7 +178,7 @@ RCreateTicket::RCreateTicket(unsigned track, const CSAssistGameAPITicket *ticket void RCreateTicket::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 5; + int16_t num_args = 5; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -202,7 +202,7 @@ RAppendComment::RAppendComment(unsigned track, const unsigned ticket, const unsi void RAppendComment::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 6; + int16_t num_args = 6; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -225,7 +225,7 @@ void RAppendComment::pack(ByteStream &msg) void RGetTicketByID::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 4; + int16_t num_args = 4; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -248,7 +248,7 @@ void RGetTicketByID::pack(ByteStream &msg) void RGetTicketComments::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 6; + int16_t num_args = 6; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -274,7 +274,7 @@ RGetTicketByCharacter::RGetTicketByCharacter(unsigned track, const unsigned uid, void RGetTicketByCharacter::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 7; + int16_t num_args = 7; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -297,7 +297,7 @@ void RGetTicketByCharacter::pack(ByteStream &msg) void RMarkTicketRead::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 3; + int16_t num_args = 3; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -318,7 +318,7 @@ RCancelTicket::RCancelTicket(unsigned track, const unsigned ticket, const unsign void RCancelTicket::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 5; + int16_t num_args = 5; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -339,7 +339,7 @@ void RCancelTicket::pack(ByteStream &msg) void RCommentCount::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 3; + int16_t num_args = 3; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -362,7 +362,7 @@ void RCommentCount::pack(ByteStream &msg) void RReplyGameLocation::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 7; + int16_t num_args = 7; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -384,7 +384,7 @@ void RReplyGameLocation::pack(ByteStream &msg) void RGetDocumentList::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 4; + int16_t num_args = 4; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -403,7 +403,7 @@ void RGetDocumentList::pack(ByteStream &msg) void RGetDocument::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 3; + int16_t num_args = 3; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -422,7 +422,7 @@ void RGetDocument::pack(ByteStream &msg) void RGetTicketXMLBlock::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 3; + int16_t num_args = 3; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -443,7 +443,7 @@ void RGetTicketXMLBlock::pack(ByteStream &msg) void RGetKBArticle::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 5; + int16_t num_args = 5; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -466,7 +466,7 @@ void RGetKBArticle::pack(ByteStream &msg) void RSearchKB::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 5; + int16_t num_args = 5; put(msg, num_args); put(msg, mType); put(msg, mTrack); @@ -488,7 +488,7 @@ mConnectString(connectString) void RConnectLB::pack(ByteStream &msg) //---------------------------------------------- { - short num_args = 3; + int16_t num_args = 3; put(msg, num_args); put(msg, mType); put(msg, mTrack); diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/request.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/request.h index a3ade508..6925ec91 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/request.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/request.h @@ -68,7 +68,7 @@ class Request //---------------------------------------------- { public: - Request(short type, unsigned track); + Request(int16_t type, unsigned track); virtual ~Request() { } unsigned getType() { return (unsigned)mType; } unsigned getTrack() { return mTrack; } @@ -77,7 +77,7 @@ class Request virtual void pack(Base::ByteStream &msg); protected: - short mType; + int16_t mType; unsigned mTrack; private: diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/response.h b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/response.h index 57cfd2ad..8a640ebe 100755 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/response.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/response.h @@ -32,14 +32,14 @@ class Response virtual CSAssistGameAPITrack getTrack() { return (CSAssistGameAPITrack)mTrack; } virtual CSAssistGameAPIResult getResult() { return (CSAssistGameAPIResult)mResult; } inline void *getUserData() { return muserData; } - inline void init(short type, unsigned track, unsigned result) + inline void init(int16_t type, unsigned track, unsigned result) { mType = type; mTrack = track; mResult = result; } inline void setResult(unsigned result) { mResult = result; } virtual void decode(Base::ByteStream::ReadIterator &msg); protected: - short mType; + int16_t mType; unsigned mTrack; unsigned mResult; void *muserData; @@ -393,7 +393,7 @@ class ResConnectLB : public Response private: std::string mServerName; - unsigned short mServerPort; + uint16_t mServerPort; Request *mConnectRequest; Response *mConnectResponse; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/BlockAllocator.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/BlockAllocator.h index bbfbf273..778331da 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/BlockAllocator.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/BlockAllocator.h @@ -1,9 +1,16 @@ #if !defined (BLOCKALLOCATOR_H_) #define BLOCKALLOCATOR_H_ +#include #include #include +#if __x86_64__ +typedef long unsigned int baType; +#else +typedef uint baType; +#endif + #ifdef EXTERNAL_DISTRO namespace NAMESPACE { @@ -16,11 +23,11 @@ namespace Base public: BlockAllocator(); ~BlockAllocator(); - void *getBlock(unsigned accum); - void returnBlock(unsigned *handle); + void *getBlock(baType accum); + void returnBlock(baType *handle); private: - uintptr_t *m_blocks[31]; + uintptr_t *m_blocks[31]; }; }; #ifdef EXTERNAL_DISTRO diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/Platform.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/Platform.h index 2bdb170b..fa7918d7 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/Platform.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/Platform.h @@ -70,7 +70,7 @@ namespace Base // return (uint64(byteReverse(uint32(value))) << 32) | byteReverse(uint32(value>>32)); } - inline uint32 strlen(const unsigned short * string) + inline uint32 strlen(const uint16_t * string) { if (string == 0) return 0; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h index 28159b18..57f71262 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/WideString.h @@ -14,7 +14,7 @@ namespace ucs2 class string { public: - typedef unsigned short char_type; + typedef uint16_t char_type; typedef unsigned size_type; public: diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp index 29d91074..41ea545f 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/BlockAllocator.cpp @@ -10,7 +10,7 @@ namespace Base { BlockAllocator::BlockAllocator() { - for(unsigned i = 0; i < 31; i++) + for(baType i = 0; i < 31; i++) { m_blocks[i] = nullptr; } @@ -19,12 +19,12 @@ namespace Base BlockAllocator::~BlockAllocator() { // free all allocated memory blocks - for(unsigned i = 0; i < 31; i++) + for(baType i = 0; i < 31; i++) { while(m_blocks[i] != nullptr) { - unsigned *tmp = m_blocks[i]; - m_blocks[i] = (unsigned *)*m_blocks[i]; + baType *tmp = m_blocks[i]; + m_blocks[i] = (baType *)*m_blocks[i]; free(tmp); } } @@ -33,10 +33,10 @@ namespace Base // Allocate a block that is the next power of two greater than the # of bytes passed. // 33 bytes yields a 64 byte block of memory and so forth. - void *BlockAllocator::getBlock(unsigned bytes) + void *BlockAllocator::getBlock(baType bytes) { - unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + baType accum = 16, bits = 16; + baType *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -44,14 +44,14 @@ namespace Base { // If bytes is less than the bit we're testing for, subtract half // from the bit value and repeat - if(bytes < (unsigned)(1 << accum)) + if(bytes < (baType)(1 << accum)) { bits /= 2; accum -= bits; } // If bytes is greater than the bit we're testing for, add half // from the but value and repeat - else if(bytes > (unsigned)(1 << accum)) + else if(bytes > (baType)(1 << accum)) { bits /= 2; accum += bits; @@ -79,7 +79,7 @@ namespace Base if(m_blocks[accum] == 0) { // remove the pre allocated block from the linked list - handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle = (baType *)calloc(((1 << accum) / 4) + 2, sizeof(baType)); handle[1] = accum; handle[0] = 0; } @@ -87,20 +87,20 @@ namespace Base { // Allocate a new block handle = m_blocks[accum]; - m_blocks[accum] = (unsigned *)handle[0]; + m_blocks[accum] = (baType *)handle[0]; handle[0] = 0; } // return a pointer that skips over the header used for the allocator's purposes return(handle + 2); } - void BlockAllocator::returnBlock(unsigned *handle) + void BlockAllocator::returnBlock(baType *handle) { // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head - *(handle - 2) = (unsigned)m_blocks[*(handle - 1)]; + *(handle - 2) = (baType)m_blocks[*(handle - 1)]; // Add this entry to the proper linked list node m_blocks[*(handle - 1)] = (handle - 2); } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Types.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Types.h index 69419a0f..c9f2e7f3 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Types.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/linux/Types.h @@ -11,7 +11,7 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -28,15 +28,17 @@ namespace Base #define UINT32_MAX 0xFFFFFFFF #endif -typedef signed char int8; -typedef unsigned char uint8; -typedef signed short int16; -typedef unsigned short uint16; + + +typedef int8_t int8; +typedef uint8_t uint8; +typedef int16_t int16; +typedef uint16_t uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/BlockAllocator.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/BlockAllocator.cpp index 927c5aef..b5a22b36 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/BlockAllocator.cpp @@ -10,7 +10,7 @@ namespace Base BlockAllocator::BlockAllocator() { - for(unsigned i = 0; i < 31; i++) + for(long unsigned int i = 0; i < 31; i++) { m_blocks[i] = NULL; } @@ -19,7 +19,7 @@ namespace Base BlockAllocator::~BlockAllocator() { // free all allocated memory blocks - for(unsigned i = 0; i < 31; i++) + for(long unsigned int i = 0; i < 31; i++) { while(m_blocks[i] != NULL) { @@ -33,10 +33,10 @@ namespace Base // Allocate a block that is the next power of two greater than the # of bytes passed. // 33 bytes yields a 64 byte block of memory and so forth. - void *BlockAllocator::getBlock(unsigned bytes) + void *BlockAllocator::getBlock(long unsigned int bytes) { - unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + long unsigned int accum = 16, bits = 16; + long unsigned int *handle = NULL; // Perform a binary search looking for the highest bit. @@ -44,14 +44,14 @@ namespace Base { // If bytes is less than the bit we're testing for, subtract half // from the bit value and repeat - if(bytes < (unsigned)(1 << accum)) + if(bytes < (long unsigned int)(1 << accum)) { bits /= 2; accum -= bits; } // If bytes is greater than the bit we're testing for, add half // from the but value and repeat - else if(bytes > (unsigned)(1 << accum)) + else if(bytes > (long unsigned int)(1 << accum)) { bits /= 2; accum += bits; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h index 0c64cb2c..24d0b66c 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/win32/Types.h @@ -25,8 +25,8 @@ namespace Base typedef signed char int8; typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; +typedef int16_t int16; +typedef uint16_t uint16; typedef int int32; typedef unsigned uint32; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp index c74eaca4..874bdf81 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.cpp @@ -10,7 +10,7 @@ namespace NAMESPACE //used when want to open new connection with this socket -TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) +TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, int16_t destPort, unsigned timeout) : m_nextConnection(nullptr), m_prevConnection(nullptr), m_socket(INVALID_SOCKET), @@ -93,7 +93,7 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo } //used when server mode creates new connection object representing a connect request -TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) +TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, int16_t destPort) : m_nextConnection(nullptr), m_prevConnection(nullptr), m_socket(socket), diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h index 92d631d1..aff1b2be 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpConnection.h @@ -88,7 +88,7 @@ public: /** * @brief Returns the port on the other side of this conection. */ - short GetDestinationPort(){ return m_destPort; } + int16_t GetDestinationPort(){ return m_destPort; } /** * @brief Standard AddRef/Release scheme @@ -105,9 +105,9 @@ public: protected: friend class TcpManager; - TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout); + TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, int16_t destPort, unsigned timeout); int finishConnect();/**< returns < 0 if fatal error and connect will not work, =0 if need more time, >0 if connect completed */ - TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort); + TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, int16_t destPort); TcpConnection *m_nextConnection; /**< Double linked list imp. */ TcpConnection *m_prevConnection; /**< Double linked list imp. */ SOCKET m_socket; @@ -131,7 +131,7 @@ private: Status m_status; TcpConnectionHandler *m_handler; IPAddress m_destIP; - short m_destPort; + int16_t m_destPort; unsigned m_refCount; TcpBlockAllocator *m_sendAllocator; data_block *m_head; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpLibrary.ncb b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpLibrary.ncb index ef1eb6ed..819ffb24 100644 Binary files a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpLibrary.ncb and b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpLibrary.ncb differ diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp index 2073fc8f..f352d4aa 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.cpp @@ -567,7 +567,7 @@ namespace NAMESPACE return processedIncoming; } - TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) + TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, uint16_t serverPort, unsigned timeout) { if (m_boundAsServer) { diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h index cdc01daa..512c7106 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TcpManager.h @@ -66,7 +66,7 @@ public: * do so in order to navigate company firewalls which may have specific port numbers open to them for this purpose. * default = 0 */ - unsigned short port; + uint16_t port; /** * @ brief Server bind ip. @@ -214,7 +214,7 @@ public: * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ - TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); + TcpConnection *EstablishConnection(const char *serverAddress, uint16_t serverPort, unsigned timeout = 0); /** * @brief Binds this manager as a server which will listen for and accept incoming connections. diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp index 35423e88..8d49e81a 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.cpp @@ -5,7 +5,7 @@ extern unsigned g_numSent; extern unsigned g_numRecvd; -TestClient::TestClient(const std::string &serverAddress, unsigned short serverPort) +TestClient::TestClient(const std::string &serverAddress, uint16_t serverPort) : m_conState(CON_DISCONNECT), m_serverAddress(serverAddress), m_serverPort(serverPort) diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.h index dc35ef6d..1b03083c 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.h @@ -17,7 +17,7 @@ class TestClient : public TcpConnectionHandler { public: - TestClient(const std::string &serverAddress, unsigned short serverPort); + TestClient(const std::string &serverAddress, uint16_t serverPort); virtual ~TestClient(); void process(); @@ -35,7 +35,7 @@ private: TcpManager *m_manager; TcpConnection *m_con; std::string m_serverAddress; - unsigned short m_serverPort; + uint16_t m_serverPort; time_t m_conTimeout; }; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.ncb b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.ncb index 33e8cf9e..9683ad27 100644 Binary files a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.ncb and b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestClient/TestClient.ncb differ diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestServer/TestServer.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestServer/TestServer.cpp index 97b9a951..70966477 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestServer/TestServer.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestServer/TestServer.cpp @@ -1,7 +1,7 @@ #include "TestServer.h" -TestServer::TestServer(unsigned short port) +TestServer::TestServer(uint16_t port) : m_port(port) { TcpManager::TcpParams params; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestServer/TestServer.h b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestServer/TestServer.h index cd0e93ab..5da7ef84 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestServer/TestServer.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/TestServer/TestServer.h @@ -13,7 +13,7 @@ class Connection; class TestServer : public TcpManagerHandler { public: - TestServer(unsigned short port); + TestServer(uint16_t port); virtual ~TestServer(); void process(); @@ -23,7 +23,7 @@ public: void removeConnection(Connection *con); private: - unsigned short m_port; + uint16_t m_port; TcpManager *m_manager; std::list m_connections; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/Unicode.h b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/Unicode.h index 5288d694..f30a3a0b 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/Unicode.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/Unicode.h @@ -29,7 +29,7 @@ namespace NAMESPACE namespace Plat_Unicode { - typedef unsigned short unicode_char_t; + typedef uint16_t unicode_char_t; /** * Standard Unicode string is UTF-16 diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterData.h b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterData.h index 22e76cd7..b0399e8a 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterData.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeCharacterData.h @@ -19,6 +19,8 @@ // ====================================================================== +#include + #ifdef EXTERNAL_DISTRO namespace NAMESPACE { @@ -26,7 +28,7 @@ namespace NAMESPACE namespace Plat_Unicode { - typedef unsigned short unicode_char_t; //lint !e761 redundant typedef + typedef uint16_t unicode_char_t; //lint !e761 redundant typedef struct CharData; diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeUtils.h b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeUtils.h index ab466482..91be63a7 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeUtils.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/UnicodeUtils.h @@ -114,7 +114,7 @@ namespace Plat_Unicode * Compares str1 and str2, where str1 is a String and str2 is templated, * thus could be a std::string as well. Unlike caseInsensitiveCompare, this * version returns an int for < or > comparisons, and comparison must start - * at the front. Note that this kind of comparison does not allow the shortcut + * at the front. Note that this kind of comparison does not allow the int16_tcut * of first comparing sizes--every character must be compared up to the last one. */ template int caseInsensitiveCompareInt (const String & str1, const T & str2) diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.h b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.h index 86251e81..0a9f054f 100755 --- a/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.h +++ b/external/3rd/library/soePlatform/CSAssist/utils/Unicode/utf8.h @@ -13,7 +13,7 @@ namespace Plat_Unicode { typedef char UTF8; -typedef unsigned short int UTF16; +typedef uint16_t UTF16; int UTF8_charSize( char * ); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Platform.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Platform.h index 2bdb170b..fa7918d7 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Platform.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/Platform.h @@ -70,7 +70,7 @@ namespace Base // return (uint64(byteReverse(uint32(value))) << 32) | byteReverse(uint32(value>>32)); } - inline uint32 strlen(const unsigned short * string) + inline uint32 strlen(const uint16_t * string) { if (string == 0) return 0; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/linux/Types.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/linux/Types.h index 69419a0f..c9f2e7f3 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/linux/Types.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/linux/Types.h @@ -11,7 +11,7 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -28,15 +28,17 @@ namespace Base #define UINT32_MAX 0xFFFFFFFF #endif -typedef signed char int8; -typedef unsigned char uint8; -typedef signed short int16; -typedef unsigned short uint16; + + +typedef int8_t int8; +typedef uint8_t uint8; +typedef int16_t int16; +typedef uint16_t uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h index 0c64cb2c..24d0b66c 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Base/win32/Types.h @@ -25,8 +25,8 @@ namespace Base typedef signed char int8; typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; +typedef int16_t int16; +typedef uint16_t uint16; typedef int int32; typedef unsigned uint32; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTEnum.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTEnum.h index 17654be3..840f3f1e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTEnum.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTEnum.h @@ -1,6 +1,8 @@ #ifndef CTENUM_H #define CTENUM_H +#include + namespace CTService { diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCharacter.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCharacter.h index b880941a..f72d8f7e 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCharacter.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCharacter.h @@ -1,6 +1,8 @@ #ifndef CTSERVICECHARACTER_H #define CTSERVICECHARACTER_H +#include + namespace CTService { @@ -8,7 +10,7 @@ namespace CTService class CTServiceCharacter //-------------------------------------------------------- { - typedef unsigned short uchar_t; + typedef uint16_t uchar_t; inline void copy_wide_string(uchar_t * target, const uchar_t * source, int length) { if (!target) @@ -34,7 +36,7 @@ class CTServiceCharacter mMoveReason[0] = 0; mTransferReason[0]= 0; } - CTServiceCharacter(const unsigned short *ch) : mCharacter(), mCanRename(true), mCanMove(true), mCanTransfer(true), mRenameReason(), mMoveReason(), mTransferReason() + CTServiceCharacter(const uint16_t *ch) : mCharacter(), mCanRename(true), mCanMove(true), mCanTransfer(true), mRenameReason(), mMoveReason(), mTransferReason() { copy_wide_string(mCharacter, ch, CHARACTER_BUFFER); mRenameReason[0] = 0; mMoveReason[0] = 0; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCustomer.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCustomer.h index cf5d2f27..2406cbaa 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCustomer.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCustomer.h @@ -10,7 +10,7 @@ namespace CTService class CTServiceCustomer //-------------------------------------------------------- { - inline void copy_wide_string(unsigned short * target, const unsigned short * source, int length) + inline void copy_wide_string(uint16_t * target, const uint16_t * source, int length) { if (!target) return; @@ -58,68 +58,68 @@ class CTServiceCustomer mCardExpirationYear[0]= 0; } - void SetFirstName(const unsigned short * value) { copy_wide_string(mFirstName, value, SHORT_NAME_BUFFER); } - unsigned short *GetFirstName() { return mFirstName; } + void SetFirstName(const uint16_t * value) { copy_wide_string(mFirstName, value, SHORT_NAME_BUFFER); } + uint16_t *GetFirstName() { return mFirstName; } - void SetLastName(const unsigned short * value) { copy_wide_string(mLastName, value, SHORT_NAME_BUFFER); } - unsigned short *GetLastName() { return mLastName; } + void SetLastName(const uint16_t * value) { copy_wide_string(mLastName, value, SHORT_NAME_BUFFER); } + uint16_t *GetLastName() { return mLastName; } - void SetPhone(const unsigned short * value) { copy_wide_string(mPhone, value, PHONE_BUFFER); } - unsigned short *GetPhone() { return mPhone; } + void SetPhone(const uint16_t * value) { copy_wide_string(mPhone, value, PHONE_BUFFER); } + uint16_t *GetPhone() { return mPhone; } - void SetEmail(const unsigned short * value) { copy_wide_string(mEmail, value, EMAIL_BUFFER); } - unsigned short *GetEmail() { return mEmail; } + void SetEmail(const uint16_t * value) { copy_wide_string(mEmail, value, EMAIL_BUFFER); } + uint16_t *GetEmail() { return mEmail; } void SetStationID(const unsigned value) { mStationID = value; } unsigned GetStationID() { return mStationID; } - void SetCardName(const unsigned short * value) { copy_wide_string(mCardName, value, CARD_NAME_BUFFER); } - unsigned short *GetCardName() { return mCardName; } + void SetCardName(const uint16_t * value) { copy_wide_string(mCardName, value, CARD_NAME_BUFFER); } + uint16_t *GetCardName() { return mCardName; } - void SetCardAddress1(const unsigned short * value) { copy_wide_string(mCardAddress1, value, CARD_ADDRESS1_BUFFER); } - unsigned short *GetCardAddress1() { return mCardAddress1; } + void SetCardAddress1(const uint16_t * value) { copy_wide_string(mCardAddress1, value, CARD_ADDRESS1_BUFFER); } + uint16_t *GetCardAddress1() { return mCardAddress1; } - void SetCardAddress2(const unsigned short * value) { copy_wide_string(mCardAddress2, value, CARD_ADDRESS2_BUFFER); } - unsigned short *GetCardAddress2() { return mCardAddress2; } + void SetCardAddress2(const uint16_t * value) { copy_wide_string(mCardAddress2, value, CARD_ADDRESS2_BUFFER); } + uint16_t *GetCardAddress2() { return mCardAddress2; } - void SetCardCity(const unsigned short * value) { copy_wide_string(mCardCity, value, CARD_CITY_BUFFER); } - unsigned short *GetCardCity() { return mCardCity; } + void SetCardCity(const uint16_t * value) { copy_wide_string(mCardCity, value, CARD_CITY_BUFFER); } + uint16_t *GetCardCity() { return mCardCity; } - void SetCardState(const unsigned short * value) { copy_wide_string(mCardState, value, CARD_STATE_BUFFER); } - unsigned short *GetCardState() { return mCardState; } + void SetCardState(const uint16_t * value) { copy_wide_string(mCardState, value, CARD_STATE_BUFFER); } + uint16_t *GetCardState() { return mCardState; } - void SetCardZip(const unsigned short * value) { copy_wide_string(mCardZip, value, CARD_ZIP_BUFFER); } - unsigned short *GetCardZip() { return mCardZip; } + void SetCardZip(const uint16_t * value) { copy_wide_string(mCardZip, value, CARD_ZIP_BUFFER); } + uint16_t *GetCardZip() { return mCardZip; } - void SetCountry(const unsigned short * value) { copy_wide_string(mCountry, value, CARD_COUNTRY_BUFFER); } - unsigned short *GetCountry() { return mCountry; } + void SetCountry(const uint16_t * value) { copy_wide_string(mCountry, value, CARD_COUNTRY_BUFFER); } + uint16_t *GetCountry() { return mCountry; } - void SetCardNumber(const unsigned short * value) { copy_wide_string(mCardNumber, value, CARD_NUMBER_BUFFER); } - unsigned short *GetCardNumber() { return mCardNumber; } + void SetCardNumber(const uint16_t * value) { copy_wide_string(mCardNumber, value, CARD_NUMBER_BUFFER); } + uint16_t *GetCardNumber() { return mCardNumber; } - void SetCardExpirationMonth(const unsigned short * value){ copy_wide_string(mCardExpirationMonth, value, CARD_EXPIRATION_MONTH_BUFFER); } - unsigned short *GetCardExpirationMonth() { return mCardExpirationMonth; } + void SetCardExpirationMonth(const uint16_t * value){ copy_wide_string(mCardExpirationMonth, value, CARD_EXPIRATION_MONTH_BUFFER); } + uint16_t *GetCardExpirationMonth() { return mCardExpirationMonth; } - void SetCardExpirationYear(const unsigned short * value) { copy_wide_string(mCardExpirationYear, value, CARD_EXPIRATION_YEAR_BUFFER); } - unsigned short *GetCardExpirationYear() { return mCardExpirationYear; } + void SetCardExpirationYear(const uint16_t * value) { copy_wide_string(mCardExpirationYear, value, CARD_EXPIRATION_YEAR_BUFFER); } + uint16_t *GetCardExpirationYear() { return mCardExpirationYear; } private: - unsigned short mFirstName[SHORT_NAME_BUFFER]; - unsigned short mLastName[SHORT_NAME_BUFFER]; - unsigned short mPhone[PHONE_BUFFER]; - unsigned short mEmail[EMAIL_BUFFER]; + uint16_t mFirstName[SHORT_NAME_BUFFER]; + uint16_t mLastName[SHORT_NAME_BUFFER]; + uint16_t mPhone[PHONE_BUFFER]; + uint16_t mEmail[EMAIL_BUFFER]; unsigned mStationID; - unsigned short mCardName[CARD_NAME_BUFFER]; - unsigned short mCardAddress1[CARD_ADDRESS1_BUFFER]; - unsigned short mCardAddress2[CARD_ADDRESS2_BUFFER]; - unsigned short mCardCity[CARD_CITY_BUFFER]; - unsigned short mCardState[CARD_STATE_BUFFER]; - unsigned short mCardZip[CARD_ZIP_BUFFER]; - unsigned short mCountry[CARD_COUNTRY_BUFFER]; - unsigned short mCardNumber[CARD_NUMBER_BUFFER]; - unsigned short mCardExpirationMonth[CARD_EXPIRATION_MONTH_BUFFER]; - unsigned short mCardExpirationYear[CARD_EXPIRATION_YEAR_BUFFER]; + uint16_t mCardName[CARD_NAME_BUFFER]; + uint16_t mCardAddress1[CARD_ADDRESS1_BUFFER]; + uint16_t mCardAddress2[CARD_ADDRESS2_BUFFER]; + uint16_t mCardCity[CARD_CITY_BUFFER]; + uint16_t mCardState[CARD_STATE_BUFFER]; + uint16_t mCardZip[CARD_ZIP_BUFFER]; + uint16_t mCountry[CARD_COUNTRY_BUFFER]; + uint16_t mCardNumber[CARD_NUMBER_BUFFER]; + uint16_t mCardExpirationMonth[CARD_EXPIRATION_MONTH_BUFFER]; + uint16_t mCardExpirationYear[CARD_EXPIRATION_YEAR_BUFFER]; }; }; // namespace diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBOrder.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBOrder.h index cbd79ad8..1e0dfb55 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBOrder.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBOrder.h @@ -13,7 +13,7 @@ namespace CTService class CTServiceDBOrder //-------------------------------------------------------- { - inline void copy_wide_string(unsigned short * target, const unsigned short * source, int length) + inline void copy_wide_string(uint16_t * target, const uint16_t * source, int length) { if (!target) return; @@ -104,39 +104,39 @@ class CTServiceDBOrder void SetGameCode(const char * value) { if (value) strncpy(mGameCode, value, GAME_CODE_BUFFER); else mGameCode[0] = 0; } const char * GetGameCode() { return mGameCode; } - // unsigned short - void SetCustomerFirstName(const unsigned short * value) { copy_wide_string(mCustomerFirstName, value, CUSTOMER_NAME_BUFFER); } - unsigned short *GetCustomerFirstName() { return mCustomerFirstName; } + // uint16_t + void SetCustomerFirstName(const uint16_t * value) { copy_wide_string(mCustomerFirstName, value, CUSTOMER_NAME_BUFFER); } + uint16_t *GetCustomerFirstName() { return mCustomerFirstName; } - void SetCustomerLastName(const unsigned short * value) { copy_wide_string(mCustomerLastName, value, CUSTOMER_NAME_BUFFER); } - unsigned short *GetCustomerLastName() { return mCustomerLastName; } + void SetCustomerLastName(const uint16_t * value) { copy_wide_string(mCustomerLastName, value, CUSTOMER_NAME_BUFFER); } + uint16_t *GetCustomerLastName() { return mCustomerLastName; } - void SetCustomerPhone(const unsigned short * value) { copy_wide_string(mCustomerPhone, value, CUSTOMER_PHONE_BUFFER); } - unsigned short *GetCustomerPhone() { return mCustomerPhone; } + void SetCustomerPhone(const uint16_t * value) { copy_wide_string(mCustomerPhone, value, CUSTOMER_PHONE_BUFFER); } + uint16_t *GetCustomerPhone() { return mCustomerPhone; } - void SetCustomerEmail(const unsigned short * value) { copy_wide_string(mCustomerEmail, value, CUSTOMER_EMAIL_BUFFER); } - unsigned short *GetCustomerEmail() { return mCustomerEmail; } + void SetCustomerEmail(const uint16_t * value) { copy_wide_string(mCustomerEmail, value, CUSTOMER_EMAIL_BUFFER); } + uint16_t *GetCustomerEmail() { return mCustomerEmail; } - void SetCardName(const unsigned short * value) { copy_wide_string(mCardName, value, CARD_INFO_BUFFER); } - unsigned short *GetCardName() { return mCardName; } + void SetCardName(const uint16_t * value) { copy_wide_string(mCardName, value, CARD_INFO_BUFFER); } + uint16_t *GetCardName() { return mCardName; } - void SetCardAddress1(const unsigned short * value) { copy_wide_string(mCardAddress1, value, CARD_INFO_BUFFER); } - unsigned short *GetCardAddress1() { return mCardAddress1; } + void SetCardAddress1(const uint16_t * value) { copy_wide_string(mCardAddress1, value, CARD_INFO_BUFFER); } + uint16_t *GetCardAddress1() { return mCardAddress1; } - void SetCardAddress2(const unsigned short * value) { copy_wide_string(mCardAddress2, value, CARD_INFO_BUFFER); } - unsigned short *GetCardAddress2() { return mCardAddress2; } + void SetCardAddress2(const uint16_t * value) { copy_wide_string(mCardAddress2, value, CARD_INFO_BUFFER); } + uint16_t *GetCardAddress2() { return mCardAddress2; } - void SetCardCity(const unsigned short * value) { copy_wide_string(mCardCity, value, CARD_INFO_BUFFER); } - unsigned short *GetCardCity() { return mCardCity; } + void SetCardCity(const uint16_t * value) { copy_wide_string(mCardCity, value, CARD_INFO_BUFFER); } + uint16_t *GetCardCity() { return mCardCity; } - void SetCardState(const unsigned short * value) { copy_wide_string(mCardState, value, CARD_INFO_BUFFER); } - unsigned short *GetCardState() { return mCardState; } + void SetCardState(const uint16_t * value) { copy_wide_string(mCardState, value, CARD_INFO_BUFFER); } + uint16_t *GetCardState() { return mCardState; } - void SetCardZip(const unsigned short * value) { copy_wide_string(mCardZip, value, CARD_INFO_BUFFER); } - unsigned short *GetCardZip() { return mCardZip; } + void SetCardZip(const uint16_t * value) { copy_wide_string(mCardZip, value, CARD_INFO_BUFFER); } + uint16_t *GetCardZip() { return mCardZip; } - void SetCountry(const unsigned short * value) { copy_wide_string(mCountry, value, COUNTRY_BUFFER); } - unsigned short *GetCountry() { return mCountry; } + void SetCountry(const uint16_t * value) { copy_wide_string(mCountry, value, COUNTRY_BUFFER); } + uint16_t *GetCountry() { return mCountry; } private: unsigned mOrderID; @@ -145,17 +145,17 @@ class CTServiceDBOrder char mLanguage[LANGUAGE_BUFFER]; char mGameCode[GAME_CODE_BUFFER]; unsigned mStationID; - unsigned short mCustomerFirstName[CUSTOMER_NAME_BUFFER]; - unsigned short mCustomerLastName[CUSTOMER_NAME_BUFFER]; - unsigned short mCustomerPhone[CUSTOMER_PHONE_BUFFER]; - unsigned short mCustomerEmail[CUSTOMER_EMAIL_BUFFER]; - unsigned short mCardName[CARD_INFO_BUFFER]; - unsigned short mCardAddress1[CARD_INFO_BUFFER]; - unsigned short mCardAddress2[CARD_INFO_BUFFER]; - unsigned short mCardCity[CARD_INFO_BUFFER]; - unsigned short mCardState[CARD_INFO_BUFFER]; - unsigned short mCardZip[CARD_INFO_BUFFER]; - unsigned short mCountry[COUNTRY_BUFFER]; + uint16_t mCustomerFirstName[CUSTOMER_NAME_BUFFER]; + uint16_t mCustomerLastName[CUSTOMER_NAME_BUFFER]; + uint16_t mCustomerPhone[CUSTOMER_PHONE_BUFFER]; + uint16_t mCustomerEmail[CUSTOMER_EMAIL_BUFFER]; + uint16_t mCardName[CARD_INFO_BUFFER]; + uint16_t mCardAddress1[CARD_INFO_BUFFER]; + uint16_t mCardAddress2[CARD_INFO_BUFFER]; + uint16_t mCardCity[CARD_INFO_BUFFER]; + uint16_t mCardState[CARD_INFO_BUFFER]; + uint16_t mCardZip[CARD_INFO_BUFFER]; + uint16_t mCountry[COUNTRY_BUFFER]; char mCreationDate[DATE_BUFFER]; char mModifyDate[DATE_BUFFER]; char mCompletionDate[DATE_BUFFER]; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h index b96efe7f..3aedc2f4 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h @@ -12,7 +12,7 @@ namespace CTService class CTServiceTransaction //-------------------------------------------------------- { - inline void copy_wide_string(unsigned short * target, const unsigned short * source, int length) + inline void copy_wide_string(uint16_t * target, const uint16_t * source, int length) { if (!target) return; @@ -111,25 +111,25 @@ class CTServiceTransaction void SetTransferServerPort(const char * value) { if (value) strncpy(mTransferServerPort, value, NAME_BUFFER); else mTransferServerPort[0] = 0; } const char * GetTransferServerPort() { return mTransferServerPort; } - // unsigned short + // uint16_t - void SetSuggestedName(const unsigned short * value) { copy_wide_string(mSuggestedName, value, NAME_BUFFER); } - unsigned short *GetSuggestedName() { return mSuggestedName; } + void SetSuggestedName(const uint16_t * value) { copy_wide_string(mSuggestedName, value, NAME_BUFFER); } + uint16_t *GetSuggestedName() { return mSuggestedName; } - void SetSourceServer(const unsigned short * value) { copy_wide_string(mSourceServer, value, NAME_BUFFER); } - unsigned short *GetSourceServer() { return mSourceServer; } + void SetSourceServer(const uint16_t * value) { copy_wide_string(mSourceServer, value, NAME_BUFFER); } + uint16_t *GetSourceServer() { return mSourceServer; } - void SetDestServer(const unsigned short * value) { copy_wide_string(mDestServer, value, NAME_BUFFER); } - unsigned short *GetDestServer() { return mDestServer; } + void SetDestServer(const uint16_t * value) { copy_wide_string(mDestServer, value, NAME_BUFFER); } + uint16_t *GetDestServer() { return mDestServer; } - void SetSourceCharacter(const unsigned short * value) { copy_wide_string(mSourceCharacter, value, NAME_BUFFER); } - unsigned short *GetSourceCharacter() { return mSourceCharacter; } + void SetSourceCharacter(const uint16_t * value) { copy_wide_string(mSourceCharacter, value, NAME_BUFFER); } + uint16_t *GetSourceCharacter() { return mSourceCharacter; } - void SetDestCharacter(const unsigned short * value) { copy_wide_string(mDestCharacter, value, NAME_BUFFER); } - unsigned short *GetDestCharacter() { return mDestCharacter; } + void SetDestCharacter(const uint16_t * value) { copy_wide_string(mDestCharacter, value, NAME_BUFFER); } + uint16_t *GetDestCharacter() { return mDestCharacter; } - void SetDestStationName(const unsigned short * value) { copy_wide_string(mDestStationName, value, NAME_BUFFER); } - unsigned short *GetDestStationName() { return mDestStationName; } + void SetDestStationName(const uint16_t * value) { copy_wide_string(mDestStationName, value, NAME_BUFFER); } + uint16_t *GetDestStationName() { return mDestStationName; } private: @@ -137,14 +137,14 @@ class CTServiceTransaction unsigned mOrderID; char mTransactionStatus[TRANSACTIONS_STATUS_BUFFER]; unsigned mGameResultID; - unsigned short mSuggestedName[NAME_BUFFER]; + uint16_t mSuggestedName[NAME_BUFFER]; char mGameCode[GAME_CODE_BUFFER]; - unsigned short mSourceServer[NAME_BUFFER]; - unsigned short mDestServer[NAME_BUFFER]; - unsigned short mSourceCharacter[NAME_BUFFER]; - unsigned short mDestCharacter[NAME_BUFFER]; + uint16_t mSourceServer[NAME_BUFFER]; + uint16_t mDestServer[NAME_BUFFER]; + uint16_t mSourceCharacter[NAME_BUFFER]; + uint16_t mDestCharacter[NAME_BUFFER]; unsigned mSourceUID; - unsigned short mDestStationName[NAME_BUFFER]; + uint16_t mDestStationName[NAME_BUFFER]; unsigned mDestUID; unsigned mWithItems; unsigned mOverride; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceServer.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceServer.h index 5cef4bde..ef3c909d 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceServer.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceServer.h @@ -1,6 +1,8 @@ #ifndef CTSERVICESERVER_H #define CTSERVICESERVER_H +#include + namespace CTService { @@ -8,7 +10,7 @@ namespace CTService class CTServiceServer //-------------------------------------------------------- { - inline void copy_wide_string(unsigned short * target, const unsigned short * source, int length) + inline void copy_wide_string(uint16_t * target, const uint16_t * source, int length) { if (!target) return; @@ -33,14 +35,14 @@ class CTServiceServer mMoveReason[0] = 0; mTransferReason[0]= 0; } - CTServiceServer(const unsigned short *server) : mServer(), mCanRename(true), mCanMove(true), mCanTransfer(true), mRenameReason(), mMoveReason(), mTransferReason() + CTServiceServer(const uint16_t *server) : mServer(), mCanRename(true), mCanMove(true), mCanTransfer(true), mRenameReason(), mMoveReason(), mTransferReason() { copy_wide_string(mServer, server, SERVER_BUFFER); mRenameReason[0] = 0; mMoveReason[0] = 0; mTransferReason[0]= 0; } - void SetServer(const unsigned short * value) { copy_wide_string(mServer, value, SERVER_BUFFER); } - unsigned short *GetServer() { return mServer; } + void SetServer(const uint16_t * value) { copy_wide_string(mServer, value, SERVER_BUFFER); } + uint16_t *GetServer() { return mServer; } void SetCanRename(const bool value) { mCanRename = value; } const bool GetCanRename() const { return mCanRename; } @@ -49,21 +51,21 @@ class CTServiceServer void SetCanTransfer(const bool value) { mCanTransfer = value; } const bool GetCanTransfer() const { return mCanTransfer; } - void SetRenameReason(const unsigned short * value) { copy_wide_string(mRenameReason, value, REASON_BUFFER); } - const unsigned short * GetRenameReason() const { return mRenameReason; } - void SetMoveReason(const unsigned short * value) { copy_wide_string(mMoveReason, value, REASON_BUFFER); } - const unsigned short * GetMoveReason() const { return mMoveReason; } - void SetTransferReason(const unsigned short * value) { copy_wide_string(mTransferReason, value, REASON_BUFFER); } - const unsigned short * GetTransferReason() const { return mTransferReason; } + void SetRenameReason(const uint16_t * value) { copy_wide_string(mRenameReason, value, REASON_BUFFER); } + const uint16_t * GetRenameReason() const { return mRenameReason; } + void SetMoveReason(const uint16_t * value) { copy_wide_string(mMoveReason, value, REASON_BUFFER); } + const uint16_t * GetMoveReason() const { return mMoveReason; } + void SetTransferReason(const uint16_t * value) { copy_wide_string(mTransferReason, value, REASON_BUFFER); } + const uint16_t * GetTransferReason() const { return mTransferReason; } private: - unsigned short mServer[SERVER_BUFFER]; + uint16_t mServer[SERVER_BUFFER]; bool mCanRename; bool mCanMove; bool mCanTransfer; - unsigned short mRenameReason[REASON_BUFFER]; - unsigned short mMoveReason[REASON_BUFFER]; - unsigned short mTransferReason[REASON_BUFFER]; + uint16_t mRenameReason[REASON_BUFFER]; + uint16_t mMoveReason[REASON_BUFFER]; + uint16_t mTransferReason[REASON_BUFFER]; }; }; // namespace diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceWebAPITransaction.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceWebAPITransaction.h index 47005521..6c86939f 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceWebAPITransaction.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceWebAPITransaction.h @@ -12,7 +12,7 @@ namespace CTService class CTServiceWebAPITransaction //-------------------------------------------------------- { - inline void copy_wide_string(unsigned short * target, const unsigned short * source, int length) + inline void copy_wide_string(uint16_t * target, const uint16_t * source, int length) { if (!target) return; @@ -28,7 +28,7 @@ class CTServiceWebAPITransaction offset++; } } - typedef unsigned short uchar_t; + typedef uint16_t uchar_t; public: enum { CHARACTER_SIZE=64, CHARACTER_BUFFER, @@ -51,25 +51,25 @@ class CTServiceWebAPITransaction // void SetGameCode(const char * value) { strncpy(mGameCode, value, GAMECODE_BUFFER); } const char * GetGameCode() const { return mGameCode; } - void SetSourceServerName(const unsigned short * value) { copy_wide_string(mSourceServerName, value, SERVER_BUFFER); } + void SetSourceServerName(const uint16_t * value) { copy_wide_string(mSourceServerName, value, SERVER_BUFFER); } const uchar_t * GetSourceServerName() const { return mSourceServerName; } - void SetDestServerName(const unsigned short * value) { copy_wide_string(mDestServerName, value, SERVER_BUFFER); } + void SetDestServerName(const uint16_t * value) { copy_wide_string(mDestServerName, value, SERVER_BUFFER); } const uchar_t * GetDestServerName() const { return mDestServerName; } - void SetSourceCharacterName(const unsigned short * value){ copy_wide_string(mSourceCharacterName, value, CHARACTER_BUFFER); } + void SetSourceCharacterName(const uint16_t * value){ copy_wide_string(mSourceCharacterName, value, CHARACTER_BUFFER); } const uchar_t * GetSourceCharacterName() const { return mSourceCharacterName; } - void SetDestCharacterName(const unsigned short * value) { copy_wide_string(mDestCharacterName, value, CHARACTER_BUFFER); } + void SetDestCharacterName(const uint16_t * value) { copy_wide_string(mDestCharacterName, value, CHARACTER_BUFFER); } const uchar_t * GetDestCharacterName() const { return mDestCharacterName; } void SetSourceUID(const unsigned value) { mSourceUID = value; } unsigned GetSourceUID() { return mSourceUID; } - void SetDestStationName(const unsigned short * value) { copy_wide_string(mDestStationName, value, STATION_NAME_BUFFER); } + void SetDestStationName(const uint16_t * value) { copy_wide_string(mDestStationName, value, STATION_NAME_BUFFER); } const uchar_t * GetDestStationName() const { return mDestStationName; } - void SetDestStationPassword(const unsigned short * value){ copy_wide_string(mDestStationPassword, value, STATION_PASSWORD_BUFFER); } + void SetDestStationPassword(const uint16_t * value){ copy_wide_string(mDestStationPassword, value, STATION_PASSWORD_BUFFER); } const uchar_t * GetDestStationPassword() const { return mDestStationPassword; } void SetWithItems(const bool value) { mWithItems = value; } diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp index 527f5b69..cc11671b 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp @@ -27,7 +27,7 @@ ServerTrackObject::ServerTrackObject(unsigned mapped_track, unsigned real_track, //---------------------------------------- GenericAPICore::GenericAPICore(const char *host, - short port, + int16_t port, unsigned reqTimeout, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, @@ -52,7 +52,7 @@ GenericAPICore::GenericAPICore(const char *host, //---------------------------------------- GenericAPICore::GenericAPICore(const char *game, const char *hosts[], - const short port[], + const int16_t port[], unsigned arraySize, unsigned reqTimeout, unsigned reconnectTimeout, diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.h index af66fc9b..e2c9a212 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.h @@ -51,7 +51,7 @@ public: friend class GenericConnection; GenericAPICore(const char *host, - short port, + int16_t port, unsigned reqTimeout, unsigned reconnectTimeout, unsigned noDataTimeoutSecs = 5, @@ -66,7 +66,7 @@ public: * ALSO: cannot specify a 0 array size. */ GenericAPICore(const char *game, const char *hosts[], - const short port[], + const int16_t port[], unsigned arraySize, unsigned reqTimeout, unsigned reconnectTimeout, @@ -80,7 +80,7 @@ public: virtual ~GenericAPICore(); void process(); - virtual void responseCallback(short type, Base::ByteStream::ReadIterator &iter, GenericConnection *con) = 0; + virtual void responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter, GenericConnection *con) = 0; virtual void responseCallback(GenericResponse *R) = 0; virtual void OnDisconnect(GenericConnection *con) = 0; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp index ae67918e..8997f142 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.cpp @@ -19,7 +19,7 @@ namespace NAMESPACE using namespace std; using namespace Base; - GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) + GenericConnection::GenericConnection(const char *host, int16_t port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB) : m_bConnected(CON_NONE), m_apiCore(apiCore), m_con(nullptr), @@ -83,7 +83,7 @@ namespace NAMESPACE void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *data, int dataLen) { - short type; + int16_t type; unsigned track; ByteStream msg(data, dataLen); @@ -164,7 +164,7 @@ namespace NAMESPACE // identifying us // m_apiCore->OnConnect(this); Base::ByteStream msg; - put(msg, (short)CTService::CTGAME_REQUEST_CONNECT); + put(msg, (int16_t)CTService::CTGAME_REQUEST_CONNECT); put(msg, (unsigned)0); // track put(msg, (unsigned)API_VERSION_CODE); put(msg, m_apiCore->getGameCode()); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.h index 8ace9864..83911435 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericConnection.h @@ -39,7 +39,7 @@ class GenericConnection : public TcpConnectionHandler { public: GenericConnection(const char *host, - short port, + int16_t port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs = 5, @@ -55,7 +55,7 @@ class GenericConnection : public TcpConnectionHandler virtual void OnTerminated(TcpConnection *con); void Send(Base::ByteStream &msg); inline const char *getHost() const { return m_host.c_str(); } - inline const short getPort() const { return m_port; } + inline const int16_t getPort() const { return m_port; } inline eConnectStatus isConnected() { return m_bConnected; } void disconnect(); @@ -67,7 +67,7 @@ private: TcpManager *m_manager; TcpConnection *m_con; std::string m_host; - short m_port; + int16_t m_port; unsigned m_lastTrack; eConState m_conState; time_t m_conTimeout; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.cpp index 695d9442..54e89f19 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.cpp @@ -16,14 +16,14 @@ namespace NAMESPACE using namespace Base; //------------------------------------------- - GenericRequest::GenericRequest(short type, unsigned server_track) + GenericRequest::GenericRequest(int16_t type, unsigned server_track) : m_type(type), m_server_track(server_track), m_track(0), m_timeout(100) //------------------------------------------- { } //------------------------------------------- - GenericResponse::GenericResponse(short type, unsigned result, void *user) + GenericResponse::GenericResponse(int16_t type, unsigned result, void *user) : m_type(type), m_result(result), m_user(user), m_track(0), m_timeout(100) //------------------------------------------- { diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.h index dec032a6..16a709f0 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericMessage.h @@ -22,11 +22,11 @@ class GenericRequest //------------------------------------------- { public: - GenericRequest(short type, unsigned server_track = 0); + GenericRequest(int16_t type, unsigned server_track = 0); virtual ~GenericRequest() {}; virtual void pack(Base::ByteStream &msg) = 0; - short getType() const { return m_type; } + int16_t getType() const { return m_type; } void setTimeout(time_t t) { m_timeout = t; } time_t getTimeout() { return m_timeout; } void setTrack(unsigned t) { m_track = t; } @@ -35,7 +35,7 @@ public: inline void setServerTrack(unsigned track) { m_server_track = track; } protected: - short m_type; + int16_t m_type; unsigned m_track; time_t m_timeout; unsigned m_server_track; @@ -49,11 +49,11 @@ class GenericResponse //------------------------------------------- { public: - GenericResponse(short type, unsigned result, void *user); + GenericResponse(int16_t type, unsigned result, void *user); virtual ~GenericResponse() {}; virtual void unpack(Base::ByteStream::ReadIterator &iter); - short getType() const { return m_type; } + int16_t getType() const { return m_type; } void setTimeout(time_t t) { m_timeout = t; } time_t getTimeout() { return m_timeout; } void setTrack(unsigned t) { m_track = t; } @@ -62,7 +62,7 @@ public: void setResult(unsigned res) { m_result = res; } void * getUser() const { return m_user; } protected: - short m_type; + int16_t m_type; unsigned m_track; unsigned m_result; void *m_user; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp index 4e6b0954..cc7ea2a0 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.cpp @@ -6,10 +6,10 @@ #include "Request.h" #include "Response.h" -const unsigned short EMPTY_STRING[1] = { 0 }; +const uint16_t EMPTY_STRING[1] = { 0 }; const char * DEFAULT_GAMECODE = "SWG"; const char * DEFAULT_HOST = "localhost"; -const unsigned short DEFAULT_PORT = 2000; +const uint16_t DEFAULT_PORT = 2000; namespace CTService { @@ -21,7 +21,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) //----------------------------------------------- { std::vector hostArray; - std::vector portArray; + std::vector portArray; char hostConfig[4096]; if (hostName == nullptr) hostName = DEFAULT_HOST; @@ -34,7 +34,7 @@ CTServiceAPI::CTServiceAPI(const char *hostName, const char *game) { char * host = ptr; char * portStr = strchr(host, ':'); - unsigned short port = DEFAULT_PORT; + uint16_t port = DEFAULT_PORT; if (portStr) { *portStr++ = 0; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.h index a51104c1..9e0c3fea 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPI.h @@ -13,7 +13,7 @@ namespace CTService class CTServiceAPICore; -typedef unsigned short CTUnicodeChar; +typedef uint16_t CTUnicodeChar; //-------------------------------------- class CTServiceAPI @@ -23,8 +23,8 @@ public: CTServiceAPI(const char *hostName, const char *game); // hostName: "addr1:port1 addr2:port2" virtual ~CTServiceAPI(); - virtual void onConnect(const char *host, const short port, const short current, const short max) = 0; - virtual void onDisconnect(const char *host, const short port, const short current, const short max) = 0; + virtual void onConnect(const char *host, const int16_t port, const int16_t current, const int16_t max) = 0; + virtual void onDisconnect(const char *host, const int16_t port, const int16_t current, const int16_t max) = 0; void process(); // ----- Requests generated by API ----- diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPICore.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPICore.cpp index 347c88ea..87137fd6 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPICore.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPICore.cpp @@ -10,7 +10,7 @@ using namespace Base; using namespace Plat_Unicode; //---------------------------------------- -CTServiceAPICore::CTServiceAPICore(const char *host[], const short port[], int count, CTServiceAPI *api, const char *game) +CTServiceAPICore::CTServiceAPICore(const char *host[], const int16_t port[], int count, CTServiceAPI *api, const char *game) : GenericAPICore(game, host, port, count, 45, 5, 0, 90, 32, 32), m_api(api), m_mappedServerTrack(1000) //---------------------------------------- @@ -40,7 +40,7 @@ void CTServiceAPICore::OnDisconnect(GenericConnection *con) } //---------------------------------------- -void CTServiceAPICore::responseCallback(short type, Base::ByteStream::ReadIterator &iter, GenericConnection *con) +void CTServiceAPICore::responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter, GenericConnection *con) // Received a request/notification from the server //---------------------------------------- { diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPICore.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPICore.h index dad7e3d0..690ea57c 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPICore.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTServiceAPICore.h @@ -17,13 +17,13 @@ class CTServiceAPICore : public GenericAPICore //--------------------------------------------------- { public: - CTServiceAPICore(const char *hostName[], const short port[], int count, CTServiceAPI *api, const char *game); + CTServiceAPICore(const char *hostName[], const int16_t port[], int count, CTServiceAPI *api, const char *game); virtual ~CTServiceAPICore(); void OnConnect(GenericConnection *con); void OnDisconnect(GenericConnection *con); void responseCallback(GenericResponse *res); - void responseCallback(short type, Base::ByteStream::ReadIterator &iter, GenericConnection *con); + void responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter, GenericConnection *con); private: diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp index cd2c1f20..83419651 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.cpp @@ -10,7 +10,7 @@ namespace NAMESPACE //used when want to open new connection with this socket -TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout) +TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, int16_t destPort, unsigned timeout) : m_nextConnection(nullptr), m_prevConnection(nullptr), m_socket(INVALID_SOCKET), @@ -93,7 +93,7 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo } //used when server mode creates new connection object representing a connect request -TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort) +TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, int16_t destPort) : m_nextConnection(nullptr), m_prevConnection(nullptr), m_socket(socket), diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h index 92d631d1..aff1b2be 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpConnection.h @@ -88,7 +88,7 @@ public: /** * @brief Returns the port on the other side of this conection. */ - short GetDestinationPort(){ return m_destPort; } + int16_t GetDestinationPort(){ return m_destPort; } /** * @brief Standard AddRef/Release scheme @@ -105,9 +105,9 @@ public: protected: friend class TcpManager; - TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, short destPort, unsigned timeout); + TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, int16_t destPort, unsigned timeout); int finishConnect();/**< returns < 0 if fatal error and connect will not work, =0 if need more time, >0 if connect completed */ - TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, short destPort); + TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, int16_t destPort); TcpConnection *m_nextConnection; /**< Double linked list imp. */ TcpConnection *m_prevConnection; /**< Double linked list imp. */ SOCKET m_socket; @@ -131,7 +131,7 @@ private: Status m_status; TcpConnectionHandler *m_handler; IPAddress m_destIP; - short m_destPort; + int16_t m_destPort; unsigned m_refCount; TcpBlockAllocator *m_sendAllocator; data_block *m_head; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp index bfc84c13..c42b1660 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.cpp @@ -567,7 +567,7 @@ namespace NAMESPACE return processedIncoming; } - TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) + TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, uint16_t serverPort, unsigned timeout) { if (m_boundAsServer) { diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h index c4e8b1cf..5ee74506 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/TcpManager.h @@ -66,7 +66,7 @@ public: * do so in order to navigate company firewalls which may have specific port numbers open to them for this purpose. * default = 0 */ - unsigned short port; + uint16_t port; /** * @ brief Server bind ip. @@ -214,7 +214,7 @@ public: * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ - TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); + TcpConnection *EstablishConnection(const char *serverAddress, uint16_t serverPort, unsigned timeout = 0); /** * @brief Binds this manager as a server which will listen for and accept incoming connections. diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Client.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Client.cpp index 04b4db69..c2b264d7 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Client.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Client.cpp @@ -26,7 +26,7 @@ Client::~Client() //------------------------------------------- -void Client::onConnect(const char *host, short port, short current, short max) +void Client::onConnect(const char *host, int16_t port, int16_t current, int16_t max) //------------------------------------------- { printf("\nConnect to %s:%d (%d of %d)", host, port, current, max); @@ -34,7 +34,7 @@ void Client::onConnect(const char *host, short port, short current, short max) } //------------------------------------------- -void Client::onDisconnect(const char *host, short port, short current, short max) +void Client::onDisconnect(const char *host, int16_t port, int16_t current, int16_t max) //------------------------------------------- { printf("\nDisconnect from %s:%d (%d of %d)", host, port, current, max); diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Client.h b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Client.h index 6320c85c..e103f383 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Client.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TestClient/Client.h @@ -30,8 +30,8 @@ public: Client(const char *hostName, const char *game); virtual ~Client(); - void onConnect(const char *host, const short port, const short current, const short max); - void onDisconnect(const char *host, const short port, const short current, const short max); + void onConnect(const char *host, const int16_t port, const int16_t current, const int16_t max); + void onDisconnect(const char *host, const int16_t port, const int16_t current, const int16_t max); bool m_connected; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/Unicode.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/Unicode.h index 5288d694..f30a3a0b 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/Unicode.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/Unicode.h @@ -29,7 +29,7 @@ namespace NAMESPACE namespace Plat_Unicode { - typedef unsigned short unicode_char_t; + typedef uint16_t unicode_char_t; /** * Standard Unicode string is UTF-16 diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterData.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterData.h index 22e76cd7..b1a3d544 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterData.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeCharacterData.h @@ -17,6 +17,8 @@ #pragma warning (disable:4786) #endif +#include + // ====================================================================== #ifdef EXTERNAL_DISTRO @@ -26,7 +28,7 @@ namespace NAMESPACE namespace Plat_Unicode { - typedef unsigned short unicode_char_t; //lint !e761 redundant typedef + typedef uint16_t unicode_char_t; //lint !e761 redundant typedef struct CharData; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeUtils.h b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeUtils.h index 0a65f8fc..fbc661f9 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeUtils.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/Unicode/UnicodeUtils.h @@ -114,7 +114,7 @@ namespace Plat_Unicode * Compares str1 and str2, where str1 is a String and str2 is templated, * thus could be a std::string as well. Unlike caseInsensitiveCompare, this * version returns an int for < or > comparisons, and comparison must start - * at the front. Note that this kind of comparison does not allow the shortcut + * at the front. Note that this kind of comparison does not allow the int16_tcut * of first comparing sizes--every character must be compared up to the last one. */ template int caseInsensitiveCompareInt (const String & str1, const T & str2) diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp index e24b265e..208fa64b 100755 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/test/main.cpp @@ -12,8 +12,8 @@ namespace CTService Client(const char *hostList, const char *game); virtual ~Client(); - virtual void onConnect(const char *host, const short port, const short current, const short max); - virtual void onDisconnect(const char *host, const short port, const short current, const short max); + virtual void onConnect(const char *host, const int16_t port, const int16_t current, const int16_t max); + virtual void onDisconnect(const char *host, const int16_t port, const int16_t current, const int16_t max); virtual void onTest(const unsigned track, const int resultCode, const unsigned value, void *user); virtual void onReplyTest(const unsigned track, const int resultCode, void *user); @@ -59,17 +59,17 @@ namespace CTService } void Client::onConnect(const char *host, - const short port, - const short current, - const short max) + const int16_t port, + const int16_t current, + const int16_t max) { printf("onConnect(%s, %u, %d, %d)\n",host,port,current,max); } void Client::onDisconnect(const char *host, - const short port, - const short current, - const short max) + const int16_t port, + const int16_t current, + const int16_t max) { printf("onDisconnect(%s, %u, %d, %d)\n",host,port,current,max); } @@ -145,7 +145,7 @@ namespace CTService { unsigned status; unsigned result; - unsigned short * reason = L"makes me horny it does"; + uint16_t * reason = L"makes me horny it does"; printf("#%x onRequestMoveStatus(%s, #%u)\n", server_track, @@ -190,8 +190,8 @@ namespace CTService withItems ? "/w items" : "/wo items"); int result = resultArray[(resultIndex++)%4]; - unsigned short * reason = L"makes me horny it does"; - unsigned short * suggested = L"yoda"; + uint16_t * reason = L"makes me horny it does"; + uint16_t * suggested = L"yoda"; replyValidateMove(server_track, result, reason, suggested, 0); } @@ -222,8 +222,8 @@ namespace CTService withItems ? "/w items" : "/wo items"); int result = resultArray[(resultIndex++)%4]; - unsigned short * reason = L"makes me horny it does"; - unsigned short * suggested = L"yoda"; + uint16_t * reason = L"makes me horny it does"; + uint16_t * suggested = L"yoda"; mTransactionMap[transactionID] = result; replyMove(server_track, result, reason, 0); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp index ca9a7023..aa19755c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.cpp @@ -12,7 +12,7 @@ namespace ChatSystem { -ChatAPI::ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port) +ChatAPI::ChatAPI(const char *registrar_host, int16_t registrar_port, const char *server_host, int16_t server_port) : m_defaultRoomParams(nullptr), m_defaultLoginPriority(0), m_defaultEntryType(false) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h index 0d255ca2..8c31b8c9 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPI.h @@ -106,7 +106,7 @@ namespace ChatSystem // ChatServer (which will automatically reroute the ChatAPI connection to // a hotspare ChatServer if the provided choice is unavailable). // nullptr pointers are NOT valid input. - ChatAPI(const char *registrar_host, short registrar_port, const char *server_host, short server_port); + ChatAPI(const char *registrar_host, int16_t registrar_port, const char *server_host, int16_t server_port); virtual ~ChatAPI(); // setRequestTimeout diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp index 06bea775..0782a436 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.cpp @@ -98,7 +98,7 @@ namespace ChatSystem unsigned ChatAPICore::ms_numErrorStrings = sizeof(ChatAPICore::ms_errorStringsEnglish) / sizeof(const char *); - ChatAPICore::ChatAPICore(const char *registrar_host, short registrar_port, const char *server_host, short server_port) + ChatAPICore::ChatAPICore(const char *registrar_host, int16_t registrar_port, const char *server_host, int16_t server_port) : GenericAPICore(registrar_host, registrar_port, 180 /*request timeout*/, @@ -1567,7 +1567,7 @@ namespace ChatSystem if (R->getResult() == CHATRESULT_SUCCESS) { m_assignedServerHost = wideToNarrow(R->getHostname()).c_str(); - m_assignedServerPort = (short)R->getPort(); + m_assignedServerPort = (int16_t)R->getPort(); } } break; @@ -1718,7 +1718,7 @@ namespace ChatSystem } } - void ChatAPICore::responseCallback(short type, ByteStream::ReadIterator &iter) + void ChatAPICore::responseCallback(int16_t type, ByteStream::ReadIterator &iter) { switch (type) { @@ -3053,7 +3053,7 @@ namespace ChatSystem process(); } - void ChatAPICore::OnConnect(const char *host, short port) + void ChatAPICore::OnConnect(const char *host, int16_t port) { m_connected = true; @@ -3137,7 +3137,7 @@ namespace ChatSystem } } - void ChatAPICore::OnDisconnect(const char *host, short port) + void ChatAPICore::OnDisconnect(const char *host, int16_t port) { // we may get OnDisconnect even when we're already disconnected, // so protect against unnecessary OnDisconnects by checking m_connected diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.h index 583850d2..7f09fd09 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAPICore.h @@ -22,7 +22,7 @@ namespace ChatSystem class ChatAPICore : public GenericAPI::GenericAPICore { public: - ChatAPICore(const char *registrar_host, short registrar_port, const char *server_host, short server_port); + ChatAPICore(const char *registrar_host, int16_t registrar_port, const char *server_host, int16_t server_port); virtual ~ChatAPICore(); void setRequestTimeout(unsigned requestTimeout) { m_requestTimeout = requestTimeout; } @@ -31,11 +31,11 @@ namespace ChatSystem unsigned RequestDestroyAvatar(ChatAvatar *avatar); virtual void responseCallback(GenericAPI::GenericResponse *res); - virtual void responseCallback(short type, Base::ByteStream::ReadIterator &iter); + virtual void responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter); void clearRequestCount() { m_requestCount = 0; } - virtual void OnConnect(const char *host, short port); - virtual void OnDisconnect(const char *host, short port); + virtual void OnConnect(const char *host, int16_t port); + virtual void OnDisconnect(const char *host, int16_t port); void setAPI(ChatAPI *api) { m_api = api; } ChatAvatar *getAvatar(const ChatUnicodeString &avatarName, const ChatUnicodeString &avatarAddress); @@ -86,9 +86,9 @@ namespace ChatSystem std::string m_registrarHost; std::string m_defaultServerHost; std::string m_assignedServerHost; - short m_registrarPort; - short m_defaultServerPort; - short m_assignedServerPort; + int16_t m_registrarPort; + int16_t m_defaultServerPort; + int16_t m_assignedServerPort; time_t m_timeSinceLastDisconnect; bool m_rcvdRegistrarResponse; diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatar.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatar.cpp index 8ec60bc8..f3ea84c1 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatar.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatar.cpp @@ -193,7 +193,7 @@ ChatUnicodeString ChatAvatar::CreateAddressFromName(const ChatUnicodeString & na unsigned sum = std::accumulate(hexName.begin(), hexName.end(), 0); // mod to a world ID. - unsigned short worldID = (sum % MOD_NUMBER); + uint16_t worldID = (sum % MOD_NUMBER); char buff[256]; memset(buff, 0, 256); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.cpp index 871f63d7..616fac60 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.cpp @@ -17,7 +17,7 @@ namespace ChatSystem { } - ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const unsigned short *name, const unsigned short *address, const unsigned short *gateway, const unsigned short *server, unsigned gatewayID, unsigned serverID, const unsigned short *loginLocation, unsigned attributes) + ChatAvatarCore::ChatAvatarCore(unsigned avatarID, unsigned userID, const uint16_t *name, const uint16_t *address, const uint16_t *gateway, const uint16_t *server, unsigned gatewayID, unsigned serverID, const uint16_t *loginLocation, unsigned attributes) : m_name(name), m_address(address), m_server(server), diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.h index ebd3fc81..44098bba 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatAvatarCore.h @@ -20,7 +20,7 @@ namespace ChatSystem public: ChatAvatarCore(); ChatAvatarCore(Base::ByteStream::ReadIterator &iter); - ChatAvatarCore(unsigned avatarID, unsigned userID, const unsigned short *name, const unsigned short *address, const unsigned short *gateway, const unsigned short *server, unsigned gatewayID, unsigned serverID, const unsigned short *loginLocation, unsigned attributes); + ChatAvatarCore(unsigned avatarID, unsigned userID, const uint16_t *name, const uint16_t *address, const uint16_t *gateway, const uint16_t *server, unsigned gatewayID, unsigned serverID, const uint16_t *loginLocation, unsigned attributes); ChatAvatarCore(unsigned avatarID, unsigned userID, const ChatUnicodeString &name, const ChatUnicodeString &address, const ChatUnicodeString &gateway, const ChatUnicodeString &server, unsigned gatewayID, unsigned serverID, const ChatUnicodeString &loginLocation, unsigned attributes); ChatAvatarCore(unsigned avatarID, unsigned userID, const Plat_Unicode::String &name, const Plat_Unicode::String &address, const Plat_Unicode::String &gateway, const Plat_Unicode::String &server, unsigned gatewayID, unsigned serverID, const Plat_Unicode::String &loginLocation, unsigned attributes); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp index f18fac5d..a84e6298 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.cpp @@ -17,7 +17,7 @@ ChatUnicodeString::ChatUnicodeString() m_cString = wideToNarrow(m_wideString); } -ChatUnicodeString::ChatUnicodeString(const unsigned short *data, unsigned length) +ChatUnicodeString::ChatUnicodeString(const uint16_t *data, unsigned length) { m_wideString.assign(data, length); m_cString = wideToNarrow(m_wideString); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.h index 75534928..9a99869b 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatEnum.h @@ -151,13 +151,13 @@ namespace ChatSystem std::string m_cString; - // const unsigned short *string_data; + // const uint16_t *string_data; // unsigned string_length; public: ChatUnicodeString(); - ChatUnicodeString(const unsigned short *data, unsigned length); + ChatUnicodeString(const uint16_t *data, unsigned length); ChatUnicodeString(const char *nData, unsigned length); ChatUnicodeString(const Plat_Unicode::String& src); ChatUnicodeString(const std::string& nSrc); @@ -178,7 +178,7 @@ namespace ChatSystem CHATUNICODESTRING_COMP_OPER_DECL(>=) CHATUNICODESTRING_COMP_OPER_DECL(>) inline unsigned length() const { return (unsigned)m_wideString.length(); } - inline const unsigned short * data() const { return m_wideString.data(); } + inline const uint16_t * data() const { return m_wideString.data(); } const char * c_str() const; }; diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatus.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatus.h index 069d2705..e7325707 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatus.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatus.h @@ -17,7 +17,7 @@ namespace ChatSystem const ChatUnicodeString &getName() const; const ChatUnicodeString &getAddress() const; const ChatUnicodeString &getComment() const; - short getStatus() const; // 0 = offline, else = online + int16_t getStatus() const; // 0 = offline, else = online friend class ChatFriendStatusCore; private: diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp index 653f0cbd..f06d268c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.cpp @@ -54,7 +54,7 @@ const ChatUnicodeString &ChatFriendStatus::getComment() const return m_comment; } -short ChatFriendStatus::getStatus() const +int16_t ChatFriendStatus::getStatus() const { return m_core->getStatus(); } diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.h index 841f80d0..40d10f82 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/ChatFriendStatusCore.h @@ -21,7 +21,7 @@ namespace ChatSystem const Plat_Unicode::String &getName() const { return m_name; } const Plat_Unicode::String &getAddress() const { return m_address; } - short getStatus() const { return m_status; } + int16_t getStatus() const { return m_status; } void load(Base::ByteStream::ReadIterator &iter, ChatFriendStatus *inf); @@ -31,7 +31,7 @@ namespace ChatSystem Plat_Unicode::String m_address; Plat_Unicode::String m_comment; - short m_status; + int16_t m_status; }; }; diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.h index 2f8bcd8b..6c0f9b8c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Message.h @@ -741,7 +741,7 @@ namespace ChatSystem private: ChatAvatarCore m_srcAvatar; unsigned m_destAvatarID; - short m_confirm; + int16_t m_confirm; }; class MFriendConfirmReciprocateRequest : GenericAPI::GenericMessage @@ -769,7 +769,7 @@ namespace ChatSystem private: ChatAvatarCore m_srcAvatar; unsigned m_destAvatarID; - short m_confirm; + int16_t m_confirm; }; class MChangeRoomOwner: GenericAPI::GenericMessage diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp index 06b643bd..f9d2ee89 100644 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.cpp @@ -1438,7 +1438,7 @@ namespace ChatSystem put(msg, m_userID); } - RRegistrarGetChatServer::RRegistrarGetChatServer(std::string &hostname, unsigned short port) + RRegistrarGetChatServer::RRegistrarGetChatServer(std::string &hostname, uint16_t port) : GenericRequest(REQUEST_REGISTRAR_GETCHATSERVER), m_hostname(narrowToWide(hostname)), m_port(port) diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.h index fda17c67..5b84897b 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Request.h @@ -836,7 +836,7 @@ public: virtual void pack(Base::ByteStream &msg); private: - short m_avatarPresence;; + int16_t m_avatarPresence;; unsigned m_srcAvatarID; Plat_Unicode::String m_srcName; Plat_Unicode::String m_destAvatar; @@ -860,7 +860,7 @@ public: virtual void pack(Base::ByteStream &msg); private: - short m_avatarPresence;; + int16_t m_avatarPresence;; unsigned m_srcAvatarID; Plat_Unicode::String m_srcName; unsigned m_numDestAvatars; @@ -1078,7 +1078,7 @@ public: private: unsigned m_srcAvatarID; unsigned m_destAvatarID; - short m_confirm; + int16_t m_confirm; Plat_Unicode::String m_srcAddress; }; @@ -1093,7 +1093,7 @@ public: private: unsigned m_srcAvatarID; unsigned m_destAvatarID; - short m_confirm; + int16_t m_confirm; Plat_Unicode::String m_srcAddress; }; class RGetFanClubHandle : public GenericAPI::GenericRequest @@ -1124,14 +1124,14 @@ private: class RRegistrarGetChatServer : public GenericAPI::GenericRequest { public: - RRegistrarGetChatServer(std::string &hostname, unsigned short port); + RRegistrarGetChatServer(std::string &hostname, uint16_t port); virtual ~RRegistrarGetChatServer() {}; virtual void pack(Base::ByteStream &msg); private: Plat_Unicode::String m_hostname; - unsigned short m_port; + uint16_t m_port; }; class RSendApiVersion : public GenericAPI::GenericRequest diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.h b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.h index b1207746..5b5fceb3 100755 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.h +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.h @@ -1172,10 +1172,10 @@ namespace ChatSystem virtual void unpack(Base::ByteStream::ReadIterator &iter); const Plat_Unicode::String &getHostname() const { return m_hostname; } - unsigned short getPort() const { return m_port; } + uint16_t getPort() const { return m_port; } private: Plat_Unicode::String m_hostname; - unsigned short m_port; + uint16_t m_port; }; class ResSendApiVersion: public GenericAPI::GenericResponse diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/BlockAllocator.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/BlockAllocator.h index bbfbf273..778331da 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/BlockAllocator.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/BlockAllocator.h @@ -1,9 +1,16 @@ #if !defined (BLOCKALLOCATOR_H_) #define BLOCKALLOCATOR_H_ +#include #include #include +#if __x86_64__ +typedef long unsigned int baType; +#else +typedef uint baType; +#endif + #ifdef EXTERNAL_DISTRO namespace NAMESPACE { @@ -16,11 +23,11 @@ namespace Base public: BlockAllocator(); ~BlockAllocator(); - void *getBlock(unsigned accum); - void returnBlock(unsigned *handle); + void *getBlock(baType accum); + void returnBlock(baType *handle); private: - uintptr_t *m_blocks[31]; + uintptr_t *m_blocks[31]; }; }; #ifdef EXTERNAL_DISTRO diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Platform.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Platform.h index 2bdb170b..fa7918d7 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Platform.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Platform.h @@ -70,7 +70,7 @@ namespace Base // return (uint64(byteReverse(uint32(value))) << 32) | byteReverse(uint32(value>>32)); } - inline uint32 strlen(const unsigned short * string) + inline uint32 strlen(const uint16_t * string) { if (string == 0) return 0; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h index 28159b18..57f71262 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/WideString.h @@ -14,7 +14,7 @@ namespace ucs2 class string { public: - typedef unsigned short char_type; + typedef uint16_t char_type; typedef unsigned size_type; public: diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp index 29d91074..41ea545f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/BlockAllocator.cpp @@ -10,7 +10,7 @@ namespace Base { BlockAllocator::BlockAllocator() { - for(unsigned i = 0; i < 31; i++) + for(baType i = 0; i < 31; i++) { m_blocks[i] = nullptr; } @@ -19,12 +19,12 @@ namespace Base BlockAllocator::~BlockAllocator() { // free all allocated memory blocks - for(unsigned i = 0; i < 31; i++) + for(baType i = 0; i < 31; i++) { while(m_blocks[i] != nullptr) { - unsigned *tmp = m_blocks[i]; - m_blocks[i] = (unsigned *)*m_blocks[i]; + baType *tmp = m_blocks[i]; + m_blocks[i] = (baType *)*m_blocks[i]; free(tmp); } } @@ -33,10 +33,10 @@ namespace Base // Allocate a block that is the next power of two greater than the # of bytes passed. // 33 bytes yields a 64 byte block of memory and so forth. - void *BlockAllocator::getBlock(unsigned bytes) + void *BlockAllocator::getBlock(baType bytes) { - unsigned accum = 16, bits = 16; - unsigned *handle = nullptr; + baType accum = 16, bits = 16; + baType *handle = nullptr; // Perform a binary search looking for the highest bit. @@ -44,14 +44,14 @@ namespace Base { // If bytes is less than the bit we're testing for, subtract half // from the bit value and repeat - if(bytes < (unsigned)(1 << accum)) + if(bytes < (baType)(1 << accum)) { bits /= 2; accum -= bits; } // If bytes is greater than the bit we're testing for, add half // from the but value and repeat - else if(bytes > (unsigned)(1 << accum)) + else if(bytes > (baType)(1 << accum)) { bits /= 2; accum += bits; @@ -79,7 +79,7 @@ namespace Base if(m_blocks[accum] == 0) { // remove the pre allocated block from the linked list - handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle = (baType *)calloc(((1 << accum) / 4) + 2, sizeof(baType)); handle[1] = accum; handle[0] = 0; } @@ -87,20 +87,20 @@ namespace Base { // Allocate a new block handle = m_blocks[accum]; - m_blocks[accum] = (unsigned *)handle[0]; + m_blocks[accum] = (baType *)handle[0]; handle[0] = 0; } // return a pointer that skips over the header used for the allocator's purposes return(handle + 2); } - void BlockAllocator::returnBlock(unsigned *handle) + void BlockAllocator::returnBlock(baType *handle) { // C++ allows for safe deletion of a nullptr pointer if(handle) { // Update the allocator linked list, insert this entry at the head - *(handle - 2) = (unsigned)m_blocks[*(handle - 1)]; + *(handle - 2) = (baType)m_blocks[*(handle - 1)]; // Add this entry to the proper linked list node m_blocks[*(handle - 1)] = (handle - 2); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Types.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Types.h index 6ee50450..c9f2e7f3 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Types.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/linux/Types.h @@ -11,7 +11,7 @@ #ifndef BASE_LINUX_TYPES_H #define BASE_LINUX_TYPES_H -#include +#include #ifdef EXTERNAL_DISTRO namespace NAMESPACE @@ -21,19 +21,24 @@ namespace NAMESPACE namespace Base { -//#define INT32_MAX 0x7FFFFFFF -//#define INT32_MIN 0x80000000 -//#define UINT32_MAX 0xFFFFFFFF -typedef signed char int8; -typedef unsigned char uint8; -typedef signed short int16; -typedef unsigned short uint16; +#ifndef INT32_MAX +#define INT32_MAX 0x7FFFFFFF +#define INT32_MIN 0x80000000 +#define UINT32_MAX 0xFFFFFFFF +#endif + + + +typedef int8_t int8; +typedef uint8_t uint8; +typedef int16_t int16; +typedef uint16_t uint16; typedef int32_t int32; -typedef u_int32_t uint32; +typedef uint32_t uint32; typedef int64_t int64; -typedef u_int64_t uint64; +typedef uint64_t uint64; } #ifdef EXTERNAL_DISTRO }; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/BlockAllocator.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/BlockAllocator.cpp index 6762bc2a..e2d1cfe6 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/BlockAllocator.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/BlockAllocator.cpp @@ -10,7 +10,7 @@ namespace Base BlockAllocator::BlockAllocator() { - for(unsigned i = 0; i < 31; i++) + for(long unsigned int i = 0; i < 31; i++) { m_blocks[i] = NULL; } @@ -19,11 +19,11 @@ namespace Base BlockAllocator::~BlockAllocator() { // free all allocated memory blocks - for(unsigned i = 0; i < 31; i++) + for(long unsigned int i = 0; i < 31; i++) { while(m_blocks[i] != NULL) { - unsigned *tmp = m_blocks[i]; + long unsigned int *tmp = m_blocks[i]; m_blocks[i] = (uintptr_t *)*m_blocks[i]; free(tmp); } @@ -33,10 +33,10 @@ namespace Base // Allocate a block that is the next power of two greater than the # of bytes passed. // 33 bytes yields a 64 byte block of memory and so forth. - void *BlockAllocator::getBlock(unsigned bytes) + void *BlockAllocator::getBlock(long unsigned int bytes) { - unsigned accum = 16, bits = 16; - unsigned *handle = NULL; + long unsigned int accum = 16, bits = 16; + long unsigned int *handle = NULL; // Perform a binary search looking for the highest bit. @@ -44,14 +44,14 @@ namespace Base { // If bytes is less than the bit we're testing for, subtract half // from the bit value and repeat - if(bytes < (unsigned)(1 << accum)) + if(bytes < (long unsigned int)(1 << accum)) { bits /= 2; accum -= bits; } // If bytes is greater than the bit we're testing for, add half // from the but value and repeat - else if(bytes > (unsigned)(1 << accum)) + else if(bytes > (long unsigned int)(1 << accum)) { bits /= 2; accum += bits; @@ -79,7 +79,7 @@ namespace Base if(m_blocks[accum] == 0) { // remove the pre allocated block from the linked list - handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned)); + handle = (long unsigned int *)calloc(((1 << accum) / 4) + 2, sizeof(long unsigned int)); handle[1] = accum; handle[0] = 0; } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h index 0c64cb2c..24d0b66c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/win32/Types.h @@ -25,8 +25,8 @@ namespace Base typedef signed char int8; typedef unsigned char uint8; -typedef short int16; -typedef unsigned short uint16; +typedef int16_t int16; +typedef uint16_t uint16; typedef int int32; typedef unsigned uint32; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.cpp index 42319570..7f989882 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.cpp @@ -19,7 +19,7 @@ namespace GenericAPI GenericAPICore::GenericAPICore(const char *host, - short port, + int16_t port, unsigned reqTimeout, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, @@ -40,7 +40,7 @@ GenericAPICore::GenericAPICore(const char *host, } GenericAPICore::GenericAPICore(const char *hosts[], - const short port[], + const int16_t port[], unsigned arraySize, unsigned reqTimeout, unsigned reconnectTimeout, @@ -90,7 +90,7 @@ GenericAPICore::~GenericAPICore() } } -void GenericAPICore::changeHostPort(unsigned connectionIndex, const char *host, short port) +void GenericAPICore::changeHostPort(unsigned connectionIndex, const char *host, int16_t port) { if (connectionIndex <= m_serverConnections.size() - 1) { diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.h b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.h index df5704b7..e5d6b5b4 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.h @@ -30,7 +30,7 @@ public: friend class GenericAPI; GenericAPICore(const char *host, - short port, + int16_t port, unsigned reqTimeout, unsigned reconnectTimeout, unsigned noDataTimeoutSecs = 5, @@ -45,7 +45,7 @@ public: * ALSO: cannot specify a 0 array size. */ GenericAPICore(const char *hosts[], - const short port[], + const int16_t port[], unsigned arraySize, unsigned reqTimeout, unsigned reconnectTimeout, @@ -60,21 +60,21 @@ public: void process(); #ifdef USE_SERIALIZE_LIB - virtual void responseCallback(short type, const unsigned char *data, unsigned dataLen) = 0; + virtual void responseCallback(int16_t type, const unsigned char *data, unsigned dataLen) = 0; #else - virtual void responseCallback(short type, Base::ByteStream::ReadIterator &iter) = 0; + virtual void responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter) = 0; #endif virtual void responseCallback(GenericResponse *R) = 0; - virtual void OnDisconnect(const char *host, short port) = 0; - virtual void OnConnect(const char *host, short port) = 0; + virtual void OnDisconnect(const char *host, int16_t port) = 0; + virtual void OnConnect(const char *host, int16_t port) = 0; void suspendProcessing() { m_suspended = true; } void resumeProcessing() { m_suspended = false; } // change the host and port for a connection object, will take effect // on connection's next CON_DISCONNECT state. - void changeHostPort(unsigned connectionIndex, const char *host, short port); + void changeHostPort(unsigned connectionIndex, const char *host, int16_t port); unsigned submitRequest(GenericRequest *req, GenericResponse *res); unsigned submitRequest(GenericRequest *req, GenericResponse *res, unsigned reqTimeout); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp index c7c6234c..3a53d5f8 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.cpp @@ -19,7 +19,7 @@ namespace NAMESPACE unsigned GenericConnection::ms_crcBytes = 0; - GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime) + GenericConnection::GenericConnection(const char *host, int16_t port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime) : m_bConnected(false), m_apiCore(apiCore), m_con(nullptr), @@ -74,7 +74,7 @@ namespace NAMESPACE m_manager->Release(); } - void GenericConnection::changeHostPort(const char *host, short port) + void GenericConnection::changeHostPort(const char *host, int16_t port) { if (host && strcmp(host, "") != 0) @@ -118,7 +118,7 @@ namespace NAMESPACE void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *data, int dataLen) #endif { - short type; + int16_t type; unsigned track; #ifdef USE_SERIALIZE_LIB diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.h b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.h index fd14c3a3..fc71b208 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericConnection.h @@ -36,7 +36,7 @@ namespace GenericAPI { public: GenericConnection(const char *host, - short port, + int16_t port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs = 5, @@ -63,7 +63,7 @@ namespace GenericAPI #endif - void changeHostPort(const char *host, short port); + void changeHostPort(const char *host, int16_t port); bool isConnected() { return m_bConnected; } void disconnect(); void process(bool giveTime = true); @@ -81,8 +81,8 @@ namespace GenericAPI #endif std::string m_host; std::string m_nextHost; - short m_port; - short m_nextPort; + int16_t m_port; + int16_t m_nextPort; unsigned m_lastTrack; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.cpp index 8ee9459f..fd5ff796 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.cpp @@ -6,17 +6,17 @@ namespace NAMESPACE #endif namespace GenericAPI { - GenericMessage::GenericMessage(short type) + GenericMessage::GenericMessage(int16_t type) : m_type(type) { } - GenericRequest::GenericRequest(short type) + GenericRequest::GenericRequest(int16_t type) : GenericMessage(type) { } - GenericResponse::GenericResponse(short type, unsigned result, void *user) + GenericResponse::GenericResponse(int16_t type, unsigned result, void *user) : GenericMessage(type), m_result(result), m_user(user), diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.h b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.h index b50aa5a0..f3957d2a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericMessage.h @@ -16,18 +16,18 @@ namespace GenericAPI class GenericMessage { public: - GenericMessage(short type); + GenericMessage(int16_t type); virtual ~GenericMessage() {}; - short getType() const { return m_type; } + int16_t getType() const { return m_type; } protected: - short m_type; + int16_t m_type; }; class GenericRequest : public GenericMessage { public: - GenericRequest(short type); + GenericRequest(int16_t type); virtual ~GenericRequest() {}; #ifdef USE_SERIALIZE_LIB virtual const unsigned char *pack(unsigned &msgSize) = 0; @@ -54,7 +54,7 @@ protected: class GenericResponse : public GenericMessage { public: - GenericResponse(short type, unsigned result, void *user); + GenericResponse(int16_t type, unsigned result, void *user); virtual ~GenericResponse() {}; #ifdef USE_SERIALIZE_LIB virtual void unpack(const unsigned char *data, unsigned dataLen) = 0; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp index df2137bd..03cb08fd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp @@ -250,7 +250,7 @@ void UdpConnection::SendTerminatePacket(int connectCode, DisconnectReason reason buf[0] = 0; buf[1] = cUdpPacketTerminate; UdpMisc::PutValue32(buf + 2, connectCode); - UdpMisc::PutValue16(buf + 6, (udp_ushort)reason); + UdpMisc::PutValue16(buf + 6, (uint16_t)reason); PhysicalSend(buf, 8, true); } @@ -348,7 +348,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int udp_uchar *bufPtr = tempBuffer; bufPtr[0] = 0; bufPtr[1] = cUdpPacketOrdered; - UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing & 0xffff)); + UdpMisc::PutValue16(bufPtr + 2, (uint16_t)(++mOrderedCountOutgoing & 0xffff)); memcpy(bufPtr + 4, data, dataLen); if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); @@ -361,7 +361,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int udp_uchar *bufPtr = tempBuffer; bufPtr[0] = 0; bufPtr[1] = cUdpPacketOrdered2; - UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing2 & 0xffff)); + UdpMisc::PutValue16(bufPtr + 2, (uint16_t)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); @@ -731,7 +731,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) } case cUdpPacketOrdered: { - udp_ushort orderedStamp = UdpMisc::GetValue16(data + 2); + uint16_t orderedStamp = UdpMisc::GetValue16(data + 2); int diff = (int)orderedStamp - (int)mOrderedStampLast; if (diff <= 0) // equal here makes it strip dupes too diff += 0x10000; @@ -749,7 +749,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) } case cUdpPacketOrdered2: { - udp_ushort orderedStamp = UdpMisc::GetValue16(data + 2); + uint16_t orderedStamp = UdpMisc::GetValue16(data + 2); int diff = (int)orderedStamp - (int)mOrderedStampLast2; if (diff <= 0) // equal here makes it strip dupes too diff += 0x10000; @@ -898,7 +898,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen) if (mUdpManager->mProcessingInducedLag > 1000) // if it has been over a second since our manager got processing time, then we should ignore the timing aspects of the clock-sync packets as we will have introduced too much lag ourselves. break; - udp_ushort curStamp = mUdpManager->LocalSyncStampShort(); + uint16_t curStamp = mUdpManager->LocalSyncStampShort(); int roundTime = UdpMisc::SyncStampShortDeltaTime(pp.timeStamp, curStamp); mSyncStatCount++; @@ -1374,7 +1374,7 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append *crcPtr = (udp_uchar)(crc & 0xff); break; case 2: - UdpMisc::PutValue16(crcPtr, (udp_ushort)(crc & 0xffff)); + UdpMisc::PutValue16(crcPtr, (uint16_t)(crc & 0xffff)); break; case 3: UdpMisc::PutValue24(crcPtr, crc & 0xffffff); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h index 253e9139..87f0ac73 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.h @@ -4,6 +4,8 @@ // Copyright 2004 Sony Online Entertainment, all rights reserved. // Author: Jeff Petersen +#include + namespace UdpLibrary { @@ -177,9 +179,9 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub // packet travel times under 32 seconds, would should be completely safe. You must use the // UdpManager::SyncStampDeltaTime function in order to calculate the elapsed time between // the two stamps. - udp_ushort ServerSyncStampShort() const; + uint16_t ServerSyncStampShort() const; udp_uint ServerSyncStampLong() const; - int ServerSyncStampShortElapsed(udp_ushort syncStamp) const; + int ServerSyncStampShortElapsed(uint16_t syncStamp) const; int ServerSyncStampLongElapsed(udp_uint syncStamp) const; // returns the IP address/port this connection is linked to @@ -355,8 +357,8 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub int mOrderedCountOutgoing; int mOrderedCountOutgoing2; - udp_ushort mOrderedStampLast; - udp_ushort mOrderedStampLast2; + uint16_t mOrderedStampLast; + uint16_t mOrderedStampLast2; udp_uchar *mEncryptXorBuffer; int mEncryptExpansionBytes; @@ -443,7 +445,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub { udp_uchar zeroByte; udp_uchar packetType; - udp_ushort timeStamp; + uint16_t timeStamp; int masterPingTime; int averagePingTime; int lowPingTime; @@ -457,7 +459,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub { udp_uchar zeroByte; udp_uchar packetType; - udp_ushort timeStamp; + uint16_t timeStamp; udp_uint serverSyncStampLong; udp_int64 yourSent; udp_int64 yourReceived; @@ -469,7 +471,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub { udp_uchar zeroByte; udp_uchar packetType; - udp_ushort reliableStamp; + uint16_t reliableStamp; }; struct UdpPacketReliableFragmentStart @@ -482,14 +484,14 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub { udp_uchar zeroByte; udp_uchar packetType; - udp_ushort reliableStamp; + uint16_t reliableStamp; }; struct UdpPacketOrdered { udp_uchar zeroByte; udp_uchar packetType; - udp_ushort orderStamp; + uint16_t orderStamp; }; @@ -524,7 +526,7 @@ inline void UdpConnection::ScheduleTimeNow() { // if we are current in our GiveTime function getting time, then there is no need to reprioritize to 0 when we send a raw packet, since // the last thing we do in out GiveTime is do a scheduling calculation based on the last time a packet was sent. This little check - // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. + // prevents us from reprioritizing to 0, only to int16_tly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { if (mUdpManager != nullptr) @@ -596,12 +598,12 @@ inline int UdpConnection::LastSend() const return(mUdpManager->CachedClockElapsed(mLastSendTime)); } -inline udp_ushort UdpConnection::ServerSyncStampShort() const +inline uint16_t UdpConnection::ServerSyncStampShort() const { UdpGuard guard(&mGuard); if (mUdpManager == nullptr) return(0); - return((udp_ushort)(mUdpManager->LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); + return((uint16_t)(mUdpManager->LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); } inline udp_uint UdpConnection::ServerSyncStampLong() const @@ -612,7 +614,7 @@ inline udp_uint UdpConnection::ServerSyncStampLong() const return(mUdpManager->LocalSyncStampLong() + mSyncTimeDelta); } -inline int UdpConnection::ServerSyncStampShortElapsed(udp_ushort syncStamp) const +inline int UdpConnection::ServerSyncStampShortElapsed(uint16_t syncStamp) const { return(UdpMisc::SyncStampShortDeltaTime(syncStamp, ServerSyncStampShort())); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp index aa11f5cd..dee20d6d 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverLinux.cpp @@ -99,7 +99,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin // bind it to any address struct sockaddr_in addr_loc; addr_loc.sin_family = PF_INET; - addr_loc.sin_port = htons((unsigned short)port); + addr_loc.sin_port = htons((uint16_t)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); if (bindIpAddress != nullptr && bindIpAddress[0] != 0) { @@ -157,7 +157,7 @@ bool UdpPlatformDriver::SocketSend(const char *data, int dataLen, const UdpPlatf struct sockaddr_in addr_dest; addr_dest.sin_family = PF_INET; memcpy(&addr_dest.sin_addr.s_addr, ipAddress->mData, 4); - addr_dest.sin_port = htons((unsigned short)port); + addr_dest.sin_port = htons((uint16_t)port); if (SOCKET_ERROR == sendto(mData->socket, data, dataLen, 0, (struct sockaddr *)&addr_dest, sizeof(addr_dest))) { return(false); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp index 4a2a80e7..930ee61c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp @@ -100,7 +100,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin // bind it to any address struct sockaddr_in addr_loc; addr_loc.sin_family = PF_INET; - addr_loc.sin_port = htons((unsigned short)port); + addr_loc.sin_port = htons((uint16_t)port); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); if (bindIpAddress != nullptr && bindIpAddress[0] != 0) { @@ -163,7 +163,7 @@ bool UdpPlatformDriver::SocketSend(const char *data, int dataLen, const UdpPlatf struct sockaddr_in addr_dest; addr_dest.sin_family = PF_INET; memcpy(&addr_dest.sin_addr.s_addr, ipAddress->mData, 4); - addr_dest.sin_port = htons((unsigned short)port); + addr_dest.sin_port = htons((uint16_t)port); if (SOCKET_ERROR == sendto(mData->socket, data, dataLen, 0, (struct sockaddr *)&addr_dest, sizeof(addr_dest))) { return(false); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h index 7c263031..b4b624bd 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpManager.h @@ -237,7 +237,7 @@ struct UdpParams // to be kept alive, or at least kept alive very often (like for a chat server perhaps where nobody is talking much). // For some people, it may be necessary to send data more frequently in order to keep their NAT mapping fresh, or their // firewall software happy. However, we don't want to be in a situation where our server is receiving a lot more data - // than it needs to just so these people can keep their port open. I have seen NAT's that lose mappings in as short + // than it needs to just so these people can keep their port open. I have seen NAT's that lose mappings in as int16_t // as 20 seconds. What this feature does is a bit tricky. It changes the time-to-live (TTL) for a special keep-alive // packet to some small value (4) which is enough for the packet to get past firewalls and NAT's, but not make it all // the way to our server. In this manner, the port gets kept alive, but we don't waste bandwidth with these packets. @@ -285,7 +285,7 @@ struct UdpParams // them and terminate the connection. When a packet is successfully received into the connection in question, the // retry period is reset, such that the next time an ICMP error comes in, it has another period of time for it // to resolve the issue. This servers a couple purpose, 1) it can allow for momentary outages that can be recovered - // from in short order, and 2) it is necessary for the port-remapping feature to work properly in situations where + // from in int16_t order, and 2) it is necessary for the port-remapping feature to work properly in situations where // the server may send data to the old-port before the remapping negotiations are completed. In order for the // remapping feature to work properly, this value should be set to larger than the longest time a connection typically // goes without receiving data from the other side. (0=no grace period) @@ -574,7 +574,7 @@ class UdpManager : public UdpGuardedRefCount ErrorCondition GetErrorCondition() const; // previous UdpMisc stuff that now needs driver - udp_ushort LocalSyncStampShort(); // gets a local-clock based sync-stamp. (only good for timings up to 32 seconds) + uint16_t LocalSyncStampShort(); // gets a local-clock based sync-stamp. (only good for timings up to 32 seconds) udp_uint LocalSyncStampLong(); // gets a local-clock based sync-stamp. (good for timings up to 23 days) int ClockElapsed(UdpClockStamp stamp); // returns a elapsed time since stamp in milliseconds (if elapsed is over 23 days, it returns 23 days) UdpClockStamp Clock(); @@ -991,9 +991,9 @@ inline int UdpManager::ClockElapsed(UdpClockStamp stamp) return(UdpMisc::ClockDiff(stamp, Clock())); } -inline udp_ushort UdpManager::LocalSyncStampShort() +inline uint16_t UdpManager::LocalSyncStampShort() { - return((udp_ushort)(Clock() & 0xffff)); + return((uint16_t)(Clock() & 0xffff)); } inline udp_uint UdpManager::LocalSyncStampLong() diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp index 651492fc..f569a20b 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp @@ -14,9 +14,9 @@ namespace UdpLibrary // UdpMisc functions //////////////////////////////////////////////////////////////////////////////////////////////////// -int UdpMisc::SyncStampShortDeltaTime(udp_ushort stamp1, udp_ushort stamp2) +int UdpMisc::SyncStampShortDeltaTime(uint16_t stamp1, uint16_t stamp2) { - udp_ushort delta = (udp_ushort)(stamp1 - stamp2); + uint16_t delta = (uint16_t)(stamp1 - stamp2); if (delta > 0x7fff) return((int)(0xffff - delta)); return((int)delta); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h index af72d619..c063c063 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.h @@ -4,6 +4,7 @@ // Copyright 2004 Sony Online Entertainment, all rights reserved. // Author: Jeff Petersen +#include #include #include #include "UdpDriver.h" @@ -32,7 +33,7 @@ class UdpMisc // you a sync-stamp that you can compare with ServerSyncStampShort values generated on other // machines that are synchronized against the same server. This ServerSyncStampShort function and // this delta time function serve as the basis for calculating one-way travel times for packets. - static int SyncStampShortDeltaTime(udp_ushort stamp1, udp_ushort stamp2); + static int SyncStampShortDeltaTime(uint16_t stamp1, uint16_t stamp2); static int SyncStampLongDeltaTime(udp_uint stamp1, udp_uint stamp2); // same as Short version only no limit // used to alloc/resize/free an allocation previously created with this function @@ -56,13 +57,13 @@ class UdpMisc static int PutValue64(void *buffer, udp_int64 value); // puts a 64-bit value into the buffer in big-endian format, returns number of bytes used(8) static int PutValue32(void *buffer, udp_uint value); // puts a 32-bit value into the buffer in big-endian format, returns number of bytes used(4) static int PutValue24(void *buffer, udp_uint value); // puts a 24-bit value into the buffer in big-endian format, returns number of bytes used(4) - static int PutValue16(void *buffer, udp_ushort value); // puts a 16-bit value into the buffer in big-endian format, returns number of bytes used(2) + static int PutValue16(void *buffer, uint16_t value); // puts a 16-bit value into the buffer in big-endian format, returns number of bytes used(2) static int PutValueLE32(void *buffer, udp_uint value); // puts a 32-bit value in little-endian format static udp_int64 GetValue64(const void *buffer); // gets a 64-bit value from the buffer in big-endian format static udp_uint GetValue32(const void *buffer); // gets a 32-bit value from the buffer in big-endian format static udp_uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format - static udp_ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format + static uint16_t GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); @@ -151,7 +152,7 @@ inline udp_uint UdpMisc::GetValue24(const void *buffer) return((*bufptr << 16) | (*(bufptr + 1) << 8) | *(bufptr + 2)); } -inline int UdpMisc::PutValue16(void *buffer, udp_ushort value) +inline int UdpMisc::PutValue16(void *buffer, uint16_t value) { udp_uchar *bufptr = (udp_uchar *)buffer; *bufptr++ = (udp_uchar)((value >> 8) & 0xff); @@ -159,10 +160,10 @@ inline int UdpMisc::PutValue16(void *buffer, udp_ushort value) return(2); } -inline udp_ushort UdpMisc::GetValue16(const void *buffer) +inline uint16_t UdpMisc::GetValue16(const void *buffer) { const udp_uchar *bufptr = (const udp_uchar *)buffer; - return((udp_ushort)((*bufptr << 8) | *(bufptr + 1))); + return((uint16_t)((*bufptr << 8) | *(bufptr + 1))); } inline char *UdpMisc::Strncpy(char *dest, const char *source, int len) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp index 5b6250f5..b90476ba 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.cpp @@ -387,7 +387,7 @@ int UdpReliableChannel::GiveTime() bufPtr = buf; *bufPtr++ = 0; *bufPtr++ = (udp_uchar)(((fragment) ? UdpConnection::cUdpPacketFragment1 : UdpConnection::cUdpPacketReliable1) + mChannelNumber); // mark us as a fragment if we are one - bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)(reliableId & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)(reliableId & 0xffff)); if (fragment && entry->mDataPtr == parentBase) bufPtr += UdpMisc::PutValue32(bufPtr, entry->mParent->GetDataLen()); // first fragment has a total-length byte after the reliable header mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), entry->mDataPtr, entry->mDataLen, false); @@ -570,7 +570,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) } int packetType = data[1]; - udp_ushort reliableStamp = UdpMisc::GetValue16(data + 2); + uint16_t reliableStamp = UdpMisc::GetValue16(data + 2); udp_int64 reliableId = GetReliableIncomingId(reliableStamp); if (reliableId >= mReliableIncomingId + mConfig.maxInstandingPackets) @@ -641,14 +641,14 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen) { // ack everything up to the current head of our chain (minus one since the stamp represents the next one we want to get) *bufPtr++ = (udp_uchar)(UdpConnection::cUdpPacketAckAll1 + mChannelNumber); - bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)((mReliableIncomingId - 1) & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)((mReliableIncomingId - 1) & 0xffff)); ackAll = true; } else { // a simple ack for us only *bufPtr++ = (udp_uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); - bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)(reliableId & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)(reliableId & 0xffff)); } if (mBufferedAckPtr != nullptr && mConfig.ackDeduping && ackAll) @@ -742,7 +742,7 @@ void UdpReliableChannel::AckAllPacket(const udp_uchar *data, int dataLen) return; } - udp_int64 reliableId = GetReliableOutgoingId((udp_ushort)UdpMisc::GetValue16(data + 2)); + udp_int64 reliableId = GetReliableOutgoingId((uint16_t)UdpMisc::GetValue16(data + 2)); if (mReliableOutgoingPendingId > reliableId) { @@ -818,7 +818,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // harm done is that the we may not resend some of the earlier sent packets quite as quickly. This will only // happen in situations where a packet that was truely lost gets acked on it's second attempt...we just // won't be using that ack for the purposes of accelerating other resends...since odds are a non-lost packet - // will accelerate those other resends shortly anyhow, there really is no loss + // will accelerate those other resends int16_tly anyhow, there really is no loss // (note: we used to only set this value forward for packets that were never lost (one time sends); however, if this stamp // ever got set way high for some reason (in theory it can't happen), then we would get into a situation where it would // rapidly resend and possibly never get reset, causing infinite rapid resends, so we now set it every time to the first-stamp) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h index 033585eb..9ea3917a 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpReliableChannel.h @@ -123,7 +123,7 @@ inline void UdpReliableChannel::AckPacket(const udp_uchar *data, int dataLen) return; } - Ack(GetReliableOutgoingId((udp_ushort)UdpMisc::GetValue16(data + 2))); + Ack(GetReliableOutgoingId((uint16_t)UdpMisc::GetValue16(data + 2))); } inline int UdpReliableChannel::GetAveragePing() const diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpTypes.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpTypes.h index 5296a0ec..e4646389 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpTypes.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpTypes.h @@ -4,6 +4,7 @@ // Copyright 2004 Sony Online Entertainment, all rights reserved. // Author: Jeff Petersen +#include #include namespace UdpLibrary @@ -22,8 +23,7 @@ class UdpPlatformAddress; #endif typedef unsigned char udp_uchar; -typedef unsigned short udp_ushort; -typedef unsigned int udp_uint; +typedef uint32_t udp_uint; typedef unsigned long udp_ulong; typedef udp_int64 UdpClockStamp; typedef UdpPlatformAddress UdpIpAddress; // deprecated, use UdpPlatformAddress directly instead diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/Unicode.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/Unicode.h index 3c31835c..ac94087c 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/Unicode.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/Unicode.h @@ -29,7 +29,7 @@ namespace NAMESPACE namespace Plat_Unicode { - typedef unsigned short unicode_char_t; + typedef uint16_t unicode_char_t; /** * Standard Unicode string is UTF-16 diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterData.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterData.h index 22e76cd7..b1a3d544 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterData.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeCharacterData.h @@ -17,6 +17,8 @@ #pragma warning (disable:4786) #endif +#include + // ====================================================================== #ifdef EXTERNAL_DISTRO @@ -26,7 +28,7 @@ namespace NAMESPACE namespace Plat_Unicode { - typedef unsigned short unicode_char_t; //lint !e761 redundant typedef + typedef uint16_t unicode_char_t; //lint !e761 redundant typedef struct CharData; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeUtils.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeUtils.h index c00c3f2f..fd9d29d5 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeUtils.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/UnicodeUtils.h @@ -134,7 +134,7 @@ namespace NAMESPACE * Compares str1 and str2, where str1 is a String and str2 is templated, * thus could be a std::string as well. Unlike caseInsensitiveCompare, this * version returns an int for < or > comparisons, and comparison must start - * at the front. Note that this kind of comparison does not allow the shortcut + * at the front. Note that this kind of comparison does not allow the int16_tcut * of first comparing sizes--every character must be compared up to the last one. */ template int caseInsensitiveCompareInt(const String & str1, const T & str2) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.h b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.h index 86251e81..0a9f054f 100755 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Unicode/utf8.h @@ -13,7 +13,7 @@ namespace Plat_Unicode { typedef char UTF8; -typedef unsigned short int UTF16; +typedef uint16_t UTF16; int UTF8_charSize( char * ); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h index 9cd24094..93877512 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Api/api.h @@ -8,6 +8,8 @@ #include "Base/profile.h" #include "Base/stringutils.h" +#include + #ifdef UDP_LIBRARY #include "UdpLibrary/UdpLibrary.hpp" #else diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp index cb3a87d0..b8ab5888 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.cpp @@ -190,10 +190,10 @@ int len; memset(sendBuf, 0, sizeof(sendBuf)); len = 0; - packShort( sendBuf + len, len,(short)MON_MSG_AUTHREPLY); + packShort( sendBuf + len, len,(int16_t)MON_MSG_AUTHREPLY); packShort( sendBuf + len, len, mSequence); - packShort( sendBuf + len, len,(short)3); - packShort( sendBuf + len, len,(short)CURRENT_API_VERSION); + packShort( sendBuf + len, len,(int16_t)3); + packShort( sendBuf + len, len,(int16_t)CURRENT_API_VERSION); packByte( sendBuf + len, len, reply); mConnection->Send(cUdpChannelReliable1, sendBuf, 9 ); @@ -205,7 +205,7 @@ void MonitorObject::DescriptionMark(int x,int mode) if( mode == 0 ) set_bit(mMark,x); else unset_bit(mMark,x); } -char * getErrorString(unsigned short errorCode) +char * getErrorString(uint16_t errorCode) { if (errorCode == 0) { @@ -246,7 +246,7 @@ char * getErrorString(unsigned short errorCode) bool MonitorObject::processError(const unsigned char * data) { stringMessage strMsg(data); - unsigned short errCode = (unsigned short)atoi(strMsg.getData()); + uint16_t errCode = (uint16_t)atoi(strMsg.getData()); fprintf(stderr,"MONITOR API Error: %s\n", getErrorString(errCode)); return true; } @@ -397,7 +397,7 @@ char buffer[1024]; //****************************************************************************************************** //****************************************************************************************************** -CMonitorAPI::CMonitorAPI( char *configFile, unsigned short Port, bool _bprint , char *address, UdpManager * mang ) +CMonitorAPI::CMonitorAPI( char *configFile, uint16_t Port, bool _bprint , char *address, UdpManager * mang ) { mbprint = _bprint; mPort = Port; @@ -480,7 +480,7 @@ void CMonitorAPI::dump(){ mMonitorData->dump(); } monMessage::monMessage():command(0),sequence(0),size(0){} //---------------------------------------------------------------- -monMessage::monMessage(short cmd,short seq,short s):command(cmd),sequence(seq),size(s){} +monMessage::monMessage(int16_t cmd,int16_t seq,int16_t s):command(cmd),sequence(seq),size(s){} //---------------------------------------------------------------- monMessage::monMessage(const unsigned char * source):command(0),sequence(0),size(0) @@ -511,7 +511,7 @@ int size; } //---------------------------------------------------------------- -stringMessage::stringMessage(const unsigned short command,const unsigned short sequence,const unsigned short size,char * newData): +stringMessage::stringMessage(const uint16_t command,const uint16_t sequence,const uint16_t size,char * newData): monMessage(command, sequence, size) { data = new char [strlen(newData) + 1]; @@ -535,9 +535,9 @@ monMessage(source) } //---------------------------------------------------------------- -authReplyMessage::authReplyMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size, +authReplyMessage::authReplyMessage(const uint16_t command, + const uint16_t sequence, + const uint16_t size, unsigned char newData): monMessage(command, sequence, size),data(newData){} @@ -555,9 +555,9 @@ monMessage(source) } //---------------------------------------------------------------- -dataReplyMessage::dataReplyMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size, +dataReplyMessage::dataReplyMessage(const uint16_t command, + const uint16_t sequence, + const uint16_t size, unsigned char * newData, int newDataLen): monMessage(command, sequence, size) @@ -576,9 +576,9 @@ dataReplyMessage::~dataReplyMessage() //---------------------------------------------------------------- simpleMessage::simpleMessage(const unsigned char * source):monMessage(source){} //---------------------------------------------------------------- -simpleMessage::simpleMessage(const unsigned short command, - const unsigned short sequence, - const unsigned short size): +simpleMessage::simpleMessage(const uint16_t command, + const uint16_t sequence, + const uint16_t size): monMessage(command, sequence, size){} //---------------------------------------------------------------- simpleMessage::~simpleMessage(){} diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h index 60fa8509..1e78198c 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorAPI.h @@ -17,7 +17,7 @@ class MonitorObject : public UdpConnectionHandler { CMonitorData *mMonitorData; - short mSequence; + int16_t mSequence; char *mPasswd; char **mAddressList; unsigned char *mMark; @@ -72,7 +72,7 @@ class CMonitorAPI { public: - CMonitorAPI( char *configFile, unsigned short Port, bool _bprint = false , char * address = nullptr, UdpManager * mang = nullptr ); + CMonitorAPI( char *configFile, uint16_t Port, bool _bprint = false , char * address = nullptr, UdpManager * mang = nullptr ); ~CMonitorAPI(); @@ -96,7 +96,7 @@ private: UdpManager *mManager; MonitorManager *mObjectManager; char *mAddress; - unsigned short mPort; + uint16_t mPort; }; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp index 0d3c66d5..611ea299 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.cpp @@ -100,7 +100,7 @@ char *temp; } } -void CMonitorData::send(UdpConnection *con,short & sequence,short msg,char *data ) +void CMonitorData::send(UdpConnection *con,int16_t & sequence,int16_t msg,char *data ) { int len; int size; @@ -118,7 +118,7 @@ char *p; sequence++; } -bool CMonitorData::processHierarchyRequest( UdpConnection *con, short & sequence ) +bool CMonitorData::processHierarchyRequest( UdpConnection *con, int16_t & sequence ) { int x,size; char temp[215]; @@ -150,7 +150,7 @@ char temp[215]; return 1; } -bool CMonitorData::processElementsRequest(UdpConnection *con, short & sequence, char * data, int /* dataLen */ , long lastUpdateTime ) +bool CMonitorData::processElementsRequest(UdpConnection *con, int16_t & sequence, char * data, int /* dataLen */ , long lastUpdateTime ) { char tmp[200]; int x,id; @@ -233,7 +233,7 @@ char **list; } -bool CMonitorData::processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen, unsigned char *mark) +bool CMonitorData::processDescriptionRequest(UdpConnection *con, int16_t & sequence, char * userData, int dataLen, unsigned char *mark) { char line[4096]; char tmp[400]; @@ -543,7 +543,7 @@ int packByte(char *buffer, int & len, char value) return 1; } -int packShort(char *buffer, int & len, short value) +int packShort(char *buffer, int & len, int16_t value) { char *p; @@ -562,7 +562,7 @@ int packShort(char *buffer, int & len, short value) return 2; } -int unpackShort(char *buffer, int & len, short & value) +int unpackShort(char *buffer, int & len, int16_t & value) { char *p; p = (char *)&value; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.h index ec0a78b5..be604ede 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/monitorData.h @@ -36,7 +36,7 @@ Usage 'l' - long int (4) 'L' - long long int (8) 'i' - int (4) - 's' - short int (2) + 's' - int16_t int (2) 'S' - C-style, nullptr-terminated string (n + nullptr) 'Bn' - buffer, of size n. Used for non-terminated strings, or other binary data. @@ -44,8 +44,8 @@ Usage extern int packString(char *buffer, int & len, char * value); extern int packByte(char *buffer, int & len, char value); -extern int packShort(char *buffer, int & len, short value); -extern int unpackShort(char *buffer, int & len, short & value); +extern int packShort(char *buffer, int & len, int16_t value); +extern int unpackShort(char *buffer, int & len, int16_t & value); extern int unpackByte( char *buffer, int & len, char & value); @@ -94,21 +94,21 @@ enum MON_ERRORS class monMessage { public: - explicit monMessage(short command, short sequence, short size); + explicit monMessage(int16_t command, int16_t sequence, int16_t size); explicit monMessage(const unsigned char * source); monMessage(const monMessage ©); monMessage(); ~monMessage(); - inline const unsigned short getCommand() const {return command;} - inline const unsigned short getSequence() const {return sequence;} - inline const unsigned short getSize() const {return size;} + inline const uint16_t getCommand() const {return command;} + inline const uint16_t getSequence() const {return sequence;} + inline const uint16_t getSize() const {return size;} private: - short command; - short sequence; - short size; + int16_t command; + int16_t sequence; + int16_t size; }; @@ -119,7 +119,7 @@ private: class stringMessage : public monMessage { public: - explicit stringMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, char * data); + explicit stringMessage(const uint16_t command, const uint16_t sequence, const uint16_t size, char * data); explicit stringMessage(const unsigned char * source); ~stringMessage(); @@ -137,18 +137,18 @@ private: class authReplyMessage : public monMessage { public: - explicit authReplyMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, byte data); + explicit authReplyMessage(const uint16_t command, const uint16_t sequence, const uint16_t size, byte data); explicit authReplyMessage(const unsigned char * source); ~authReplyMessage(); inline const unsigned char getData() const {return data;}; - inline const short getVersion() const { return version; }; + inline const int16_t getVersion() const { return version; }; inline void setData(const unsigned char newData) {data = newData;} private: char data; - short version; + int16_t version; }; //---------------------------------------------------------------- @@ -158,7 +158,7 @@ private: class dataReplyMessage : public monMessage { public: - explicit dataReplyMessage(const unsigned short command, const unsigned short sequence, const unsigned short size, unsigned char *data, int dataLen); + explicit dataReplyMessage(const uint16_t command, const uint16_t sequence, const uint16_t size, unsigned char *data, int dataLen); explicit dataReplyMessage(const unsigned char * source); ~dataReplyMessage(); @@ -178,7 +178,7 @@ private: class simpleMessage : public monMessage { public: - explicit simpleMessage(const unsigned short command, const unsigned short sequence, const unsigned short size); + explicit simpleMessage(const uint16_t command, const uint16_t sequence, const uint16_t size); explicit simpleMessage(const unsigned char * source); ~simpleMessage(); @@ -221,12 +221,12 @@ class CMonitorData { int m_sort; char *m_buffer; int m_nbuffer; - short m_sequence; + int16_t m_sequence; int parseList( char **list, char *data, char tok , int max ); void resize_buffer(int new_size); - void send( UdpConnection *mConnection,short & sequence, short msg,char *data ); + void send( UdpConnection *mConnection,int16_t & sequence, int16_t msg,char *data ); public: @@ -235,9 +235,9 @@ public: int getCount(){ return m_ndata; } int DataMax(){ return m_max; } - bool processHierarchyRequest(UdpConnection *con, short & sequence); - bool processElementsRequest( UdpConnection *con, short & sequence, char * userData, int dataLen , long lastUpdateTime); - bool processDescriptionRequest(UdpConnection *con, short & sequence, char * userData, int dataLen,unsigned char *mark); + bool processHierarchyRequest(UdpConnection *con, int16_t & sequence); + bool processElementsRequest( UdpConnection *con, int16_t & sequence, char * userData, int dataLen , long lastUpdateTime); + bool processDescriptionRequest(UdpConnection *con, int16_t & sequence, char * userData, int dataLen,unsigned char *mark); int add(const char *label, int id, int ping, char *des ); int setDescription( int Id, const char *Description , int & mode); char *getDescription(int x){ if( m_ndata >= x ) return nullptr; return m_data[x].discription;} diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp index 7115e242..b065c4e6 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.cpp @@ -301,7 +301,7 @@ RWLock::~RWLock() void RWLock::ReadLock() { mReadMutex.Lock(); - unsigned short readCount = mReadCount++; + uint16_t readCount = mReadCount++; mReadMutex.Unlock(); if (readCount == 0) { @@ -315,7 +315,7 @@ void RWLock::ReadUnlock() { assert(mReadCount); mReadMutex.Lock(); - unsigned short readCount = --mReadCount; + uint16_t readCount = --mReadCount; mReadMutex.Unlock(); if (readCount == 0) { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.h index acf22463..b57ab155 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/thread.h @@ -113,7 +113,7 @@ class RWLock private: Mutex mWriteMutex; Mutex mReadMutex; - unsigned short mReadCount; + uint16_t mReadCount; EventLock mReadLock; Event mReadEvent; }; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h index ba396c51..4455aa0e 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h @@ -6,7 +6,7 @@ #define STRINGIFY(S) #S #ifdef linux -#include +#include #endif #define DECLSPEC @@ -32,12 +32,11 @@ namespace soe { +#ifdef WIN32 typedef char int8; typedef unsigned char uint8; - typedef short int16; - typedef unsigned short uint16; - -#ifdef WIN32 + typedef int16_t int16; + typedef uint16_t uint16; typedef int int32; typedef unsigned uint32; typedef __int64 int64; @@ -45,15 +44,14 @@ namespace soe #elif linux - typedef int32_t int32; - typedef u_int32_t uint32; + typedef int8_t int8; + typedef uint8_t uint8; + typedef uint16_t uint16; + typedef int16_t int16; + typedef int int32; + typedef uint32_t uint32; typedef int64_t int64; - typedef u_int64_t uint64; -//! the previous seem erroneous -// typedef signed int int32; -// typedef unsigned int uint32; -// typedef signed long long int64; -// typedef unsigned long long uint64; + typedef uint64_t uint64; #endif } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.h index c785489e..dcb97d36 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.h @@ -1,6 +1,7 @@ #ifndef UTF8_H #define UTF8_H +#include #include //#include "Unicode.h" @@ -8,7 +9,7 @@ namespace soe { typedef char UTF8; -typedef unsigned short int UTF16; +typedef uint16_t UTF16; size_t UTF8_charSize( char * ); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp index a41ad0df..43421708 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.cpp @@ -10,7 +10,7 @@ namespace NAMESPACE //used when want to open new connection with this socket -TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, unsigned short destPort, unsigned timeout) +TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, uint16_t destPort, unsigned timeout) : m_nextConnection(nullptr), m_prevConnection(nullptr), m_socket(INVALID_SOCKET), @@ -93,7 +93,7 @@ TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAllo } //used when server mode creates new connection object representing a connect request -TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, unsigned short destPort) +TcpConnection::TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, uint16_t destPort) : m_nextConnection(nullptr), m_prevConnection(nullptr), m_socket(socket), diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h index efe2d031..ccda9ffa 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpConnection.h @@ -88,7 +88,7 @@ public: /** * @brief Returns the port on the other side of this conection. */ - unsigned short GetDestinationPort(){ return m_destPort; } + uint16_t GetDestinationPort(){ return m_destPort; } /** * @brief Standard AddRef/Release scheme @@ -107,9 +107,9 @@ public: protected: friend class TcpManager; - TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, unsigned short destPort, unsigned timeout); + TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, const IPAddress &destIP, uint16_t destPort, unsigned timeout); int finishConnect();/**< returns < 0 if fatal error and connect will not work, =0 if need more time, >0 if connect completed */ - TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, unsigned short destPort); + TcpConnection(TcpManager *tcpManager, TcpBlockAllocator *sendAlloc, TcpManager::TcpParams ¶ms, SOCKET socket, const IPAddress &destIP, uint16_t destPort); TcpConnection *m_nextConnection; /**< Double linked list imp. */ TcpConnection *m_prevConnection; /**< Double linked list imp. */ SOCKET m_socket; @@ -133,7 +133,7 @@ private: Status m_status; TcpConnectionHandler *m_handler; IPAddress m_destIP; - unsigned short m_destPort; + uint16_t m_destPort; unsigned m_refCount; TcpBlockAllocator *m_sendAllocator; data_block *m_head; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp index 6f31e9ae..1cc4b0ae 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.cpp @@ -600,7 +600,7 @@ bool TcpManager::GiveTime(unsigned maxTimeAcceptingConnections,unsigned maxSendT return processedIncoming; } -TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout) +TcpConnection *TcpManager::EstablishConnection(const char *serverAddress, uint16_t serverPort, unsigned timeout) { if (m_boundAsServer) { diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h index e9b9e176..13f83d43 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/TcpManager.h @@ -78,7 +78,7 @@ public: * do so in order to navigate company firewalls which may have specific port numbers open to them for this purpose. * default = 0 */ - unsigned short port; + uint16_t port; /** * @ brief Server bind ip. @@ -226,7 +226,7 @@ public: * nullptr if the manager object has exceeded its maximum number of connections * or if the serverAddress cannot be resolved to an IP address. */ - TcpConnection *EstablishConnection(const char *serverAddress, unsigned short serverPort, unsigned timeout = 0); + TcpConnection *EstablishConnection(const char *serverAddress, uint16_t serverPort, unsigned timeout = 0); /** * @brief Binds this manager as a server which will listen for and accept incoming connections. diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpHandler.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpHandler.hpp index c97f6c6c..9aa70200 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpHandler.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpHandler.hpp @@ -6,8 +6,9 @@ class UdpManager; class UdpConnection; class LogicalPacket; +#include + typedef unsigned char uchar; -typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp index f86f5d7b..5b998ad9 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.cpp @@ -481,7 +481,7 @@ void UdpManager::CreateAndBindSocket(int usePort) // bind it to any address struct sockaddr_in addr_loc; addr_loc.sin_family = PF_INET; - addr_loc.sin_port = htons((ushort)usePort); + addr_loc.sin_port = htons((uint16_t)usePort); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); if (mParams.bindIpAddress[0] != 0) @@ -954,7 +954,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i struct sockaddr_in addr_dest; addr_dest.sin_family = PF_INET; addr_dest.sin_addr.s_addr = ip.GetAddress(); - addr_dest.sin_port = htons((ushort)port); + addr_dest.sin_port = htons((uint16_t)port); if (SOCKET_ERROR == sendto(mUdpSocket, (const char *)data, dataLen, 0, (struct sockaddr *)&addr_dest, sizeof(addr_dest))) { // error writing to socket, what is the error? @@ -1432,7 +1432,7 @@ void UdpConnection::SendTerminatePacket(int connectCode, DisconnectReason reason buf[0] = 0; buf[1] = cUdpPacketTerminate; UdpMisc::PutValue32(buf + 2, connectCode); - UdpMisc::PutValue16(buf + 6, (ushort)reason); + UdpMisc::PutValue16(buf + 6, (uint16_t)reason); PhysicalSend(buf, 8, true); } @@ -1529,7 +1529,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data uchar *bufPtr = tempBuffer; bufPtr[0] = 0; bufPtr[1] = cUdpPacketOrdered2; - UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); + UdpMisc::PutValue16(bufPtr + 2, (uint16_t)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); @@ -1542,7 +1542,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data uchar *bufPtr = tempBuffer; bufPtr[0] = 0; bufPtr[1] = cUdpPacketOrdered2; - UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); + UdpMisc::PutValue16(bufPtr + 2, (uint16_t)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); @@ -1933,7 +1933,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) } case cUdpPacketOrdered: { - ushort orderedStamp = UdpMisc::GetValue16(data + 2); + uint16_t orderedStamp = UdpMisc::GetValue16(data + 2); int diff = (int)orderedStamp - (int)mOrderedStampLast; if (diff <= 0) // equal here makes it strip dupes too diff += 0x10000; @@ -1951,7 +1951,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) } case cUdpPacketOrdered2: { - ushort orderedStamp = UdpMisc::GetValue16(data + 2); + uint16_t orderedStamp = UdpMisc::GetValue16(data + 2); int diff = (int)orderedStamp - (int)mOrderedStampLast2; if (diff <= 0) // equal here makes it strip dupes too diff += 0x10000; @@ -2095,7 +2095,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) pp.ourSent = UdpMisc::GetValue64(data + 24); pp.ourReceived = UdpMisc::GetValue64(data + 32); - ushort curStamp = UdpMisc::LocalSyncStampShort(); + uint16_t curStamp = UdpMisc::LocalSyncStampShort(); int roundTime = UdpMisc::SyncStampShortDeltaTime(pp.timeStamp, curStamp); mSyncStatCount++; @@ -2555,7 +2555,7 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo *crcPtr = (uchar)(crc & 0xff); break; case 2: - UdpMisc::PutValue16(crcPtr, (ushort)(crc & 0xffff)); + UdpMisc::PutValue16(crcPtr, (uint16_t)(crc & 0xffff)); break; case 3: UdpMisc::PutValue24(crcPtr, crc & 0xffffff); @@ -3360,7 +3360,7 @@ int UdpReliableChannel::GiveTime() bufPtr = buf; *bufPtr++ = 0; *bufPtr++ = (uchar)(((fragment) ? UdpConnection::cUdpPacketFragment1 : UdpConnection::cUdpPacketReliable1) + mChannelNumber); // mark us as a fragment if we are one - bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)(reliableId & 0xffff)); if (fragment && entry->mDataPtr == parentBase) bufPtr += UdpMisc::PutValue32(bufPtr, entry->mParent->GetDataLen()); // first fragment has a total-length byte after the reliable header mUdpConnection->BufferedSend(buf, bufPtr - buf, entry->mDataPtr, entry->mDataLen, false); @@ -3507,7 +3507,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } int packetType = data[1]; - ushort reliableStamp = UdpMisc::GetValue16(data + 2); + uint16_t reliableStamp = UdpMisc::GetValue16(data + 2); udp_int64 reliableId = GetReliableIncomingId(reliableStamp); if (reliableId >= mReliableIncomingId + mConfig.maxInstandingPackets) @@ -3577,13 +3577,13 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // ack everything up to the current head of our chain (minus one since the stamp represents the next one we want to get) *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAckAll1 + mChannelNumber); - bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)((mReliableIncomingId - 1) & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)((mReliableIncomingId - 1) & 0xffff)); } else { // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); - bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)(reliableId & 0xffff)); mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack } @@ -3640,7 +3640,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat void UdpReliableChannel::AckAllPacket(const uchar *data, int /*dataLen*/) { - udp_int64 reliableId = GetReliableOutgoingId((ushort)UdpMisc::GetValue16(data + 2)); + udp_int64 reliableId = GetReliableOutgoingId((uint16_t)UdpMisc::GetValue16(data + 2)); if (mReliableOutgoingPendingId > reliableId) { @@ -3710,7 +3710,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // harm done is that the we may not resend some of the earlier sent packets quite as quickly. This will only // happen in situations where a packet that was truely lost gets acked on it's second attempt...we just // won't be using that ack for the purposes of accelerating other resends...since odds are a non-lost packet - // will accelerate those other resends shortly anyhow, there really is no loss + // will accelerate those other resends int16_tly anyhow, there really is no loss // (note: we used to only set this value forward for packets that were never lost (one time sends); however, if this stamp // ever got set way high for some reason (in theory it can't happen), then we would get into a situation where it would // rapidly resend and possibly never get reset, causing infinite rapid resends, so we now set it every time to the first-stamp) @@ -4127,9 +4127,9 @@ UdpMisc::ClockStamp UdpMisc::Clock() #endif } -int UdpMisc::SyncStampShortDeltaTime(ushort stamp1, ushort stamp2) +int UdpMisc::SyncStampShortDeltaTime(uint16_t stamp1, uint16_t stamp2) { - ushort delta = (ushort)(stamp1 - stamp2); + uint16_t delta = (uint16_t)(stamp1 - stamp2); if (delta > 0x7fff) return((int)(0xffff - delta)); return((int)delta); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp index 9db50e40..76ddbd53 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/UdpLibrary/UdpLibrary.hpp @@ -1,6 +1,8 @@ #ifndef UDPLIBRARY_HPP #define UDPLIBRARY_HPP + +#include #include #include "UdpHandler.hpp" #include "Base/priority.hpp" @@ -130,7 +132,7 @@ class UdpMisc static int Random(int *seed); // random number generator static void Sleep(int milliseconds); - static ushort LocalSyncStampShort(); // gets a local-clock based sync-stamp. (only good for timings up to 32 seconds) + static uint16_t LocalSyncStampShort(); // gets a local-clock based sync-stamp. (only good for timings up to 32 seconds) static uint LocalSyncStampLong(); // gets a local-clock based sync-stamp. (good for timings up to 23 days) // returns the time difference between two sync-stamps that are based on the same clock @@ -139,7 +141,7 @@ class UdpMisc // you a sync-stamp that you can compare with ServerSyncStampShort values generated on other // machines that are synchronized against the same server. This ServerSyncStampShort function and // this delta time function serve as the basis for calculating one-way travel times for packets. - static int SyncStampShortDeltaTime(ushort stamp1, ushort stamp2); + static int SyncStampShortDeltaTime(uint16_t stamp1, uint16_t stamp2); static int SyncStampLongDeltaTime(uint stamp1, uint stamp2); // same as Short version only no limit // used to alloc/resize/free an allocation previously created with this function @@ -163,12 +165,12 @@ class UdpMisc static int PutValue64(void *buffer, udp_int64 value); // puts a 64-bit value into the buffer in big-endian format, returns number of bytes used(8) static int PutValue32(void *buffer, uint value); // puts a 32-bit value into the buffer in big-endian format, returns number of bytes used(4) static int PutValue24(void *buffer, uint value); // puts a 24-bit value into the buffer in big-endian format, returns number of bytes used(4) - static int PutValue16(void *buffer, ushort value); // puts a 16-bit value into the buffer in big-endian format, returns number of bytes used(2) + static int PutValue16(void *buffer, uint16_t value); // puts a 16-bit value into the buffer in big-endian format, returns number of bytes used(2) static udp_int64 GetValue64(const void *buffer); // gets a 64-bit value from the buffer in big-endian format static uint GetValue32(const void *buffer); // gets a 32-bit value from the buffer in big-endian format static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format - static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format + static uint16_t GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); @@ -535,7 +537,7 @@ class UdpManager // to be kept alive, or at least kept alive very often (like for a chat server perhaps where nobody is talking much). // For some people, it may be necessary to send data more frequently in order to keep their NAT mapping fresh, or their // firewall software happy. However, we don't want to be in a situation where our server is receiving a lot more data - // than it needs to just so these people can keep their port open. I have seen NAT's that lose mappings in as short + // than it needs to just so these people can keep their port open. I have seen NAT's that lose mappings in as int16_t // as 20 seconds. What this feature does is a bit tricky. It changes the time-to-live (TTL) for a special keep-alive // packet to some small value (4) which is enough for the packet to get past firewalls and NAT's, but not make it all // the way to our server. In this manner, the port gets kept alive, but we don't waste bandwidth with these packets. @@ -583,7 +585,7 @@ class UdpManager // them and terminate the connection. When a packet is successfully received into the connection in question, the // retry period is reset, such that the next time an ICMP error comes in, it has another period of time for it // to resolve the issue. This servers a couple purpose, 1) it can allow for momentary outages that can be recovered - // from in short order, and 2) it is necessary for the port-remapping feature to work properly in situations where + // from in int16_t order, and 2) it is necessary for the port-remapping feature to work properly in situations where // the server may send data to the old-port before the remapping negotiations are completed. In order for the // remapping feature to work properly, this value should be set to larger than the longest time a connection typically // goes without receiving data from the other side. (0=no grace period) @@ -1189,9 +1191,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, // packet travel times under 32 seconds, would should be completely safe. You must use the // UdpManager::SyncStampDeltaTime function in order to calculate the elapsed time between // the two stamps. - ushort ServerSyncStampShort() const; + uint16_t ServerSyncStampShort() const; uint ServerSyncStampLong() const; - int ServerSyncStampShortElapsed(ushort syncStamp) const; + int ServerSyncStampShortElapsed(uint16_t syncStamp) const; int ServerSyncStampLongElapsed(uint syncStamp) const; // returns the IP address/port this connection is linked to @@ -1355,8 +1357,8 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int mOrderedCountOutgoing; int mOrderedCountOutgoing2; - ushort mOrderedStampLast; - ushort mOrderedStampLast2; + uint16_t mOrderedStampLast; + uint16_t mOrderedStampLast2; typedef int (UdpConnection::* IEncryptFunction)(uchar *destData, const uchar *sourceData, int sourceLen); typedef int (UdpConnection::* IDecryptFunction)(uchar *destData, const uchar *sourceData, int sourceLen); @@ -1461,7 +1463,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, { uchar zeroByte; uchar packetType; - ushort timeStamp; + uint16_t timeStamp; int masterPingTime; int averagePingTime; int lowPingTime; @@ -1475,7 +1477,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, { uchar zeroByte; uchar packetType; - ushort timeStamp; + uint16_t timeStamp; uint serverSyncStampLong; udp_int64 yourSent; udp_int64 yourReceived; @@ -1487,7 +1489,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, { uchar zeroByte; uchar packetType; - ushort reliableStamp; + uint16_t reliableStamp; }; struct UdpPacketReliableFragmentStart @@ -1500,14 +1502,14 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, { uchar zeroByte; uchar packetType; - ushort reliableStamp; + uint16_t reliableStamp; }; struct UdpPacketOrdered { uchar zeroByte; uchar packetType; - ushort orderStamp; + uint16_t orderStamp; }; @@ -1702,9 +1704,9 @@ inline int UdpMisc::ClockDiff(ClockStamp start, ClockStamp stop) return((int)t); } -inline ushort UdpMisc::LocalSyncStampShort() +inline uint16_t UdpMisc::LocalSyncStampShort() { - return((ushort)(Clock() & 0xffff)); + return((uint16_t)(Clock() & 0xffff)); } inline uint UdpMisc::LocalSyncStampLong() @@ -1764,7 +1766,7 @@ inline uint UdpMisc::GetValue24(const void *buffer) return((*bufptr << 16) | (*(bufptr + 1) << 8) | *(bufptr + 2)); } -inline int UdpMisc::PutValue16(void *buffer, ushort value) +inline int UdpMisc::PutValue16(void *buffer, uint16_t value) { uchar *bufptr = (uchar *)buffer; *bufptr++ = (uchar)((value >> 8) & 0xff); @@ -1772,10 +1774,10 @@ inline int UdpMisc::PutValue16(void *buffer, ushort value) return(2); } -inline ushort UdpMisc::GetValue16(const void *buffer) +inline uint16_t UdpMisc::GetValue16(const void *buffer) { const uchar *bufptr = (const uchar *)buffer; - return((ushort)((*bufptr << 8) | *(bufptr + 1))); + return((uint16_t)((*bufptr << 8) | *(bufptr + 1))); } // UdpManager @@ -1874,7 +1876,7 @@ inline void UdpConnection::ScheduleTimeNow() { // if we are current in our GiveTime function getting time, then there is no need to reprioritize to 0 when we send a raw packet, since // the last thing we do in out GiveTime is do a scheduling calculation based on the last time a packet was sent. This little check - // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. + // prevents us from reprioritizing to 0, only to int16_tly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { if (mUdpManager != nullptr) @@ -1950,9 +1952,9 @@ inline int UdpConnection::LastSend() const return(UdpMisc::ClockElapsed(mLastSendTime)); } -inline ushort UdpConnection::ServerSyncStampShort() const +inline uint16_t UdpConnection::ServerSyncStampShort() const { - return((ushort)(UdpMisc::LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); + return((uint16_t)(UdpMisc::LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); } inline uint UdpConnection::ServerSyncStampLong() const @@ -1960,7 +1962,7 @@ inline uint UdpConnection::ServerSyncStampLong() const return(UdpMisc::LocalSyncStampLong() + mSyncTimeDelta); } -inline int UdpConnection::ServerSyncStampShortElapsed(ushort syncStamp) const +inline int UdpConnection::ServerSyncStampShortElapsed(uint16_t syncStamp) const { return(UdpMisc::SyncStampShortDeltaTime(syncStamp, ServerSyncStampShort())); } @@ -2051,7 +2053,7 @@ inline int UdpConnection::GetKeepAliveDelay() const // UdpReliableChannel inline void UdpReliableChannel::AckPacket(const uchar *data, int /*dataLen*/) { - Ack(GetReliableOutgoingId((ushort)UdpMisc::GetValue16(data + 2))); + Ack(GetReliableOutgoingId((uint16_t)UdpMisc::GetValue16(data + 2))); } inline int UdpReliableChannel::GetAveragePing() const diff --git a/external/3rd/library/udplibrary/UdpHandler.hpp b/external/3rd/library/udplibrary/UdpHandler.hpp index d7b3869a..ad1fcd2a 100644 --- a/external/3rd/library/udplibrary/UdpHandler.hpp +++ b/external/3rd/library/udplibrary/UdpHandler.hpp @@ -5,8 +5,9 @@ class UdpManager; class UdpConnection; class LogicalPacket; +#include + typedef unsigned char uchar; -typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index 4105355f..f3d2b138 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -476,7 +476,7 @@ void UdpManager::CreateAndBindSocket(int usePort) // bind it to any address struct sockaddr_in addr_loc; addr_loc.sin_family = PF_INET; - addr_loc.sin_port = htons((ushort)usePort); + addr_loc.sin_port = htons((uint16_t)usePort); addr_loc.sin_addr.s_addr = htonl(INADDR_ANY); if (mParams.bindIpAddress[0] != 0) @@ -953,7 +953,7 @@ void UdpManager::ActualSendHelper(const uchar *data, int dataLen, UdpIpAddress i struct sockaddr_in addr_dest; addr_dest.sin_family = PF_INET; addr_dest.sin_addr.s_addr = ip.GetAddress(); - addr_dest.sin_port = htons((ushort)port); + addr_dest.sin_port = htons((uint16_t)port); if (SOCKET_ERROR == sendto(mUdpSocket, (const char *)data, dataLen, 0, (struct sockaddr *)&addr_dest, sizeof(addr_dest))) { // error writing to socket, what is the error? @@ -1431,7 +1431,7 @@ void UdpConnection::SendTerminatePacket(int connectCode, DisconnectReason reason buf[0] = 0; buf[1] = cUdpPacketTerminate; UdpMisc::PutValue32(buf + 2, connectCode); - UdpMisc::PutValue16(buf + 6, (ushort)reason); + UdpMisc::PutValue16(buf + 6, (uint16_t)reason); PhysicalSend(buf, 8, true); } @@ -1528,7 +1528,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data uchar *bufPtr = tempBuffer; bufPtr[0] = 0; bufPtr[1] = cUdpPacketOrdered2; - UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); + UdpMisc::PutValue16(bufPtr + 2, (uint16_t)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); @@ -1541,7 +1541,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const uchar *data, int data uchar *bufPtr = tempBuffer; bufPtr[0] = 0; bufPtr[1] = cUdpPacketOrdered2; - UdpMisc::PutValue16(bufPtr + 2, (ushort)(++mOrderedCountOutgoing2 & 0xffff)); + UdpMisc::PutValue16(bufPtr + 2, (uint16_t)(++mOrderedCountOutgoing2 & 0xffff)); memcpy(bufPtr + 4, data, dataLen); if (data2 != nullptr) memcpy(bufPtr + 4 + dataLen, data2, dataLen2); @@ -1915,7 +1915,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) } case cUdpPacketOrdered: { - ushort orderedStamp = UdpMisc::GetValue16(data + 2); + uint16_t orderedStamp = UdpMisc::GetValue16(data + 2); int diff = (int)orderedStamp - (int)mOrderedStampLast; if (diff <= 0) // equal here makes it strip dupes too diff += 0x10000; @@ -1933,7 +1933,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) } case cUdpPacketOrdered2: { - ushort orderedStamp = UdpMisc::GetValue16(data + 2); + uint16_t orderedStamp = UdpMisc::GetValue16(data + 2); int diff = (int)orderedStamp - (int)mOrderedStampLast2; if (diff <= 0) // equal here makes it strip dupes too diff += 0x10000; @@ -2075,7 +2075,7 @@ void UdpConnection::ProcessCookedPacket(const uchar *data, int dataLen) pp.ourSent = UdpMisc::GetValue64(data + 24); pp.ourReceived = UdpMisc::GetValue64(data + 32); - ushort curStamp = UdpMisc::LocalSyncStampShort(); + uint16_t curStamp = UdpMisc::LocalSyncStampShort(); int roundTime = UdpMisc::SyncStampShortDeltaTime(pp.timeStamp, curStamp); mSyncStatCount++; @@ -2533,7 +2533,7 @@ void UdpConnection::PhysicalSend(const uchar *data, int dataLen, bool appendAllo *crcPtr = (uchar)(crc & 0xff); break; case 2: - UdpMisc::PutValue16(crcPtr, (ushort)(crc & 0xffff)); + UdpMisc::PutValue16(crcPtr, (uint16_t)(crc & 0xffff)); break; case 3: UdpMisc::PutValue24(crcPtr, crc & 0xffffff); @@ -3345,7 +3345,7 @@ int UdpReliableChannel::GiveTime() bufPtr = buf; *bufPtr++ = 0; *bufPtr++ = (uchar)(((fragment) ? UdpConnection::cUdpPacketFragment1 : UdpConnection::cUdpPacketReliable1) + mChannelNumber); // mark us as a fragment if we are one - bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)(reliableId & 0xffff)); if (fragment && entry->mDataPtr == parentBase) bufPtr += UdpMisc::PutValue32(bufPtr, entry->mParent->GetDataLen()); // first fragment has a total-length byte after the reliable header mUdpConnection->BufferedSend(buf, bufPtr - buf, entry->mDataPtr, entry->mDataLen, false); @@ -3492,7 +3492,7 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) } int packetType = data[1]; - ushort reliableStamp = UdpMisc::GetValue16(data + 2); + uint16_t reliableStamp = UdpMisc::GetValue16(data + 2); udp_int64 reliableId = GetReliableIncomingId(reliableStamp); if (reliableId >= mReliableIncomingId + mConfig.maxInstandingPackets) @@ -3562,13 +3562,13 @@ void UdpReliableChannel::ReliablePacket(const uchar *data, int dataLen) { // ack everything up to the current head of our chain (minus one since the stamp represents the next one we want to get) *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAckAll1 + mChannelNumber); - bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)((mReliableIncomingId - 1) & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)((mReliableIncomingId - 1) & 0xffff)); } else { // a simple ack for us only *bufPtr++ = (uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber); - bufPtr += UdpMisc::PutValue16(bufPtr, (ushort)(reliableId & 0xffff)); + bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)(reliableId & 0xffff)); mBufferedAckPtr = nullptr; // not allowed to replace an old one with a selective-ack } @@ -3631,7 +3631,7 @@ void UdpReliableChannel::ProcessPacket(ReliablePacketMode mode, const uchar *dat void UdpReliableChannel::AckAllPacket(const uchar *data, int /*dataLen*/) { - udp_int64 reliableId = GetReliableOutgoingId((ushort)UdpMisc::GetValue16(data + 2)); + udp_int64 reliableId = GetReliableOutgoingId((uint16_t)UdpMisc::GetValue16(data + 2)); if (mReliableOutgoingPendingId > reliableId) { @@ -3701,7 +3701,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId) // harm done is that the we may not resend some of the earlier sent packets quite as quickly. This will only // happen in situations where a packet that was truely lost gets acked on it's second attempt...we just // won't be using that ack for the purposes of accelerating other resends...since odds are a non-lost packet - // will accelerate those other resends shortly anyhow, there really is no loss + // will accelerate those other resends int16_tly anyhow, there really is no loss // (note: we used to only set this value forward for packets that were never lost (one time sends); however, if this stamp // ever got set way high for some reason (in theory it can't happen), then we would get into a situation where it would // rapidly resend and possibly never get reset, causing infinite rapid resends, so we now set it every time to the first-stamp) @@ -4118,9 +4118,9 @@ UdpMisc::ClockStamp UdpMisc::Clock() #endif } -int UdpMisc::SyncStampShortDeltaTime(ushort stamp1, ushort stamp2) +int UdpMisc::SyncStampShortDeltaTime(uint16_t stamp1, uint16_t stamp2) { - ushort delta = (ushort)(stamp1 - stamp2); + uint16_t delta = (uint16_t)(stamp1 - stamp2); if (delta > 0x7fff) return((int)(0xffff - delta)); return((int)delta); diff --git a/external/3rd/library/udplibrary/UdpLibrary.doc b/external/3rd/library/udplibrary/UdpLibrary.doc index 97735470..9eb283bb 100644 Binary files a/external/3rd/library/udplibrary/UdpLibrary.doc and b/external/3rd/library/udplibrary/UdpLibrary.doc differ diff --git a/external/3rd/library/udplibrary/UdpLibrary.hpp b/external/3rd/library/udplibrary/UdpLibrary.hpp index 3117e386..c512d8e7 100644 --- a/external/3rd/library/udplibrary/UdpLibrary.hpp +++ b/external/3rd/library/udplibrary/UdpLibrary.hpp @@ -3,6 +3,7 @@ #include +#include #include "UdpHandler.hpp" #include "priority.hpp" #include "hashtable.hpp" @@ -129,7 +130,7 @@ class UdpMisc static int Random(int *seed); // random number generator static void Sleep(int milliseconds); - static ushort LocalSyncStampShort(); // gets a local-clock based sync-stamp. (only good for timings up to 32 seconds) + static uint16_t LocalSyncStampShort(); // gets a local-clock based sync-stamp. (only good for timings up to 32 seconds) static uint LocalSyncStampLong(); // gets a local-clock based sync-stamp. (good for timings up to 23 days) // returns the time difference between two sync-stamps that are based on the same clock @@ -138,7 +139,7 @@ class UdpMisc // you a sync-stamp that you can compare with ServerSyncStampShort values generated on other // machines that are synchronized against the same server. This ServerSyncStampShort function and // this delta time function serve as the basis for calculating one-way travel times for packets. - static int SyncStampShortDeltaTime(ushort stamp1, ushort stamp2); + static int SyncStampShortDeltaTime(uint16_t stamp1, uint16_t stamp2); static int SyncStampLongDeltaTime(uint stamp1, uint stamp2); // same as Short version only no limit // used to alloc/resize/free an allocation previously created with this function @@ -162,12 +163,12 @@ class UdpMisc static int PutValue64(void *buffer, udp_int64 value); // puts a 64-bit value into the buffer in big-endian format, returns number of bytes used(8) static int PutValue32(void *buffer, uint value); // puts a 32-bit value into the buffer in big-endian format, returns number of bytes used(4) static int PutValue24(void *buffer, uint value); // puts a 24-bit value into the buffer in big-endian format, returns number of bytes used(4) - static int PutValue16(void *buffer, ushort value); // puts a 16-bit value into the buffer in big-endian format, returns number of bytes used(2) + static int PutValue16(void *buffer, uint16_t value); // puts a 16-bit value into the buffer in big-endian format, returns number of bytes used(2) static udp_int64 GetValue64(const void *buffer); // gets a 64-bit value from the buffer in big-endian format static uint GetValue32(const void *buffer); // gets a 32-bit value from the buffer in big-endian format static uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format - static ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format + static uint16_t GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); @@ -534,7 +535,7 @@ class UdpManager // to be kept alive, or at least kept alive very often (like for a chat server perhaps where nobody is talking much). // For some people, it may be necessary to send data more frequently in order to keep their NAT mapping fresh, or their // firewall software happy. However, we don't want to be in a situation where our server is receiving a lot more data - // than it needs to just so these people can keep their port open. I have seen NAT's that lose mappings in as short + // than it needs to just so these people can keep their port open. I have seen NAT's that lose mappings in as int16_t // as 20 seconds. What this feature does is a bit tricky. It changes the time-to-live (TTL) for a special keep-alive // packet to some small value (4) which is enough for the packet to get past firewalls and NAT's, but not make it all // the way to our server. In this manner, the port gets kept alive, but we don't waste bandwidth with these packets. @@ -582,7 +583,7 @@ class UdpManager // them and terminate the connection. When a packet is successfully received into the connection in question, the // retry period is reset, such that the next time an ICMP error comes in, it has another period of time for it // to resolve the issue. This servers a couple purpose, 1) it can allow for momentary outages that can be recovered - // from in short order, and 2) it is necessary for the port-remapping feature to work properly in situations where + // from in int16_t order, and 2) it is necessary for the port-remapping feature to work properly in situations where // the server may send data to the old-port before the remapping negotiations are completed. In order for the // remapping feature to work properly, this value should be set to larger than the longest time a connection typically // goes without receiving data from the other side. (0=no grace period) @@ -1172,9 +1173,9 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, // packet travel times under 32 seconds, would should be completely safe. You must use the // UdpManager::SyncStampDeltaTime function in order to calculate the elapsed time between // the two stamps. - ushort ServerSyncStampShort() const; + uint16_t ServerSyncStampShort() const; uint ServerSyncStampLong() const; - int ServerSyncStampShortElapsed(ushort syncStamp) const; + int ServerSyncStampShortElapsed(uint16_t syncStamp) const; int ServerSyncStampLongElapsed(uint syncStamp) const; // returns the IP address/port this connection is linked to @@ -1337,8 +1338,8 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, int mOrderedCountOutgoing; int mOrderedCountOutgoing2; - ushort mOrderedStampLast; - ushort mOrderedStampLast2; + uint16_t mOrderedStampLast; + uint16_t mOrderedStampLast2; typedef int (UdpConnection::* IEncryptFunction)(uchar *destData, const uchar *sourceData, int sourceLen); typedef int (UdpConnection::* IDecryptFunction)(uchar *destData, const uchar *sourceData, int sourceLen); @@ -1443,7 +1444,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, { uchar zeroByte; uchar packetType; - ushort timeStamp; + uint16_t timeStamp; int masterPingTime; int averagePingTime; int lowPingTime; @@ -1457,7 +1458,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, { uchar zeroByte; uchar packetType; - ushort timeStamp; + uint16_t timeStamp; uint serverSyncStampLong; udp_int64 yourSent; udp_int64 yourReceived; @@ -1469,7 +1470,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, { uchar zeroByte; uchar packetType; - ushort reliableStamp; + uint16_t reliableStamp; }; struct UdpPacketReliableFragmentStart @@ -1482,14 +1483,14 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember, { uchar zeroByte; uchar packetType; - ushort reliableStamp; + uint16_t reliableStamp; }; struct UdpPacketOrdered { uchar zeroByte; uchar packetType; - ushort orderStamp; + uint16_t orderStamp; }; @@ -1685,9 +1686,9 @@ inline int UdpMisc::ClockDiff(ClockStamp start, ClockStamp stop) return((int)t); } -inline ushort UdpMisc::LocalSyncStampShort() +inline uint16_t UdpMisc::LocalSyncStampShort() { - return((ushort)(Clock() & 0xffff)); + return((uint16_t)(Clock() & 0xffff)); } inline uint UdpMisc::LocalSyncStampLong() @@ -1747,7 +1748,7 @@ inline uint UdpMisc::GetValue24(const void *buffer) return((*bufptr << 16) | (*(bufptr + 1) << 8) | *(bufptr + 2)); } -inline int UdpMisc::PutValue16(void *buffer, ushort value) +inline int UdpMisc::PutValue16(void *buffer, uint16_t value) { uchar *bufptr = (uchar *)buffer; *bufptr++ = (uchar)((value >> 8) & 0xff); @@ -1755,10 +1756,10 @@ inline int UdpMisc::PutValue16(void *buffer, ushort value) return(2); } -inline ushort UdpMisc::GetValue16(const void *buffer) +inline uint16_t UdpMisc::GetValue16(const void *buffer) { const uchar *bufptr = (const uchar *)buffer; - return((ushort)((*bufptr << 8) | *(bufptr + 1))); + return((uint16_t)((*bufptr << 8) | *(bufptr + 1))); } // UdpManager @@ -1857,7 +1858,7 @@ inline void UdpConnection::ScheduleTimeNow() { // if we are current in our GiveTime function getting time, then there is no need to reprioritize to 0 when we send a raw packet, since // the last thing we do in out GiveTime is do a scheduling calculation based on the last time a packet was sent. This little check - // prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong. + // prevents us from reprioritizing to 0, only to int16_tly thereafter be reprioritized to where we actually belong. if (!mGettingTime) { if (mUdpManager != nullptr) @@ -1933,9 +1934,9 @@ inline int UdpConnection::LastSend() const return(UdpMisc::ClockElapsed(mLastSendTime)); } -inline ushort UdpConnection::ServerSyncStampShort() const +inline uint16_t UdpConnection::ServerSyncStampShort() const { - return((ushort)(UdpMisc::LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); + return((uint16_t)(UdpMisc::LocalSyncStampShort() + (mSyncTimeDelta & 0xffff))); } inline uint UdpConnection::ServerSyncStampLong() const @@ -1943,7 +1944,7 @@ inline uint UdpConnection::ServerSyncStampLong() const return(UdpMisc::LocalSyncStampLong() + mSyncTimeDelta); } -inline int UdpConnection::ServerSyncStampShortElapsed(ushort syncStamp) const +inline int UdpConnection::ServerSyncStampShortElapsed(uint16_t syncStamp) const { return(UdpMisc::SyncStampShortDeltaTime(syncStamp, ServerSyncStampShort())); } @@ -2034,7 +2035,7 @@ inline int UdpConnection::GetKeepAliveDelay() const // UdpReliableChannel inline void UdpReliableChannel::AckPacket(const uchar *data, int /*dataLen*/) { - Ack(GetReliableOutgoingId((ushort)UdpMisc::GetValue16(data + 2))); + Ack(GetReliableOutgoingId((uint16_t)UdpMisc::GetValue16(data + 2))); } inline int UdpReliableChannel::GetAveragePing() const diff --git a/external/3rd/library/udplibrary/UdpLibraryRelease.txt b/external/3rd/library/udplibrary/UdpLibraryRelease.txt index 934ab022..a6d21c2f 100644 --- a/external/3rd/library/udplibrary/UdpLibraryRelease.txt +++ b/external/3rd/library/udplibrary/UdpLibraryRelease.txt @@ -266,7 +266,7 @@ UdpLibrary Release Notes to terminate a connection. However, there are situations where it may be desireable to tolerate ICMP errors for a few seconds as sometimes these situations resolve themselves. In particular, the new port-remapping feature (see below) requires that some tolerance be set in this regard, as ICMP errors - will likely occur for a short period of time while remapping is occurring. Although it changes + will likely occur for a int16_t period of time while remapping is occurring. Although it changes previous behavior of the library, I have decided to make this new setting start out at 5000ms. This means that ICMP errors for port unreachable and such will not occur for at least 5 seconds, whereas before they may have occurred nearly instantly. If you want the previous behavior, setting this value @@ -373,7 +373,7 @@ UdpLibrary Release Notes and we don't want to mess them up. - recently, the UdpLibrary has been seeing much heavier load as a server-to-server interprocess communications - protocol. While it was designed to handle this sort of thing, it did have one short-sighted limitation; it + protocol. While it was designed to handle this sort of thing, it did have one int16_t-sighted limitation; it was only capable of transferring 4 billion logical reliable packets per session before it would fall apart. Even at a very high average trasfer rate of 1000 packets per second on a single connection, it would take over a month to exceed this rate. It seemed at first that this might be a reasonable limitation, until Planetside @@ -530,7 +530,7 @@ UdpLibrary Release Notes process using bandwidth in the system, and you don't really care to be 'friendly' to other connections running on the system. Normally, if a modem-user is playing the game and has an TCP transfer going on in the background, then the TCP connection and the UdpLibrary connection will both effectively settle-in on using about half the available - bandwidth. That is, the flow-control algorithms used by the UdpLibrary and TCP are such that over a fairly short period + bandwidth. That is, the flow-control algorithms used by the UdpLibrary and TCP are such that over a fairly int16_t period of time, they will both settle in on a happy split. However, if half-the-bandwidth was equal to a 2k window-size, and the UdpLibrary was configured to have a minimum window size of 3k, then the UdpLibrary would not scale down. Because the TCP connection is willing to scale down further, it would, and you would effectively end up with a 3k/1k split @@ -906,7 +906,7 @@ UdpLibrary Release Notes server perhaps where nobody is talking much). For some people, it may be necessary to send data more frequently in order to keep their NAT mapping fresh, or their firewall software happy. However, we don't want to be in a situation where our server is receiving a lot more data than it needs to just so these people can keep their port open. I have seen NAT's that lose - mappings in as short as 20 seconds. What this feature does is a bit tricky. It changes the time-to-live (TTL) for a special + mappings in as int16_t as 20 seconds. What this feature does is a bit tricky. It changes the time-to-live (TTL) for a special keep-alive packet to some small value (5) which is enough for the packet to get past local firewalls and NAT's, but not make it all the way to our server. In this manner, the port gets kept alive, but we don't waste bandwidth with these packets. These special packets are not counted statistically in any way and they do not reset any timers of any kind. Their sole diff --git a/external/3rd/library/udplibrary/udpclient.cpp b/external/3rd/library/udplibrary/udpclient.cpp index b66ed3a8..913374b2 100755 --- a/external/3rd/library/udplibrary/udpclient.cpp +++ b/external/3rd/library/udplibrary/udpclient.cpp @@ -181,6 +181,6 @@ int main(int argc, char **argv) void MyConnectionHandler::OnRoutePacket(UdpConnection * /*con*/, const uchar *data, int dataLen) { - printf("IN=%d/%d LEN=%d \n", *(ushort *)data, *(ushort *)(data + dataLen - 2), dataLen); + printf("IN=%d/%d LEN=%d \n", *(uint16_t *)data, *(uint16_t *)(data + dataLen - 2), dataLen); } diff --git a/external/3rd/library/udplibrary/udpserver.cpp b/external/3rd/library/udplibrary/udpserver.cpp index 65f844ec..43657afe 100755 --- a/external/3rd/library/udplibrary/udpserver.cpp +++ b/external/3rd/library/udplibrary/udpserver.cpp @@ -136,11 +136,11 @@ int main(int argc, char **argv) { count++; char buf[2000]; - *(ushort *)buf = (ushort)count; + *(uint16_t *)buf = (uint16_t)count; int len = (rand() % 1000) + 10; - *(ushort *)(buf + len - 2) = (ushort)count; + *(uint16_t *)(buf + len - 2) = (uint16_t)count; myPlayerManager->SendPacketToAll(cUdpChannelReliable1, buf, len); - printf("OUT=%d/%d LEN=%d \n", *(ushort *)buf, *(ushort *)(buf + len - 2), len); + printf("OUT=%d/%d LEN=%d \n", *(uint16_t *)buf, *(uint16_t *)(buf + len - 2), len); } myUdpManager->GiveTime(); diff --git a/external/3rd/library/webAPI/json.hpp b/external/3rd/library/webAPI/json.hpp index f8d948f1..5d9c63b5 100644 --- a/external/3rd/library/webAPI/json.hpp +++ b/external/3rd/library/webAPI/json.hpp @@ -1389,7 +1389,7 @@ class basic_json @tparam CompatibleNumberIntegerType An integer type which is compatible to @ref number_integer_t. Examples include the types `int`, `int32_t`, - `long`, and `short`. + `long`, and `int16_t`. @param[in] val an integer to create a JSON number from @@ -1452,7 +1452,7 @@ class basic_json @tparam CompatibleNumberUnsignedType An integer type which is compatible to @ref number_unsigned_t. Examples may include the types `unsigned int`, - `uint32_t`, or `unsigned short`. + `uint32_t`, or `uint16_t`. @param[in] val an unsigned integer to create a JSON number from @@ -2868,7 +2868,7 @@ class basic_json @liveexample{The example below shows several conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers\, (2) A JSON array can be converted to a standard - `std::vector`\, (3) A JSON object can be converted to C++ + `std::vector`\, (3) A JSON object can be converted to C++ associative containers such as `std::unordered_map`.,get__ValueType_const} @@ -3082,7 +3082,7 @@ class basic_json @liveexample{The example below shows several conversions from JSON values to other types. There a few things to note: (1) Floating-point numbers can be converted to integers\, (2) A JSON array can be converted to a standard - `std::vector`\, (3) A JSON object can be converted to C++ + `std::vector`\, (3) A JSON object can be converted to C++ associative containers such as `std::unordered_map`.,operator__ValueType} @@ -8918,7 +8918,7 @@ class basic_json class json_reverse_iterator : public std::reverse_iterator { public: - /// shortcut to the reverse iterator adaptor + /// int16_tcut to the reverse iterator adaptor using base_iterator = std::reverse_iterator; /// the reference type for the pointed-to element using reference = typename Base::reference; diff --git a/external/ours/library/archive/src/shared/AutoByteStream.cpp b/external/ours/library/archive/src/shared/AutoByteStream.cpp index d62be53b..04c66345 100755 --- a/external/ours/library/archive/src/shared/AutoByteStream.cpp +++ b/external/ours/library/archive/src/shared/AutoByteStream.cpp @@ -96,7 +96,7 @@ const unsigned int AutoByteStream::getItemCount() const void AutoByteStream::pack(ByteStream & target) const { std::vector::const_iterator i; - unsigned short packedSize=static_cast(members.size()); + uint16_t packedSize=static_cast(members.size()); Archive::put(target,packedSize); for(i = members.begin(); i != members.end(); ++i) { @@ -127,7 +127,7 @@ void AutoByteStream::pack(ByteStream & target) const void AutoByteStream::unpack(ReadIterator & source) { std::vector::iterator i; - unsigned short packedSize; + uint16_t packedSize; Archive::get(source,packedSize); for(i = members.begin(); i != members.end(); ++i) { diff --git a/external/ours/library/archive/src/shared/AutoDeltaByteStream.cpp b/external/ours/library/archive/src/shared/AutoDeltaByteStream.cpp index 2fde39eb..2a881fcc 100755 --- a/external/ours/library/archive/src/shared/AutoDeltaByteStream.cpp +++ b/external/ours/library/archive/src/shared/AutoDeltaByteStream.cpp @@ -88,7 +88,7 @@ void AutoDeltaByteStream::addToDirtyList(AutoDeltaVariableBase * var) */ void AutoDeltaByteStream::addVariable(AutoDeltaVariableBase & var) { - var.setIndex(static_cast(members.size())); + var.setIndex(static_cast(members.size())); var.setOwner(this); AutoByteStream::addVariable(var); } @@ -97,7 +97,7 @@ void AutoDeltaByteStream::addVariable(AutoDeltaVariableBase & var) const unsigned int AutoDeltaByteStream::getItemCount() const { - unsigned short int count = 0; + uint16_t count = 0; if (!dirtyList.empty()) { @@ -121,7 +121,7 @@ const unsigned int AutoDeltaByteStream::getItemCount() const */ void AutoDeltaByteStream::packDeltas(ByteStream & target) const { - unsigned short int const count = static_cast(getItemCount()); + uint16_t const count = static_cast(getItemCount()); // place count in archive Archive::put(target, count); @@ -175,8 +175,8 @@ void AutoDeltaByteStream::removeOnDirtyCallback() */ void AutoDeltaByteStream::unpackDeltas(ReadIterator & source) { - unsigned short int index; - unsigned short int count; + uint16_t index; + uint16_t count; Archive::get(source, count); while (source.getSize()) diff --git a/external/ours/library/archive/src/shared/AutoDeltaByteStream.h b/external/ours/library/archive/src/shared/AutoDeltaByteStream.h index 53b4d07d..9aac6b0e 100755 --- a/external/ours/library/archive/src/shared/AutoDeltaByteStream.h +++ b/external/ours/library/archive/src/shared/AutoDeltaByteStream.h @@ -198,7 +198,7 @@ public: /** pure virtual */ virtual void clearDelta() const = 0; - const unsigned short int getIndex() const; + const uint16_t getIndex() const; /** pure virtual */ virtual const bool isDirty() const = 0; @@ -207,7 +207,7 @@ public: protected: friend class AutoDeltaByteStream; AutoDeltaByteStream * getOwner(); - void setIndex(const unsigned short int index); + void setIndex(const uint16_t index); void setOwner(AutoDeltaByteStream * owner); /** pure virtual */ @@ -219,7 +219,7 @@ protected: /** pure virtual */ virtual void unpackDelta(ReadIterator & source) = 0; private: - unsigned short int index; + uint16_t index; AutoDeltaByteStream * owner; }; @@ -244,7 +244,7 @@ private: @author Justin Randall */ -inline const unsigned short int AutoDeltaVariableBase::getIndex() const +inline const uint16_t AutoDeltaVariableBase::getIndex() const { return index; } @@ -298,7 +298,7 @@ inline AutoDeltaByteStream * AutoDeltaVariableBase::getOwner() @author Justin Randall */ -inline void AutoDeltaVariableBase::setIndex(const unsigned short int newIndex) +inline void AutoDeltaVariableBase::setIndex(const uint16_t newIndex) { index = newIndex; } diff --git a/external/ours/library/archive/src/shared/AutoDeltaVector.h b/external/ours/library/archive/src/shared/AutoDeltaVector.h index 5d2d37bf..c164701e 100755 --- a/external/ours/library/archive/src/shared/AutoDeltaVector.h +++ b/external/ours/library/archive/src/shared/AutoDeltaVector.h @@ -33,7 +33,7 @@ public: CLEAR }; unsigned char cmd; - unsigned short int index; + uint16_t index; ValueType value; }; @@ -207,10 +207,10 @@ inline void AutoDeltaVector::erase(const unsigned int ele Command c; c.cmd = Command::ERASE; - //-- cast to shorts to reduce net traffic. If we are synchronizing + //-- cast to int16_ts to reduce net traffic. If we are synchronizing // vectors with more than 65,535 elements, we have some serious // design issues - c.index = static_cast(element); + c.index = static_cast(element); //-- commands.push_back(c); @@ -273,7 +273,7 @@ inline void AutoDeltaVector::insert(const unsigned int be { Command c; c.cmd = Command::INSERT; - c.index = static_cast(before); + c.index = static_cast(before); c.value = newValue; commands.push_back(c); ++baselineCommandCount; @@ -510,7 +510,7 @@ inline void AutoDeltaVector::set(const unsigned int eleme Command c; c.cmd = Command::SET; - c.index = static_cast(element); + c.index = static_cast(element); c.value = newValue; commands.push_back(c); ++baselineCommandCount; @@ -533,7 +533,7 @@ inline void AutoDeltaVector::set(const VectorType & newVa { Command c; c.cmd = Command::SETALL; - c.index = static_cast(newValue.size()); + c.index = static_cast(newValue.size()); commands.push_back(c); ++baselineCommandCount; @@ -542,7 +542,7 @@ inline void AutoDeltaVector::set(const VectorType & newVa for (unsigned int i = 0; i < newValue.size(); ++i) { c.cmd = Command::SET; - c.index = static_cast(i); + c.index = static_cast(i); c.value = v[i]; commands.push_back(c); ++baselineCommandCount; @@ -654,7 +654,7 @@ inline void AutoDeltaVector::unpack(ReadIterator & source for (size_t i = 0; i < commandCount; ++i) { get(source,c.value); - c.index = static_cast(i); + c.index = static_cast(i); c.cmd = Command::INSERT; data.push_back(c); diff --git a/external/ours/library/crypto/src/shared/original/config.h b/external/ours/library/crypto/src/shared/original/config.h index f0dfb23e..aeff11cf 100755 --- a/external/ours/library/crypto/src/shared/original/config.h +++ b/external/ours/library/crypto/src/shared/original/config.h @@ -1,6 +1,8 @@ #ifndef CRYPTOPP_CONFIG_H #define CRYPTOPP_CONFIG_H +#include + // ***************** Important Settings ******************** // define this if running on a big-endian CPU @@ -73,14 +75,14 @@ NAMESPACE_BEGIN(CryptoPP) typedef unsigned short word16; #if defined(__alpha) && !defined(_MSC_VER) -typedef unsigned int word32; +typedef uint32_t word32; #else -typedef unsigned long word32; +typedef uint32_t word32; #endif #if defined(__GNUC__) || defined(__MWERKS__) #define WORD64_AVAILABLE -typedef unsigned long long word64; +typedef uint64_t word64; #define W64LIT(x) x##LL #elif defined(_MSC_VER) || defined(__BCPLUSPLUS__) #define WORD64_AVAILABLE @@ -97,18 +99,18 @@ typedef unsigned __int64 word64; // dword should be twice as big as word #if (defined(__GNUC__) && !defined(__alpha)) || defined(__MWERKS__) -typedef unsigned long word; -typedef unsigned long long dword; +typedef uint32_t word; +typedef uint64_t dword; #elif defined(_MSC_VER) || defined(__BCPLUSPLUS__) typedef unsigned __int32 word; typedef unsigned __int64 dword; #else -typedef unsigned int word; -typedef unsigned long dword; +typedef uint32_t word; +typedef uint32_t dword; #endif -const unsigned int WORD_SIZE = sizeof(word); -const unsigned int WORD_BITS = WORD_SIZE * 8; +const uint32_t WORD_SIZE = sizeof(word); +const uint32_t WORD_BITS = WORD_SIZE * 8; #define LOW_WORD(x) (word)(x) diff --git a/external/ours/library/crypto/src/shared/original/cryptlib.cpp b/external/ours/library/crypto/src/shared/original/cryptlib.cpp index 174cea86..e2b228a7 100755 --- a/external/ours/library/crypto/src/shared/original/cryptlib.cpp +++ b/external/ours/library/crypto/src/shared/original/cryptlib.cpp @@ -11,12 +11,12 @@ NAMESPACE_BEGIN(CryptoPP) const std::string BufferedTransformation::NULL_CHANNEL; -unsigned int RandomNumberGenerator::GenerateBit() +uint32_t RandomNumberGenerator::GenerateBit() { return Parity(GetByte()); } -void RandomNumberGenerator::GenerateBlock(byte *output, unsigned int size) +void RandomNumberGenerator::GenerateBlock(byte *output, uint32_t size) { while (size--) *output++ = GetByte(); @@ -42,13 +42,13 @@ word32 RandomNumberGenerator::GenerateWord32(word32 min, word32 max) return value+min; } -void StreamCipher::ProcessString(byte *outString, const byte *inString, unsigned int length) +void StreamCipher::ProcessString(byte *outString, const byte *inString, uint32_t length) { while(length--) *outString++ = ProcessByte(*inString++); } -void StreamCipher::ProcessString(byte *inoutString, unsigned int length) +void StreamCipher::ProcessString(byte *inoutString, uint32_t length) { while(length--) { (*inoutString)++; @@ -98,7 +98,7 @@ void BufferedTransformation::Put(byte b) AttachedTransformation()->Put(b); } -void BufferedTransformation::Put(const byte *inString, unsigned int length) +void BufferedTransformation::Put(const byte *inString, uint32_t length) { if (AttachedTransformation()) AttachedTransformation()->Put(inString, length); @@ -122,7 +122,7 @@ void BufferedTransformation::MessageSeriesEnd(int propagation) AttachedTransformation()->MessageSeriesEnd(propagation-1); } -void BufferedTransformation::PutMessageEnd(const byte *inString, unsigned int length, int propagation) +void BufferedTransformation::PutMessageEnd(const byte *inString, uint32_t length, int propagation) { Put(inString, length); MessageEnd(propagation); @@ -152,7 +152,7 @@ void BufferedTransformation::ChannelMessageSeriesEnd(const std::string &channel, AttachedTransformation()->ChannelMessageSeriesEnd(channel, propagation-1); } -void BufferedTransformation::ChannelPutMessageEnd(const std::string &channel, const byte *inString, unsigned int length, int propagation) +void BufferedTransformation::ChannelPutMessageEnd(const std::string &channel, const byte *inString, uint32_t length, int propagation) { if (channel.empty()) PutMessageEnd(inString, length, propagation); @@ -163,7 +163,7 @@ void BufferedTransformation::ChannelPutMessageEnd(const std::string &channel, co } } -unsigned long BufferedTransformation::MaxRetrievable() const +uint32_t BufferedTransformation::MaxRetrievable() const { if (AttachedTransformation()) return AttachedTransformation()->MaxRetrievable(); @@ -182,7 +182,7 @@ bool BufferedTransformation::AnyRetrievable() const } } -unsigned int BufferedTransformation::Get(byte &outByte) +uint32_t BufferedTransformation::Get(byte &outByte) { if (AttachedTransformation()) return AttachedTransformation()->Get(outByte); @@ -190,7 +190,7 @@ unsigned int BufferedTransformation::Get(byte &outByte) return Get(&outByte, 1); } -unsigned int BufferedTransformation::Get(byte *outString, unsigned int getMax) +uint32_t BufferedTransformation::Get(byte *outString, uint32_t getMax) { if (AttachedTransformation()) return AttachedTransformation()->Get(outString, getMax); @@ -201,7 +201,7 @@ unsigned int BufferedTransformation::Get(byte *outString, unsigned int getMax) } } -unsigned int BufferedTransformation::Peek(byte &outByte) const +uint32_t BufferedTransformation::Peek(byte &outByte) const { if (AttachedTransformation()) return AttachedTransformation()->Peek(outByte); @@ -209,7 +209,7 @@ unsigned int BufferedTransformation::Peek(byte &outByte) const return Peek(&outByte, 1); } -unsigned int BufferedTransformation::Peek(byte *outString, unsigned int peekMax) const +uint32_t BufferedTransformation::Peek(byte *outString, uint32_t peekMax) const { if (AttachedTransformation()) return AttachedTransformation()->Peek(outString, peekMax); @@ -220,7 +220,7 @@ unsigned int BufferedTransformation::Peek(byte *outString, unsigned int peekMax) } } -unsigned long BufferedTransformation::Skip(unsigned long skipMax) +uint32_t BufferedTransformation::Skip(uint32_t skipMax) { if (AttachedTransformation()) return AttachedTransformation()->Skip(skipMax); @@ -228,7 +228,7 @@ unsigned long BufferedTransformation::Skip(unsigned long skipMax) return TransferTo(g_bitBucket, skipMax); } -unsigned long BufferedTransformation::CopyTo(BufferedTransformation &target, unsigned long copyMax) const +uint32_t BufferedTransformation::CopyTo(BufferedTransformation &target, uint32_t copyMax) const { if (AttachedTransformation()) return AttachedTransformation()->CopyTo(target, copyMax); @@ -236,7 +236,7 @@ unsigned long BufferedTransformation::CopyTo(BufferedTransformation &target, uns return 0; } -unsigned long BufferedTransformation::TransferTo(BufferedTransformation &target, unsigned long size) +uint32_t BufferedTransformation::TransferTo(BufferedTransformation &target, uint32_t size) { if (AttachedTransformation()) return AttachedTransformation()->TransferTo(target, size); @@ -244,7 +244,7 @@ unsigned long BufferedTransformation::TransferTo(BufferedTransformation &target, return 0; } -unsigned long BufferedTransformation::TotalBytesRetrievable() const +uint32_t BufferedTransformation::TotalBytesRetrievable() const { if (AttachedTransformation()) return AttachedTransformation()->TotalBytesRetrievable(); @@ -252,7 +252,7 @@ unsigned long BufferedTransformation::TotalBytesRetrievable() const return MaxRetrievable(); } -unsigned int BufferedTransformation::NumberOfMessages() const +uint32_t BufferedTransformation::NumberOfMessages() const { if (AttachedTransformation()) return AttachedTransformation()->NumberOfMessages(); @@ -276,7 +276,7 @@ bool BufferedTransformation::GetNextMessage() return false; } -unsigned int BufferedTransformation::SkipMessages(unsigned int count) +uint32_t BufferedTransformation::SkipMessages(uint32_t count) { if (AttachedTransformation()) return AttachedTransformation()->SkipMessages(count); @@ -284,13 +284,13 @@ unsigned int BufferedTransformation::SkipMessages(unsigned int count) return TransferMessagesTo(g_bitBucket, count); } -unsigned int BufferedTransformation::TransferMessagesTo(BufferedTransformation &target, unsigned int count) +uint32_t BufferedTransformation::TransferMessagesTo(BufferedTransformation &target, uint32_t count) { if (AttachedTransformation()) return AttachedTransformation()->TransferMessagesTo(target, count); else { - unsigned int i; + uint32_t i; for (i=0; iCopyMessagesTo(target, count); @@ -356,7 +356,7 @@ void BufferedTransformation::ChannelPut(const std::string &channel, byte inByte) Put(inByte); } -void BufferedTransformation::ChannelPut(const std::string &channel, const byte *inString, unsigned int length) +void BufferedTransformation::ChannelPut(const std::string &channel, const byte *inString, uint32_t length) { if (channel.empty()) Put(inString, length); @@ -400,10 +400,10 @@ void BufferedTransformation::PutWord32(word32 value, bool highFirst) ChannelPutWord32(NULL_CHANNEL, value, highFirst); } -unsigned int BufferedTransformation::PeekWord16(word16 &value, bool highFirst) +uint32_t BufferedTransformation::PeekWord16(word16 &value, bool highFirst) { byte buf[2] = {0, 0}; - unsigned int len = Peek(buf, 2); + uint32_t len = Peek(buf, 2); if (highFirst) value = (buf[0] << 8) | buf[1]; @@ -413,10 +413,10 @@ unsigned int BufferedTransformation::PeekWord16(word16 &value, bool highFirst) return len; } -unsigned int BufferedTransformation::PeekWord32(word32 &value, bool highFirst) +uint32_t BufferedTransformation::PeekWord32(word32 &value, bool highFirst) { byte buf[4] = {0, 0, 0, 0}; - unsigned int len = Peek(buf, 4); + uint32_t len = Peek(buf, 4); if (highFirst) value = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf [3]; @@ -426,12 +426,12 @@ unsigned int BufferedTransformation::PeekWord32(word32 &value, bool highFirst) return len; } -unsigned int BufferedTransformation::GetWord16(word16 &value, bool highFirst) +uint32_t BufferedTransformation::GetWord16(word16 &value, bool highFirst) { return Skip(PeekWord16(value, highFirst)); } -unsigned int BufferedTransformation::GetWord32(word32 &value, bool highFirst) +uint32_t BufferedTransformation::GetWord32(word32 &value, bool highFirst) { return Skip(PeekWord32(value, highFirst)); } @@ -447,7 +447,7 @@ void BufferedTransformation::Attach(BufferedTransformation *newOut) Detach(newOut); } -unsigned int PK_FixedLengthCryptoSystem::MaxPlainTextLength(unsigned int cipherTextLength) const +uint32_t PK_FixedLengthCryptoSystem::MaxPlainTextLength(uint32_t cipherTextLength) const { if (cipherTextLength == CipherTextLength()) return MaxPlainTextLength(); @@ -455,7 +455,7 @@ unsigned int PK_FixedLengthCryptoSystem::MaxPlainTextLength(unsigned int cipherT return 0; } -unsigned int PK_FixedLengthCryptoSystem::CipherTextLength(unsigned int plainTextLength) const +uint32_t PK_FixedLengthCryptoSystem::CipherTextLength(uint32_t plainTextLength) const { if (plainTextLength <= MaxPlainTextLength()) return CipherTextLength(); @@ -463,7 +463,7 @@ unsigned int PK_FixedLengthCryptoSystem::CipherTextLength(unsigned int plainText return 0; } -unsigned int PK_FixedLengthDecryptor::Decrypt(const byte *cipherText, unsigned int cipherTextLength, byte *plainText) +uint32_t PK_FixedLengthDecryptor::Decrypt(const byte *cipherText, uint32_t cipherTextLength, byte *plainText) { if (cipherTextLength != CipherTextLength()) return 0; @@ -471,14 +471,14 @@ unsigned int PK_FixedLengthDecryptor::Decrypt(const byte *cipherText, unsigned i return Decrypt(cipherText, plainText); } -void PK_Signer::SignMessage(RandomNumberGenerator &rng, const byte *message, unsigned int messageLen, byte *signature) const +void PK_Signer::SignMessage(RandomNumberGenerator &rng, const byte *message, uint32_t messageLen, byte *signature) const { std::unique_ptr accumulator(NewMessageAccumulator()); accumulator->Update(message, messageLen); Sign(rng, accumulator.release(), signature); } -bool PK_Verifier::VerifyMessage(const byte *message, unsigned int messageLen, const byte *sig) const +bool PK_Verifier::VerifyMessage(const byte *message, uint32_t messageLen, const byte *sig) const { std::unique_ptr accumulator(NewMessageAccumulator()); accumulator->Update(message, messageLen); diff --git a/external/ours/library/crypto/src/shared/original/cryptlib.h b/external/ours/library/crypto/src/shared/original/cryptlib.h index fd258706..8bdcdf72 100755 --- a/external/ours/library/crypto/src/shared/original/cryptlib.h +++ b/external/ours/library/crypto/src/shared/original/cryptlib.h @@ -1,4 +1,7 @@ // cryptlib.h - written and placed in the public domain by Wei Dai + +#define ULONG_SIZE sizeof(uint32_t) + /*! \file This file contains the declarations for the abstract base classes that provide a uniform interface to this library. @@ -112,16 +115,16 @@ public: virtual void ProcessBlock(const byte *inBlock, byte *outBlock) const =0; //! block size of the cipher in bytes - virtual unsigned int BlockSize() const =0; + virtual uint32_t BlockSize() const =0; }; //! provides an implementation of BlockSize() -template +template class FixedBlockSize : public BlockTransformation { public: enum {BLOCKSIZE = N}; - virtual unsigned int BlockSize() const {return BLOCKSIZE;} + virtual uint32_t BlockSize() const {return BLOCKSIZE;} }; //! abstract base class for stream ciphers @@ -136,9 +139,9 @@ public: virtual byte ProcessByte(byte input) =0; //! encrypt or decrypt an array of bytes of specified length in place - virtual void ProcessString(byte *inoutString, unsigned int length); + virtual void ProcessString(byte *inoutString, uint32_t length); //! encrypt or decrypt an array of bytes of specified length, may assume inString != outString - virtual void ProcessString(byte *outString, const byte *inString, unsigned int length); + virtual void ProcessString(byte *outString, const byte *inString, uint32_t length); }; //! abstract base class for random access stream ciphers @@ -150,7 +153,7 @@ public: virtual ~RandomAccessStreamCipher() {} /*/ specify that the next byte to be processed is at absolute position n in the plaintext/ciphertext stream */ - virtual void Seek(unsigned long n) =0; + virtual void Seek(uint32_t n) =0; }; //! abstract base class for random number generators @@ -168,14 +171,14 @@ public: //! generate new random bit and return it /*! Default implementation is to call GenerateByte() and return its parity. */ - virtual unsigned int GenerateBit(); + virtual uint32_t GenerateBit(); //! generate a random 32 bit word in the range min to max, inclusive virtual word32 GenerateWord32(word32 a=0, word32 b=0xffffffffL); //! generate random array of bytes //* Default implementation is to call GenerateByte() size times. - virtual void GenerateBlock(byte *output, unsigned int size); + virtual void GenerateBlock(byte *output, uint32_t size); //! randomly shuffle the specified array, resulting permutation is uniformly distributed template void Shuffle(IT begin, IT end) @@ -186,10 +189,10 @@ public: // for backwards compatibility, maybe be remove later byte GetByte() {return GenerateByte();} - unsigned int GetBit() {return GenerateBit();} + uint32_t GetBit() {return GenerateBit();} word32 GetLong(word32 a=0, word32 b=0xffffffffL) {return GenerateWord32(a, b);} word16 GetShort(word16 a=0, word16 b=0xffff) {return (word16)GenerateWord32(a, b);} - void GetBlock(byte *output, unsigned int size) {GenerateBlock(output, size);} + void GetBlock(byte *output, uint32_t size) {GenerateBlock(output, size);} }; //! abstract base class for hash functions @@ -207,7 +210,7 @@ public: virtual ~HashModule() {} //! process more input - virtual void Update(const byte *input, unsigned int length) =0; + virtual void Update(const byte *input, uint32_t length) =0; /*/ calculate hash for the current message (the concatenation of all inputs passed in via Update()), then reinitialize the object */ @@ -215,7 +218,7 @@ public: virtual void Final(byte *digest) =0; //! size of the hash returned by Final() - virtual unsigned int DigestSize() const =0; + virtual uint32_t DigestSize() const =0; //! use this if your input is short and you don't want to call Update() and Final() seperately virtual void CalculateDigest(byte *digest, const byte *input, int length) @@ -272,7 +275,7 @@ public: //! input a byte for processing virtual void Put(byte inByte) =0; //! input multiple bytes - virtual void Put(const byte *inString, unsigned int length) =0; + virtual void Put(const byte *inString, uint32_t length) =0; //! input a 16-bit word, big-endian or little-endian depending on highFirst void PutWord16(word16 value, bool highFirst=true); @@ -293,7 +296,7 @@ public: -1 means unlimited propagation. */ virtual void MessageEnd(int propagation=-1); //! same as Put() followed by MessageEnd() but may be more efficient - virtual void PutMessageEnd(const byte *inString, unsigned int length, int propagation=-1); + virtual void PutMessageEnd(const byte *inString, uint32_t length, int propagation=-1); //! mark end of a series of messages /*! There should be a MessageEnd immediately before MessageSeriesEnd. */ virtual void MessageSeriesEnd(int propagation=-1); @@ -345,50 +348,50 @@ public: /*! All retrieval functions return the actual number of bytes retrieved, which is the lesser of the request number and MaxRetrievable(). */ - virtual unsigned long MaxRetrievable() const; + virtual uint32_t MaxRetrievable() const; // old mispelled name - unsigned long MaxRetrieveable() const {return MaxRetrievable();} + uint32_t MaxRetrieveable() const {return MaxRetrievable();} //! returns whether any bytes are currently ready for retrieval virtual bool AnyRetrievable() const; //! try to retrieve a single byte - virtual unsigned int Get(byte &outByte); + virtual uint32_t Get(byte &outByte); //! try to retrieve multiple bytes - virtual unsigned int Get(byte *outString, unsigned int getMax); + virtual uint32_t Get(byte *outString, uint32_t getMax); //! peek at the next byte without removing it from the output buffer - virtual unsigned int Peek(byte &outByte) const; + virtual uint32_t Peek(byte &outByte) const; //! peek at multiple bytes without removing them from the output buffer - virtual unsigned int Peek(byte *outString, unsigned int peekMax) const; + virtual uint32_t Peek(byte *outString, uint32_t peekMax) const; //! try to retrieve a 16-bit word, big-endian or little-endian depending on highFirst - unsigned int GetWord16(word16 &value, bool highFirst=true); + uint32_t GetWord16(word16 &value, bool highFirst=true); //! try to retrieve a 32-bit word - unsigned int GetWord32(word32 &value, bool highFirst=true); + uint32_t GetWord32(word32 &value, bool highFirst=true); //! try to peek at a 16-bit word, big-endian or little-endian depending on highFirst - unsigned int PeekWord16(word16 &value, bool highFirst=true); + uint32_t PeekWord16(word16 &value, bool highFirst=true); //! try to peek at a 32-bit word - unsigned int PeekWord32(word32 &value, bool highFirst=true); + uint32_t PeekWord32(word32 &value, bool highFirst=true); //! move transferMax bytes of the buffered output to target as input - virtual unsigned long TransferTo(BufferedTransformation &target, unsigned long transferMax=ULONG_MAX); + virtual uint32_t TransferTo(BufferedTransformation &target, uint32_t transferMax=ULONG_SIZE); //! discard skipMax bytes from the output buffer - virtual unsigned long Skip(unsigned long skipMax=ULONG_MAX); + virtual uint32_t Skip(uint32_t skipMax=ULONG_SIZE); //! copy copyMax bytes of the buffered output to target as input - virtual unsigned long CopyTo(BufferedTransformation &target, unsigned long copyMax=ULONG_MAX) const; + virtual uint32_t CopyTo(BufferedTransformation &target, uint32_t copyMax=ULONG_SIZE) const; //@} //! \name RETRIEVAL OF MULTIPLE MESSAGES //@{ //! - virtual unsigned long TotalBytesRetrievable() const; + virtual uint32_t TotalBytesRetrievable() const; //! number of times MessageEnd() has been received minus messages retrieved or skipped - virtual unsigned int NumberOfMessages() const; + virtual uint32_t NumberOfMessages() const; //! returns true if NumberOfMessages() > 0 virtual bool AnyMessages() const; //! start retrieving the next message @@ -398,11 +401,11 @@ public: */ virtual bool GetNextMessage(); //! skip count number of messages - virtual unsigned int SkipMessages(unsigned int count=UINT_MAX); + virtual uint32_t SkipMessages(uint32_t count=UINT_MAX); //! - virtual unsigned int TransferMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX); + virtual uint32_t TransferMessagesTo(BufferedTransformation &target, uint32_t count=UINT_MAX); //! - virtual unsigned int CopyMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX) const; + virtual uint32_t CopyMessagesTo(BufferedTransformation &target, uint32_t count=UINT_MAX) const; //! virtual void SkipAll(); @@ -415,14 +418,14 @@ public: //! \name CHANNELS //@{ virtual void ChannelPut(const std::string &channel, byte inByte); - virtual void ChannelPut(const std::string &channel, const byte *inString, unsigned int length); + virtual void ChannelPut(const std::string &channel, const byte *inString, uint32_t length); void ChannelPutWord16(const std::string &channel, word16 value, bool highFirst=true); void ChannelPutWord32(const std::string &channel, word32 value, bool highFirst=true); virtual void ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1); virtual void ChannelMessageEnd(const std::string &channel, int propagation=-1); - virtual void ChannelPutMessageEnd(const std::string &channel, const byte *inString, unsigned int length, int propagation=-1); + virtual void ChannelPutMessageEnd(const std::string &channel, const byte *inString, uint32_t length, int propagation=-1); virtual void ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1); virtual void SetRetrievalChannel(const std::string &channel); @@ -465,11 +468,11 @@ public: //! maximum length of plaintext for a given ciphertext length //* This function returns 0 if cipherTextLength is not valid (too long or too short). - virtual unsigned int MaxPlainTextLength(unsigned int cipherTextLength) const =0; + virtual uint32_t MaxPlainTextLength(uint32_t cipherTextLength) const =0; //! calculate length of ciphertext given length of plaintext //* This function returns 0 if plainTextLength is not valid (too long). - virtual unsigned int CipherTextLength(unsigned int plainTextLength) const =0; + virtual uint32_t CipherTextLength(uint32_t plainTextLength) const =0; }; //! abstract base class for public-key encryptors @@ -487,7 +490,7 @@ public: \item size of cipherText == CipherTextLength(plainTextLength) \end{itemize} */ - virtual void Encrypt(RandomNumberGenerator &rng, const byte *plainText, unsigned int plainTextLength, byte *cipherText) =0; + virtual void Encrypt(RandomNumberGenerator &rng, const byte *plainText, uint32_t plainTextLength, byte *cipherText) =0; }; //! abstract base class for public-key decryptors @@ -505,7 +508,7 @@ public: The function returns the actual length of the plaintext, or 0 if decryption fails. */ - virtual unsigned int Decrypt(const byte *cipherText, unsigned int cipherTextLength, byte *plainText) =0; + virtual uint32_t Decrypt(const byte *cipherText, uint32_t cipherTextLength, byte *plainText) =0; }; //! abstract base class for encryptors and decryptors with fixed length ciphertext @@ -520,12 +523,12 @@ class PK_FixedLengthCryptoSystem : public virtual PK_CryptoSystem { public: //! - virtual unsigned int MaxPlainTextLength() const =0; + virtual uint32_t MaxPlainTextLength() const =0; //! - virtual unsigned int CipherTextLength() const =0; + virtual uint32_t CipherTextLength() const =0; - unsigned int MaxPlainTextLength(unsigned int cipherTextLength) const; - unsigned int CipherTextLength(unsigned int plainTextLength) const; + uint32_t MaxPlainTextLength(uint32_t cipherTextLength) const; + uint32_t CipherTextLength(uint32_t plainTextLength) const; }; //! abstract base class for encryptors with fixed length ciphertext @@ -549,9 +552,9 @@ public: The function returns the actual length of the plaintext, or 0 if decryption fails. */ - virtual unsigned int Decrypt(const byte *cipherText, byte *plainText) =0; + virtual uint32_t Decrypt(const byte *cipherText, byte *plainText) =0; - unsigned int Decrypt(const byte *cipherText, unsigned int cipherTextLength, byte *plainText); + uint32_t Decrypt(const byte *cipherText, uint32_t cipherTextLength, byte *plainText); }; //! abstract base class for public-key signers and verifiers @@ -567,7 +570,7 @@ public: virtual ~PK_SignatureSystem() {}; //! signature length support by this object (as either input or output) - virtual unsigned int SignatureLength() const =0; + virtual uint32_t SignatureLength() const =0; //! create a new HashModule to accumulate the message to be signed or verified virtual HashModule * NewMessageAccumulator() const =0; @@ -600,7 +603,7 @@ public: //! sign a message /*! Precondition: size of signature == SignatureLength() */ - virtual void SignMessage(RandomNumberGenerator &rng, const byte *message, unsigned int messageLen, byte *signature) const; + virtual void SignMessage(RandomNumberGenerator &rng, const byte *message, uint32_t messageLen, byte *signature) const; }; //! abstract base class for public-key verifiers @@ -623,7 +626,7 @@ public: //! check whether sig is a valid signature for message /*! Precondition: size of signature == SignatureLength() */ - virtual bool VerifyMessage(const byte *message, unsigned int messageLen, const byte *sig) const; + virtual bool VerifyMessage(const byte *message, uint32_t messageLen, const byte *sig) const; }; //! abstract base class for public-key signers and verifiers with recovery @@ -635,7 +638,7 @@ class PK_SignatureSystemWithRecovery : public virtual PK_SignatureSystem { public: //! length of longest message that can be fully recovered - virtual unsigned int MaximumRecoverableLength() const =0; + virtual uint32_t MaximumRecoverableLength() const =0; //! whether or not messages longer than MaximumRecoverableLength() can be signed /*! If this function returns false, any message longer than @@ -672,7 +675,7 @@ public: \item size of recoveredMessage == MaximumRecoverableLength() \end{itemize} */ - virtual unsigned int PartialRecover(HashModule *leftoverMessageAccumulator, byte *recoveredMessage) const =0; + virtual uint32_t PartialRecover(HashModule *leftoverMessageAccumulator, byte *recoveredMessage) const =0; //! recover a message from its signature, return length of message, or 0 if signature is invalid /*! This function should be equivalent to PartialRecover(NewLeftoverMessageAccumulator(signature), recoveredMessage). @@ -682,7 +685,7 @@ public: \item size of recoveredMessage == MaximumRecoverableLength() \end{itemize} */ - virtual unsigned int Recover(const byte *signature, byte *recoveredMessage) const =0; + virtual uint32_t Recover(const byte *signature, byte *recoveredMessage) const =0; }; //! abstract base class for domains of simple key agreement protocols @@ -699,11 +702,11 @@ public: //! return whether the domain parameters stored in this object are valid virtual bool ValidateDomainParameters(RandomNumberGenerator &rng) const =0; //! return length of agreed value produced - virtual unsigned int AgreedValueLength() const =0; + virtual uint32_t AgreedValueLength() const =0; //! return length of private keys in this domain - virtual unsigned int PrivateKeyLength() const =0; + virtual uint32_t PrivateKeyLength() const =0; //! return length of public keys in this domain - virtual unsigned int PublicKeyLength() const =0; + virtual uint32_t PublicKeyLength() const =0; //! generate private/public key pair /*! Preconditions: \begin{itemize} @@ -738,12 +741,12 @@ public: //! return whether the domain parameters stored in this object are valid virtual bool ValidateDomainParameters(RandomNumberGenerator &rng) const =0; //! return length of agreed value produced - virtual unsigned int AgreedValueLength() const =0; + virtual uint32_t AgreedValueLength() const =0; //! return length of static private keys in this domain - virtual unsigned int StaticPrivateKeyLength() const =0; + virtual uint32_t StaticPrivateKeyLength() const =0; //! return length of static public keys in this domain - virtual unsigned int StaticPublicKeyLength() const =0; + virtual uint32_t StaticPublicKeyLength() const =0; //! generate static private/public key pair /*! Preconditions: \begin{itemize} @@ -754,9 +757,9 @@ public: virtual void GenerateStaticKeyPair(RandomNumberGenerator &rng, byte *privateKey, byte *publicKey) const =0; //! return length of ephemeral private keys in this domain - virtual unsigned int EphemeralPrivateKeyLength() const =0; + virtual uint32_t EphemeralPrivateKeyLength() const =0; //! return length of ephemeral public keys in this domain - virtual unsigned int EphemeralPublicKeyLength() const =0; + virtual uint32_t EphemeralPublicKeyLength() const =0; //! generate ephemeral private/public key pair /*! Preconditions: \begin{itemize} @@ -800,7 +803,7 @@ public: typically it means calculate a table of n objects that can be used later to speed up computation. */ - virtual void Precompute(unsigned int n) =0; + virtual void Precompute(uint32_t n) =0; //! retrieve previously saved precomputation virtual void LoadPrecomputation(BufferedTransformation &storedPrecomputation) =0; diff --git a/external/ours/library/crypto/src/shared/original/filters.cpp b/external/ours/library/crypto/src/shared/original/filters.cpp index 852a7b7f..81a88c52 100755 --- a/external/ours/library/crypto/src/shared/original/filters.cpp +++ b/external/ours/library/crypto/src/shared/original/filters.cpp @@ -29,13 +29,13 @@ void Filter::Insert(Filter *filter) // ************************************************************* -FilterWithBufferedInput::BlockQueue::BlockQueue(unsigned int blockSize, unsigned int maxBlocks) +FilterWithBufferedInput::BlockQueue::BlockQueue(uint32_t blockSize, uint32_t maxBlocks) : m_buffer(blockSize * maxBlocks) { ResetQueue(blockSize, maxBlocks); } -void FilterWithBufferedInput::BlockQueue::ResetQueue(unsigned int blockSize, unsigned int maxBlocks) +void FilterWithBufferedInput::BlockQueue::ResetQueue(uint32_t blockSize, uint32_t maxBlocks) { m_buffer.Resize(blockSize * maxBlocks); m_blockSize = blockSize; @@ -58,9 +58,9 @@ const byte *FilterWithBufferedInput::BlockQueue::GetBlock() return nullptr; } -const byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(unsigned int &numberOfBlocks) +const byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(uint32_t &numberOfBlocks) { - numberOfBlocks = STDMIN(numberOfBlocks, STDMIN((unsigned int)(m_buffer.End()-m_begin), m_size)/m_blockSize); + numberOfBlocks = STDMIN(numberOfBlocks, STDMIN((uint32_t)(m_buffer.End()-m_begin), m_size)/m_blockSize); const byte *ptr = m_begin; if ((m_begin+=m_blockSize*numberOfBlocks) == m_buffer.End()) m_begin = m_buffer; @@ -68,10 +68,10 @@ const byte *FilterWithBufferedInput::BlockQueue::GetContigousBlocks(unsigned int return ptr; } -unsigned int FilterWithBufferedInput::BlockQueue::GetAll(byte *outString) +uint32_t FilterWithBufferedInput::BlockQueue::GetAll(byte *outString) { - unsigned int size = m_size; - unsigned int numberOfBlocks = m_maxBlocks; + uint32_t size = m_size; + uint32_t numberOfBlocks = m_maxBlocks; const byte *ptr = GetContigousBlocks(numberOfBlocks); memcpy(outString, ptr, numberOfBlocks*m_blockSize); memcpy(outString+numberOfBlocks*m_blockSize, m_begin, m_size); @@ -79,18 +79,18 @@ unsigned int FilterWithBufferedInput::BlockQueue::GetAll(byte *outString) return size; } -void FilterWithBufferedInput::BlockQueue::Put(const byte *inString, unsigned int length) +void FilterWithBufferedInput::BlockQueue::Put(const byte *inString, uint32_t length) { assert(m_size + length <= m_buffer.size); byte *end = (m_size < (unsigned)(m_buffer+m_buffer.size-m_begin)) ? m_begin + m_size : m_begin + m_size - m_buffer.size; - unsigned int len = STDMIN(length, (unsigned int)(m_buffer+m_buffer.size-end)); + uint32_t len = STDMIN(length, (uint32_t)(m_buffer+m_buffer.size-end)); memcpy(end, inString, len); if (len < length) memcpy(m_buffer, inString+len, length-len); m_size += length; } -FilterWithBufferedInput::FilterWithBufferedInput(unsigned int firstSize, unsigned int blockSize, unsigned int lastSize, BufferedTransformation *outQ) +FilterWithBufferedInput::FilterWithBufferedInput(uint32_t firstSize, uint32_t blockSize, uint32_t lastSize, BufferedTransformation *outQ) : Filter(outQ), m_firstSize(firstSize), m_blockSize(blockSize), m_lastSize(lastSize) , m_firstInputDone(false) , m_queue(1, m_firstSize) @@ -102,16 +102,16 @@ void FilterWithBufferedInput::Put(byte inByte) Put(&inByte, 1); } -void FilterWithBufferedInput::Put(const byte *inString, unsigned int length) +void FilterWithBufferedInput::Put(const byte *inString, uint32_t length) { if (length == 0) return; - unsigned int newLength = m_queue.CurrentSize() + length; + uint32_t newLength = m_queue.CurrentSize() + length; if (!m_firstInputDone && newLength >= m_firstSize) { - unsigned int len = m_firstSize - m_queue.CurrentSize(); + uint32_t len = m_firstSize - m_queue.CurrentSize(); m_queue.Put(inString, len); FirstPut(m_queue.GetContigousBlocks(m_firstSize)); assert(m_queue.CurrentSize() == 0); @@ -128,7 +128,7 @@ void FilterWithBufferedInput::Put(const byte *inString, unsigned int length) { while (newLength > m_lastSize && m_queue.CurrentSize() > 0) { - unsigned int len = newLength - m_lastSize; + uint32_t len = newLength - m_lastSize; const byte *ptr = m_queue.GetContigousBlocks(len); NextPut(ptr, len); newLength -= len; @@ -136,7 +136,7 @@ void FilterWithBufferedInput::Put(const byte *inString, unsigned int length) if (newLength > m_lastSize) { - unsigned int len = newLength - m_lastSize; + uint32_t len = newLength - m_lastSize; NextPut(inString, len); inString += len; newLength -= len; @@ -153,7 +153,7 @@ void FilterWithBufferedInput::Put(const byte *inString, unsigned int length) if (newLength >= m_blockSize + m_lastSize && m_queue.CurrentSize() > 0) { assert(m_queue.CurrentSize() < m_blockSize); - unsigned int len = m_blockSize - m_queue.CurrentSize(); + uint32_t len = m_blockSize - m_queue.CurrentSize(); m_queue.Put(inString, len); inString += len; NextPut(m_queue.GetBlock(), m_blockSize); @@ -199,7 +199,7 @@ void FilterWithBufferedInput::ForceNextPut() // ************************************************************* -ProxyFilter::ProxyFilter(Filter *filter, unsigned int firstSize, unsigned int lastSize, BufferedTransformation *outQ) +ProxyFilter::ProxyFilter(Filter *filter, uint32_t firstSize, uint32_t lastSize, BufferedTransformation *outQ) : FilterWithBufferedInput(firstSize, 1, lastSize, outQ), m_filter(filter), m_proxy(nullptr) { if (m_filter.get()) @@ -232,7 +232,7 @@ void ProxyFilter::SetFilter(Filter *filter) m_proxy=nullptr; } -void ProxyFilter::NextPut(const byte *s, unsigned int len) +void ProxyFilter::NextPut(const byte *s, uint32_t len) { if (m_filter.get()) m_filter->Put(s, len); @@ -240,7 +240,7 @@ void ProxyFilter::NextPut(const byte *s, unsigned int len) // ************************************************************* -void StreamCipherFilter::Put(const byte *inString, unsigned int length) +void StreamCipherFilter::Put(const byte *inString, uint32_t length) { SecByteBlock temp(length); cipher.ProcessString(temp, inString, length); @@ -254,7 +254,7 @@ void HashFilter::Put(byte inByte) AttachedTransformation()->Put(inByte); } -void HashFilter::Put(const byte *inString, unsigned int length) +void HashFilter::Put(const byte *inString, uint32_t length) { m_hashModule.Update(inString, length); if (m_putMessage) @@ -288,14 +288,14 @@ void HashVerifier::FirstPut(const byte *inString) } } -void HashVerifier::NextPut(const byte *inString, unsigned int length) +void HashVerifier::NextPut(const byte *inString, uint32_t length) { m_hashModule.Update(inString, length); if (m_flags & PUT_MESSAGE) AttachedTransformation()->Put(inString, length); } -void HashVerifier::LastPut(const byte *inString, unsigned int length) +void HashVerifier::LastPut(const byte *inString, uint32_t length) { if (m_flags & HASH_AT_BEGIN) { @@ -354,7 +354,7 @@ StringSource::StringSource(const char *string, bool pumpAll, BufferedTransformat PumpAll(); } -StringSource::StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue) +StringSource::StringSource(const byte *string, uint32_t length, bool pumpAll, BufferedTransformation *outQueue) : Source(outQueue), m_store(string, length) { if (pumpAll) @@ -372,7 +372,7 @@ bool Store::GetNextMessage() return false; } -unsigned int Store::CopyMessagesTo(BufferedTransformation &target, unsigned int count) const +uint32_t Store::CopyMessagesTo(BufferedTransformation &target, uint32_t count) const { if (m_messageEnd || count == 0) return 0; @@ -385,36 +385,36 @@ unsigned int Store::CopyMessagesTo(BufferedTransformation &target, unsigned int } } -unsigned long StringStore::TransferTo(BufferedTransformation &target, unsigned long transferMax) +uint32_t StringStore::TransferTo(BufferedTransformation &target, uint32_t transferMax) { - unsigned long result = CopyTo(target, transferMax); + uint32_t result = CopyTo(target, transferMax); m_count += result; return result; } -unsigned long StringStore::CopyTo(BufferedTransformation &target, unsigned long copyMax) const +uint32_t StringStore::CopyTo(BufferedTransformation &target, uint32_t copyMax) const { - unsigned int len = (unsigned int)STDMIN((unsigned long)(m_length-m_count), copyMax); + uint32_t len = (uint32_t)STDMIN((uint32_t)(m_length-m_count), copyMax); target.Put(m_store+m_count, len); return len; } -unsigned long RandomNumberStore::CopyTo(BufferedTransformation &target, unsigned long copyMax) const +uint32_t RandomNumberStore::CopyTo(BufferedTransformation &target, uint32_t copyMax) const { - unsigned int len = (unsigned int)STDMIN((unsigned long)(m_length-m_count), copyMax); - for (unsigned int i=0; iPut(inByte);} - void Put(const byte *inString, unsigned int length) {AttachedTransformation()->Put(inString, length);} + void Put(const byte *inString, uint32_t length) {AttachedTransformation()->Put(inString, length);} }; //! . @@ -44,7 +46,7 @@ class OpaqueFilter : public Filter public: OpaqueFilter(BufferedTransformation *outQ=nullptr) : Filter(outQ) {} void Put(byte inByte) {} - void Put(const byte *inString, unsigned int length) {} + void Put(const byte *inString, uint32_t length) {} }; /*! FilterWithBufferedInput divides up the input stream into @@ -56,9 +58,9 @@ class FilterWithBufferedInput : public Filter { public: /// firstSize and lastSize may be 0, blockSize must be at least 1 - FilterWithBufferedInput(unsigned int firstSize, unsigned int blockSize, unsigned int lastSize, BufferedTransformation *outQ); + FilterWithBufferedInput(uint32_t firstSize, uint32_t blockSize, uint32_t lastSize, BufferedTransformation *outQ); void Put(byte inByte); - void Put(const byte *inString, unsigned int length); + void Put(const byte *inString, uint32_t length); void MessageEnd(int propagation=-1); /*! the input buffer may contain more than blockSize bytes if lastSize != 0 @@ -74,33 +76,33 @@ protected: virtual void FirstPut(const byte *inString) =0; // NextPut() is called if totalLength >= firstSize+blockSize+lastSize // length parameter is always blockSize unless blockSize == 1 - virtual void NextPut(const byte *inString, unsigned int length) =0; + virtual void NextPut(const byte *inString, uint32_t length) =0; // LastPut() is always called // if totalLength < firstSize then length == totalLength // else if totalLength <= firstSize+lastSize then length == totalLength-firstSize // else lastSize <= length < lastSize+blockSize - virtual void LastPut(const byte *inString, unsigned int length) =0; + virtual void LastPut(const byte *inString, uint32_t length) =0; private: class BlockQueue { public: - BlockQueue(unsigned int blockSize, unsigned int maxBlocks); - void ResetQueue(unsigned int blockSize, unsigned int maxBlocks); + BlockQueue(uint32_t blockSize, uint32_t maxBlocks); + void ResetQueue(uint32_t blockSize, uint32_t maxBlocks); const byte *GetBlock(); - const byte *GetContigousBlocks(unsigned int &numberOfBlocks); - unsigned int GetAll(byte *outString); - void Put(const byte *inString, unsigned int length); - unsigned int CurrentSize() const {return m_size;} - unsigned int MaxSize() const {return m_buffer.size;} + const byte *GetContigousBlocks(uint32_t &numberOfBlocks); + uint32_t GetAll(byte *outString); + void Put(const byte *inString, uint32_t length); + uint32_t CurrentSize() const {return m_size;} + uint32_t MaxSize() const {return m_buffer.size;} private: SecByteBlock m_buffer; - unsigned int m_blockSize, m_maxBlocks, m_size; + uint32_t m_blockSize, m_maxBlocks, m_size; byte *m_begin; }; - unsigned int m_firstSize, m_blockSize, m_lastSize; + uint32_t m_firstSize, m_blockSize, m_lastSize; bool m_firstInputDone; BlockQueue m_queue; }; @@ -111,7 +113,7 @@ class FilterWithInputQueue : public Filter public: FilterWithInputQueue(BufferedTransformation *attachment) : Filter(attachment) {} void Put(byte inByte) {m_inQueue.Put(inByte);} - void Put(const byte *inString, unsigned int length) {m_inQueue.Put(inString, length);} + void Put(const byte *inString, uint32_t length) {m_inQueue.Put(inString, length);} protected: ByteQueue m_inQueue; @@ -128,7 +130,7 @@ public: void Put(byte inByte) {AttachedTransformation()->Put(cipher.ProcessByte(inByte));} - void Put(const byte *inString, unsigned int length); + void Put(const byte *inString, uint32_t length); private: StreamCipher &cipher; @@ -144,7 +146,7 @@ public: void MessageEnd(int propagation=-1); void Put(byte inByte); - void Put(const byte *inString, unsigned int length); + void Put(const byte *inString, uint32_t length); private: HashModule &m_hashModule; @@ -169,8 +171,8 @@ public: protected: void FirstPut(const byte *inString); - void NextPut(const byte *inString, unsigned int length); - void LastPut(const byte *inString, unsigned int length); + void NextPut(const byte *inString, uint32_t length); + void LastPut(const byte *inString, uint32_t length); private: HashModule &m_hashModule; @@ -191,7 +193,7 @@ public: void Put(byte inByte) {m_messageAccumulator->Update(&inByte, 1);} - void Put(const byte *inString, unsigned int length) + void Put(const byte *inString, uint32_t length) {m_messageAccumulator->Update(inString, length);} private: @@ -216,7 +218,7 @@ public: void Put(byte inByte) {m_messageAccumulator->Update(&inByte, 1);} - void Put(const byte *inString, unsigned int length) + void Put(const byte *inString, uint32_t length) {m_messageAccumulator->Update(inString, length);} private: @@ -235,7 +237,7 @@ class BitBucket : public Sink { public: void Put(byte) {} - void Put(const byte *, unsigned int) {} + void Put(const byte *, uint32_t) {} }; extern BitBucket g_bitBucket; @@ -254,7 +256,7 @@ public: void Put(byte b) {if (m_target) m_target->Put(b);} - void Put(const byte *string, unsigned int len) + void Put(const byte *string, uint32_t len) {if (m_target) m_target->Put(string, len);} void Flush(bool completeFlush, int propagation=-1) {if (m_target && m_passSignal) m_target->Flush(completeFlush, propagation);} @@ -265,7 +267,7 @@ public: void ChannelPut(const std::string &channel, byte b) {if (m_target) m_target->ChannelPut(channel, b);} - void ChannelPut(const std::string &channel, const byte *string, unsigned int len) + void ChannelPut(const std::string &channel, const byte *string, uint32_t len) {if (m_target) m_target->ChannelPut(channel, string, len);} void ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1) {if (m_target && m_passSignal) m_target->ChannelFlush(channel, completeFlush, propagation);} @@ -290,7 +292,7 @@ public: void Put(byte b) {m_owner.AttachedTransformation()->Put(b);} - void Put(const byte *string, unsigned int len) + void Put(const byte *string, uint32_t len) {m_owner.AttachedTransformation()->Put(string, len);} void Flush(bool completeFlush, int propagation=-1) {if (m_passSignal) m_owner.AttachedTransformation()->Flush(completeFlush, propagation);} @@ -301,7 +303,7 @@ public: void ChannelPut(const std::string &channel, byte b) {m_owner.AttachedTransformation()->ChannelPut(channel, b);} - void ChannelPut(const std::string &channel, const byte *string, unsigned int len) + void ChannelPut(const std::string &channel, const byte *string, uint32_t len) {m_owner.AttachedTransformation()->ChannelPut(channel, string, len);} void ChannelFlush(const std::string &channel, bool completeFlush, int propagation=-1) {if (m_passSignal) m_owner.AttachedTransformation()->ChannelFlush(channel, completeFlush, propagation);} @@ -319,12 +321,12 @@ private: class ProxyFilter : public FilterWithBufferedInput { public: - ProxyFilter(Filter *filter, unsigned int firstSize, unsigned int lastSize, BufferedTransformation *outQ); + ProxyFilter(Filter *filter, uint32_t firstSize, uint32_t lastSize, BufferedTransformation *outQ); void Flush(bool completeFlush, int propagation=-1); void SetFilter(Filter *filter); - void NextPut(const byte *s, unsigned int len); + void NextPut(const byte *s, uint32_t len); protected: member_ptr m_filter; @@ -343,7 +345,7 @@ public: : m_output(output) {assert(sizeof(output[0])==1);} void Put(byte b) {m_output += (char_type)b;} - void Put(const byte *str, unsigned int bc) + void Put(const byte *str, uint32_t bc) {m_output.append((const char_type *)str, bc);} private: @@ -357,10 +359,10 @@ typedef StringSinkTemplate StringSink; class ArraySink : public Sink { public: - ArraySink(byte *buf, unsigned int size) : m_buf(buf), m_size(size), m_total(0) {} + ArraySink(byte *buf, uint32_t size) : m_buf(buf), m_size(size), m_total(0) {} - unsigned int AvailableSize() {return m_size - STDMIN(m_total, (unsigned long)m_size);} - unsigned long TotalPutLength() {return m_total;} + uint32_t AvailableSize() {return m_size - STDMIN(m_total, (uint32_t)m_size);} + uint32_t TotalPutLength() {return m_total;} void Put(byte b) { @@ -369,24 +371,24 @@ public: m_total++; } - void Put(const byte *str, unsigned int len) + void Put(const byte *str, uint32_t len) { if (m_total < m_size) - memcpy(m_buf+m_total, str, STDMIN(len, (unsigned int)(m_size-m_total))); + memcpy(m_buf+m_total, str, STDMIN(len, (uint32_t)(m_size-m_total))); m_total += len; } protected: byte *m_buf; - unsigned int m_size; - unsigned long m_total; + uint32_t m_size; + uint32_t m_total; }; //! Xor input to a memory buffer class ArrayXorSink : public ArraySink { public: - ArrayXorSink(byte *buf, unsigned int size) + ArrayXorSink(byte *buf, uint32_t size) : ArraySink(buf, size) {} void Put(byte b) @@ -396,10 +398,10 @@ public: m_total++; } - void Put(const byte *str, unsigned int len) + void Put(const byte *str, uint32_t len) { if (m_total < m_size) - xorbuf(m_buf+m_total, str, STDMIN(len, (unsigned int)(m_size-m_total))); + xorbuf(m_buf+m_total, str, STDMIN(len, (uint32_t)(m_size-m_total))); m_total += len; } }; @@ -427,15 +429,15 @@ public: void Put(byte) {} - void Put(const byte *, unsigned int length) + void Put(const byte *, uint32_t length) {} - virtual unsigned long TransferTo(BufferedTransformation &target, unsigned long transferMax=ULONG_MAX) =0; - virtual unsigned long CopyTo(BufferedTransformation &target, unsigned long copyMax=ULONG_MAX) const =0; + virtual uint32_t TransferTo(BufferedTransformation &target, uint32_t transferMax=ULONG_SIZE) =0; + virtual uint32_t CopyTo(BufferedTransformation &target, uint32_t copyMax=ULONG_SIZE) const =0; - unsigned int NumberOfMessages() const {return m_messageEnd ? 0 : 1;} + uint32_t NumberOfMessages() const {return m_messageEnd ? 0 : 1;} bool GetNextMessage(); - unsigned int CopyMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX) const; + uint32_t CopyMessagesTo(BufferedTransformation &target, uint32_t count=UINT_MAX) const; private: bool m_messageEnd; @@ -447,32 +449,32 @@ class StringStore : public Store public: StringStore(const char *string) : m_store((const byte *)string), m_length(strlen(string)), m_count(0) {} - StringStore(const byte *string, unsigned int length) + StringStore(const byte *string, uint32_t length) : m_store(string), m_length(length), m_count(0) {} template StringStore(const T &string) : m_store((const byte *)string.data()), m_length(string.length()), m_count(0) {assert(sizeof(string[0])==1);} - unsigned long TransferTo(BufferedTransformation &target, unsigned long transferMax=ULONG_MAX); - unsigned long CopyTo(BufferedTransformation &target, unsigned long copyMax=ULONG_MAX) const; + uint32_t TransferTo(BufferedTransformation &target, uint32_t transferMax=ULONG_SIZE); + uint32_t CopyTo(BufferedTransformation &target, uint32_t copyMax=ULONG_SIZE) const; private: const byte *m_store; - unsigned int m_length, m_count; + uint32_t m_length, m_count; }; //! . class RandomNumberStore : public Store { public: - RandomNumberStore(RandomNumberGenerator &rng, unsigned long length) + RandomNumberStore(RandomNumberGenerator &rng, uint32_t length) : m_rng(rng), m_length(length), m_count(0) {} - unsigned long TransferTo(BufferedTransformation &target, unsigned long transferMax=ULONG_MAX); - unsigned long CopyTo(BufferedTransformation &target, unsigned long copyMax=ULONG_MAX) const; + uint32_t TransferTo(BufferedTransformation &target, uint32_t transferMax=ULONG_SIZE); + uint32_t CopyTo(BufferedTransformation &target, uint32_t copyMax=ULONG_SIZE) const; private: RandomNumberGenerator &m_rng; - unsigned long m_length, m_count; + uint32_t m_length, m_count; }; //! A Filter that pumps data into its attachment as input @@ -482,13 +484,13 @@ public: Source(BufferedTransformation *outQ) : Filter(outQ) {} - virtual unsigned long Pump(unsigned long pumpMax=ULONG_MAX) =0; - virtual unsigned int PumpMessages(unsigned int count=UINT_MAX) {return 0;} + virtual uint32_t Pump(uint32_t pumpMax=ULONG_SIZE) =0; + virtual uint32_t PumpMessages(uint32_t count=UINT_MAX) {return 0;} void PumpAll(); void Put(byte) {Pump(1);} - void Put(const byte *, unsigned int length) + void Put(const byte *, uint32_t length) {Pump(length);} void MessageEnd(int propagation=-1) {PumpAll();} @@ -504,9 +506,9 @@ public: if (pumpAll) PumpAll(); } - unsigned long Pump(unsigned long pumpMax=ULONG_MAX) + uint32_t Pump(uint32_t pumpMax=ULONG_SIZE) {return m_store.TransferTo(*AttachedTransformation(), pumpMax);} - unsigned int PumpMessages(unsigned int count=UINT_MAX) + uint32_t PumpMessages(uint32_t count=UINT_MAX) {return m_store.TransferMessagesTo(*AttachedTransformation(), count);} private: @@ -518,7 +520,7 @@ class StringSource : public Source { public: StringSource(const char *string, bool pumpAll, BufferedTransformation *outQueue = nullptr); - StringSource(const byte *string, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); + StringSource(const byte *string, uint32_t length, bool pumpAll, BufferedTransformation *outQueue = nullptr); #ifdef __MWERKS__ // CW60 workaround StringSource(const std::string &string, bool pumpAll, BufferedTransformation *outQueue = nullptr) @@ -531,9 +533,9 @@ public: PumpAll(); } - unsigned long Pump(unsigned long pumpMax=ULONG_MAX) + uint32_t Pump(uint32_t pumpMax=ULONG_SIZE) {return m_store.TransferTo(*AttachedTransformation(), pumpMax);} - unsigned int PumpMessages(unsigned int count=UINT_MAX) + uint32_t PumpMessages(uint32_t count=UINT_MAX) {return m_store.TransferMessagesTo(*AttachedTransformation(), count);} private: @@ -544,11 +546,11 @@ private: class RandomNumberSource : public Source { public: - RandomNumberSource(RandomNumberGenerator &rng, unsigned int length, bool pumpAll, BufferedTransformation *outQueue = nullptr); + RandomNumberSource(RandomNumberGenerator &rng, uint32_t length, bool pumpAll, BufferedTransformation *outQueue = nullptr); - unsigned long Pump(unsigned long pumpMax=ULONG_MAX) + uint32_t Pump(uint32_t pumpMax=ULONG_SIZE) {return m_store.TransferTo(*AttachedTransformation(), pumpMax);} - unsigned int PumpMessages(unsigned int count=UINT_MAX) + uint32_t PumpMessages(uint32_t count=UINT_MAX) {return m_store.TransferMessagesTo(*AttachedTransformation(), count);} private: diff --git a/external/ours/library/crypto/src/shared/original/iterhash.h b/external/ours/library/crypto/src/shared/original/iterhash.h index a0abd0e7..9a5f7d28 100755 --- a/external/ours/library/crypto/src/shared/original/iterhash.h +++ b/external/ours/library/crypto/src/shared/original/iterhash.h @@ -17,31 +17,31 @@ class IteratedHashBase : public virtual HashModule public: typedef T HashWordType; - IteratedHashBase(unsigned int blockSize, unsigned int digestSize); - unsigned int DigestSize() const {return digest.size * sizeof(T);}; - void Update(const byte *input, unsigned int length); + IteratedHashBase(uint32_t blockSize, uint32_t digestSize); + uint32_t DigestSize() const {return digest.size * sizeof(T);}; + void Update(const byte *input, uint32_t length); protected: - virtual unsigned int HashMultipleBlocks(const T *input, unsigned int length); - void PadLastBlock(unsigned int lastBlockSize, byte padFirst=0x80); + virtual uint32_t HashMultipleBlocks(const T *input, uint32_t length); + void PadLastBlock(uint32_t lastBlockSize, byte padFirst=0x80); void Reinit(); virtual void Init() =0; virtual void HashBlock(const T *input) =0; - unsigned int blockSize; + uint32_t blockSize; word32 countLo, countHi; // 64-bit bit count SecBlock data; // Data buffer SecBlock digest; // Message digest }; template -IteratedHashBase::IteratedHashBase(unsigned int blockSize, unsigned int digestSize) +IteratedHashBase::IteratedHashBase(uint32_t blockSize, uint32_t digestSize) : blockSize(blockSize), countLo(0), countHi(0) , data(blockSize/sizeof(T)), digest(digestSize/sizeof(T)) { } -template void IteratedHashBase::Update(const byte *input, unsigned int len) +template void IteratedHashBase::Update(const byte *input, uint32_t len) { HashWordType tmp = countLo; if ((countLo = tmp + ((word32)len << 3)) < tmp) @@ -54,7 +54,7 @@ template void IteratedHashBase::Update(const byte *input, unsigned } assert((blockSize & (blockSize-1)) == 0); // blockSize is a power of 2 - unsigned int num = (unsigned int)(tmp >> 3) & (blockSize-1); + uint32_t num = (uint32_t)(tmp >> 3) & (blockSize-1); if (num != 0) { @@ -80,7 +80,7 @@ template void IteratedHashBase::Update(const byte *input, unsigned { if (IsAligned(input)) { - unsigned int leftOver = HashMultipleBlocks((T *)input, len); + uint32_t leftOver = HashMultipleBlocks((T *)input, len); input += (len - leftOver); len = leftOver; } @@ -97,7 +97,7 @@ template void IteratedHashBase::Update(const byte *input, unsigned memcpy(data, input, len); } -template unsigned int IteratedHashBase::HashMultipleBlocks(const T *input, unsigned int length) +template uint32_t IteratedHashBase::HashMultipleBlocks(const T *input, uint32_t length) { do { @@ -109,9 +109,9 @@ template unsigned int IteratedHashBase::HashMultipleBlocks(const T return length; } -template void IteratedHashBase::PadLastBlock(unsigned int lastBlockSize, byte padFirst) +template void IteratedHashBase::PadLastBlock(uint32_t lastBlockSize, byte padFirst) { - unsigned int num = (unsigned int)(countLo >> 3) & (blockSize-1); + uint32_t num = (uint32_t)(countLo >> 3) & (blockSize-1); assert(num < blockSize); ((byte *)data.ptr)[num++]=padFirst; if (num <= lastBlockSize) @@ -135,16 +135,16 @@ template void IteratedHashBase::Init() {} template void IteratedHashBase::HashBlock(const T *input) {} //! . -template +template class IteratedHash : public IteratedHashBase { public: typedef T HashWordType; enum {HIGHFIRST = H, BLOCKSIZE = S}; - IteratedHash(unsigned int digestSize) : IteratedHashBase(BLOCKSIZE, digestSize) {} + IteratedHash(uint32_t digestSize) : IteratedHashBase(BLOCKSIZE, digestSize) {} - inline static void CorrectEndianess(HashWordType *out, const HashWordType *in, unsigned int byteCount) + inline static void CorrectEndianess(HashWordType *out, const HashWordType *in, uint32_t byteCount) { if (!CheckEndianess(HIGHFIRST)) byteReverse(out, in, byteCount); @@ -174,7 +174,7 @@ protected: vTransform(input); else { - byteReverse(this->data.ptr, input, (unsigned int)BLOCKSIZE); + byteReverse(this->data.ptr, input, (uint32_t)BLOCKSIZE); vTransform(this->data); } } diff --git a/external/ours/library/crypto/src/shared/original/misc.cpp b/external/ours/library/crypto/src/shared/original/misc.cpp index 5e49edfc..663684f1 100755 --- a/external/ours/library/crypto/src/shared/original/misc.cpp +++ b/external/ours/library/crypto/src/shared/original/misc.cpp @@ -8,38 +8,38 @@ NAMESPACE_BEGIN(CryptoPP) byte OAEP_P_DEFAULT[1]; -void xorbuf(byte *buf, const byte *mask, unsigned int count) +void xorbuf(byte *buf, const byte *mask, unsigned long count) { - if (((unsigned int)buf | (unsigned int)mask | count) % WORD_SIZE == 0) + if (((unsigned long)buf | (unsigned long)mask | count) % WORD_SIZE == 0) XorWords((word *)buf, (const word *)mask, count/WORD_SIZE); else { - for (unsigned int i=0; i0; i/=2) + for (unsigned long i=8*sizeof(value)/2; i>0; i/=2) value ^= value >> i; - return (unsigned int)value&1; + return (unsigned long)value&1; } -unsigned int BytePrecision(unsigned long value) +unsigned long BytePrecision(unsigned long value) { - unsigned int i; + unsigned long i; for (i=sizeof(value); i; --i) if (value >> (i-1)*8) break; @@ -47,16 +47,16 @@ unsigned int BytePrecision(unsigned long value) return i; } -unsigned int BitPrecision(unsigned long value) +unsigned long BitPrecision(unsigned long value) { if (!value) return 0; - unsigned int l=0, h=8*sizeof(value); + unsigned long l=0, h=8*sizeof(value); while (h-l > 1) { - unsigned int t = (l+h)/2; + unsigned long t = (l+h)/2; if (value >> t) l = t; else @@ -66,7 +66,7 @@ unsigned int BitPrecision(unsigned long value) return h; } -unsigned long Crop(unsigned long value, unsigned int size) +unsigned long Crop(unsigned long value, unsigned long size) { if (size < 8*sizeof(value)) return (value & ((1L << size) - 1)); diff --git a/external/ours/library/crypto/src/shared/original/misc.h b/external/ours/library/crypto/src/shared/original/misc.h index 8eb15e2e..36eaaa97 100755 --- a/external/ours/library/crypto/src/shared/original/misc.h +++ b/external/ours/library/crypto/src/shared/original/misc.h @@ -15,39 +15,39 @@ NAMESPACE_BEGIN(CryptoPP) // ************** misc functions *************** -#define GETBYTE(x, y) (unsigned int)(((x)>>(8*(y)))&255) +#define GETBYTE(x, y) (unsigned long)(((x)>>(8*(y)))&255) // this one may be faster on a Pentium // #define GETBYTE(x, y) (((byte *)&(x))[y]) -unsigned int Parity(unsigned long); -unsigned int BytePrecision(unsigned long); -unsigned int BitPrecision(unsigned long); -unsigned long Crop(unsigned long, unsigned int size); +unsigned long Parity(unsigned long); +unsigned long BytePrecision(unsigned long); +unsigned long BitPrecision(unsigned long); +unsigned long Crop(unsigned long, unsigned long size); -inline unsigned int bitsToBytes(unsigned int bitCount) +inline unsigned long bitsToBytes(unsigned long bitCount) { return ((bitCount+7)/(8)); } -inline unsigned int bytesToWords(unsigned int byteCount) +inline unsigned long bytesToWords(unsigned long byteCount) { return ((byteCount+WORD_SIZE-1)/WORD_SIZE); } -inline unsigned int bitsToWords(unsigned int bitCount) +inline unsigned long bitsToWords(unsigned long bitCount) { return ((bitCount+WORD_BITS-1)/(WORD_BITS)); } -void xorbuf(byte *buf, const byte *mask, unsigned int count); -void xorbuf(byte *output, const byte *input, const byte *mask, unsigned int count); +void xorbuf(byte *buf, const byte *mask, unsigned long count); +void xorbuf(byte *output, const byte *input, const byte *mask, unsigned long count); -inline unsigned int RoundDownToMultipleOf(unsigned int n, unsigned int m) +inline unsigned long RoundDownToMultipleOf(unsigned long n, unsigned long m) { return n - n%m; } -inline unsigned int RoundUpToMultipleOf(unsigned int n, unsigned int m) +inline unsigned long RoundUpToMultipleOf(unsigned long n, unsigned long m) { return RoundDownToMultipleOf(n+m-1, m); } @@ -91,37 +91,37 @@ std::string IntToString(T a) // ************** rotate functions *************** -template inline T rotlFixed(T x, unsigned int y) +template inline T rotlFixed(T x, unsigned long y) { assert(y < sizeof(T)*8); return (x<>(sizeof(T)*8-y)); } -template inline T rotrFixed(T x, unsigned int y) +template inline T rotrFixed(T x, unsigned long y) { assert(y < sizeof(T)*8); return (x>>y) | (x<<(sizeof(T)*8-y)); } -template inline T rotlVariable(T x, unsigned int y) +template inline T rotlVariable(T x, unsigned long y) { assert(y < sizeof(T)*8); return (x<>(sizeof(T)*8-y)); } -template inline T rotrVariable(T x, unsigned int y) +template inline T rotrVariable(T x, unsigned long y) { assert(y < sizeof(T)*8); return (x>>y) | (x<<(sizeof(T)*8-y)); } -template inline T rotlMod(T x, unsigned int y) +template inline T rotlMod(T x, unsigned long y) { y %= sizeof(T)*8; return (x<>(sizeof(T)*8-y)); } -template inline T rotrMod(T x, unsigned int y) +template inline T rotrMod(T x, unsigned long y) { y %= sizeof(T)*8; return (x>>y) | (x<<(sizeof(T)*8-y)); @@ -129,36 +129,36 @@ template inline T rotrMod(T x, unsigned int y) #ifdef INTEL_INTRINSICS -template<> inline word32 rotlFixed(word32 x, unsigned int y) +template<> inline word32 rotlFixed(word32 x, unsigned long y) { assert(y < 32); return y ? _lrotl(x, y) : x; } -template<> inline word32 rotrFixed(word32 x, unsigned int y) +template<> inline word32 rotrFixed(word32 x, unsigned long y) { assert(y < 32); return y ? _lrotr(x, y) : x; } -template<> inline word32 rotlVariable(word32 x, unsigned int y) +template<> inline word32 rotlVariable(word32 x, unsigned long y) { assert(y < 32); return _lrotl(x, y); } -template<> inline word32 rotrVariable(word32 x, unsigned int y) +template<> inline word32 rotrVariable(word32 x, unsigned long y) { assert(y < 32); return _lrotr(x, y); } -template<> inline word32 rotlMod(word32 x, unsigned int y) +template<> inline word32 rotlMod(word32 x, unsigned long y) { return _lrotl(x, y); } -template<> inline word32 rotrMod(word32 x, unsigned int y) +template<> inline word32 rotrMod(word32 x, unsigned long y) { return _lrotr(x, y); } @@ -167,36 +167,36 @@ template<> inline word32 rotrMod(word32 x, unsigned int y) #ifdef PPC_INTRINSICS -template<> inline word32 rotlFixed(word32 x, unsigned int y) +template<> inline word32 rotlFixed(word32 x, unsigned long y) { assert(y < 32); return y ? __rlwinm(x,y,0,31) : x; } -template<> inline word32 rotrFixed(word32 x, unsigned int y) +template<> inline word32 rotrFixed(word32 x, unsigned long y) { assert(y < 32); return y ? __rlwinm(x,32-y,0,31) : x; } -template<> inline word32 rotlVariable(word32 x, unsigned int y) +template<> inline word32 rotlVariable(word32 x, unsigned long y) { assert(y < 32); return (__rlwnm(x,y,0,31)); } -template<> inline word32 rotrVariable(word32 x, unsigned int y) +template<> inline word32 rotrVariable(word32 x, unsigned long y) { assert(y < 32); return (__rlwnm(x,32-y,0,31)); } -template<> inline word32 rotlMod(word32 x, unsigned int y) +template<> inline word32 rotlMod(word32 x, unsigned long y) { return (__rlwnm(x,y,0,31)); } -template<> inline word32 rotrMod(word32 x, unsigned int y) +template<> inline word32 rotrMod(word32 x, unsigned long y) { return (__rlwnm(x,32-y,0,31)); } @@ -297,17 +297,17 @@ inline T bitReverse(T value) } template -void byteReverse(T *out, const T *in, unsigned int byteCount) +void byteReverse(T *out, const T *in, unsigned long byteCount) { - unsigned int count = (byteCount+sizeof(T)-1)/sizeof(T); - for (unsigned int i=0; i -inline void GetUserKeyLittleEndian(T *out, unsigned int outlen, const byte *in, unsigned int inlen) +inline void GetUserKeyLittleEndian(T *out, unsigned long outlen, const byte *in, unsigned long inlen) { - const unsigned int U = sizeof(T); + const unsigned long U = sizeof(T); assert(inlen <= outlen*U); memcpy(out, in, inlen); memset((byte *)out+inlen, 0, outlen*U-inlen); @@ -317,9 +317,9 @@ inline void GetUserKeyLittleEndian(T *out, unsigned int outlen, const byte *in, } template -inline void GetUserKeyBigEndian(T *out, unsigned int outlen, const byte *in, unsigned int inlen) +inline void GetUserKeyBigEndian(T *out, unsigned long outlen, const byte *in, unsigned long inlen) { - const unsigned int U = sizeof(T); + const unsigned long U = sizeof(T); assert(inlen <= outlen*U); memcpy(out, in, inlen); memset((byte *)out+inlen, 0, outlen*U-inlen); @@ -468,23 +468,23 @@ T StringToWord(const std::string &str, bool highFirst = true) // ************** key length query *************** /// support query of fixed key length -template +template class FixedKeyLength { public: enum {KEYLENGTH=N, MIN_KEYLENGTH=N, MAX_KEYLENGTH=N, DEFAULT_KEYLENGTH=N}; /// returns the key length - static unsigned int KeyLength(unsigned int) {return KEYLENGTH;} + static unsigned long KeyLength(unsigned long) {return KEYLENGTH;} }; /// support query of variable key length, template parameters are default, min, max, multiple (default multiple 1) -template +template class VariableKeyLength { public: enum {MIN_KEYLENGTH=N, MAX_KEYLENGTH=M, DEFAULT_KEYLENGTH=D, KEYLENGTH_MULTIPLE=Q}; /// returns the smallest valid key length in bytes that is >= min(n, MAX_KEYLENGTH) - static unsigned int KeyLength(unsigned int n) + static unsigned long KeyLength(unsigned long n) { assert(KEYLENGTH_MULTIPLE > 0 && MIN_KEYLENGTH % KEYLENGTH_MULTIPLE == 0 && MAX_KEYLENGTH % KEYLENGTH_MULTIPLE == 0); if (n < MIN_KEYLENGTH) @@ -503,7 +503,7 @@ class SameKeyLengthAs public: enum {MIN_KEYLENGTH=T::MIN_KEYLENGTH, MAX_KEYLENGTH=T::MAX_KEYLENGTH, DEFAULT_KEYLENGTH=T::DEFAULT_KEYLENGTH}; /// returns the smallest valid key length in bytes that is >= min(n, MAX_KEYLENGTH) - static unsigned int KeyLength(unsigned int keylength) + static unsigned long KeyLength(unsigned long keylength) {return T::KeyLength(keylength);} }; @@ -520,11 +520,11 @@ public: //! a block of memory allocated using SecAlloc template struct SecBlock { - explicit SecBlock(unsigned int size=0) + explicit SecBlock(unsigned long size=0) : size(size) {ptr = SecAlloc(T, size);} SecBlock(const SecBlock &t) : size(t.size) {ptr = SecAlloc(T, size); memcpy(ptr, t.ptr, size*sizeof(T));} - SecBlock(const T *t, unsigned int len) + SecBlock(const T *t, unsigned long len) : size(len) {ptr = SecAlloc(T, len); memcpy(ptr, t, len*sizeof(T));} ~SecBlock() {SecFree(ptr, size);} @@ -551,13 +551,13 @@ template struct SecBlock // CodeWarrior defines _MSC_VER #if !defined(_MSC_VER) || defined(__MWERKS__) - T *operator +(unsigned int offset) + T *operator +(unsigned long offset) {return ptr+offset;} - const T *operator +(unsigned int offset) const + const T *operator +(unsigned long offset) const {return ptr+offset;} - T& operator[](unsigned int index) + T& operator[](unsigned long index) {assert(index struct SecBlock T* End() {return ptr+size;} - unsigned int Size() const {return size;} + unsigned long Size() const {return size;} - void Assign(const T *t, unsigned int len) + void Assign(const T *t, unsigned long len) { New(len); memcpy(ptr, t, len*sizeof(T)); @@ -600,7 +600,7 @@ template struct SecBlock return !operator==(t); } - void New(unsigned int newSize) + void New(unsigned long newSize) { if (newSize != size) { @@ -611,7 +611,7 @@ template struct SecBlock } } - void CleanNew(unsigned int newSize) + void CleanNew(unsigned long newSize) { if (newSize != size) { @@ -623,7 +623,7 @@ template struct SecBlock memset(ptr, 0, size*sizeof(T)); } - void Grow(unsigned int newSize) + void Grow(unsigned long newSize) { if (newSize > size) { @@ -635,7 +635,7 @@ template struct SecBlock } } - void CleanGrow(unsigned int newSize) + void CleanGrow(unsigned long newSize) { if (newSize > size) { @@ -648,7 +648,7 @@ template struct SecBlock } } - void Resize(unsigned int newSize) + void Resize(unsigned long newSize) { if (newSize != size) { @@ -662,7 +662,7 @@ template struct SecBlock void swap(SecBlock &b); - unsigned int size; + unsigned long size; T *ptr; }; diff --git a/external/ours/library/crypto/src/shared/original/mqueue.cpp b/external/ours/library/crypto/src/shared/original/mqueue.cpp index 314d6f75..f8c59907 100755 --- a/external/ours/library/crypto/src/shared/original/mqueue.cpp +++ b/external/ours/library/crypto/src/shared/original/mqueue.cpp @@ -5,7 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) -MessageQueue::MessageQueue(unsigned int nodeSize) +MessageQueue::MessageQueue(uint32_t nodeSize) : m_queue(nodeSize), m_lengths(1, 0) { } @@ -21,11 +21,11 @@ bool MessageQueue::RetrieveNextMessage() return false; } -unsigned int MessageQueue::CopyMessagesTo(BufferedTransformation &target, unsigned int count) const +uint32_t MessageQueue::CopyMessagesTo(BufferedTransformation &target, uint32_t count) const { ByteQueue::Walker walker(m_queue); - std::deque::const_iterator it = m_lengths.begin(); - unsigned int i; + std::deque::const_iterator it = m_lengths.begin(); + uint32_t i; for (i=0; i +#define ULONG_SIZE sizeof(uint32_t) + NAMESPACE_BEGIN(CryptoPP) //! Message Queue class MessageQueue : public BufferedTransformationWithAutoSignal { public: - MessageQueue(unsigned int nodeSize=256); + MessageQueue(uint32_t nodeSize=256); void Put(byte inByte) {m_queue.Put(inByte); m_lengths.back()++;} - void Put(const byte *inString, unsigned int length) + void Put(const byte *inString, uint32_t length) {m_queue.Put(inString, length); m_lengths.back()+=length;} - unsigned long MaxRetrievable() const + uint32_t MaxRetrievable() const {return m_lengths.front();} bool AnyRetrievable() const {return m_lengths.front() > 0;} - unsigned long TransferTo(BufferedTransformation &target, unsigned long transferMax=ULONG_MAX) + uint32_t TransferTo(BufferedTransformation &target, uint32_t transferMax=ULONG_SIZE) {return Got(m_queue.TransferTo(target, STDMIN(MaxRetrievable(), transferMax)));} - unsigned long CopyTo(BufferedTransformation &target, unsigned long copyMax=ULONG_MAX) const + uint32_t CopyTo(BufferedTransformation &target, uint32_t copyMax=ULONG_SIZE) const {return m_queue.CopyTo(target, STDMIN(MaxRetrievable(), copyMax));} void MessageEnd(int=-1) {m_lengths.push_back(0);} - unsigned long TotalBytesRetrievable() const + uint32_t TotalBytesRetrievable() const {return m_queue.MaxRetrievable();} - unsigned int NumberOfMessages() const + uint32_t NumberOfMessages() const {return m_lengths.size()-1;} bool RetrieveNextMessage(); - unsigned int CopyMessagesTo(BufferedTransformation &target, unsigned int count=UINT_MAX) const; + uint32_t CopyMessagesTo(BufferedTransformation &target, uint32_t count=UINT_MAX) const; void swap(MessageQueue &rhs); private: - unsigned long Got(unsigned long length) + uint32_t Got(uint32_t length) {assert(m_lengths.front() >= length); m_lengths.front() -= length; return length;} ByteQueue m_queue; - std::deque m_lengths; + std::deque m_lengths; }; NAMESPACE_END diff --git a/external/ours/library/crypto/src/shared/original/queue.cpp b/external/ours/library/crypto/src/shared/original/queue.cpp index 590b8899..4585468e 100755 --- a/external/ours/library/crypto/src/shared/original/queue.cpp +++ b/external/ours/library/crypto/src/shared/original/queue.cpp @@ -10,16 +10,16 @@ NAMESPACE_BEGIN(CryptoPP) class ByteQueueNode { public: - ByteQueueNode(unsigned int maxSize) + ByteQueueNode(uint32_t maxSize) : buf(maxSize) { m_head = m_tail = 0; next = 0; } - inline unsigned int MaxSize() const { return buf.size; } + inline uint32_t MaxSize() const { return buf.size; } - inline unsigned int CurrentSize() const + inline uint32_t CurrentSize() const { return m_tail - m_head; } @@ -34,7 +34,7 @@ public: m_head = m_tail = 0; } - inline unsigned int Put(byte inByte) + inline uint32_t Put(byte inByte) { if (MaxSize() == m_tail) return 0; @@ -43,15 +43,15 @@ public: return 1; } - inline unsigned int Put(const byte *inString, unsigned int length) + inline uint32_t Put(const byte *inString, uint32_t length) { - unsigned int l = STDMIN(length, MaxSize() - m_tail); + uint32_t l = STDMIN(length, MaxSize() - m_tail); memcpy(buf + m_tail, inString, l); m_tail += l; return l; } - inline unsigned int Peek(byte &outByte) const + inline uint32_t Peek(byte &outByte) const { if (m_tail == m_head) return 0; @@ -60,63 +60,63 @@ public: return 1; } - inline unsigned int Peek(byte *target, unsigned int copyMax) const + inline uint32_t Peek(byte *target, uint32_t copyMax) const { - unsigned int len = STDMIN(copyMax, m_tail - m_head); + uint32_t len = STDMIN(copyMax, m_tail - m_head); memcpy(target, buf + m_head, len); return len; } - inline unsigned int CopyTo(BufferedTransformation &target) const + inline uint32_t CopyTo(BufferedTransformation &target) const { - unsigned int len = m_tail - m_head; + uint32_t len = m_tail - m_head; target.Put(buf + m_head, len); return len; } - inline unsigned int CopyTo(BufferedTransformation &target, unsigned int copyMax) const + inline uint32_t CopyTo(BufferedTransformation &target, uint32_t copyMax) const { - unsigned int len = STDMIN(copyMax, m_tail - m_head); + uint32_t len = STDMIN(copyMax, m_tail - m_head); target.Put(buf + m_head, len); return len; } - inline unsigned int Get(byte &outByte) + inline uint32_t Get(byte &outByte) { - unsigned int len = Peek(outByte); + uint32_t len = Peek(outByte); m_head += len; return len; } - inline unsigned int Get(byte *outString, unsigned int getMax) + inline uint32_t Get(byte *outString, uint32_t getMax) { - unsigned int len = Peek(outString, getMax); + uint32_t len = Peek(outString, getMax); m_head += len; return len; } - inline unsigned int TransferTo(BufferedTransformation &target) + inline uint32_t TransferTo(BufferedTransformation &target) { - unsigned int len = CopyTo(target); + uint32_t len = CopyTo(target); m_head += len; return len; } - inline unsigned int TransferTo(BufferedTransformation &target, unsigned int transferMax) + inline uint32_t TransferTo(BufferedTransformation &target, uint32_t transferMax) { - unsigned int len = CopyTo(target, transferMax); + uint32_t len = CopyTo(target, transferMax); m_head += len; return len; } - inline unsigned int Skip(unsigned int skipMax) + inline uint32_t Skip(uint32_t skipMax) { - unsigned int len = STDMIN(skipMax, m_tail - m_head); + uint32_t len = STDMIN(skipMax, m_tail - m_head); m_head += len; return len; } - inline byte operator[](unsigned int i) const + inline byte operator[](uint32_t i) const { return buf[m_head + i]; } @@ -124,12 +124,12 @@ public: ByteQueueNode *next; SecByteBlock buf; - unsigned int m_head, m_tail; + uint32_t m_head, m_tail; }; // ******************************************************** -ByteQueue::ByteQueue(unsigned int m_nodeSize) +ByteQueue::ByteQueue(uint32_t m_nodeSize) : m_nodeSize(0), m_lazyLength(0), m_lazyString(nullptr) { m_head = m_tail = new ByteQueueNode(m_nodeSize); @@ -173,9 +173,9 @@ void ByteQueue::Destroy() } } -unsigned long ByteQueue::CurrentSize() const +uint32_t ByteQueue::CurrentSize() const { - unsigned long size = 0; + uint32_t size = 0; for (ByteQueueNode *current = m_head; current; current = current->next) size += current->CurrentSize(); @@ -208,12 +208,12 @@ void ByteQueue::Put(byte inByte) } } -void ByteQueue::Put(const byte *inString, unsigned int length) +void ByteQueue::Put(const byte *inString, uint32_t length) { if (m_lazyLength > 0) FinalizeLazyPut(); - unsigned int len; + uint32_t len; while ((len = m_tail->Put(inString, length)) < length) { m_tail->next = new ByteQueueNode(m_nodeSize); @@ -236,7 +236,7 @@ void ByteQueue::CleanupUsedNodes() m_head->Clear(); } -void ByteQueue::LazyPut(const byte *inString, unsigned int size) +void ByteQueue::LazyPut(const byte *inString, uint32_t size) { if (m_lazyLength > 0) FinalizeLazyPut(); @@ -246,12 +246,12 @@ void ByteQueue::LazyPut(const byte *inString, unsigned int size) void ByteQueue::FinalizeLazyPut() { - unsigned int len = m_lazyLength; + uint32_t len = m_lazyLength; m_lazyLength = 0; Put(m_lazyString, len); } -unsigned int ByteQueue::Get(byte &outByte) +uint32_t ByteQueue::Get(byte &outByte) { if (m_head->Get(outByte)) { @@ -269,13 +269,13 @@ unsigned int ByteQueue::Get(byte &outByte) return 0; } -unsigned int ByteQueue::Get(byte *outString, unsigned int getMax) +uint32_t ByteQueue::Get(byte *outString, uint32_t getMax) { ArraySink sink(outString, getMax); return TransferTo(sink, getMax); } -unsigned int ByteQueue::Peek(byte &outByte) const +uint32_t ByteQueue::Peek(byte &outByte) const { if (m_head->Peek(outByte)) return 1; @@ -288,25 +288,25 @@ unsigned int ByteQueue::Peek(byte &outByte) const return 0; } -unsigned int ByteQueue::Peek(byte *outString, unsigned int peekMax) const +uint32_t ByteQueue::Peek(byte *outString, uint32_t peekMax) const { ArraySink sink(outString, peekMax); return CopyTo(sink, peekMax); } -unsigned long ByteQueue::Skip(unsigned long skipMax) +uint32_t ByteQueue::Skip(uint32_t skipMax) { return TransferTo(g_bitBucket, skipMax); } -unsigned long ByteQueue::TransferTo(BufferedTransformation &target, unsigned long transferMax) +uint32_t ByteQueue::TransferTo(BufferedTransformation &target, uint32_t transferMax) { - unsigned long bytesLeft = transferMax; + uint32_t bytesLeft = transferMax; for (ByteQueueNode *current = m_head; bytesLeft && current; current = current->next) bytesLeft -= current->TransferTo(target, bytesLeft); CleanupUsedNodes(); - unsigned int len = (unsigned int)STDMIN(bytesLeft, (unsigned long)m_lazyLength); + uint32_t len = (uint32_t)STDMIN(bytesLeft, (uint32_t)m_lazyLength); if (len) { target.Put(m_lazyString, len); @@ -317,14 +317,14 @@ unsigned long ByteQueue::TransferTo(BufferedTransformation &target, unsigned lon return transferMax - bytesLeft; } -unsigned long ByteQueue::CopyTo(BufferedTransformation &target, unsigned long copyMax) const +uint32_t ByteQueue::CopyTo(BufferedTransformation &target, uint32_t copyMax) const { - unsigned long bytesLeft = copyMax; + uint32_t bytesLeft = copyMax; for (ByteQueueNode *current = m_head; bytesLeft && current; current = current->next) bytesLeft -= current->CopyTo(target, bytesLeft); if (bytesLeft && m_lazyLength) { - unsigned int len = (unsigned int)STDMIN(bytesLeft, (unsigned long)m_lazyLength); + uint32_t len = (uint32_t)STDMIN(bytesLeft, (uint32_t)m_lazyLength); target.Put(m_lazyString, len); bytesLeft -= len; } @@ -336,7 +336,7 @@ void ByteQueue::Unget(byte inByte) Unget(&inByte, 1); } -void ByteQueue::Unget(const byte *inString, unsigned int length) +void ByteQueue::Unget(const byte *inString, uint32_t length) { ByteQueueNode *newHead = new ByteQueueNode(length); newHead->next = m_head; @@ -344,13 +344,13 @@ void ByteQueue::Unget(const byte *inString, unsigned int length) m_head->Put(inString, length); } /* -byte * ByteQueue::Spy(unsigned int &contiguousSize) +byte * ByteQueue::Spy(uint32_t &contiguousSize) { contiguousSize = m_head->m_tail - m_head->m_head; return m_head->buf + m_head->m_head; } */ -const byte * ByteQueue::Spy(unsigned int &contiguousSize) const +const byte * ByteQueue::Spy(uint32_t &contiguousSize) const { contiguousSize = m_head->m_tail - m_head->m_head; if (contiguousSize == 0 && m_lazyLength > 0) @@ -362,7 +362,7 @@ const byte * ByteQueue::Spy(unsigned int &contiguousSize) const return m_head->buf + m_head->m_head; } -byte * ByteQueue::MakeNewSpace(unsigned int &contiguousSize) +byte * ByteQueue::MakeNewSpace(uint32_t &contiguousSize) { if (m_lazyLength > 0) FinalizeLazyPut(); @@ -377,7 +377,7 @@ byte * ByteQueue::MakeNewSpace(unsigned int &contiguousSize) return m_tail->buf + m_tail->m_tail; } -void ByteQueue::OccupyNewSpace(unsigned int size) +void ByteQueue::OccupyNewSpace(uint32_t size) { m_tail->m_tail += size; assert(m_tail->m_tail <= m_tail->MaxSize()); @@ -392,7 +392,7 @@ ByteQueue & ByteQueue::operator=(const ByteQueue &rhs) bool ByteQueue::operator==(const ByteQueue &rhs) const { - const unsigned long currentSize = CurrentSize(); + const uint32_t currentSize = CurrentSize(); if (currentSize != rhs.CurrentSize()) return false; @@ -407,7 +407,7 @@ bool ByteQueue::operator==(const ByteQueue &rhs) const return true; } -byte ByteQueue::operator[](unsigned long i) const +byte ByteQueue::operator[](uint32_t i) const { for (ByteQueueNode *current = m_head; current; current = current->next) { @@ -432,36 +432,36 @@ void ByteQueue::swap(ByteQueue &rhs) // ******************************************************** -unsigned int ByteQueue::Walker::Get(byte &outByte) +uint32_t ByteQueue::Walker::Get(byte &outByte) { ArraySink sink(&outByte, 1); return TransferTo(sink, 1); } -unsigned int ByteQueue::Walker::Get(byte *outString, unsigned int getMax) +uint32_t ByteQueue::Walker::Get(byte *outString, uint32_t getMax) { ArraySink sink(outString, getMax); return TransferTo(sink, getMax); } -unsigned int ByteQueue::Walker::Peek(byte &outByte) const +uint32_t ByteQueue::Walker::Peek(byte &outByte) const { ArraySink sink(&outByte, 1); return CopyTo(sink, 1); } -unsigned int ByteQueue::Walker::Peek(byte *outString, unsigned int peekMax) const +uint32_t ByteQueue::Walker::Peek(byte *outString, uint32_t peekMax) const { ArraySink sink(outString, peekMax); return CopyTo(sink, peekMax); } -unsigned long ByteQueue::Walker::TransferTo(BufferedTransformation &target, unsigned long transferMax) +uint32_t ByteQueue::Walker::TransferTo(BufferedTransformation &target, uint32_t transferMax) { - unsigned long bytesLeft = transferMax; + uint32_t bytesLeft = transferMax; while (m_node) { - unsigned int len = STDMIN(bytesLeft, (unsigned long)m_node->CurrentSize() - m_offset); + uint32_t len = STDMIN(bytesLeft, (uint32_t)m_node->CurrentSize() - m_offset); target.Put(m_node->buf + m_node->m_head + m_offset, len); m_position += len; bytesLeft -= len; @@ -476,7 +476,7 @@ unsigned long ByteQueue::Walker::TransferTo(BufferedTransformation &target, unsi m_offset = 0; } - unsigned int len = (unsigned int)STDMIN(bytesLeft, (unsigned long)m_lazyLength); + uint32_t len = (uint32_t)STDMIN(bytesLeft, (uint32_t)m_lazyLength); if (len) { target.Put(m_lazyString, len); @@ -487,12 +487,12 @@ unsigned long ByteQueue::Walker::TransferTo(BufferedTransformation &target, unsi return transferMax - bytesLeft; } -unsigned long ByteQueue::Walker::Skip(unsigned long skipMax) +uint32_t ByteQueue::Walker::Skip(uint32_t skipMax) { return TransferTo(g_bitBucket, skipMax); } -unsigned long ByteQueue::Walker::CopyTo(BufferedTransformation &target, unsigned long copyMax) const +uint32_t ByteQueue::Walker::CopyTo(BufferedTransformation &target, uint32_t copyMax) const { return Walker(*this).TransferTo(target, copyMax); } diff --git a/external/ours/library/crypto/src/shared/original/queue.h b/external/ours/library/crypto/src/shared/original/queue.h index 76cf58d7..34d22252 100755 --- a/external/ours/library/crypto/src/shared/original/queue.h +++ b/external/ours/library/crypto/src/shared/original/queue.h @@ -6,6 +6,8 @@ #include "cryptlib.h" #include +#define ULONG_SIZE sizeof(uint32_t) + NAMESPACE_BEGIN(CryptoPP) /** The queue is implemented as a linked list of arrays, but you don't need to @@ -16,48 +18,48 @@ class ByteQueueNode; class ByteQueue : public BufferedTransformation { public: - ByteQueue(unsigned int m_nodeSize=256); + ByteQueue(uint32_t m_nodeSize=256); ByteQueue(const ByteQueue ©); ~ByteQueue(); - unsigned long MaxRetrievable() const + uint32_t MaxRetrievable() const {return CurrentSize();} bool AnyRetrievable() const {return !IsEmpty();} void Put(byte inByte); - void Put(const byte *inString, unsigned int length); + void Put(const byte *inString, uint32_t length); - unsigned int Get(byte &outByte); - unsigned int Get(byte *outString, unsigned int getMax); + uint32_t Get(byte &outByte); + uint32_t Get(byte *outString, uint32_t getMax); - unsigned int Peek(byte &outByte) const; - unsigned int Peek(byte *outString, unsigned int peekMax) const; + uint32_t Peek(byte &outByte) const; + uint32_t Peek(byte *outString, uint32_t peekMax) const; - unsigned long Skip(unsigned long skipMax=ULONG_MAX); - unsigned long TransferTo(BufferedTransformation &target, unsigned long transferMax=ULONG_MAX); - unsigned long CopyTo(BufferedTransformation &target, unsigned long copyMax=ULONG_MAX) const; + uint32_t Skip(uint32_t skipMax=ULONG_SIZE); + uint32_t TransferTo(BufferedTransformation &target, uint32_t transferMax=ULONG_SIZE); + uint32_t CopyTo(BufferedTransformation &target, uint32_t copyMax=ULONG_SIZE) const; // these member functions are not inherited - unsigned long CurrentSize() const; + uint32_t CurrentSize() const; bool IsEmpty() const; void Clear(); void Unget(byte inByte); - void Unget(const byte *inString, unsigned int length); + void Unget(const byte *inString, uint32_t length); - const byte * Spy(unsigned int &contiguousSize) const; + const byte * Spy(uint32_t &contiguousSize) const; - byte * MakeNewSpace(unsigned int &contiguousSize); - void OccupyNewSpace(unsigned int size); + byte * MakeNewSpace(uint32_t &contiguousSize); + void OccupyNewSpace(uint32_t size); - void LazyPut(const byte *inString, unsigned int size); + void LazyPut(const byte *inString, uint32_t size); void FinalizeLazyPut(); ByteQueue & operator=(const ByteQueue &rhs); bool operator==(const ByteQueue &rhs) const; - byte operator[](unsigned long i) const; + byte operator[](uint32_t i) const; void swap(ByteQueue &rhs); class Walker : public BufferedTransformation @@ -67,28 +69,28 @@ public: : m_queue(queue), m_node(queue.m_head), m_position(0), m_offset(0) , m_lazyString(queue.m_lazyString), m_lazyLength(queue.m_lazyLength) {} - unsigned long MaxRetrievable() const + uint32_t MaxRetrievable() const {return m_queue.CurrentSize() - m_position;} void Put(byte inByte) {} - void Put(const byte *inString, unsigned int length) {} + void Put(const byte *inString, uint32_t length) {} - unsigned int Get(byte &outByte); - unsigned int Get(byte *outString, unsigned int getMax); + uint32_t Get(byte &outByte); + uint32_t Get(byte *outString, uint32_t getMax); - unsigned int Peek(byte &outByte) const; - unsigned int Peek(byte *outString, unsigned int peekMax) const; + uint32_t Peek(byte &outByte) const; + uint32_t Peek(byte *outString, uint32_t peekMax) const; - unsigned long Skip(unsigned long skipMax=ULONG_MAX); - unsigned long TransferTo(BufferedTransformation &target, unsigned long transferMax=ULONG_MAX); - unsigned long CopyTo(BufferedTransformation &target, unsigned long copyMax=ULONG_MAX) const; + uint32_t Skip(uint32_t skipMax=ULONG_SIZE); + uint32_t TransferTo(BufferedTransformation &target, uint32_t transferMax=ULONG_SIZE); + uint32_t CopyTo(BufferedTransformation &target, uint32_t copyMax=ULONG_SIZE) const; private: const ByteQueue &m_queue; const ByteQueueNode *m_node; - unsigned int m_position, m_offset; + uint32_t m_position, m_offset; const byte *m_lazyString; - unsigned int m_lazyLength; + uint32_t m_lazyLength; }; friend class Walker; @@ -98,17 +100,17 @@ private: void CopyFrom(const ByteQueue ©); void Destroy(); - unsigned int m_nodeSize; + uint32_t m_nodeSize; ByteQueueNode *m_head, *m_tail; const byte *m_lazyString; - unsigned int m_lazyLength; + uint32_t m_lazyLength; }; //! use this to make sure LazyPut is finalized in event of exception class LazyPutter { public: - LazyPutter(ByteQueue &bq, const byte *inString, unsigned int size) + LazyPutter(ByteQueue &bq, const byte *inString, uint32_t size) : m_bq(bq) {bq.LazyPut(inString, size);} ~LazyPutter() {try {m_bq.FinalizeLazyPut();} catch(...) {}} diff --git a/external/ours/library/crypto/src/shared/original/smartptr.h b/external/ours/library/crypto/src/shared/original/smartptr.h index f5c0b41b..ca81ff34 100755 --- a/external/ours/library/crypto/src/shared/original/smartptr.h +++ b/external/ours/library/crypto/src/shared/original/smartptr.h @@ -147,21 +147,21 @@ template counted_ptr & counted_ptr::operator=(const counted_ptr< template class vector_member_ptrs { public: - vector_member_ptrs(unsigned int size=0) + vector_member_ptrs(uint32_t size=0) : _size(size) {ptr = new member_ptr[_size];} ~vector_member_ptrs() {delete [] ptr;} - member_ptr& operator[](unsigned int index) + member_ptr& operator[](uint32_t index) {assert(index<_size); return ptr[index];} - const member_ptr& operator[](unsigned int index) const + const member_ptr& operator[](uint32_t index) const {assert(index<_size); return ptr[index];} - unsigned int size() const {return _size;} - void resize(unsigned int newSize) + uint32_t size() const {return _size;} + void resize(uint32_t newSize) { member_ptr *newPtr = new member_ptr[newSize]; - for (unsigned int i=0; i &c); // copy not allowed void operator=(const vector_member_ptrs &x); // assignment not allowed - unsigned int _size; + uint32_t _size; member_ptr *ptr; }; diff --git a/external/ours/library/crypto/src/shared/original/twofish.cpp b/external/ours/library/crypto/src/shared/original/twofish.cpp index 55ba2c49..56e9b572 100755 --- a/external/ours/library/crypto/src/shared/original/twofish.cpp +++ b/external/ours/library/crypto/src/shared/original/twofish.cpp @@ -8,11 +8,11 @@ NAMESPACE_BEGIN(CryptoPP) // compute (c * x^4) mod (x^4 + (a + 1/a) * x^3 + a * x^2 + (a + 1/a) * x + 1) // over GF(256) -static inline unsigned int Mod(unsigned int c) +static inline uint32_t Mod(uint32_t c) { - static const unsigned int modulus = 0x14d; - unsigned int c2 = (c<<1) ^ ((c & 0x80) ? modulus : 0); - unsigned int c1 = c2 ^ (c>>1) ^ ((c & 1) ? (modulus>>1) : 0); + static const uint32_t modulus = 0x14d; + uint32_t c2 = (c<<1) ^ ((c & 0x80) ? modulus : 0); + uint32_t c1 = c2 ^ (c>>1) ^ ((c & 1) ? (modulus>>1) : 0); return c | (c1 << 8) | (c2 << 16) | (c1 << 24); } @@ -20,7 +20,7 @@ static inline unsigned int Mod(unsigned int c) // this is equivalent to multiplying by the RS matrix static word32 ReedSolomon(word32 high, word32 low) { - for (unsigned int i=0; i<8; i++) + for (uint32_t i=0; i<8; i++) { high = Mod(high>>24) ^ (high<<8) ^ (low>>24); low <<= 8; @@ -28,7 +28,7 @@ static word32 ReedSolomon(word32 high, word32 low) return high; } -inline word32 Twofish::h0(word32 x, const word32 *key, unsigned int kLen) +inline word32 Twofish::h0(word32 x, const word32 *key, uint32_t kLen) { x = x | (x<<8) | (x<<16) | (x<<24); switch(kLen) @@ -42,22 +42,22 @@ inline word32 Twofish::h0(word32 x, const word32 *key, unsigned int kLen) return x; } -inline word32 Twofish::h(word32 x, const word32 *key, unsigned int kLen) +inline word32 Twofish::h(word32 x, const word32 *key, uint32_t kLen) { x = h0(x, key, kLen); return mds[0][GETBYTE(x,0)] ^ mds[1][GETBYTE(x,1)] ^ mds[2][GETBYTE(x,2)] ^ mds[3][GETBYTE(x,3)]; } -Twofish::Twofish(const byte *userKey, unsigned int keylength) +Twofish::Twofish(const byte *userKey, uint32_t keylength) : m_k(40), m_s(4) { assert(keylength == KeyLength(keylength)); - unsigned int len = (keylength <= 16 ? 2 : (keylength <= 24 ? 3 : 4)); + uint32_t len = (keylength <= 16 ? 2 : (keylength <= 24 ? 3 : 4)); SecBlock key(len*2); GetUserKeyLittleEndian(key.ptr, len*2, userKey, keylength); - unsigned int i; + uint32_t i; for (i=0; i<40; i+=2) { word32 a = h(i, key, len); diff --git a/external/ours/library/crypto/src/shared/original/twofish.h b/external/ours/library/crypto/src/shared/original/twofish.h index bc7a84f4..4b2d81fa 100755 --- a/external/ours/library/crypto/src/shared/original/twofish.h +++ b/external/ours/library/crypto/src/shared/original/twofish.h @@ -13,9 +13,9 @@ NAMESPACE_BEGIN(CryptoPP) class Twofish : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32> { protected: - Twofish(const byte *userKey, unsigned int keylength); - static word32 h0(word32 x, const word32 *key, unsigned int kLen); - static word32 h(word32 x, const word32 *key, unsigned int kLen); + Twofish(const byte *userKey, uint32_t keylength); + static word32 h0(word32 x, const word32 *key, uint32_t kLen); + static word32 h(word32 x, const word32 *key, uint32_t kLen); static const byte q[2][256]; static const word32 mds[4][256]; @@ -28,7 +28,7 @@ protected: class TwofishEncryption : public Twofish { public: - TwofishEncryption(const byte *userKey, unsigned int keylength=DEFAULT_KEYLENGTH) + TwofishEncryption(const byte *userKey, uint32_t keylength=DEFAULT_KEYLENGTH) : Twofish(userKey, keylength) {} void ProcessBlock(const byte *inBlock, byte * outBlock) const; @@ -40,7 +40,7 @@ public: class TwofishDecryption : public Twofish { public: - TwofishDecryption(const byte *userKey, unsigned int keylength=DEFAULT_KEYLENGTH) + TwofishDecryption(const byte *userKey, uint32_t keylength=DEFAULT_KEYLENGTH) : Twofish(userKey, keylength) {} void ProcessBlock(const byte *inBlock, byte * outBlock) const; diff --git a/external/ours/library/crypto/src/shared/original/words.h b/external/ours/library/crypto/src/shared/original/words.h index 8849b610..df055c06 100755 --- a/external/ours/library/crypto/src/shared/original/words.h +++ b/external/ours/library/crypto/src/shared/original/words.h @@ -5,55 +5,55 @@ NAMESPACE_BEGIN(CryptoPP) -inline unsigned int CountWords(const word *X, unsigned int N) +inline uint32_t CountWords(const word *X, uint32_t N) { while (N && X[N-1]==0) N--; return N; } -inline void SetWords(word *r, word a, unsigned int n) +inline void SetWords(word *r, word a, uint32_t n) { - for (unsigned int i=0; i=shiftWords; i--) + for (uint32_t i=n-1; i>=shiftWords; i--) r[i] = r[i-shiftWords]; SetWords(r, 0, shiftWords); } } -inline void ShiftWordsRightByWords(word *r, unsigned int n, unsigned int shiftWords) +inline void ShiftWordsRightByWords(word *r, uint32_t n, uint32_t shiftWords) { shiftWords = STDMIN(shiftWords, n); if (shiftWords) { - for (unsigned int i=0; i+shiftWords LocUnicodeString; + typedef std::basic_string LocUnicodeString; StringId (); StringId (const std::string & table, const std::string & text); diff --git a/external/ours/library/unicode/src/shared/Unicode.h b/external/ours/library/unicode/src/shared/Unicode.h index 0f29b589..1032451b 100755 --- a/external/ours/library/unicode/src/shared/Unicode.h +++ b/external/ours/library/unicode/src/shared/Unicode.h @@ -25,7 +25,7 @@ namespace Unicode { - typedef unsigned short unicode_char_t; + typedef uint16_t unicode_char_t; /** * Standard Unicode string is UTF-16 diff --git a/external/ours/library/unicode/src/shared/UnicodeCharacterData.h b/external/ours/library/unicode/src/shared/UnicodeCharacterData.h index 4c828ce3..9ca2c033 100755 --- a/external/ours/library/unicode/src/shared/UnicodeCharacterData.h +++ b/external/ours/library/unicode/src/shared/UnicodeCharacterData.h @@ -17,11 +17,13 @@ #pragma warning (disable:4786) #endif +#include + // ====================================================================== namespace Unicode { - typedef unsigned short unicode_char_t; //lint !e761 redundant typedef + typedef uint16_t unicode_char_t; //lint !e761 redundant typedef struct CharData; diff --git a/external/ours/library/unicode/src/shared/UnicodeUtils.h b/external/ours/library/unicode/src/shared/UnicodeUtils.h index a110eafa..dfa9ed0b 100755 --- a/external/ours/library/unicode/src/shared/UnicodeUtils.h +++ b/external/ours/library/unicode/src/shared/UnicodeUtils.h @@ -76,7 +76,7 @@ namespace Unicode bool isUnicode (const Unicode::String & theStr); unsigned int utf8Size(const Unicode::String & str); - unsigned short utf8CharSize(const Unicode::unicode_char_t value); + uint16_t utf8CharSize(const Unicode::unicode_char_t value); void truncateToUTF8Size(Unicode::String & str, unsigned int size); enum FieldAlignment @@ -350,7 +350,7 @@ namespace Unicode * Return the size of the single character represented by the * given two byte value if it were stored as UTF-8. */ - inline unsigned short utf8CharSize(const Unicode::unicode_char_t value) + inline uint16_t utf8CharSize(const Unicode::unicode_char_t value) { if (value < 0x80) return 1; diff --git a/external/ours/library/unicode/src/shared/utf8.h b/external/ours/library/unicode/src/shared/utf8.h index 64277ad2..5e5398af 100755 --- a/external/ours/library/unicode/src/shared/utf8.h +++ b/external/ours/library/unicode/src/shared/utf8.h @@ -8,7 +8,7 @@ namespace Unicode { typedef char UTF8; -typedef unsigned short int UTF16; +typedef uint16_t UTF16; int UTF8_charSize( char * ); diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp index a111e70c..c07558f6 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp @@ -571,7 +571,7 @@ bool SwgSnapshot::send(GameServerConnection *connection) const { DEBUG_FATAL(networkId != baseData->object_id.getValue(), ("Object ID and row value didn't match")); uint32 crc = baseData->object_template_id.getValue(); - CreateObjectByCrcMessage com(networkId, crc, static_cast(baseData->type_id.getValue()), true, NetworkId(baseData->contained_by.getValue())); + CreateObjectByCrcMessage com(networkId, crc, static_cast(baseData->type_id.getValue()), true, NetworkId(baseData->contained_by.getValue())); // connection->send(com,true); DEBUG_REPORT_LOG(ConfigServerDatabase::getLogObjectLoading(), ("\tSent CreateObjectMessage for object %s\n", networkId.getValueString().c_str())); diff --git a/game/server/application/SwgGameServer/src/linux/SwgGameServer.profdata b/game/server/application/SwgGameServer/src/linux/SwgGameServer.profdata index 362d29a9..5f7b883f 100644 Binary files a/game/server/application/SwgGameServer/src/linux/SwgGameServer.profdata and b/game/server/application/SwgGameServer/src/linux/SwgGameServer.profdata differ diff --git a/game/server/database/import/resources/resource_import_delta.pl b/game/server/database/import/resources/resource_import_delta.pl index e1ecfcce..0c370c8c 100755 --- a/game/server/database/import/resources/resource_import_delta.pl +++ b/game/server/database/import/resources/resource_import_delta.pl @@ -7,7 +7,7 @@ while (<>) chop; @data=split("\t"); $id=shift (@data); - $shortname=shift (@data); + $int16_tname=shift (@data); $fullname=""; $found = 0; @@ -68,7 +68,7 @@ while (<>) #### output: $classname =~ s/'/''/g; - print "insert into resource_import values ($id,$parent_id,'$shortname','$classname',$max_types,$min_types,$min_pools,$max_pools,'$resource_container_type','$random_name_class');\n"; + print "insert into resource_import values ($id,$parent_id,'$int16_tname','$classname',$max_types,$min_types,$min_pools,$max_pools,'$resource_container_type','$random_name_class');\n"; for ($i=0; $i!=11; ++$i) { diff --git a/game/server/database/item_conversion/hotfix_7.sql b/game/server/database/item_conversion/hotfix_7.sql index d048a89c..cd84e4d3 100644 --- a/game/server/database/item_conversion/hotfix_7.sql +++ b/game/server/database/item_conversion/hotfix_7.sql @@ -3015,7 +3015,7 @@ CREATE OR REPLACE PACKAGE BODY "HOTFIX_7" as --pistol_blaster_scout_trooper_corsec elsif template_id = -1929515589 then DeleteObjVar('weapon.strCertUsed'); - --pistol_blaster_short_range_combat + --pistol_blaster_int16_t_range_combat elsif template_id = 1691705957 then DeleteObjVar('weapon.strCertUsed'); --pistol_projectile_striker diff --git a/game/server/database/item_conversion/item_conversion.sql b/game/server/database/item_conversion/item_conversion.sql index 19d5ac11..87b86a38 100644 --- a/game/server/database/item_conversion/item_conversion.sql +++ b/game/server/database/item_conversion/item_conversion.sql @@ -6800,7 +6800,7 @@ CREATE OR REPLACE PACKAGE BODY "ITEM_CONVERSION" as else AddScript('systems.combat.combat_weapon'); end if; - --pistol_blaster_short_range_combat + --pistol_blaster_int16_t_range_combat elsif template_id = 1691705957 then HandleWeaponDots; ConvertMinDamage(rangeTableType(rangeType(4,124,162,310),rangeType(124,420,310,354))); diff --git a/game/server/database/item_conversion/weapon_conversion.txt b/game/server/database/item_conversion/weapon_conversion.txt index 56727117..ae4fa753 100644 --- a/game/server/database/item_conversion/weapon_conversion.txt +++ b/game/server/database/item_conversion/weapon_conversion.txt @@ -99,7 +99,7 @@ template_id crafted_object_template min_damage_from min_damage_to max_damage_fro 322519616 pistol_scatter "[83:173,173:251]" "[228:434,434:496]" "[104:290,290:647]" "[681:866,866:990]" "[.01:.98,.98:3.03]" "[1.8:2,2:2.5]" "[21:48,48:68]" "[5:27,27:32.4]" 84 0 0 35 1 207 413 619 825 2 2.5 5 27 0 0 75 120 kinetic 129228399 pistol_blaster_scout_trooper "[25:98,98:290]" "[46:87,87:100]" "[59:206,206:869]" "[136:173,173:198]" "[.54:.79,.79:3.78]" "[1.8:2,2:2.5]" "[4:25,25:55]" "[1:9,9:10.8]" 84 0 0 35 2 42 83 124 165 2 2.5 1 9 0 0 75 120 energy -1929515589 pistol_blaster_scout_trooper_corsec "[22:28,28:51]" "[46:87,87:100]" "[55:70,70:129]" "[136:173,173:198]" "[2.34:3.14,3.14:3.68]" "[1.8:2,2:2.5]" "[4:5,5:9]" "[1:11,11:13.2]" 84 0 0 35 2 42 83 124 165 2 2.5 1 11 0 0 75 120 energy -1691705957 pistol_blaster_short_range_combat "[4:124,124:420]" "[162:310,310:354]" "[63:213,213:659]" "[487:620,620:708]" "[1:2.28,2.28:4.12]" "[1.8:2,2:2.5]" "[7:29,29:59]" "[1:17,17:20.4]" 84 0 0 25 2 64 27 147 295 443 590 2 2.5 1 17 0 0 75 120 energy cold 15 30 +1691705957 pistol_blaster_int16_t_range_combat "[4:124,124:420]" "[162:310,310:354]" "[63:213,213:659]" "[487:620,620:708]" "[1:2.28,2.28:4.12]" "[1.8:2,2:2.5]" "[7:29,29:59]" "[1:17,17:20.4]" 84 0 0 25 2 64 27 147 295 443 590 2 2.5 1 17 0 0 75 120 energy cold 15 30 -1919723538 pistol_projectile_striker "[6:124,124:440]" "[85:163,163:186]" "[31:187,187:450]" "[256:326,326:372]" "[1:1.31,1.31:4.24]" "[1.8:2,2:2.5]" "[4:29,29:53]" "[1:13,13:15.6]" 84 0 0 35 1 77 155 233 310 2 2.5 1 13 0 0 75 120 kinetic -937385248 rifle_tanlge_gun7 "[49:85,85:107]" "[178:339,339:388]" "[90:153,153:242]" "[532:677,677:774]" "[1.28:2.26,2.26:3.54]" "[2.25:2.5,2.5:3]" "[3:4,4:6]" "[2:4,4:4.8]" 104 0 0 35 1 162 323 484 645 2.5 3 2 4 0 0 95 140 kinetic 685231719 quest_pistol_launcher "[17:19,19:23]" "[99:189,189:216]" "[87:100,100:121]" "[297:378,378:432]" "[3.81:5.19,5.19:5.96]" "[2.48:2.75,2.75:3.25]" "[12:13,13:15]" "[4:35,35:42]" 122 0 0 45 1 32 72 "('intAOEDamagePercent',2,'0.5'):('intWeaponType',0,'1'):('skillmod.bonus.pistol_speed',0,'3')" 90 180 270 360 2.75 3.25 4 35 0 0 115 150 kinetic heat 40 80 diff --git a/swg.doxygen b/swg.doxygen index 33daf53f..1d03c8b7 100644 --- a/swg.doxygen +++ b/swg.doxygen @@ -42,7 +42,7 @@ PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. +# quick idea about the purpose of the project. Keep the description int16_t. PROJECT_BRIEF = @@ -137,7 +137,7 @@ INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used +# int16_test path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = YES @@ -163,7 +163,7 @@ STRIP_FROM_PATH = STRIP_FROM_INC_PATH = -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# If the SHORT_NAMES tag is set to YES, doxygen will generate much int16_ter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO.