diff options
| author | Spp <none@none> | 2010-08-23 14:10:24 +0200 |
|---|---|---|
| committer | Spp <none@none> | 2010-08-23 14:10:24 +0200 |
| commit | 58e94dcb9d2d983c8ffc2df0bb86f3d765b08652 (patch) | |
| tree | 15d7064e900faf241d117be5bd2567f99ed5287f /src/server/worldserver | |
| parent | 16d95d3115b27536e7a1c99e795a5f90c238eb16 (diff) | |
Core: Fix more warnings
--HG--
branch : trunk
Diffstat (limited to 'src/server/worldserver')
| -rw-r--r-- | src/server/worldserver/CommandLine/CliRunnable.cpp | 68 | ||||
| -rw-r--r-- | src/server/worldserver/RemoteAccess/RASocket.cpp | 38 | ||||
| -rw-r--r-- | src/server/worldserver/TCSoap/TCSoap.cpp | 12 |
3 files changed, 58 insertions, 60 deletions
diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 18b4872055b..93fa821e345 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -47,15 +47,15 @@ char * command_finder(const char* text, int state) const char* ret; ChatCommand *cmd = ChatHandler::getCommandTable(); - if(!state) + if (!state) { idx = 0; len = strlen(text); } - while(ret = cmd[idx].Name) + while ((ret = cmd[idx].Name)) { - if(!cmd[idx].AllowConsole) + if (!cmd[idx].AllowConsole) { idx++; continue; @@ -65,7 +65,7 @@ char * command_finder(const char* text, int state) //printf("Checking %s \n", cmd[idx].Name); if (strncmp(ret, text, len) == 0) return strdup(ret); - if(cmd[idx].Name == NULL) + if (cmd[idx].Name == NULL) break; } @@ -77,7 +77,7 @@ char ** cli_completion(const char * text, int start, int /*end*/) char ** matches; matches = (char**)NULL; - if(start == 0) + if (start == 0) matches = rl_completion_matches((char*)text,&command_finder); else rl_bind_key('\t',rl_abort); @@ -90,7 +90,7 @@ void utf8print(void* /*arg*/, const char* str) #if PLATFORM == PLATFORM_WINDOWS wchar_t wtemp_buf[6000]; size_t wtemp_len = 6000-1; - if(!Utf8toWStr(str,strlen(str),wtemp_buf,wtemp_len)) + if (!Utf8toWStr(str,strlen(str),wtemp_buf,wtemp_len)) return; char temp_buf[6000]; @@ -115,7 +115,7 @@ void commandFinished(void*, bool /*success*/) /// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm, delete account chars in realm then delete account bool ChatHandler::HandleAccountDeleteCommand(const char* args) { - if(!*args) + if (!*args) return false; ///- Get the account name from the command line @@ -124,7 +124,7 @@ bool ChatHandler::HandleAccountDeleteCommand(const char* args) return false; std::string account_name = account_name_str; - if(!AccountMgr::normalizeString(account_name)) + if (!AccountMgr::normalizeString(account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -132,7 +132,7 @@ bool ChatHandler::HandleAccountDeleteCommand(const char* args) } uint32 account_id = sAccountMgr.GetId(account_name); - if(!account_id) + if (!account_id) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,account_name.c_str()); SetSentErrorMessage(true); @@ -142,7 +142,7 @@ bool ChatHandler::HandleAccountDeleteCommand(const char* args) /// Commands not recommended call from chat, but support anyway /// can delete only for account with less security /// This is also reject self apply in fact - if(HasLowerSecurityAccount (NULL,account_id,true)) + if (HasLowerSecurityAccount (NULL,account_id,true)) return false; AccountOpResult result = sAccountMgr.DeleteAccount(account_id); @@ -186,7 +186,7 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s // search by name else { - if(!normalizePlayerName(searchString)) + if (!normalizePlayerName(searchString)) return false; resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND deleteInfos_Name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), searchString.c_str()); @@ -230,7 +230,7 @@ std::string ChatHandler::GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList:: { std::ostringstream wherestr; wherestr << "guid IN ('"; - for(; itr != itr_end; ++itr) + for (; itr != itr_end; ++itr) { wherestr << itr->lowguid; @@ -241,7 +241,7 @@ std::string ChatHandler::GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList:: } DeletedInfoList::const_iterator itr2 = itr; - if(++itr2 != itr_end) + if (++itr2 != itr_end) wherestr << "','"; } wherestr << "')"; @@ -444,7 +444,7 @@ bool ChatHandler::HandleCharacterDeletedDeleteCommand(const char* args) HandleCharacterDeletedListHelper(foundList); // Call the appropriate function to delete them (current account for deleted characters is 0) - for(DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) + for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr) Player::DeleteFromDB(itr->lowguid, 0, false, true); return true; @@ -484,22 +484,22 @@ bool ChatHandler::HandleCharacterDeletedOldCommand(const char* args) } bool ChatHandler::HandleCharacterEraseCommand(const char* args){ - if(!*args) + if (!*args) return false; char *character_name_str = strtok((char*)args," "); - if(!character_name_str) + if (!character_name_str) return false; std::string character_name = character_name_str; - if(!normalizePlayerName(character_name)) + if (!normalizePlayerName(character_name)) return false; uint64 character_guid; uint32 account_id; Player *player = sObjectMgr.GetPlayer(character_name.c_str()); - if(player) + if (player) { character_guid = player->GetGUID(); account_id = player->GetSession()->GetAccountId(); @@ -508,7 +508,7 @@ bool ChatHandler::HandleCharacterEraseCommand(const char* args){ else { character_guid = sObjectMgr.GetPlayerGUIDByName(character_name); - if(!character_guid) + if (!character_guid) { PSendSysMessage(LANG_NO_PLAYER,character_name.c_str()); SetSentErrorMessage(true); @@ -565,7 +565,7 @@ bool ChatHandler::HandleAccountOnlineListCommand(const char* /*args*/) "LEFT JOIN account_access aa " "ON (a.id = aa.id) " "WHERE a.id = '%u'", account); - if(resultLogin) + if (resultLogin) { Field *fieldsLogin = resultLogin->Fetch(); PSendSysMessage(LANG_ACCOUNT_LIST_LINE, @@ -574,7 +574,7 @@ bool ChatHandler::HandleAccountOnlineListCommand(const char* /*args*/) else PSendSysMessage(LANG_ACCOUNT_LIST_ERROR,name.c_str()); - }while(resultDB->NextRow()); + }while (resultDB->NextRow()); SendSysMessage(LANG_ACCOUNT_LIST_BAR); return true; @@ -583,13 +583,13 @@ bool ChatHandler::HandleAccountOnlineListCommand(const char* /*args*/) /// Create an account bool ChatHandler::HandleAccountCreateCommand(const char* args) { - if(!*args) + if (!*args) return false; ///- %Parse the command line arguments char *szAcc = strtok((char*)args, " "); char *szPassword = strtok(NULL, " "); - if(!szAcc || !szPassword) + if (!szAcc || !szPassword) return false; // normalized in sAccountMgr.CreateAccount @@ -626,7 +626,7 @@ bool ChatHandler::HandleAccountCreateCommand(const char* args) /// Set the level of logging bool ChatHandler::HandleServerSetLogFileLevelCommand(const char *args) { - if(!*args) + if (!*args) return false; char *NewLevel = strtok((char*)args, " "); @@ -640,7 +640,7 @@ bool ChatHandler::HandleServerSetLogFileLevelCommand(const char *args) /// Set the level of logging bool ChatHandler::HandleServerSetLogLevelCommand(const char *args) { - if(!*args) + if (!*args) return false; char *NewLevel = strtok((char*)args, " "); @@ -654,15 +654,15 @@ bool ChatHandler::HandleServerSetLogLevelCommand(const char *args) /// set diff time record interval bool ChatHandler::HandleServerSetDiffTimeCommand(const char *args) { - if(!*args) + if (!*args) return false; char *NewTimeStr = strtok((char*)args, " "); - if(!NewTimeStr) + if (!NewTimeStr) return false; int32 NewTime =atoi(NewTimeStr); - if(NewTime < 0) + if (NewTime < 0) return false; sWorld.SetRecordDiffInterval(NewTime); @@ -713,14 +713,12 @@ void CliRunnable::run() if (needInit) MySQL::Thread_Init(); - char commandbuf[256]; - ///- Display the list of available CLI functions then beep - sLog.outString(""); + //sLog.outString(""); #if PLATFORM != WINDOWS rl_attempted_completion_function = cli_completion; #endif - if(sConfig.GetBoolDefault("BeepAtStart", true)) + if (sConfig.GetBoolDefault("BeepAtStart", true)) printf("\a"); // \a = Alert // print this here the first time @@ -743,13 +741,13 @@ void CliRunnable::run() if (command_str != NULL) { for (int x=0; command_str[x]; x++) - if(command_str[x]=='\r'||command_str[x]=='\n') + if (command_str[x]=='\r'||command_str[x]=='\n') { command_str[x]=0; break; } - if(!*command_str) + if (!*command_str) { #if PLATFORM == WINDOWS printf("TC>"); @@ -758,7 +756,7 @@ void CliRunnable::run() } std::string command; - if(!consoleToUtf8(command_str,command)) // convert from console encoding to utf8 + if (!consoleToUtf8(command_str,command)) // convert from console encoding to utf8 { #if PLATFORM == WINDOWS printf("TC>"); diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index d70a414597f..5a5a66a0f51 100644 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -71,7 +71,7 @@ void RASocket::OnRead() TcpSocket::OnRead(); unsigned int sz=ibuf.GetLength(); - if(iInputLength+sz>=RA_BUFF_SIZE) + if (iInputLength+sz>=RA_BUFF_SIZE) { sLog.outRemote("Input buffer overflow, possible DOS attack.\n"); SetCloseAndDelete(); @@ -82,9 +82,9 @@ void RASocket::OnRead() ibuf.Read(inp,sz); /// \todo Can somebody explain this 'Linux bugfix'? - if(stage==NONE) - if(sz>4) //linux remote telnet - if(memcmp(inp ,"USER ",5)) + if (stage==NONE) + if (sz>4) //linux remote telnet + if (memcmp(inp ,"USER ",5)) { delete [] inp;return; printf("lin bugfix"); @@ -94,7 +94,7 @@ void RASocket::OnRead() bool gotenter=false; unsigned int y=0; for (; y<sz; y++) - if(inp[y]=='\r'||inp[y]=='\n') + if (inp[y]=='\r'||inp[y]=='\n') { gotenter=true; break; @@ -104,7 +104,7 @@ void RASocket::OnRead() memcpy(&buff[iInputLength],inp,y); iInputLength+=y; delete [] inp; - if(gotenter) + if (gotenter) { buff[iInputLength]=0; @@ -113,7 +113,7 @@ void RASocket::OnRead() { /// <ul> <li> If the input is 'USER <username>' case NONE: - if(!memcmp(buff,"USER ",5)) //got "USER" cmd + if (!memcmp(buff,"USER ",5)) //got "USER" cmd { szLogin=&buff[5]; @@ -129,11 +129,11 @@ void RASocket::OnRead() QueryResult_AutoPtr result = LoginDatabase.PQuery("SELECT a.id, aa.gmlevel, aa.RealmID FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = '%s'",login.c_str ()); ///- If the user is not found, deny access - if(!result) + if (!result) { Sendf("-No such user.\r\n"); sLog.outRemote("User %s does not exist.\n",szLogin.c_str()); - if(bSecure)SetCloseAndDelete(); + if (bSecure)SetCloseAndDelete(); } else { @@ -142,18 +142,18 @@ void RASocket::OnRead() //szPass=fields[0].GetString(); ///- if gmlevel is too low, deny access - if(fields[1].GetUInt32()<iMinLevel || fields[1].GetUInt32() == NULL) + if (fields[1].GetUInt32() < iMinLevel) { Sendf("-Not enough privileges.\r\n"); sLog.outRemote("User %s has no privilege.\n",szLogin.c_str()); - if(bSecure)SetCloseAndDelete(); + if (bSecure)SetCloseAndDelete(); } - else if(fields[2].GetInt32() != -1) + else if (fields[2].GetInt32() != -1) { ///- if RealmID isn't -1, deny access Sendf("-Not enough privileges.\r\n"); sLog.outRemote("User %s has to be assigned on all realms (with RealmID = '-1').\n",szLogin.c_str()); - if(bSecure)SetCloseAndDelete(); + if (bSecure)SetCloseAndDelete(); } else { @@ -164,7 +164,7 @@ void RASocket::OnRead() break; ///<li> If the input is 'PASS <password>' (and the user already gave his username) case LG: - if(!memcmp(buff,"PASS ",5)) //got "PASS" cmd + if (!memcmp(buff,"PASS ",5)) //got "PASS" cmd { //login+pass ok ///- If password is correct, increment the number of active administrators std::string login = szLogin; @@ -179,7 +179,7 @@ void RASocket::OnRead() "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash=SHA1(CONCAT('%s',':','%s'))", login.c_str(), login.c_str(), pw.c_str()); - if(check) + if (check) { GetSocket(); stage=OK; @@ -193,13 +193,13 @@ void RASocket::OnRead() ///- Else deny access Sendf("-Wrong pass.\r\n"); sLog.outRemote("User %s has failed to log in.\n",szLogin.c_str()); - if(bSecure)SetCloseAndDelete(); + if (bSecure)SetCloseAndDelete(); } } break; ///<li> If user is logged, parse and execute the command case OK: - if(strlen(buff)) + if (strlen(buff)) { sLog.outRemote("Got '%s' cmd.\n",buff); SetDeleteByHandler(false); @@ -219,7 +219,7 @@ void RASocket::OnRead() /// Output function void RASocket::zprint(void* callbackArg, const char * szText ) { - if( !szText ) + if ( !szText ) return; unsigned int sz=strlen(szText); @@ -232,6 +232,6 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/) raSocket->Sendf("TC>"); uint64 remainingCommands = --raSocket->pendingCommands; - if(remainingCommands == 0) + if (remainingCommands == 0) raSocket->SetDeleteByHandler(true); } diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index caa64becf0b..2a52e054acd 100644 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -164,10 +164,10 @@ void SOAPCommand::commandFinished(void* soapconnection, bool success) //////////////////////////////////////////////////////////////////////////////// struct Namespace namespaces[] = -{ { "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/" }, // must be first - { "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/" }, // must be second - { "xsi", "http://www.w3.org/1999/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance" }, - { "xsd", "http://www.w3.org/1999/XMLSchema", "http://www.w3.org/*/XMLSchema" }, - { "ns1", "urn:TC" }, // "ns1" namespace prefix - { NULL, NULL } +{ { "SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", NULL, NULL }, // must be first + { "SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", NULL, NULL }, // must be second + { "xsi", "http://www.w3.org/1999/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL }, + { "xsd", "http://www.w3.org/1999/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL }, + { "ns1", "urn:TC", NULL, NULL }, // "ns1" namespace prefix + { NULL, NULL, NULL, NULL } }; |
