From 2e4eabe3f4374beafed853978815d59f9de78f23 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 21:07:19 -0500 Subject: [PATCH 1/8] fix comparison error --- .../library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.cpp | 2 +- .../library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.h | 2 +- 2 files changed, 2 insertions(+), 2 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 40d5c384..efc420f3 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 @@ -168,7 +168,7 @@ namespace soe return bytes; } - bool Base64::UUDecode(const char *source, unsigned sourceLen, unsigned char *dest, unsigned *destLen) + bool Base64::UUDecode(const char *source, unsigned sourceLen, unsigned char *dest, int *destLen) { unsigned char q[3]; unsigned index; diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.h index ac450794..3a863587 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/Base64.h @@ -13,7 +13,7 @@ namespace soe static bool UUEncode(const unsigned char *source, unsigned sourceLen, std::string &destString); static bool UUEncode(const std::vector &source, char *dest, unsigned destLen); static bool UUEncode(const std::vector &source, std::string &destString); - static bool UUDecode(const char *source, unsigned sourceLen, unsigned char *dest, unsigned *destLen); + static bool UUDecode(const char *source, unsigned sourceLen, unsigned char *dest, int *destLen); static bool UUDecode(const char *source, unsigned sourceLen, std::vector &destVector); static bool UUDecode(const char *source, unsigned sourceLen, std::string &destString); From d8349a9da8662ac7232e2a205e38533df22fc8c4 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 21:08:09 -0500 Subject: [PATCH 2/8] remove unused conversion function --- .../VChatAPI/utils2.0/utils/Base/serializeStringVector.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h index f27f37ad..7beccb4d 100644 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/serializeStringVector.h @@ -221,9 +221,6 @@ namespace soe return bytes; } - operator stringVector_t () { return *this; } - - //unsigned Read(const unsigned char * stream, unsigned size); //DECLARE_SCRIBE_MEMBERS }; From 66683ba082b59aad8c6074de8cd70b20618cdf2d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 21:09:45 -0500 Subject: [PATCH 3/8] fix comparison warn --- external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.cpp | 2 +- external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.cpp index f8d7d1cc..cfa25007 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.cpp @@ -170,7 +170,7 @@ namespace Base return bytes; } - bool Base64::UUDecode(const char *source, unsigned sourceLen, unsigned char *dest, unsigned *destLen) + bool Base64::UUDecode(const char *source, unsigned sourceLen, unsigned char *dest, int *destLen) { unsigned char q[3]; unsigned index; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.h b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.h index 73542495..6f1d0858 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.h +++ b/external/3rd/library/soePlatform/ChatAPI/utils/Base/Base64.h @@ -15,7 +15,7 @@ namespace Base public: static bool UUEncode(const unsigned char *source, unsigned sourceLen, char *dest, unsigned destLen); static bool UUEncode(const unsigned char *source, unsigned sourceLen, std::string &destString); - static bool UUDecode(const char *source, unsigned sourceLen, unsigned char *dest, unsigned *destLen); + static bool UUDecode(const char *source, unsigned sourceLen, unsigned char *dest, int *destLen); static bool UUDecode(const char *source, unsigned sourceLen, std::string &destString); // these don't *exactly* belong here, but it's a convenient place for them From cb3a59aaacbf9ce921b117a6be30a69e3e48b672 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 21:13:40 -0500 Subject: [PATCH 4/8] fix conversion error --- .../library/sharedGame/src/shared/core/LfgCharacterData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp index 21d8d4b5..31a0e655 100644 --- a/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp +++ b/engine/shared/library/sharedGame/src/shared/core/LfgCharacterData.cpp @@ -616,7 +616,7 @@ Unicode::String const & LfgCharacterData::getProfessionDisplayString(LfgCharacte static Unicode::String empty; - if ((static_cast(profession) >= 0) && (static_cast(profession) < s_professionDisplayString.size())) + if ((static_cast(profession) >= 0) && (static_cast(profession) < s_professionDisplayString.size())) return s_professionDisplayString[static_cast(profession)]; return empty; From 6b1c89032f62a191a8b603002f6c59a030e9ab29 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 21:29:27 -0500 Subject: [PATCH 5/8] fix another warning --- .../SharedCreatureObjectTemplate.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp index 36f524dc..5254f31c 100644 --- a/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp +++ b/engine/shared/library/sharedGame/src/shared/objectTemplate/SharedCreatureObjectTemplate.cpp @@ -343,7 +343,7 @@ float SharedCreatureObjectTemplate::getAcceleration(MovementTypes index) const base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) @@ -392,7 +392,7 @@ float SharedCreatureObjectTemplate::getAccelerationMin(MovementTypes index) cons base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) @@ -441,7 +441,7 @@ float SharedCreatureObjectTemplate::getAccelerationMax(MovementTypes index) cons base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_acceleration[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) @@ -490,7 +490,7 @@ float SharedCreatureObjectTemplate::getSpeed(MovementTypes index) const base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) @@ -539,7 +539,7 @@ float SharedCreatureObjectTemplate::getSpeedMin(MovementTypes index) const base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) @@ -588,7 +588,7 @@ float SharedCreatureObjectTemplate::getSpeedMax(MovementTypes index) const base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_speed[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) @@ -637,7 +637,7 @@ float SharedCreatureObjectTemplate::getTurnRate(MovementTypes index) const base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) @@ -686,7 +686,7 @@ float SharedCreatureObjectTemplate::getTurnRateMin(MovementTypes index) const base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) @@ -735,7 +735,7 @@ float SharedCreatureObjectTemplate::getTurnRateMax(MovementTypes index) const base = dynamic_cast(m_baseData); } - DEBUG_FATAL(index < 0 || index >= 2, ("template param index out of range")); + DEBUG_FATAL(static_cast(index) < 0 || static_cast(index) >= 2, ("template param index out of range")); if (!m_turnRate[index].isLoaded()) { if (ms_allowDefaultTemplateParams && /*!m_versionOk &&*/ base == NULL) From f71f036f7bfb33fd4eb43ce6792903e6b89b3faa Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 21:35:04 -0500 Subject: [PATCH 6/8] more warning fixes --- .../application/ChatServer/src/shared/ChatInterface.cpp | 4 ++-- .../library/sharedGame/src/shared/space/NebulaManager.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp index a25d2c54..9f71e8c3 100644 --- a/engine/server/application/ChatServer/src/shared/ChatInterface.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatInterface.cpp @@ -1851,7 +1851,7 @@ void ChatInterface::OnReceiveForcedLogout(const ChatAvatar *oldAvatar) ChatServer::fileLog(false, "ChatInterface", "OnReceiveForcedLogout() oldAvatar(%s)", ChatServer::getFullChatAvatarName(oldAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceiveForcedLogout"); - if ((oldAvatar == NULL)) + if (oldAvatar == NULL) { DEBUG_WARNING(true, ("We received an OnReceiveForcedLogout with a success result code but NULL data. This is an error that the API should never give.")); return; @@ -2877,7 +2877,7 @@ void ChatInterface::OnReceivePersistentMessage(const ChatAvatar *destAvatar, con ChatServer::fileLog(false, "ChatInterface", "OnReceivePersistentMessage() destAvatar(%s)", ChatServer::getFullChatAvatarName(destAvatar).c_str()); PROFILER_AUTO_BLOCK_DEFINE("ChatInterface - OnReceivePersistentMessage"); - if ((destAvatar == NULL)) + if (destAvatar == NULL) { DEBUG_WARNING(true, ("We received an OnREceivePersistentMessage with a success result code but NULL data. This is an error that the API should never give.")); return; diff --git a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp index b5035cb7..568c44e2 100644 --- a/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp +++ b/engine/shared/library/sharedGame/src/shared/space/NebulaManager.cpp @@ -200,7 +200,7 @@ void NebulaManager::loadSceneData(std::string const & sceneId) { //-- apparently not a space scene // @todo: need better way to detect this - if (!strncmp(sceneId.c_str(), "space_", 6) != 0) + if (!(strncmp(sceneId.c_str(), "space_", 6) != 0)) WARNING(true, ("NebulaManager no such datatable [%s]", filename.c_str())); return; } From 05d4d99280bb6def645ba2efd263d77706cd7a1c Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 22:03:40 -0500 Subject: [PATCH 7/8] moar warning fixes --- engine/client/application/Miff/src/linux/parser.yac | 8 ++++---- .../src/shared/console/ConsoleCommandParserSpaceAi.cpp | 3 ++- .../serverGame/src/shared/controller/AiShipController.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/engine/client/application/Miff/src/linux/parser.yac b/engine/client/application/Miff/src/linux/parser.yac index b40006e4..d1149254 100644 --- a/engine/client/application/Miff/src/linux/parser.yac +++ b/engine/client/application/Miff/src/linux/parser.yac @@ -823,7 +823,7 @@ void parseESCstring(char *str, char *targetBuffer, int sizeOfTarget) sPtr++; if (numIndex > 3) { - sprintf(err_msg, "Escape sequence Octal numbers greater then\noctal o400 (256 decimal)! [more then 3 digits]", *sPtr); + sprintf(err_msg, "Escape sequence Octal numbers greater then\noctal o400 (256 decimal)! [more then 3 digits]"); yyerror(err_msg); exitParser = 1; } @@ -841,7 +841,7 @@ void parseESCstring(char *str, char *targetBuffer, int sizeOfTarget) if (tempNum > 255) { - sprintf(err_msg, "Escape sequence Octal numbers greater then\noctal o400 (256 decimal)!", tempNum); + sprintf(err_msg, "Escape sequence Octal numbers greater then\noctal o400 (256 decimal)!"); yyerror(err_msg); exitParser = 1; } @@ -865,7 +865,7 @@ void parseESCstring(char *str, char *targetBuffer, int sizeOfTarget) sPtr++; if (numIndex > 3) { - sprintf(err_msg, "Escape sequence HEX numbers greater then 0x100\n(256 decimal)! [more then 3 digits]", *sPtr); + sprintf(err_msg, "Escape sequence HEX numbers greater then 0x100\n(256 decimal)! [more then 3 digits]"); yyerror(err_msg); exitParser = 1; } @@ -883,7 +883,7 @@ void parseESCstring(char *str, char *targetBuffer, int sizeOfTarget) if (tempNum > 255) { - sprintf(err_msg, "Escape sequence HEX numbers greater then 0x100\n(256 decimal)!", *sPtr); + sprintf(err_msg, "Escape sequence HEX numbers greater then 0x100\n(256 decimal)!"); yyerror(err_msg); exitParser = 1; } diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp index d596f78c..9972dcf5 100644 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserSpaceAi.cpp @@ -119,7 +119,8 @@ bool ConsoleCommandParserSpaceAi::performParsing(const NetworkId & userId, const { Vector const & position_w = iterTransformList->getPosition_p(); - message += formattedString.sprintf("[%d] %.2f, %.2f, %.2f%s", index++, position_w.x, position_w.y, position_w.z, (index < static_cast(transformList.size())) ? "\n" : ""); + message += formattedString.sprintf("[%d] %.2f, %.2f, %.2f%s", (index+1), position_w.x, position_w.y, position_w.z, (index < static_cast(transformList.size())) ? "\n" : ""); + index++; } Chat::sendSystemMessage(*serverObject, Unicode::narrowToWide(message.c_str()), Unicode::emptyString); diff --git a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp index b14698b3..d2bf69f7 100644 --- a/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiShipController.cpp @@ -1648,7 +1648,7 @@ void AiShipController::sendDebugAiToClients(AiDebugString & aiDebugString) float const turretMissChance = getTurretMissChance() * 100.0f; float const turretMissAngleDegrees = convertRadiansToDegrees(getTurretMissAngle()); - aiDebugString.addText(formattedString.sprintf("turret miss(%.0f%% @ %.0f°)\n", turretMissChance, turretMissAngleDegrees)); + aiDebugString.addText(formattedString.sprintf("turret miss(%.0f%% @ %.0f)\n", turretMissChance, turretMissAngleDegrees)); } } From 4973d491385ca941ddf50281fbc27a5b68d467c7 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Oct 2015 22:35:29 -0500 Subject: [PATCH 8/8] aaaand more warns --- engine/client/application/Miff/src/linux/parser.lex | 2 +- engine/client/application/Miff/src/linux/parser.yac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/client/application/Miff/src/linux/parser.lex b/engine/client/application/Miff/src/linux/parser.lex index 16e30011..f80c2c9b 100644 --- a/engine/client/application/Miff/src/linux/parser.lex +++ b/engine/client/application/Miff/src/linux/parser.lex @@ -387,7 +387,7 @@ int yyerror(char *err) /* called by yyparse() */ MIFFSetError(); /* set global error flag for shell as well */ yyterminate(); } - + return 0; } /*-------------------------** diff --git a/engine/client/application/Miff/src/linux/parser.yac b/engine/client/application/Miff/src/linux/parser.yac index d1149254..25feaf7e 100644 --- a/engine/client/application/Miff/src/linux/parser.yac +++ b/engine/client/application/Miff/src/linux/parser.yac @@ -985,7 +985,7 @@ void addEnumSymbol(char *symString, long value) if (MAX_SYMCHARS < strlen(symString)) { /* somebody insane decided to use variable longer then max size! */ - sprintf(err_msg, "%s is longer then %d characters! [value: %d]", symString, MAX_SYMCHARS, value); + sprintf(err_msg, "%s is longer then %d characters! [value: %ld]", symString, MAX_SYMCHARS, value); yyerror(err_msg); } else