From 266ac3ec3ae285e550f31efabd37c7d1bebfd51b Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 01:07:49 -0500 Subject: [PATCH 01/19] this should theoretically fix an order of operations issue that clang detected - ? has lower precedence than + so + is eval'ed first --- external/3rd/library/udplibrary/hashtable.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/3rd/library/udplibrary/hashtable.hpp b/external/3rd/library/udplibrary/hashtable.hpp index 8d9e80b7..5a6d55aa 100644 --- a/external/3rd/library/udplibrary/hashtable.hpp +++ b/external/3rd/library/udplibrary/hashtable.hpp @@ -148,7 +148,7 @@ inline int UpperHashString(char *string) int h = 0; while (*string != 0) { - h = ((31 * h) + (*string >= 'a' && *string <= 'z') ? (*string - 0x20) : *string) ^ (h >> 26); + h = ((31 * h) + ((*string >= 'a' && *string <= 'z') ? (*string - 0x20) : *string) ^ (h >> 26)); string++; } return(h); From a2da3759be4277caab72997246729cf43b5369fd Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 01:08:19 -0500 Subject: [PATCH 02/19] more order of operations fixes --- .../CTServiceGameAPI/CTCommon/CTServiceCharacter.h | 7 +++++-- .../CTServiceGameAPI/CTCommon/CTServiceServer.h | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCharacter.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCharacter.h index c9582d98..b880941a 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCharacter.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCharacter.h @@ -18,9 +18,12 @@ class CTServiceCharacter target[0] = 0; return; } + int offset = 0; - while (offset < length && (target[offset++] = source[offset])); - target[length-1] = 0; + while (offset < length && (target[(offset+1)] = source[offset])) { + target[length-1] = 0; + offset++; + } } public: enum { CHARACTER_SIZE=64, CHARACTER_BUFFER, REASON_SIZE=4096, REASON_BUFFER }; diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceServer.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceServer.h index 7d76ddff..5cef4bde 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceServer.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceServer.h @@ -17,9 +17,12 @@ class CTServiceServer target[0] = 0; return; } + int offset = 0; - while (offset < length && (target[offset++] = source[offset])); - target[length-1] = 0; + while (offset < length && (target[(offset+1)] = source[offset])) { + target[length-1] = 0; + offset++; + } } public: enum { SERVER_SIZE=64, SERVER_BUFFER, REASON_SIZE=4096, REASON_BUFFER }; From 9511fdbdb6bf2da911976972f37e44329adc9bbe Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 09:45:07 -0500 Subject: [PATCH 03/19] md5: bitwise operations - add () to silence warns and improve style --- external/3rd/library/platform/utils/Base/MD5.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/external/3rd/library/platform/utils/Base/MD5.cpp b/external/3rd/library/platform/utils/Base/MD5.cpp index a988f46b..7fa9f806 100644 --- a/external/3rd/library/platform/utils/Base/MD5.cpp +++ b/external/3rd/library/platform/utils/Base/MD5.cpp @@ -59,7 +59,7 @@ namespace Base int k = l = 0; for(; l < i; l += 4) { - ai[k] = achar0[l + j] & 0xff | (achar0[l + 1 + j] & 0xff) << 8 | (achar0[l + 2 + j] & 0xff) << 16 | (achar0[l + 3 + j] & 0xff) << 24; + ai[k] = (achar0[l + j] & 0xff) | (achar0[l + 1 + j] & 0xff) << 8 | (achar0[l + 2 + j] & 0xff) << 16 | (achar0[l + 3 + j] & 0xff) << 24; k++; } @@ -84,7 +84,7 @@ namespace Base int MD5::FF(int i, int j, int k, int l, int i1, int j1, int k1) { - i = uadd(i, j & k | ~j & l, i1, k1); + i = uadd(i, (j & k) | (~j & l), i1, k1); return uadd(rotate_left(i, j1), j); } @@ -106,7 +106,7 @@ namespace Base int MD5::GG(int i, int j, int k, int l, int i1, int j1, int k1) { - i = uadd(i, j & l | k & ~l, i1, k1); + i = uadd(i, (j & l) | (k & ~l), i1, k1); return uadd(rotate_left(i, j1), j); } @@ -128,7 +128,7 @@ namespace Base { padding.resize(64,0); padding[0] = -128; - } + } finalsNull = true; } From cf40fbc8718518fe7490eedc49deea66c9dd2869 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 09:45:58 -0500 Subject: [PATCH 04/19] add virtual destructor to slience warning; currently placeholder...not sure if it needs to actually do anything or not --- external/ours/library/fileInterface/src/shared/AbstractFile.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/external/ours/library/fileInterface/src/shared/AbstractFile.h b/external/ours/library/fileInterface/src/shared/AbstractFile.h index b2e9d9cd..0f649d1e 100644 --- a/external/ours/library/fileInterface/src/shared/AbstractFile.h +++ b/external/ours/library/fileInterface/src/shared/AbstractFile.h @@ -42,8 +42,6 @@ public: PriorityAudioVideo }; -public: - AbstractFile(PriorityType priority); virtual ~AbstractFile(); @@ -148,6 +146,7 @@ class AbstractFileFactory { public: virtual AbstractFile* createFile(const char *filename, const char *openType) = 0; + virtual ~AbstractFileFactory() {}; }; // ====================================================================== From f8d2fc114561539d4bd6c947e5656d57f4eb45d7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 09:54:21 -0500 Subject: [PATCH 05/19] missed some parenthases --- external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp index a988f46b..c6506af9 100644 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp @@ -59,7 +59,7 @@ namespace Base int k = l = 0; for(; l < i; l += 4) { - ai[k] = achar0[l + j] & 0xff | (achar0[l + 1 + j] & 0xff) << 8 | (achar0[l + 2 + j] & 0xff) << 16 | (achar0[l + 3 + j] & 0xff) << 24; + ai[k] = (achar0[l + j] & 0xff) | (achar0[l + 1 + j] & 0xff) << 8 | (achar0[l + 2 + j] & 0xff) << 16 | (achar0[l + 3 + j] & 0xff) << 24; k++; } From de6647de0215521db5e5a8314063e6f4b573076f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 10:11:59 -0500 Subject: [PATCH 06/19] more bitwise style fixes --- external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp b/external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp index c6506af9..31d75dcb 100644 --- a/external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/Base/MD5.cpp @@ -84,7 +84,7 @@ namespace Base int MD5::FF(int i, int j, int k, int l, int i1, int j1, int k1) { - i = uadd(i, j & k | ~j & l, i1, k1); + i = uadd(i, (j & k) | (~j & l), i1, k1); return uadd(rotate_left(i, j1), j); } @@ -106,7 +106,7 @@ namespace Base int MD5::GG(int i, int j, int k, int l, int i1, int j1, int k1) { - i = uadd(i, j & l | k & ~l, i1, k1); + i = uadd(i, (j & l) | (k & ~l), i1, k1); return uadd(rotate_left(i, j1), j); } From e4dce766206915585685ac28bc6e61068a9eda47 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 10:12:06 -0500 Subject: [PATCH 07/19] convert unsigned int to int, as the comparison to 0 would otherwise always eval to true --- .../projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.cpp | 2 +- .../projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 894ecd8b..1ce4b5cf 100644 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.cpp @@ -125,7 +125,7 @@ CSAssistGameAPIResult CSAssistGameAPITicket::setLocation(const CSAssistUnicodeCh } //----------------------------------------------------------- -CSAssistGameAPIResult CSAssistGameAPITicket::setCategory(unsigned index, unsigned value) +CSAssistGameAPIResult CSAssistGameAPITicket::setCategory(int index, unsigned value) //----------------------------------------------------------- { if (index < 0 || index >= (short)CSASSIST_NUM_CATEGORIES) 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 e1fdeda7..b6535350 100644 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.h +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameobjects.h @@ -33,7 +33,7 @@ public: CSAssistGameAPIResult setDetails(const CSAssistUnicodeChar *string); CSAssistGameAPIResult setLanguage(const CSAssistUnicodeChar *string); CSAssistGameAPIResult setLocation(const CSAssistUnicodeChar *string); - CSAssistGameAPIResult setCategory(unsigned index, unsigned value); + CSAssistGameAPIResult setCategory(int index, unsigned value); CSAssistGameAPITicketID ticketID; // unique ID CSAssistGameAPIUID uid; // station UID From e62615f94e9837f44f9b75fe53fe369b25fefe87 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 10:52:49 -0500 Subject: [PATCH 08/19] UDP PriorityQueue : Provided this int is a number of bytes and not a number of slots, this should be more proper as the size of a pointer is always 4 bytes --- external/3rd/library/udplibrary/priority.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/3rd/library/udplibrary/priority.hpp b/external/3rd/library/udplibrary/priority.hpp index 82751efa..19f34ab3 100644 --- a/external/3rd/library/udplibrary/priority.hpp +++ b/external/3rd/library/udplibrary/priority.hpp @@ -77,7 +77,7 @@ template PriorityQueue::PriorityQueue(int queueSiz mQueueEnd = 0; mQueueSize = queueSize; mQueue = new QueueEntry[mQueueSize]; - memset(mQueue, 0, sizeof(mQueue)); + memset(mQueue, 0, mQueueSize); } template PriorityQueue::~PriorityQueue() From 6010ad6b90e4abc080d20417b41bbabbc42f265c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 11:14:36 -0500 Subject: [PATCH 09/19] increment is evaluated before assignment so this should silence the warning...not sure if correct or not though --- .../ours/library/crypto/src/shared/original/cryptlib.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/external/ours/library/crypto/src/shared/original/cryptlib.cpp b/external/ours/library/crypto/src/shared/original/cryptlib.cpp index c3c1df06..4341b5b7 100644 --- a/external/ours/library/crypto/src/shared/original/cryptlib.cpp +++ b/external/ours/library/crypto/src/shared/original/cryptlib.cpp @@ -50,8 +50,10 @@ void StreamCipher::ProcessString(byte *outString, const byte *inString, unsigned void StreamCipher::ProcessString(byte *inoutString, unsigned int length) { - while(length--) - *inoutString++ = ProcessByte(*inoutString); //TODO: order of operations issue here, per the warning + while(length--) { + *inoutString++; + *inoutString = ProcessByte(*inoutString); + } } bool HashModule::Verify(const byte *digestIn) From 2faaef7a22e89d51b9725c84380185fe1ffbd353 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 11:21:47 -0500 Subject: [PATCH 10/19] fix unused var --- .../VChatAPI/utils2.0/utils/Base/serializeTemplates.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeTemplates.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeTemplates.h index 4af421bb..c2f745ed 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeTemplates.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeTemplates.h @@ -719,9 +719,10 @@ namespace soe int ClassScribe::Print(char * stream, unsigned size, const ClassType & data, unsigned maxDepth) const { int bytesTotal = 0; - int bytes = 0; #ifdef PRINTABLE_MESSAGES + int bytes = 0; + if (maxDepth == 0) { bytes = snprintf(stream, size, "%s{mMembers(%u)}", ClassName(), mMemberScribes.size()); return bytes; From a790a1a88d0e76dc34de3b75621c10dcded43d71 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 11:35:51 -0500 Subject: [PATCH 11/19] experimental - fixes cryptlib order of operations warn --- external/ours/library/crypto/src/shared/original/cryptlib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ours/library/crypto/src/shared/original/cryptlib.cpp b/external/ours/library/crypto/src/shared/original/cryptlib.cpp index 4341b5b7..86e2d4d3 100644 --- a/external/ours/library/crypto/src/shared/original/cryptlib.cpp +++ b/external/ours/library/crypto/src/shared/original/cryptlib.cpp @@ -51,7 +51,7 @@ void StreamCipher::ProcessString(byte *outString, const byte *inString, unsigned void StreamCipher::ProcessString(byte *inoutString, unsigned int length) { while(length--) { - *inoutString++; + (*inoutString)++; *inoutString = ProcessByte(*inoutString); } } From 2a2b6dd4b7e8a53275e1509cb95437d76b8e9fdd Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 11:36:05 -0500 Subject: [PATCH 12/19] more sequence/order of operations stuff --- .../CTServiceGameAPI/CTCommon/CTServiceCustomer.h | 8 ++++++-- .../CTServiceGameAPI/CTCommon/CTServiceDBOrder.h | 7 +++++-- .../CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h | 7 +++++-- .../CTCommon/CTServiceWebAPITransaction.h | 7 +++++-- .../soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h | 2 +- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCustomer.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCustomer.h index e8a580d0..cf5d2f27 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCustomer.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceCustomer.h @@ -19,10 +19,14 @@ class CTServiceCustomer target[0] = 0; return; } + int offset = 0; - while (offset < length && (target[offset++] = source[offset])); - target[length-1] = 0; + while (offset < length && (target[(offset+1)] = source[offset])){ + target[length-1] = 0; + offset++; + } } + public: enum { SHORT_NAME_SIZE=64, SHORT_NAME_BUFFER, PHONE_SIZE=32, PHONE_BUFFER, diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBOrder.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBOrder.h index c10f6890..cbd79ad8 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBOrder.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBOrder.h @@ -22,9 +22,12 @@ class CTServiceDBOrder target[0] = 0; return; } + int offset = 0; - while (offset < length && (target[offset++] = source[offset])); - target[length-1] = 0; + while (offset < length && (target[(offset+1)] = source[offset])){ + target[length-1] = 0; + offset++; + } } public: diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h index 21dace6c..b96efe7f 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceDBTransaction.h @@ -21,9 +21,12 @@ class CTServiceTransaction target[0] = 0; return; } + int offset = 0; - while (offset < length && (target[offset++] = source[offset])); - target[length-1] = 0; + while (offset < length && (target[(offset+1)] = source[offset])){ + target[length-1] = 0; + offset++; + } } public: diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceWebAPITransaction.h b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceWebAPITransaction.h index b51fe366..47005521 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceWebAPITransaction.h +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTCommon/CTServiceWebAPITransaction.h @@ -21,9 +21,12 @@ class CTServiceWebAPITransaction target[0] = 0; return; } + int offset = 0; - while (offset < length && (target[offset++] = source[offset])); - target[length-1] = 0; + while (offset < length && (target[(offset+1)] = source[offset])) { + target[length-1] = 0; + offset++; + } } typedef unsigned short uchar_t; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h index ba9f1748..c10b3533 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpHashTable.h @@ -614,7 +614,7 @@ inline int UpperHashString(const char *string) int h = 0; while (*string != 0) { - h = ((31 * h) + (*string >= 'a' && *string <= 'z') ? (*string - 0x20) : *string) ^ (h >> 26); + h = ((31 * h) + ((*string >= 'a' && *string <= 'z') ? (*string - 0x20) : *string)) ^ (h >> 26); string++; } return(h); From e8c36ac70e8895e5aaf7ef8aca9f3b9e3aca22d7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 12:01:16 -0500 Subject: [PATCH 13/19] more fixes --- .../library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp | 2 -- external/3rd/library/udplibrary/hashtable.hpp | 2 +- external/ours/library/crypto/src/shared/original/filters.cpp | 2 +- .../unicodeArchive/src/shared/UnicodeAutoDeltaPackedMap.cpp | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp index 2f5f47b4..2b7265bc 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp @@ -46,8 +46,6 @@ ClockStamp Clock::getCurTime() return ret; #else struct timeval tv; - int err; - err = gettimeofday(&tv, NULL); return (static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000)); #endif } diff --git a/external/3rd/library/udplibrary/hashtable.hpp b/external/3rd/library/udplibrary/hashtable.hpp index 5a6d55aa..8c7340bc 100644 --- a/external/3rd/library/udplibrary/hashtable.hpp +++ b/external/3rd/library/udplibrary/hashtable.hpp @@ -148,7 +148,7 @@ inline int UpperHashString(char *string) int h = 0; while (*string != 0) { - h = ((31 * h) + ((*string >= 'a' && *string <= 'z') ? (*string - 0x20) : *string) ^ (h >> 26)); + h = ((31 * h) + (((*string >= 'a' && *string <= 'z') ? (*string - 0x20) : *string) ^ (h >> 26))); string++; } return(h); diff --git a/external/ours/library/crypto/src/shared/original/filters.cpp b/external/ours/library/crypto/src/shared/original/filters.cpp index ea32f50b..7caaf21d 100644 --- a/external/ours/library/crypto/src/shared/original/filters.cpp +++ b/external/ours/library/crypto/src/shared/original/filters.cpp @@ -82,7 +82,7 @@ unsigned int FilterWithBufferedInput::BlockQueue::GetAll(byte *outString) void FilterWithBufferedInput::BlockQueue::Put(const byte *inString, unsigned int length) { assert(m_size + length <= m_buffer.size); - byte *end = (m_size < m_buffer+m_buffer.size-m_begin) ? m_begin + m_size : m_begin + m_size - 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)); memcpy(end, inString, len); if (len < length) diff --git a/external/ours/library/unicodeArchive/src/shared/UnicodeAutoDeltaPackedMap.cpp b/external/ours/library/unicodeArchive/src/shared/UnicodeAutoDeltaPackedMap.cpp index 2f3f26ac..8138fdbb 100644 --- a/external/ours/library/unicodeArchive/src/shared/UnicodeAutoDeltaPackedMap.cpp +++ b/external/ours/library/unicodeArchive/src/shared/UnicodeAutoDeltaPackedMap.cpp @@ -19,7 +19,6 @@ namespace Archive template <> void AutoDeltaPackedMap::pack(ByteStream & target, const std::string & buffer) { char temp[200]; - char valueBuffer[200]; Command c; Archive::put(target, countCharacter(buffer,':')); @@ -31,7 +30,6 @@ namespace Archive if (*i==':') { temp[tempPos]='\0'; - valueBuffer[0]='\0'; sscanf(temp,"%i",&c.key); char const * const valueStart = strchr(temp,' '); if (valueStart) From efc4117900b2cb5922d238f53dd37f74d7c2f9ab Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 15:43:38 -0500 Subject: [PATCH 14/19] the server runs properly with this so I'll just hope it's more correct, per the warn --- .../soePlatform/VChatAPI/utils2.0/utils/Base/Base64.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.cpp index 3aba1fb2..40d5c384 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.cpp @@ -315,7 +315,7 @@ namespace soe UUEncodeTripleToQuadPtr(source + z,quad,(z + 3 < sourceLen) ? 3 : (sourceLen - z)); destLen -= strlen(quad); if (destLen > 0) { - dest += snprintf(dest, sizeof(dest), quad); + dest += snprintf(dest, sourceLen, quad); } else { noErrors = false; } @@ -355,7 +355,7 @@ namespace soe { UUEncodeTripleToQuadRef(source.begin() + z,quad,(z + 3 < sourceLen) ? 3 : (sourceLen - z)); if (destLen > 0) { - dest += snprintf(dest, sizeof(dest), quad); + dest += snprintf(dest, sourceLen, quad); } else { noErrors = false; } @@ -389,7 +389,7 @@ namespace soe for (; sourceLen > 0; sourceLen--, source++) { if (destLen >= 2) { - destLen -= snprintf(dest, sizeof(dest), format, *source); + destLen -= snprintf(dest, sourceLen, format, *source); } else { noErrors = false; } From 25b0b97bf01088cf26d8d9b5536ccd6c02e89994 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 16:11:19 -0500 Subject: [PATCH 15/19] more warns --- .../sharedDebug/src/shared/RemoteDebug.cpp | 4 +- .../ChatAPI/projects/ChatAPI/Response.cpp | 124 +++++++++--------- .../VChatAPI/utils2.0/utils/Base/MD5.cpp | 6 +- 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp index 84163deb..45294809 100644 --- a/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp +++ b/engine/shared/library/sharedDebug/src/shared/RemoteDebug.cpp @@ -674,7 +674,7 @@ void RemoteDebug::send(MESSAGE_TYPE type, const char* theName) if (explicitMessageLength != 0) messageLength = explicitMessageLength; - else if (ms_varArgs_buffer) + else if (strlen(ms_varArgs_buffer) > 0) { //only grab buffer sizes if needed messageLength = strlen(ms_varArgs_buffer)+1; @@ -688,7 +688,7 @@ void RemoteDebug::send(MESSAGE_TYPE type, const char* theName) uint32 packetLength = static_cast(messageTypeLength + channelNumberLength + messageLengthLength + static_cast(messageLength)); - if (ms_varArgs_buffer) + if (strlen(ms_varArgs_buffer) > 0) { //copy data into the packet memcpy(ms_buffer, &messageType, static_cast(messageTypeLength)); diff --git a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp index 7e88557a..25d587fc 100644 --- a/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/projects/ChatAPI/Response.cpp @@ -28,7 +28,7 @@ ResLoginAvatar::ResLoginAvatar(void *user, int avatarLoginPriority) void ResLoginAvatar::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + Plat_Unicode::String email; unsigned inboxLimit = 0; @@ -69,7 +69,7 @@ ResTemporaryAvatar::ResTemporaryAvatar(void *user) void ResTemporaryAvatar::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -88,7 +88,7 @@ ResLogoutAvatar::ResLogoutAvatar(void *user, unsigned avatarID) void ResLogoutAvatar::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -102,7 +102,7 @@ ResDestroyAvatar::ResDestroyAvatar(void *user, unsigned avatarID) void ResDestroyAvatar::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -116,7 +116,7 @@ ResGetAvatar::ResGetAvatar(void *user) void ResGetAvatar::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -150,7 +150,7 @@ ResGetAnyAvatar::ResGetAnyAvatar(void* user) void ResGetAnyAvatar::unpack(Base::ByteStream::ReadIterator& iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -194,7 +194,7 @@ ResAvatarList::~ResAvatarList() void ResAvatarList::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -220,7 +220,7 @@ ResSetAvatarAttributes::ResSetAvatarAttributes(void *user) void ResSetAvatarAttributes::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -254,7 +254,7 @@ m_avatar(NULL) void ResSetAvatarStatusMessage::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -291,7 +291,7 @@ ResSetAvatarForwardingEmail::ResSetAvatarForwardingEmail(void *user) void ResSetAvatarForwardingEmail::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -318,7 +318,7 @@ ResSetAvatarInboxLimit::ResSetAvatarInboxLimit(void *user) void ResSetAvatarInboxLimit::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -346,7 +346,7 @@ ResSearchAvatarKeywords::ResSearchAvatarKeywords(void *user) void ResSearchAvatarKeywords::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -379,7 +379,7 @@ ResSetAvatarKeywords::ResSetAvatarKeywords(void *user, unsigned avatarID) void ResSetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -401,7 +401,7 @@ ResGetAvatarKeywords::~ResGetAvatarKeywords() void ResGetAvatarKeywords::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -427,7 +427,7 @@ ResGetRoom::ResGetRoom(void *user) void ResGetRoom::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -455,7 +455,7 @@ ResCreateRoom::ResCreateRoom(void *user, unsigned avatarID) void ResCreateRoom::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -481,7 +481,7 @@ ResDestroyRoom::ResDestroyRoom(void *user, unsigned avatarID) void ResDestroyRoom::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -498,7 +498,7 @@ ResSendInstantMessage::ResSendInstantMessage(void *user, unsigned avatarID, cons void ResSendInstantMessage::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -513,7 +513,7 @@ ResSendRoomMessage::ResSendRoomMessage(void *user, unsigned avatarID) void ResSendRoomMessage::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -529,7 +529,7 @@ ResSendBroadcastMessage::ResSendBroadcastMessage(void *user, unsigned avatarID, void ResSendBroadcastMessage::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -543,7 +543,7 @@ ResFilterMessage::ResFilterMessage(void *user, unsigned version) void ResFilterMessage::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -561,7 +561,7 @@ ResAddFriend::ResAddFriend(void *user, unsigned avatarID, const ChatUnicodeStrin void ResAddFriend::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -578,7 +578,7 @@ m_comment(comment.string_data, comment.string_length) void ResAddFriendReciprocate::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -596,7 +596,7 @@ ResSetFriendComment::ResSetFriendComment(void *user, unsigned avatarID, const Ch void ResSetFriendComment::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -612,7 +612,7 @@ ResRemoveFriend::ResRemoveFriend(void *user, unsigned avatarID, const ChatUnicod void ResRemoveFriend::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -627,7 +627,7 @@ m_address(address.string_data, address.string_length) void ResRemoveFriendReciprocate::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -650,7 +650,7 @@ ResFriendStatus::~ResFriendStatus() void ResFriendStatus::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -678,7 +678,7 @@ ResAddIgnore::ResAddIgnore(void *user, unsigned avatarID, const ChatUnicodeStrin void ResAddIgnore::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -694,7 +694,7 @@ ResRemoveIgnore::ResRemoveIgnore(void *user, unsigned avatarID, const ChatUnicod void ResRemoveIgnore::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -717,7 +717,7 @@ ResIgnoreStatus::~ResIgnoreStatus() void ResIgnoreStatus::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -747,7 +747,7 @@ ResEnterRoom::ResEnterRoom(void *user, unsigned avatarID, const ChatUnicodeStrin void ResEnterRoom::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -778,7 +778,7 @@ ResAllowRoomEntry::ResAllowRoomEntry(void *user, unsigned srcAvatarID, const Cha void ResAllowRoomEntry::unpack(Base::ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -794,7 +794,7 @@ ResLeaveRoom::ResLeaveRoom(void *user, unsigned avatarID, const ChatUnicodeStrin void ResLeaveRoom::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -810,7 +810,7 @@ ResAddModerator::ResAddModerator(void *user, unsigned srcAvatarID) void ResAddModerator::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -826,7 +826,7 @@ ResRemoveModerator::ResRemoveModerator(void *user, unsigned srcAvatarID) void ResRemoveModerator::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -842,7 +842,7 @@ ResAddTemporaryModerator::ResAddTemporaryModerator(void *user, unsigned srcAvata void ResAddTemporaryModerator::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -858,7 +858,7 @@ ResRemoveTemporaryModerator::ResRemoveTemporaryModerator(void *user, unsigned sr void ResRemoveTemporaryModerator::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -874,7 +874,7 @@ ResAddBan::ResAddBan(void *user, unsigned srcAvatarID) void ResAddBan::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -890,7 +890,7 @@ ResRemoveBan::ResRemoveBan(void *user, unsigned srcAvatarID) void ResRemoveBan::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -906,7 +906,7 @@ ResAddInvite::ResAddInvite(void *user, unsigned srcAvatarID) void ResAddInvite::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -922,7 +922,7 @@ ResRemoveInvite::ResRemoveInvite(void *user, unsigned srcAvatarID) void ResRemoveInvite::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -938,7 +938,7 @@ ResGrantVoice::ResGrantVoice(void *user, unsigned srcAvatarID) void ResGrantVoice::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -954,7 +954,7 @@ ResRevokeVoice::ResRevokeVoice(void *user, unsigned srcAvatarID) void ResRevokeVoice::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -970,7 +970,7 @@ ResKickAvatar::ResKickAvatar(void *user, unsigned srcAvatarID) void ResKickAvatar::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -986,7 +986,7 @@ ResSetRoomParams::ResSetRoomParams(void *user, unsigned srcAvatarID) void ResSetRoomParams::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1002,7 +1002,7 @@ ResChangeRoomOwner::ResChangeRoomOwner(void *user, unsigned srcAvatarID) void ResChangeRoomOwner::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1023,7 +1023,7 @@ ResGetRoomSummaries::~ResGetRoomSummaries() void ResGetRoomSummaries::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1062,7 +1062,7 @@ ResSendPersistentMessage::ResSendPersistentMessage(void *user, unsigned srcAvata void ResSendPersistentMessage::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1082,7 +1082,7 @@ ResSendMultiplePersistentMessages::ResSendMultiplePersistentMessages(void *user, void ResSendMultiplePersistentMessages::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + unsigned resultIndex; get(iter, m_type); @@ -1122,7 +1122,7 @@ ResAlterPersistentMessage::~ResAlterPersistentMessage() void ResAlterPersistentMessage::unpack(Base::ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1144,7 +1144,7 @@ ResGetPersistentMessage::~ResGetPersistentMessage() } void ResGetPersistentMessage::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1193,7 +1193,7 @@ PersistentMessage ** const ResGetMultiplePersistentMessages::getList() const void ResGetMultiplePersistentMessages::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1230,7 +1230,7 @@ ResGetPersistentHeaders::~ResGetPersistentHeaders() void ResGetPersistentHeaders::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1276,7 +1276,7 @@ ResGetPartialPersistentHeaders::~ResGetPartialPersistentHeaders() void ResGetPartialPersistentHeaders::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1315,7 +1315,7 @@ ResCountPersistentMessages::ResCountPersistentMessages(void *user, const ChatUni void ResCountPersistentMessages::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1331,7 +1331,7 @@ ResUpdatePersistentMessage::ResUpdatePersistentMessage(void *user, unsigned srcA void ResUpdatePersistentMessage::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1358,7 +1358,7 @@ ResClassifyPersistentMessages::ResClassifyPersistentMessages(void *user, unsigne void ResClassifyPersistentMessages::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1374,7 +1374,7 @@ ResDeleteAllPersistentMessages::ResDeleteAllPersistentMessages(void *user, const void ResDeleteAllPersistentMessages::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1468,7 +1468,7 @@ ResGetFanClubHandle::ResGetFanClubHandle(unsigned stationID, unsigned fanClubCod void ResGetFanClubHandle::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1494,7 +1494,7 @@ ResFindAvatarByUID::~ResFindAvatarByUID() void ResFindAvatarByUID::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1518,7 +1518,7 @@ ResRegistrarGetChatServer::ResRegistrarGetChatServer() void ResRegistrarGetChatServer::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); @@ -1622,7 +1622,7 @@ ResGetSnoopList::~ResGetSnoopList() void ResGetSnoopList::unpack(ByteStream::ReadIterator &iter) { - unsigned numRead = 0; + get(iter, m_type); get(iter, m_track); get(iter, m_result); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/MD5.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/MD5.cpp index 50f3887d..54e7e9fa 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/MD5.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/MD5.cpp @@ -54,7 +54,7 @@ namespace soe int k = l = 0; for(; l < i; l += 4) { - ai[k] = achar0[l + j] & 0xff | (achar0[l + 1 + j] & 0xff) << 8 | (achar0[l + 2 + j] & 0xff) << 16 | (achar0[l + 3 + j] & 0xff) << 24; + ai[k] = (achar0[l + j] & 0xff) | (achar0[l + 1 + j] & 0xff) << 8 | (achar0[l + 2 + j] & 0xff) << 16 | (achar0[l + 3 + j] & 0xff) << 24; k++; } @@ -79,7 +79,7 @@ namespace soe int MD5::FF(int i, int j, int k, int l, int i1, int j1, int k1) { - i = uadd(i, j & k | ~j & l, i1, k1); + i = uadd(i, (j & k) | (~j & l), i1, k1); return uadd(rotate_left(i, j1), j); } @@ -101,7 +101,7 @@ namespace soe int MD5::GG(int i, int j, int k, int l, int i1, int j1, int k1) { - i = uadd(i, j & l | k & ~l, i1, k1); + i = uadd(i, (j & l) | (k & ~l), i1, k1); return uadd(rotate_left(i, j1), j); } From d74de9fdcdb9ba083cd744c8c2be7036a045fd21 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 16:51:54 -0500 Subject: [PATCH 16/19] most of the serious unused vars are removed, so i'll silence those now... and maaaaaany other fixes --- CMakeLists.txt | 4 +- .../src/shared/DatabaseProcess.cpp | 3 - .../serverScript/src/shared/JavaLibrary.cpp | 10 +- .../src/shared/ScriptMethodsObjectInfo.cpp | 97 ------------------- .../sharedFile/src/shared/FileManifest.cpp | 2 +- .../CSAssist/utils/TcpLibrary/Clock.cpp | 2 - .../CTServiceGameAPI/TcpLibrary/Clock.cpp | 3 + .../soePlatform/ChatAPI/utils/Base/MD5.cpp | 6 +- .../ChatAPI/utils/Base/ccspanutil.cpp | 1 - .../ChatAPI/utils/UdpLibrary/UdpPriority.h | 2 +- .../VChatAPI/utils2.0/utils/Base/pid.cpp | 6 -- .../VChatAPI/utils2.0/utils/Base/priority.hpp | 2 +- .../VChatAPI/utils2.0/utils/Base/utf8.cpp | 2 +- .../utils2.0/utils/TcpLibrary/Clock.cpp | 2 - 14 files changed, 13 insertions(+), 129 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e578927..deb8cef4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,9 +47,9 @@ if(WIN32) elseif(UNIX) find_package(Curses REQUIRED) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -Wall -Wno-unknown-pragmas -Wno-reorder -O0") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -Wall -O0") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -march=native -pipe -mtune=native -O2 ") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnounused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wnouninitialized -Wno-reorder -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) endif() diff --git a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp index f27df9a7..c247838b 100644 --- a/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp +++ b/engine/server/library/serverDatabase/src/shared/DatabaseProcess.cpp @@ -193,7 +193,6 @@ DatabaseProcess::~DatabaseProcess() void DatabaseProcess::run(void) { static bool shouldSleep = ConfigServerDatabase::getShouldSleep(); - unsigned long startTime; bool idle=false; int loopcount=0; float nextMemoryReportTime=0; @@ -205,8 +204,6 @@ void DatabaseProcess::run(void) { PROFILER_AUTO_BLOCK_DEFINE("main loop"); - startTime = Clock::timeMs(); - if (!Os::update()) setDone("OS condition (Parent pid change)"); diff --git a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp index f2c3ad70..2ae597df 100644 --- a/engine/server/library/serverScript/src/shared/JavaLibrary.cpp +++ b/engine/server/library/serverScript/src/shared/JavaLibrary.cpp @@ -1232,7 +1232,7 @@ void JavaLibrary::initializeJavaThread() } #ifdef JNI_VERSION_1_4 - if (!ms_javaVmType == JV_ibm) + if ((!ms_javaVmType) == JV_ibm) { tempOption.optionString = "-Xrs"; options.push_back(tempOption); @@ -1243,14 +1243,6 @@ void JavaLibrary::initializeJavaThread() { tempOption.optionString = "-Xloggc:javagc.log"; options.push_back(tempOption); -// tempOption.optionString = "-Xrunpri"; -// options.push_back(tempOption); -// tempOption.optionString = "-Xbootclasspath/a:/home/sjakab/temp/OptimizeitSuiteDemo/lib/oibcp.jar"; -// options.push_back(tempOption); -// tempOption.optionString = "-Xboundthreads"; -// options.push_back(tempOption); -// tempOption.optionString = "-Xrunhprof:heap=format=b"; -// options.push_back(tempOption); } #endif diff --git a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp index 9c4fb1da..8d03185d 100644 --- a/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp +++ b/engine/server/library/serverScript/src/shared/ScriptMethodsObjectInfo.cpp @@ -2699,58 +2699,6 @@ namespace //----------------------------------------------------------------------- - bool DebugDumpCustomVar(JNIEnv *env, LocalRefPtr customVar) - { - NOT_NULL(env); - NOT_NULL(customVar.get()); - NOT_NULL(customVar->getValue()); - - //-- get class for custom_var - const jclass customVarClass = env->FindClass("custom_var"); - - DEBUG_REPORT_LOG(!customVarClass, ("FindClass() failed for custom_var.\n")); - if (!customVarClass) - return false; - - //-- invoke "String getVarName()" method - const jmethodID getVarNameMid = env->GetMethodID(customVarClass, "getVarName", "()Ljava/lang/String;"); - - DEBUG_REPORT_LOG(!getVarNameMid , ("GetMethodId() failed for getVarName().\n")); - if (!getVarNameMid) - { - env->DeleteLocalRef(customVarClass); - return false; - } - - std::string nativeCustomVarName; - - JavaStringPtr javaCustomVarName = callStringMethod(*customVar, getVarNameMid); - JavaLibrary::convert(*javaCustomVarName, nativeCustomVarName); - - //-- invoke "int getTypeId()" method - const jmethodID getTypeIdMid = env->GetMethodID(customVarClass, "getTypeId", "()I"); - - DEBUG_REPORT_LOG(!getTypeIdMid, ("GetMethodId() failed for getTypeId().\n")); - if (!getTypeIdMid) - { - env->DeleteLocalRef(customVarClass); - return false; - } - - const int nativeCustomVarTypeId = callIntMethod(*customVar, getTypeIdMid); - - //-- cleanup - env->DeleteLocalRef(customVarClass); - - //-- print results - REPORT_LOG(true, ("<*> (customizationVariable); - if (!variable) - return; - - //-- convert context to customization variable collection - CustomizationVariableIteratorData *const iteratorData = reinterpret_cast(context); - - //-- add CustomizationVariable to the container - iteratorData->m_variableNames.push_back(fullVariablePathName); - iteratorData->m_customizationVariables.push_back(customizationVariable); - } - - // ---------------------------------------------------------------------- - - void PalcolorCustomizationVariableCollector(const std::string &fullVariablePathName, CustomizationVariable *customizationVariable, void *context) - { - //-- validate arguments - if (!customizationVariable || !context) - { - DEBUG_FATAL(true, ("programmer error: callback made with NULL arguments.\n")); - return; - } - - //-- check if this is a PaletteColorCustomizationVariable - PaletteColorCustomizationVariable *const variable = dynamic_cast(customizationVariable); - if (!variable) - return; - - //-- convert context to customization variable collection - CustomizationVariableIteratorData *const iteratorData = reinterpret_cast(context); - - //-- add CustomizationVariable to the container - iteratorData->m_variableNames.push_back(fullVariablePathName); - iteratorData->m_customizationVariables.push_back(customizationVariable); - } } // ---------------------------------------------------------------------- diff --git a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp index b1a72a8a..a9633dc1 100644 --- a/engine/shared/library/sharedFile/src/shared/FileManifest.cpp +++ b/engine/shared/library/sharedFile/src/shared/FileManifest.cpp @@ -296,7 +296,7 @@ void FileManifest::addStoredManifestEntry(const char *fileName, const char * sce entry->size = fileSize; entry->accesses = 0; - std::pair insertReturn = s_manifest.insert(std::pair(crc, entry)); + s_manifest.insert(std::pair(crc, entry)); delete entry; } diff --git a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/Clock.cpp b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/Clock.cpp index 2f5f47b4..2b7265bc 100644 --- a/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/Clock.cpp +++ b/external/3rd/library/soePlatform/CSAssist/utils/TcpLibrary/Clock.cpp @@ -46,8 +46,6 @@ ClockStamp Clock::getCurTime() return ret; #else struct timeval tv; - int err; - err = gettimeofday(&tv, NULL); return (static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000)); #endif } diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp index 2b7265bc..9b317d05 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/TcpLibrary/Clock.cpp @@ -45,8 +45,11 @@ ClockStamp Clock::getCurTime() return ret; #else +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wuninitialized" struct timeval tv; return (static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000)); +#pragma clang diagnostic pop #endif } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/MD5.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/MD5.cpp index a988f46b..31d75dcb 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/MD5.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/MD5.cpp @@ -59,7 +59,7 @@ namespace Base int k = l = 0; for(; l < i; l += 4) { - ai[k] = achar0[l + j] & 0xff | (achar0[l + 1 + j] & 0xff) << 8 | (achar0[l + 2 + j] & 0xff) << 16 | (achar0[l + 3 + j] & 0xff) << 24; + ai[k] = (achar0[l + j] & 0xff) | (achar0[l + 1 + j] & 0xff) << 8 | (achar0[l + 2 + j] & 0xff) << 16 | (achar0[l + 3 + j] & 0xff) << 24; k++; } @@ -84,7 +84,7 @@ namespace Base int MD5::FF(int i, int j, int k, int l, int i1, int j1, int k1) { - i = uadd(i, j & k | ~j & l, i1, k1); + i = uadd(i, (j & k) | (~j & l), i1, k1); return uadd(rotate_left(i, j1), j); } @@ -106,7 +106,7 @@ namespace Base int MD5::GG(int i, int j, int k, int l, int i1, int j1, int k1) { - i = uadd(i, j & l | k & ~l, i1, k1); + i = uadd(i, (j & l) | (k & ~l), i1, k1); return uadd(rotate_left(i, j1), j); } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ccspanutil.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ccspanutil.cpp index 28781273..8d97c185 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/ccspanutil.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/ccspanutil.cpp @@ -73,7 +73,6 @@ char * CSpanUtil::getDescriptionFromCardNum(const char *cardNum) char temp[8]; memcpy(temp, cardNum, 7); temp[7] = 0; - int value7 = atoi(temp); temp[6] = 0; int value6 = atoi(temp); temp[5] = 0; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h index 6b4f5968..c50dee62 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpPriority.h @@ -83,7 +83,7 @@ template PriorityQueue::PriorityQueue(int queueSiz mQueueEnd = 0; mQueueSize = queueSize; mQueue = new QueueEntry[mQueueSize]; - memset(mQueue, 0, sizeof(mQueue)); + memset(mQueue, 0, mQueueSize); } template PriorityQueue::~PriorityQueue() diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/pid.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/pid.cpp index 6097fd7b..6a1d7b56 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/pid.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/pid.cpp @@ -44,13 +44,7 @@ std::string soegethostname() char res[NAME_SIZE]; memset(res, 0, NAME_SIZE); std::string retVal; - int error = gethostname(res, NAME_SIZE-1); - int errdetail; - if(error !=0) - { - errdetail = errno; - } retVal = res; return retVal; } diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp index 82751efa..19f34ab3 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/priority.hpp @@ -77,7 +77,7 @@ template PriorityQueue::PriorityQueue(int queueSiz mQueueEnd = 0; mQueueSize = queueSize; mQueue = new QueueEntry[mQueueSize]; - memset(mQueue, 0, sizeof(mQueue)); + memset(mQueue, 0, mQueueSize); } template PriorityQueue::~PriorityQueue() diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp index 9cc64b43..ce6b8f16 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/utf8.cpp @@ -264,7 +264,7 @@ namespace soe { int wchar_length=0; //number of utf-8 characters int code_size; //number of bytes each wchar - int cur_bytes_count = 0; + unsigned cur_bytes_count = 0; unsigned char byte; char *pout = output; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/Clock.cpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/Clock.cpp index 2f5f47b4..2b7265bc 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/Clock.cpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/TcpLibrary/Clock.cpp @@ -46,8 +46,6 @@ ClockStamp Clock::getCurTime() return ret; #else struct timeval tv; - int err; - err = gettimeofday(&tv, NULL); return (static_cast(tv.tv_sec) * 1000 + static_cast(tv.tv_usec / 1000)); #endif } From 0775701e483f7bae90bb1f949796340368d7cb35 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 16:53:57 -0500 Subject: [PATCH 17/19] whoopps --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index deb8cef4..b837fbd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ elseif(UNIX) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -Wall -O0") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -march=native -pipe -mtune=native -O2 ") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnounused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wnouninitialized -Wno-reorder -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) endif() From b61c9324987ea570cc412fb44d98726666e170a7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 13 Oct 2015 20:49:42 -0500 Subject: [PATCH 18/19] more fixing and cleanup --- CMakeLists.txt | 2 +- .../src/shared/ConnectionServerConnection.cpp | 2 +- .../serverGame/src/shared/core/GameServer.cpp | 4 +- .../src/shared/object/CreatureObject.cpp | 4 - .../src/shared/object/ServerObject.cpp | 8 +- .../library/serverUtility/src/CMakeLists.txt | 4 - .../serverUtility/src/linux/stlhack.cpp | 23 ------ .../core/TemplateDefinitionCompiler.cpp | 78 ------------------- .../shared/UdpLibraryMT/UdpConnectionMT.cpp | 3 + .../Session/CommonAPI/CommonAPIStrings.h | 2 +- 10 files changed, 13 insertions(+), 117 deletions(-) delete mode 100644 engine/server/library/serverUtility/src/linux/stlhack.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index b837fbd0..b77091e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ elseif(UNIX) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -Wall -O0") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -march=native -pipe -mtune=native -O2 ") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) endif() diff --git a/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.cpp b/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.cpp index 6dbad80b..2ce8ddbd 100644 --- a/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.cpp +++ b/engine/server/application/ChatServer/src/shared/ConnectionServerConnection.cpp @@ -421,7 +421,7 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) NetworkId targetId = message.getKickeeId(); std::string const & targetName = message.getKickeeName(); if(targetId.isValid() || - !targetName.empty() && (ChatServer::getVoiceChatLoginInfoFromName(targetName, targetId))) + (!targetName.empty() && (ChatServer::getVoiceChatLoginInfoFromName(targetName, targetId)))) { ChatServer::requestKickPlayerFromChannel(message.getRequester(), targetId, message.getChannelName()); } diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 75a6ea36..d7bf0c21 100644 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -3923,8 +3923,8 @@ void GameServer::run(void) NetworkHandler::update(); } - if ( ServerWorld::isSpaceScene() && ConfigServerGame::getSpaceShouldSleep() - || !ServerWorld::isSpaceScene() && ConfigServerGame::getGroundShouldSleep()) + if ((ServerWorld::isSpaceScene() && ConfigServerGame::getSpaceShouldSleep()) + || (!ServerWorld::isSpaceScene() && ConfigServerGame::getGroundShouldSleep())) { PROFILER_AUTO_BLOCK_DEFINE("Os::sleep"); Os::sleep(1); diff --git a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp index 68393fc1..0fe535e5 100644 --- a/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/CreatureObject.cpp @@ -1814,8 +1814,6 @@ void CreatureObject::initializeFirstTimeObject() void CreatureObject::onLoadedFromDatabase() { - typedef const std::string * strptr; - if (isAuthoritative()) { if (isPlayerControlled()) @@ -8545,8 +8543,6 @@ void CreatureObject::onCharacterMatchRetrieved(MatchMakingCharacterResult const if (creatureController != NULL) { - typedef std::pair Payload; - MessageQueueGenericValueType * const msg = new MessageQueueGenericValueType(results); creatureController->appendMessage(static_cast(CM_characterMatchRetrieved), 0.0f, msg, GameControllerMessageFlags::SEND | GameControllerMessageFlags::RELIABLE | GameControllerMessageFlags::DEST_AUTH_CLIENT); diff --git a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp index c830ff31..0ffc1842 100644 --- a/engine/server/library/serverGame/src/shared/object/ServerObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/ServerObject.cpp @@ -4156,11 +4156,13 @@ void ServerObject::performCombatSpam (const MessageQueueCombatSpam & spamMsg, bo if (sendToTarget && !sendToBystanders) { ServerObject * const target = safe_cast(NetworkIdManager::getObjectById(spamMsg.m_defender)); - if (target) - if (target->getNetworkId() != spamMsg.m_attacker) + if (target) { + if (target->getNetworkId() != spamMsg.m_attacker) { target->seeCombatSpam (spamMsg); - else + } + } else { WARNING_STRICT_FATAL (!sendToSelf && !sendToBystanders, ("null target_obj in commandFuncCombatSpam, when sendToTarget was set true")); + } } if (sendToBystanders) diff --git a/engine/server/library/serverUtility/src/CMakeLists.txt b/engine/server/library/serverUtility/src/CMakeLists.txt index 1b979319..b522f2c1 100644 --- a/engine/server/library/serverUtility/src/CMakeLists.txt +++ b/engine/server/library/serverUtility/src/CMakeLists.txt @@ -39,10 +39,6 @@ if(WIN32) set(PLATFORM_SOURCES win32/FirstServerUtility.cpp ) -else() - set(PLATFORM_SOURCES - linux/stlhack.cpp - ) endif() include_directories( diff --git a/engine/server/library/serverUtility/src/linux/stlhack.cpp b/engine/server/library/serverUtility/src/linux/stlhack.cpp deleted file mode 100644 index 5b63831a..00000000 --- a/engine/server/library/serverUtility/src/linux/stlhack.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//#include "FirstGame.h" -//#include //without this we get an internal compiler error - -// This resolves a problem with stlport compiling under gcc 2.91 that ships with RedHat 6.2. -// Basically, the compiler has trouble instantiating an instance of _Stl_prime without it -// being explicitly defined. So we have to instantiate one. -// We should try removing this file when either we a) upgrade the compiler or b) upgrate the OS. - -//#define __stl_num_primes 28 -//#define __PRIME_LIST_BODY { \ -// 53ul, 97ul, 193ul, 389ul, 769ul, \ -// 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, \ -// 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, \ -// 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, \ -// 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,\ -// 1610612741ul, 3221225473ul, 4294967291ul \ -//} -// -//template <> const size_t std::_Stl_prime::_M_list[__stl_num_primes] = __PRIME_LIST_BODY; -// -//#undef __stl_num_primes -//#undef __PRIME_LIST_BODY -// \ No newline at end of file diff --git a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp index 61e85ce8..f95e5c6c 100644 --- a/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp +++ b/engine/shared/application/TemplateDefinitionCompiler/src/shared/core/TemplateDefinitionCompiler.cpp @@ -27,84 +27,6 @@ #include -#ifdef _DEBUG -//#define ALWAYS_OVERWRITE // flag to always overwrite previous code -#endif - - -//============================================================================== -// subclass Perforce API class ClientUser in order to trap errors - -//static const int SUBMIT_NO_FILE_ERR = 17; // need to add file before submitting -// -//class MyPerforceUser : public ClientUser -//{ -//public: -// MyPerforceUser(void) : ClientUser(), m_errorOccurred(false) {} -// virtual ~MyPerforceUser() {} -// virtual void HandleError( Error *err ) -// { -// if (err != NULL && err->Test()) -// { -// m_errorOccurred = true; -// m_lastError = err->GetGeneric(); -// // test for filtered errors -// for (size_t i = 0; i < m_filteredErrors.size(); ++i) -// { -// if (m_lastError == m_filteredErrors[i]) -// return; -// } -// } -// ClientUser::HandleError(err); -// } -// -// bool errorOccurred(void) const -// { -// return m_errorOccurred; -// } -// -// int getLastError(void) const -// { -// return m_lastError; -// } -// -// void clearLastError(void) -// { -// m_errorOccurred = false; -// m_lastError = 0; -// } -// -// void addFilteredError(int error) -// { -// m_filteredErrors.push_back(error); -// } -// -// void clearFilteredErrors(void) -// { -// m_filteredErrors.clear(); -// } -// -//private: -// bool m_errorOccurred; -// int m_lastError; -// std::vector m_filteredErrors; -//}; -// -// -////============================================================================== -//// subclass of the PerforceAPI StrBuf class, to workaround a bug -//// in the destructor. We can't fix the bug because it's an external library -//class StrBufFixed : public StrBuf -//{ -//public: -// ~StrBufFixed() -// { -// delete buffer; -// StringInit(); -// } -//}; - - //============================================================================== // file variables diff --git a/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.cpp b/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.cpp index ce7159f2..9b7b7282 100644 --- a/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.cpp +++ b/engine/shared/library/sharedNetwork/src/shared/UdpLibraryMT/UdpConnectionMT.cpp @@ -18,6 +18,7 @@ class UdpConnectionHandlerInternal: public UdpConnectionHandler { public: UdpConnectionHandlerInternal(); + virtual ~UdpConnectionHandlerInternal(); void setOwner(UdpConnectionHandlerMT *owner); void processReceive(UdpConnectionMT *conMT, unsigned char const *data, int dataLen); @@ -43,6 +44,8 @@ UdpConnectionHandlerInternal::UdpConnectionHandlerInternal() : { } +UdpConnectionHandlerInternal::~UdpConnectionHandlerInternal(){} + // ---------------------------------------------------------------------- void UdpConnectionHandlerInternal::setOwner(UdpConnectionHandlerMT *owner) diff --git a/external/3rd/library/platform/projects/Session/CommonAPI/CommonAPIStrings.h b/external/3rd/library/platform/projects/Session/CommonAPI/CommonAPIStrings.h index 5ddbe62e..df836c96 100644 --- a/external/3rd/library/platform/projects/Session/CommonAPI/CommonAPIStrings.h +++ b/external/3rd/library/platform/projects/Session/CommonAPI/CommonAPIStrings.h @@ -247,6 +247,6 @@ const gamecode_text _gamecodeName[GAMECODE_END] = }; static std::map GamecodeName((const std::map::value_type *)&_gamecodeName[0],(const std::map::value_type *)&_gamecodeName[GAMECODE_END]); -#endif UNIX +#endif #endif From 338e4e68b5b52403af68da7803050d4b17daccf8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 01:28:37 -0500 Subject: [PATCH 19/19] this is probably the last of the fixes for the night --- CMakeLists.txt | 6 +++--- engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp | 3 ++- engine/shared/library/sharedDebug/src/shared/PixCounter.cpp | 2 +- .../soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b77091e7..db2930b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,9 +47,9 @@ if(WIN32) elseif(UNIX) find_package(Curses REQUIRED) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -Wall -O0") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -march=native -pipe -mtune=native -O2 ") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -O0 -Wall -Wno-overloaded-virtual -Wno-missing-braces -Wno-unused-private-field -Wno-format -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -Wno-unused-const-variable -Wno-unknown-warning-option") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -march=native -pipe -mtune=native -O2 -Wno-overloaded-virtual -Wno-missing-braces -Wno-unused-private-field -Wno-format -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -Wno-unused-const-variable -Wno-unknown-warning-option") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) endif() diff --git a/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp b/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp index c02aa59f..8e3ba4bc 100644 --- a/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp +++ b/engine/shared/library/sharedDebug/src/linux/DebugHelp.cpp @@ -404,8 +404,9 @@ static bool dwarfSearch(char const *dwarfLines, unsigned int linesLength, void c char const *srcFile = bestUnderSrcFileTable+1; for (int i = 0; i < bestUnderSrcFileNum; ++i) { - while (*srcFile++); + while (*srcFile++) { srcFile += 3; + } } retSrcFile = SymbolCache::uniqueString(srcFile); retSrcLine = bestUnderSrcLine; diff --git a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp index 5c67b80a..dcb14966 100644 --- a/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp +++ b/engine/shared/library/sharedDebug/src/shared/PixCounter.cpp @@ -461,7 +461,7 @@ void PixCounter::String::set(const char * format, ...) char buffer[512]; vsnprintf(buffer, sizeof(buffer), format, va); - buffer[sizeof(buffer-1)] = '\0'; + buffer[sizeof(buffer)-1] = '\0'; operator =(buffer); va_end(va); diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp index 0256f297..e0fe761f 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/hashtable.hpp @@ -155,7 +155,7 @@ inline int UpperHashString(char *string) int h = 0; while (*string != 0) { - h = ((31 * h) + (*string >= 'a' && *string <= 'z') ? (*string - 0x20) : *string) ^ (h >> 26); + h = ((31 * h) + ((((*string >= 'a' && *string <= 'z') ? (*string - 0x20) : *string)) ^ (h >> 26))); string++; } return(h);