From aeff8f9d1a3e83311669b94aea63e7529d1dacca Mon Sep 17 00:00:00 2001 From: Schmoozerd Date: Thu, 19 Jul 2012 22:03:32 +0200 Subject: [PATCH] [12062] Cleanup MaNGOS sources --- src/game/debugcmds.cpp | 180 ++--- src/mangosd/CliRunnable.cpp | 73 +- src/mangosd/MaNGOSsoap.cpp | 45 +- src/mangosd/MaNGOSsoap.h | 16 +- src/mangosd/Main.cpp | 76 +-- src/mangosd/Master.cpp | 270 ++++---- src/mangosd/RASocket.cpp | 97 +-- src/mangosd/RASocket.h | 16 +- src/mangosd/WorldRunnable.cpp | 12 +- src/mangosd/soapC.cpp | 918 ++++++++++++++------------ src/mangosd/soapH.h | 204 +++--- src/mangosd/soapServer.cpp | 60 +- src/mangosd/soapStub.h | 58 +- src/shared/Auth/AuthCrypt.cpp | 10 +- src/shared/Auth/AuthCrypt.h | 6 +- src/shared/Auth/BigNumber.cpp | 42 +- src/shared/Auth/BigNumber.h | 42 +- src/shared/Auth/HMACSHA1.cpp | 10 +- src/shared/Auth/HMACSHA1.h | 12 +- src/shared/Auth/SARC4.cpp | 6 +- src/shared/Auth/SARC4.h | 6 +- src/shared/Auth/Sha1.cpp | 10 +- src/shared/Auth/Sha1.h | 8 +- src/shared/Auth/md5.h | 10 +- src/shared/ByteBuffer.h | 110 +-- src/shared/Common.cpp | 23 +- src/shared/Common.h | 4 +- src/shared/Config/Config.cpp | 10 +- src/shared/Config/Config.h | 4 +- src/shared/LockedQueue.h | 20 +- src/shared/Log.cpp | 140 ++-- src/shared/Log.h | 98 +-- src/shared/PosixDaemon.cpp | 23 +- src/shared/ProgressBar.cpp | 52 +- src/shared/ProgressBar.h | 4 +- src/shared/ServiceWin32.cpp | 44 +- src/shared/Threading.cpp | 32 +- src/shared/Threading.h | 8 +- src/shared/Timer.h | 2 +- src/shared/Util.cpp | 111 ++-- src/shared/Util.h | 114 ++-- src/shared/WheatyExceptionReport.cpp | 770 ++++++++++----------- src/shared/WheatyExceptionReport.h | 26 +- src/shared/WorldPacket.h | 6 +- src/shared/revision_nr.h | 2 +- src/tools/genrevision/genrevision.cpp | 56 +- 46 files changed, 1982 insertions(+), 1864 deletions(-) diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index a20050bca..04de1a0bb 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -65,7 +65,7 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(char* args) bool ChatHandler::HandleDebugSendPoiCommand(char* args) { - Player *pPlayer = m_session->GetPlayer(); + Player* pPlayer = m_session->GetPlayer(); Unit* target = getSelectedUnit(); if (!target) { @@ -118,7 +118,7 @@ bool ChatHandler::HandleDebugSendBuyErrorCommand(char* args) bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/) { - Unit *unit = getSelectedUnit(); + Unit* unit = getSelectedUnit(); if (!unit || (unit->GetTypeId() != TYPEID_PLAYER)) unit = m_session->GetPlayer(); @@ -131,51 +131,51 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/) WorldPacket data(opcode, 0); - while(!ifs.eof()) + while (!ifs.eof()) { std::string type; ifs >> type; - if(type == "") + if (type == "") break; - if(type == "uint8") + if (type == "uint8") { uint16 val1; ifs >> val1; data << uint8(val1); } - else if(type == "uint16") + else if (type == "uint16") { uint16 val2; ifs >> val2; data << val2; } - else if(type == "uint32") + else if (type == "uint32") { uint32 val3; ifs >> val3; data << val3; } - else if(type == "uint64") + else if (type == "uint64") { uint64 val4; ifs >> val4; data << val4; } - else if(type == "float") + else if (type == "float") { float val5; ifs >> val5; data << val5; } - else if(type == "string") + else if (type == "string") { std::string val6; ifs >> val6; data << val6; } - else if(type == "pguid") + else if (type == "pguid") { data << unit->GetPackGUID(); } @@ -281,7 +281,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args) //Send notification in channel bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args) { - const char *name = "test"; + const char* name = "test"; uint32 code; if (!ExtractUInt32(&args, code) || code > 255) @@ -299,7 +299,7 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args) //Send notification in chat bool ChatHandler::HandleDebugSendChatMsgCommand(char* args) { - const char *msg = "testtest"; + const char* msg = "testtest"; uint32 type; if (!ExtractUInt32(&args, type) || type > 255) @@ -329,11 +329,11 @@ bool ChatHandler::HandleDebugGetLootRecipientCommand(char* /*args*/) if (!target->HasLootRecipient()) SendSysMessage("loot recipient: no loot recipient"); - else if(Player* recipient = target->GetLootRecipient()) + else if (Player* recipient = target->GetLootRecipient()) PSendSysMessage("loot recipient: %s with raw data %s from group %u", - recipient->GetGuidStr().c_str(), - target->GetLootRecipientGuid().GetString().c_str(), - target->GetLootGroupRecipientId()); + recipient->GetGuidStr().c_str(), + target->GetLootRecipientGuid().GetString().c_str(), + target->GetLootGroupRecipientId()); else SendSysMessage("loot recipient: offline "); @@ -393,27 +393,27 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) SendSysMessage(state_str.c_str()); for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { - if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) + if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) continue; - Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!item) continue; if (!item->IsBag()) { if (item->GetState() == state) PSendSysMessage("%s bag: 255 slot: %u owner: %s", - item->GetGuidStr().c_str(), item->GetSlot(), item->GetOwnerGuid().GetString().c_str()); + item->GetGuidStr().c_str(), item->GetSlot(), item->GetOwnerGuid().GetString().c_str()); } else { - Bag *bag = (Bag*)item; + Bag* bag = (Bag*)item; for (uint8 j = 0; j < bag->GetBagSize(); ++j) { Item* item2 = bag->GetItemByPos(j); if (item2 && item2->GetState() == state) PSendSysMessage("%s bag: %u slot: %u owner: %s", - item2->GetGuidStr().c_str(), item2->GetBagSlot(), item2->GetSlot(), - item2->GetOwnerGuid().GetString().c_str()); + item2->GetGuidStr().c_str(), item2->GetBagSlot(), item2->GetSlot(), + item2->GetOwnerGuid().GetString().c_str()); } } } @@ -421,17 +421,17 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) if (list_queue) { - std::vector &updateQueue = player->GetItemUpdateQueue(); - for(size_t i = 0; i < updateQueue.size(); ++i) + std::vector& updateQueue = player->GetItemUpdateQueue(); + for (size_t i = 0; i < updateQueue.size(); ++i) { - Item *item = updateQueue[i]; - if(!item) continue; + Item* item = updateQueue[i]; + if (!item) continue; - Bag *container = item->GetContainer(); + Bag* container = item->GetContainer(); uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0); std::string st; - switch(item->GetState()) + switch (item->GetState()) { case ITEM_UNCHANGED: st = "unchanged"; break; case ITEM_CHANGED: st = "changed"; break; @@ -440,7 +440,7 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) } PSendSysMessage("%s bag: %u slot: %u - state: %s", - item->GetGuidStr().c_str(), bag_slot, item->GetSlot(), st.c_str()); + item->GetGuidStr().c_str(), bag_slot, item->GetSlot(), st.c_str()); } if (updateQueue.empty()) PSendSysMessage("updatequeue empty"); @@ -449,35 +449,35 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) if (check_all) { bool error = false; - std::vector &updateQueue = player->GetItemUpdateQueue(); + std::vector& updateQueue = player->GetItemUpdateQueue(); for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { - if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) + if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) continue; - Item *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!item) continue; if (item->GetSlot() != i) { PSendSysMessage("%s at slot %u has an incorrect slot value: %d", - item->GetGuidStr().c_str(), i, item->GetSlot()); + item->GetGuidStr().c_str(), i, item->GetSlot()); error = true; continue; } if (item->GetOwnerGuid() != player->GetObjectGuid()) { PSendSysMessage("%s at slot %u owner (%s) and inventory owner (%s) don't match!", - item->GetGuidStr().c_str(), item->GetSlot(), - item->GetOwnerGuid().GetString().c_str(), player->GetGuidStr().c_str()); + item->GetGuidStr().c_str(), item->GetSlot(), + item->GetOwnerGuid().GetString().c_str(), player->GetGuidStr().c_str()); error = true; continue; } - if (Bag *container = item->GetContainer()) + if (Bag* container = item->GetContainer()) { PSendSysMessage("%s at slot %u has a container %s from slot %u but shouldnt!", - item->GetGuidStr().c_str(), item->GetSlot(), - container->GetGuidStr().c_str(), container->GetSlot()); + item->GetGuidStr().c_str(), item->GetSlot(), + container->GetGuidStr().c_str(), container->GetSlot()); error = true; continue; } @@ -487,35 +487,35 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) if (qp > updateQueue.size()) { PSendSysMessage("%s at slot %u has a queuepos (%d) larger than the update queue size! ", - item->GetGuidStr().c_str(), item->GetSlot(), qp); + item->GetGuidStr().c_str(), item->GetSlot(), qp); error = true; continue; } if (updateQueue[qp] == NULL) { PSendSysMessage("%s at slot %u has a queuepos (%d) that points to NULL in the queue!", - item->GetGuidStr().c_str(), item->GetSlot(), qp); + item->GetGuidStr().c_str(), item->GetSlot(), qp); error = true; continue; } if (updateQueue[qp] != item) { PSendSysMessage("%s at slot %u has a queuepos (%d) that points to %s in the queue (bag %u, slot %u)", - item->GetGuidStr().c_str(), item->GetSlot(), qp, - updateQueue[qp]->GetGuidStr().c_str(), updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot()); + item->GetGuidStr().c_str(), item->GetSlot(), qp, + updateQueue[qp]->GetGuidStr().c_str(), updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot()); error = true; continue; } } else if (item->GetState() != ITEM_UNCHANGED) { PSendSysMessage("%s at slot %u is not in queue but should be (state: %d)!", - item->GetGuidStr().c_str(), item->GetSlot(), item->GetState()); + item->GetGuidStr().c_str(), item->GetSlot(), item->GetState()); error = true; continue; } - if(item->IsBag()) + if (item->IsBag()) { - Bag *bag = (Bag*)item; + Bag* bag = (Bag*)item; for (uint8 j = 0; j < bag->GetBagSize(); ++j) { Item* item2 = bag->GetItemByPos(j); @@ -524,31 +524,31 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) if (item2->GetSlot() != j) { PSendSysMessage("%s in bag %u at slot %u has an incorrect slot value: %u", - item2->GetGuidStr().c_str(), bag->GetSlot(), j, item2->GetSlot()); + item2->GetGuidStr().c_str(), bag->GetSlot(), j, item2->GetSlot()); error = true; continue; } if (item2->GetOwnerGuid() != player->GetObjectGuid()) { PSendSysMessage("%s in bag %u at slot %u owner (%s) and inventory owner (%s) don't match!", - item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), - item2->GetOwnerGuid().GetString().c_str(), player->GetGuidStr().c_str()); + item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), + item2->GetOwnerGuid().GetString().c_str(), player->GetGuidStr().c_str()); error = true; continue; } - Bag *container = item2->GetContainer(); + Bag* container = item2->GetContainer(); if (!container) { PSendSysMessage("%s in bag %u at slot %u has no container!", - item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot()); + item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot()); error = true; continue; } if (container != bag) { PSendSysMessage("%s in bag %u at slot %u has a different container %s from slot %u!", - item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), - container->GetGuidStr().c_str(), container->GetSlot()); + item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), + container->GetGuidStr().c_str(), container->GetSlot()); error = true; continue; } @@ -558,70 +558,70 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args) if (qp > updateQueue.size()) { PSendSysMessage("%s in bag %u at slot %u has a queuepos (%d) larger than the update queue size! ", - item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), qp); + item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), qp); error = true; continue; } if (updateQueue[qp] == NULL) { PSendSysMessage("%s in bag %u at slot %u has a queuepos (%d) that points to NULL in the queue!", - item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), qp); + item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), qp); error = true; continue; } if (updateQueue[qp] != item2) { PSendSysMessage("%s in bag %u at slot %u has a queuepos (%d) that points to %s in the queue (bag %u slot %u)", - item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), qp, - updateQueue[qp]->GetGuidStr().c_str(), updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot()); + item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), qp, + updateQueue[qp]->GetGuidStr().c_str(), updateQueue[qp]->GetBagSlot(), updateQueue[qp]->GetSlot()); error = true; continue; } } else if (item2->GetState() != ITEM_UNCHANGED) { PSendSysMessage("%s in bag %u at slot %u is not in queue but should be (state: %d)!", - item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), item2->GetState()); + item2->GetGuidStr().c_str(), bag->GetSlot(), item2->GetSlot(), item2->GetState()); error = true; continue; } } } } - for(size_t i = 0; i < updateQueue.size(); ++i) + for (size_t i = 0; i < updateQueue.size(); ++i) { - Item *item = updateQueue[i]; - if(!item) continue; + Item* item = updateQueue[i]; + if (!item) continue; if (item->GetOwnerGuid() != player->GetObjectGuid()) { PSendSysMessage("queue(" SIZEFMTD "): %s has the owner (%s) and inventory owner (%s) don't match!", - i, item->GetGuidStr().c_str(), - item->GetOwnerGuid().GetString().c_str(), player->GetGuidStr().c_str()); + i, item->GetGuidStr().c_str(), + item->GetOwnerGuid().GetString().c_str(), player->GetGuidStr().c_str()); error = true; continue; } if (item->GetQueuePos() != i) { PSendSysMessage("queue(" SIZEFMTD "): %s has queuepos doesn't match it's position in the queue!", - i, item->GetGuidStr().c_str()); + i, item->GetGuidStr().c_str()); error = true; continue; } if (item->GetState() == ITEM_REMOVED) continue; - Item *test = player->GetItemByPos( item->GetBagSlot(), item->GetSlot()); + Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot()); if (test == NULL) { PSendSysMessage("queue(" SIZEFMTD "): %s has incorrect (bag %u slot %u) values, the player doesn't have an item at that position!", - i, item->GetGuidStr().c_str(), item->GetBagSlot(), item->GetSlot()); + i, item->GetGuidStr().c_str(), item->GetBagSlot(), item->GetSlot()); error = true; continue; } if (test != item) { PSendSysMessage("queue(" SIZEFMTD "): %s has incorrect (bag %u slot %u) values, the %s is there instead!", - i, item->GetGuidStr().c_str(), item->GetBagSlot(), item->GetSlot(), - test->GetGuidStr().c_str()); + i, item->GetGuidStr().c_str(), item->GetBagSlot(), item->GetSlot(), + test->GetGuidStr().c_str()); error = true; continue; } } @@ -646,7 +646,7 @@ bool ChatHandler::HandleDebugArenaCommand(char* /*args*/) bool ChatHandler::HandleDebugSpellCheckCommand(char* /*args*/) { - sLog.outString( "Check expected in code spell properties base at table 'spell_check' content..."); + sLog.outString("Check expected in code spell properties base at table 'spell_check' content..."); sSpellMgr.CheckUsedSpells("spell_check"); return true; } @@ -655,7 +655,7 @@ bool ChatHandler::HandleDebugSendLargePacketCommand(char* /*args*/) { const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. "; std::ostringstream ss; - while(ss.str().size() < 128000) + while (ss.str().size() < 128000) ss << stuffingString; SendSysMessage(ss.str().c_str()); return true; @@ -699,7 +699,7 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(char* args) if (!state) { // reset all states - for(int i = 1; i <= 32; ++i) + for (int i = 1; i <= 32; ++i) unit->ModifyAuraState(AuraState(i),false); return true; } @@ -733,7 +733,7 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS else return false; - if(base) + if (base) { uint32 iValue; if (!ExtractUInt32Base(&valStr, iValue, base)) @@ -750,7 +750,7 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS return false; DEBUG_LOG(GetMangosString(LANG_SET_FLOAT), guid.GetString().c_str(), field, fValue); - target->SetFloatValue(field , fValue ); + target->SetFloatValue(field , fValue); PSendSysMessage(LANG_SET_FLOAT_FIELD, guid.GetString().c_str(), field, fValue); } @@ -775,7 +775,7 @@ bool ChatHandler::HandleDebugSetItemValueCommand(char* args) if (!valStr) return false; - Item *item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid)); + Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid)); if (!item) return false; @@ -785,7 +785,7 @@ bool ChatHandler::HandleDebugSetItemValueCommand(char* args) bool ChatHandler::HandleDebugSetValueCommand(char* args) { Unit* target = getSelectedUnit(); - if(!target) + if (!target) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); SetSentErrorMessage(true); @@ -835,7 +835,7 @@ bool ChatHandler::HandleGetValueHelper(Object* target, uint32 field, char* typeS { uint32 iValue = target->GetUInt32Value(field); - switch(base) + switch (base) { case 2: { @@ -893,7 +893,7 @@ bool ChatHandler::HandleDebugGetItemValueCommand(char* args) bool ChatHandler::HandleDebugGetValueCommand(char* args) { Unit* target = getSelectedUnit(); - if(!target) + if (!target) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); SetSentErrorMessage(true); @@ -911,7 +911,7 @@ bool ChatHandler::HandleDebugGetValueCommand(char* args) return HandleGetValueHelper(target, field, typeStr); } -bool ChatHandler::HandlerDebugModValueHelper( Object* target, uint32 field, char* typeStr, char* valStr ) +bool ChatHandler::HandlerDebugModValueHelper(Object* target, uint32 field, char* typeStr, char* valStr) { ObjectGuid guid = target->GetObjectGuid(); @@ -944,7 +944,7 @@ bool ChatHandler::HandlerDebugModValueHelper( Object* target, uint32 field, char uint32 value = target->GetUInt32Value(field); - switch(type) + switch (type) { default: case 1: // int + @@ -1008,7 +1008,7 @@ bool ChatHandler::HandleDebugModItemValueCommand(char* args) if (!valStr) return false; - Item *item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid)); + Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid)); if (!item) return false; @@ -1018,7 +1018,7 @@ bool ChatHandler::HandleDebugModItemValueCommand(char* args) bool ChatHandler::HandleDebugModValueCommand(char* args) { Unit* target = getSelectedUnit(); - if(!target) + if (!target) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); SetSentErrorMessage(true); @@ -1046,7 +1046,7 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args) if (!spellid) return false; - SpellEntry const * spellEntry = sSpellStore.LookupEntry(spellid); + SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellid); if (!spellEntry) return false; @@ -1056,11 +1056,11 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args) float dot_calc = CalculateDefaultCoefficient(spellEntry, DOT); bool isDirectHeal = false; - for(int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { // Heals (Also count Mana Shield and Absorb effects as heals) if (spellEntry->Effect[i] == SPELL_EFFECT_HEAL || spellEntry->Effect[i] == SPELL_EFFECT_HEAL_MAX_HEALTH || - (spellEntry->Effect[i] == SPELL_EFFECT_APPLY_AURA && (spellEntry->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_ABSORB || spellEntry->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL)) ) + (spellEntry->Effect[i] == SPELL_EFFECT_APPLY_AURA && (spellEntry->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_ABSORB || spellEntry->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL))) { isDirectHeal = true; break; @@ -1068,7 +1068,7 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args) } bool isDotHeal = false; - for(int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { // Periodic Heals if (spellEntry->Effect[i] == SPELL_EFFECT_APPLY_AURA && spellEntry->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL) @@ -1084,9 +1084,9 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args) char const* dotDamageStr = GetMangosString(LANG_DOT_DAMAGE); PSendSysMessage(LANG_SPELLCOEFS, spellid, isDirectHeal ? directHealStr : directDamageStr, - direct_calc, direct_calc * 1.88f, bonus ? bonus->direct_damage : 0.0f, bonus ? bonus->ap_bonus : 0.0f); + direct_calc, direct_calc * 1.88f, bonus ? bonus->direct_damage : 0.0f, bonus ? bonus->ap_bonus : 0.0f); PSendSysMessage(LANG_SPELLCOEFS, spellid, isDotHeal ? dotHealStr : dotDamageStr, - dot_calc, dot_calc * 1.88f, bonus ? bonus->dot_damage : 0.0f, bonus ? bonus->ap_dot_bonus : 0.0f); + dot_calc, dot_calc * 1.88f, bonus ? bonus->dot_damage : 0.0f, bonus ? bonus->ap_dot_bonus : 0.0f); return true; } @@ -1117,7 +1117,7 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args) if (!ExtractInt32(&args, value)) return false; - Player *chr = getSelectedPlayer(); + Player* chr = getSelectedPlayer(); if (chr == NULL) { SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -1130,10 +1130,10 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args) return false; PSendSysMessage(LANG_YOU_CHANGE_SPELLMODS, opcode == SMSG_SET_FLAT_SPELL_MODIFIER ? "flat" : "pct", - spellmodop, value, effidx, GetNameLink(chr).c_str()); + spellmodop, value, effidx, GetNameLink(chr).c_str()); if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPELLMODS_CHANGED, GetNameLink().c_str(), - opcode == SMSG_SET_FLAT_SPELL_MODIFIER ? "flat" : "pct", spellmodop, value, effidx); + opcode == SMSG_SET_FLAT_SPELL_MODIFIER ? "flat" : "pct", spellmodop, value, effidx); WorldPacket data(opcode, (1+1+2+2)); data << uint8(effidx); diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index c2951c2bf..b2837f828 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -39,7 +39,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]; @@ -71,11 +71,11 @@ bool ChatHandler::HandleAccountDeleteCommand(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); - switch(result) + switch (result) { case AOR_OK: PSendSysMessage(LANG_ACCOUNT_DELETED,account_name.c_str()); @@ -115,7 +115,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()); @@ -137,12 +137,13 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s info.accountId = fields[2].GetUInt32(); // account name will be empty for nonexistent account - sAccountMgr.GetName (info.accountId, info.accountName); + sAccountMgr.GetName(info.accountId, info.accountName); info.deleteDate = time_t(fields[3].GetUInt64()); foundList.push_back(info); - } while (resultChar->NextRow()); + } + while (resultChar->NextRow()); delete resultChar; } @@ -161,7 +162,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; @@ -172,7 +173,7 @@ std::string ChatHandler::GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList:: } DeletedInfoList::const_iterator itr2 = itr; - if(++itr2 != itr_end) + if (++itr2 != itr_end) wherestr << "','"; } wherestr << "')"; @@ -204,12 +205,12 @@ void ChatHandler::HandleCharacterDeletedListHelper(DeletedInfoList const& foundL if (!m_session) PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE, - itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), - itr->accountId, dateStr.c_str()); + itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), + itr->accountId, dateStr.c_str()); else PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT, - itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), - itr->accountId, dateStr.c_str()); + itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "" : itr->accountName.c_str(), + itr->accountId, dateStr.c_str()); } if (!m_session) @@ -276,7 +277,7 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo } CharacterDatabase.PExecute("UPDATE characters SET name='%s', account='%u', deleteDate=NULL, deleteInfos_Name=NULL, deleteInfos_Account=NULL WHERE deleteDate IS NOT NULL AND guid = %u", - delInfo.name.c_str(), delInfo.accountId, delInfo.lowguid); + delInfo.name.c_str(), delInfo.accountId, delInfo.lowguid); } /** @@ -334,7 +335,7 @@ bool ChatHandler::HandleCharacterDeletedRestoreCommand(char* args) if (newAccount && newAccount != delInfo.accountId) { delInfo.accountId = newAccount; - sAccountMgr.GetName (newAccount, delInfo.accountName); + sAccountMgr.GetName(newAccount, delInfo.accountName); } HandleCharacterDeletedRestoreHelper(delInfo); @@ -375,7 +376,7 @@ bool ChatHandler::HandleCharacterDeletedDeleteCommand(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(ObjectGuid(HIGHGUID_PLAYER, itr->lowguid), 0, false, true); return true; @@ -429,7 +430,7 @@ bool ChatHandler::HandleCharacterEraseCommand(char* args) account_id = sObjectMgr.GetPlayerAccountIdByGUID(target_guid); std::string account_name; - sAccountMgr.GetName (account_id,account_name); + sAccountMgr.GetName(account_id,account_name); Player::DeleteFromDB(target_guid, account_id, true, true); PSendSysMessage(LANG_CHARACTER_DELETED, target_name.c_str(), target_guid.GetCounter(), account_name.c_str(), account_id); @@ -461,7 +462,7 @@ bool ChatHandler::HandleAccountOnlineListCommand(char* args) ///- Get the list of accounts ID logged to the realm // 0 1 2 3 4 - QueryResult *result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE active_realm_id = %u", realmID); + QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE active_realm_id = %u", realmID); return ShowAccountListHelper(result,&limit); } @@ -470,9 +471,9 @@ bool ChatHandler::HandleAccountOnlineListCommand(char* args) bool ChatHandler::HandleAccountCreateCommand(char* args) { ///- %Parse the command line arguments - char *szAcc = ExtractQuotedOrLiteralArg(&args); - char *szPassword = ExtractQuotedOrLiteralArg(&args); - if(!szAcc || !szPassword) + char* szAcc = ExtractQuotedOrLiteralArg(&args); + char* szPassword = ExtractQuotedOrLiteralArg(&args); + if (!szAcc || !szPassword) return false; // normalized in accmgr.CreateAccount @@ -480,7 +481,7 @@ bool ChatHandler::HandleAccountCreateCommand(char* args) std::string password = szPassword; AccountOpResult result = sAccountMgr.CreateAccount(account_name, password); - switch(result) + switch (result) { case AOR_OK: PSendSysMessage(LANG_ACCOUNT_CREATED,account_name.c_str()); @@ -512,13 +513,13 @@ bool ChatHandler::HandleServerLogFilterCommand(char* args) if (!*args) { SendSysMessage(LANG_LOG_FILTERS_STATE_HEADER); - for(int i = 0; i < LOG_FILTER_COUNT; ++i) + for (int i = 0; i < LOG_FILTER_COUNT; ++i) if (*logFilterData[i].name) PSendSysMessage(" %-20s = %s",logFilterData[i].name, GetOnOffStr(sLog.HasLogFilter(1 << i))); return true; } - char *filtername = ExtractLiteralArg(&args); + char* filtername = ExtractLiteralArg(&args); if (!filtername) return false; @@ -537,7 +538,7 @@ bool ChatHandler::HandleServerLogFilterCommand(char* args) return true; } - for(int i = 0; i < LOG_FILTER_COUNT; ++i) + for (int i = 0; i < LOG_FILTER_COUNT; ++i) { if (!*logFilterData[i].name) continue; @@ -554,7 +555,7 @@ bool ChatHandler::HandleServerLogFilterCommand(char* args) } /// Set the level of logging -bool ChatHandler::HandleServerLogLevelCommand(char *args) +bool ChatHandler::HandleServerLogLevelCommand(char* args) { if (!*args) { @@ -605,32 +606,32 @@ void CliRunnable::run() while (!World::IsStopped()) { fflush(stdout); - #ifdef linux +#ifdef linux while (!kb_hit_return() && !World::IsStopped()) // With this, we limit CLI to 10commands/second usleep(100); if (World::IsStopped()) break; - #endif - char *command_str = fgets(commandbuf,sizeof(commandbuf),stdin); +#endif + char* command_str = fgets(commandbuf,sizeof(commandbuf),stdin); if (command_str != NULL) { - for(int x=0;command_str[x];x++) - if(command_str[x]=='\r'||command_str[x]=='\n') - { - command_str[x]=0; - break; - } + for (int x=0; command_str[x]; x++) + if (command_str[x]=='\r'||command_str[x]=='\n') + { + command_str[x]=0; + break; + } - if(!*command_str) + if (!*command_str) { printf("mangos>"); continue; } 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 { printf("mangos>"); continue; diff --git a/src/mangosd/MaNGOSsoap.cpp b/src/mangosd/MaNGOSsoap.cpp index 68bc953ba..14f63f868 100644 --- a/src/mangosd/MaNGOSsoap.cpp +++ b/src/mangosd/MaNGOSsoap.cpp @@ -24,7 +24,7 @@ void MaNGOSsoapRunnable::run() { // create pool SOAPWorkingThread pool; - pool.activate (THR_NEW_LWP | THR_JOINABLE, POOL_SIZE); + pool.activate(THR_NEW_LWP | THR_JOINABLE, POOL_SIZE); struct soap soap; int m, s; @@ -46,7 +46,7 @@ void MaNGOSsoapRunnable::run() sLog.outString("MaNGOSsoap: bound to http://%s:%d", m_host.c_str(), m_port); - while(!World::IsStopped()) + while (!World::IsStopped()) { s = soap_accept(&soap); @@ -59,23 +59,23 @@ void MaNGOSsoapRunnable::run() DEBUG_LOG("MaNGOSsoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); struct soap* thread_soap = soap_copy(&soap);// make a safe copy - ACE_Message_Block *mb = new ACE_Message_Block(sizeof(struct soap*)); - ACE_OS::memcpy (mb->wr_ptr (), &thread_soap, sizeof(struct soap*)); + ACE_Message_Block* mb = new ACE_Message_Block(sizeof(struct soap*)); + ACE_OS::memcpy(mb->wr_ptr(), &thread_soap, sizeof(struct soap*)); pool.putq(mb); } - pool.msg_queue ()->deactivate (); - pool.wait (); + pool.msg_queue()->deactivate(); + pool.wait(); soap_done(&soap); } -void SOAPWorkingThread::process_message (ACE_Message_Block *mb) +void SOAPWorkingThread::process_message(ACE_Message_Block* mb) { - ACE_TRACE (ACE_TEXT ("SOAPWorkingThread::process_message")); + ACE_TRACE(ACE_TEXT("SOAPWorkingThread::process_message")); struct soap* soap; - ACE_OS::memcpy (&soap, mb->rd_ptr (), sizeof(struct soap*)); - mb->release (); + ACE_OS::memcpy(&soap, mb->rd_ptr(), sizeof(struct soap*)); + mb->release(); soap_serve(soap); soap_destroy(soap); // dealloc C++ data @@ -98,25 +98,25 @@ int ns1__executeCommand(soap* soap, char* command, char** result) } uint32 accountId = sAccountMgr.GetId(soap->userid); - if(!accountId) + if (!accountId) { DEBUG_LOG("MaNGOSsoap: Client used invalid username '%s'", soap->userid); return 401; } - if(!sAccountMgr.CheckPassword(accountId, soap->passwd)) + if (!sAccountMgr.CheckPassword(accountId, soap->passwd)) { DEBUG_LOG("MaNGOSsoap: invalid password for account '%s'", soap->userid); return 401; } - if(sAccountMgr.GetSecurity(accountId) < SEC_ADMINISTRATOR) + if (sAccountMgr.GetSecurity(accountId) < SEC_ADMINISTRATOR) { DEBUG_LOG("MaNGOSsoap: %s's gmlevel is too low", soap->userid); return 403; } - if(!command || !*command) + if (!command || !*command) return soap_sender_fault(soap, "Command mustn't be empty", "The supplied command was an empty string"); DEBUG_LOG("MaNGOSsoap: got command '%s'", command); @@ -132,7 +132,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) // wait for callback to complete command int acc = connection.pendingCommands.acquire(); - if(acc) + if (acc) { sLog.outError("MaNGOSsoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno); } @@ -140,7 +140,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) // alright, command finished char* printBuffer = soap_strdup(soap, connection.m_printBuffer.c_str()); - if(connection.hasCommandSucceeded()) + if (connection.hasCommandSucceeded()) { *result = printBuffer; return SOAP_OK; @@ -164,10 +164,11 @@ 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:MaNGOS" }, // "ns1" namespace prefix - { NULL, NULL } +{ + { "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:MaNGOS" }, // "ns1" namespace prefix + { NULL, NULL } }; diff --git a/src/mangosd/MaNGOSsoap.h b/src/mangosd/MaNGOSsoap.h index 409cbf20e..c47bada5c 100644 --- a/src/mangosd/MaNGOSsoap.h +++ b/src/mangosd/MaNGOSsoap.h @@ -49,29 +49,29 @@ class MaNGOSsoapRunnable: public ACE_Based::Runnable class SOAPWorkingThread : public ACE_Task { public: - SOAPWorkingThread () + SOAPWorkingThread() { } - virtual int svc (void) + virtual int svc(void) { while (1) { - ACE_Message_Block *mb = 0; - if (this->getq (mb) == -1) + ACE_Message_Block* mb = 0; + if (this->getq(mb) == -1) { - ACE_DEBUG ((LM_INFO, - ACE_TEXT ("(%t) Shutting down\n"))); + ACE_DEBUG((LM_INFO, + ACE_TEXT("(%t) Shutting down\n"))); break; } // Process the message. - process_message (mb); + process_message(mb); } return 0; } private: - void process_message (ACE_Message_Block *mb); + void process_message(ACE_Message_Block* mb); }; diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index dda2ad8ce..e4fc62983 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -58,33 +58,33 @@ DatabaseType LoginDatabase; ///< Accessor to the uint32 realmID; ///< Id of the realm /// Print out the usage string for this program on the console. -void usage(const char *prog) +void usage(const char* prog) { sLog.outString("Usage: \n %s []\n" - " -v, --version print version and exist\n\r" - " -c config_file use config_file as configuration file\n\r" - " -a, --ahbot config_file use config_file as ahbot configuration file\n\r" - #ifdef WIN32 - " Running as service functions:\n\r" - " -s run run as service\n\r" - " -s install install service\n\r" - " -s uninstall uninstall service\n\r" - #else - " Running as daemon functions:\n\r" - " -s run run as daemon\n\r" - " -s stop stop daemon\n\r" - #endif - ,prog); + " -v, --version print version and exist\n\r" + " -c config_file use config_file as configuration file\n\r" + " -a, --ahbot config_file use config_file as ahbot configuration file\n\r" +#ifdef WIN32 + " Running as service functions:\n\r" + " -s run run as service\n\r" + " -s install install service\n\r" + " -s uninstall uninstall service\n\r" +#else + " Running as daemon functions:\n\r" + " -s run run as daemon\n\r" + " -s stop stop daemon\n\r" +#endif + ,prog); } /// Launch the mangos server -extern int main(int argc, char **argv) +extern int main(int argc, char** argv) { ///- Command line parsing char const* cfg_file = _MANGOSD_CONFIG; - char const *options = ":a:c:s:"; + char const* options = ":a:c:s:"; ACE_Get_Opt cmd_opts(argc, argv, options); cmd_opts.long_option("version", 'v', ACE_Get_Opt::NO_ARG); @@ -108,7 +108,7 @@ extern int main(int argc, char **argv) return 0; case 's': { - const char *mode = cmd_opts.opt_arg(); + const char* mode = cmd_opts.opt_arg(); if (!strcmp(mode, "run")) serviceDaemonMode = 'r'; @@ -170,33 +170,33 @@ extern int main(int argc, char **argv) #ifndef WIN32 // posix daemon commands need apply after config read switch (serviceDaemonMode) { - case 'r': - startDaemon(); - break; - case 's': - stopDaemon(); - break; + case 'r': + startDaemon(); + break; + case 's': + stopDaemon(); + break; } #endif - sLog.outString( "%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); - sLog.outString( " to stop." ); + sLog.outString("%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID)); + sLog.outString(" to stop."); sLog.outString("\n\n" - "MM MM MM MM MMMMM MMMM MMMMM\n" - "MM MM MM MM MMM MMM MM MM MMM MMM\n" - "MMM MMM MMM MM MMM MMM MM MM MMM\n" - "MM M MM MMMM MM MMM MM MM MMM\n" - "MM M MM MMMMM MM MMMM MMM MM MM MMM\n" - "MM M MM M MMM MM MMM MMMMMMM MM MM MMM\n" - "MM MM MMM MM MM MM MMM MM MM MMM\n" - "MM MM MMMMMMM MM MM MMM MMM MM MM MMM MMM\n" - "MM MM MM MMM MM MM MMMMMM MMMM MMMMM\n" - " MM MMM http://getmangos.com\n" - " MMMMMM\n\n"); + "MM MM MM MM MMMMM MMMM MMMMM\n" + "MM MM MM MM MMM MMM MM MM MMM MMM\n" + "MMM MMM MMM MM MMM MMM MM MM MMM\n" + "MM M MM MMMM MM MMM MM MM MMM\n" + "MM M MM MMMMM MM MMMM MMM MM MM MMM\n" + "MM M MM M MMM MM MMM MMMMMMM MM MM MMM\n" + "MM MM MMM MM MM MM MMM MM MM MMM\n" + "MM MM MMMMMMM MM MM MMM MMM MM MM MMM MMM\n" + "MM MM MM MMM MM MM MMMMMM MMMM MMMMM\n" + " MM MMM http://getmangos.com\n" + " MMMMMM\n\n"); sLog.outString("Using configuration file %s.", cfg_file); DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - if (SSLeay() < 0x009080bfL ) + if (SSLeay() < 0x009080bfL) { DETAIL_LOG("WARNING: Outdated version of OpenSSL lib. Logins to server may not work!"); DETAIL_LOG("WARNING: Minimal required version [OpenSSL 0.9.8k]"); diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index bc7ef987e..7f3e44ec8 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -21,7 +21,7 @@ */ #ifndef WIN32 - #include "PosixDaemon.h" +#include "PosixDaemon.h" #endif #include "WorldSocketMgr.h" @@ -53,116 +53,116 @@ extern int m_ServiceStatus; #endif -INSTANTIATE_SINGLETON_1( Master ); +INSTANTIATE_SINGLETON_1(Master); volatile uint32 Master::m_masterLoopCounter = 0; class FreezeDetectorRunnable : public ACE_Based::Runnable { -public: - FreezeDetectorRunnable() { _delaytime = 0; } - uint32 m_loops, m_lastchange; - uint32 w_loops, w_lastchange; - uint32 _delaytime; - void SetDelayTime(uint32 t) { _delaytime = t; } - void run(void) - { - if(!_delaytime) - return; - sLog.outString("Starting up anti-freeze thread (%u seconds max stuck time)...",_delaytime/1000); - m_loops = 0; - w_loops = 0; - m_lastchange = 0; - w_lastchange = 0; - while(!World::IsStopped()) + public: + FreezeDetectorRunnable() { _delaytime = 0; } + uint32 m_loops, m_lastchange; + uint32 w_loops, w_lastchange; + uint32 _delaytime; + void SetDelayTime(uint32 t) { _delaytime = t; } + void run(void) { - ACE_Based::Thread::Sleep(1000); - - uint32 curtime = WorldTimer::getMSTime(); - //DEBUG_LOG("anti-freeze: time=%u, counters=[%u; %u]",curtime,Master::m_masterLoopCounter,World::m_worldLoopCounter); - - // normal work - if (w_loops != World::m_worldLoopCounter) + if (!_delaytime) + return; + sLog.outString("Starting up anti-freeze thread (%u seconds max stuck time)...",_delaytime/1000); + m_loops = 0; + w_loops = 0; + m_lastchange = 0; + w_lastchange = 0; + while (!World::IsStopped()) { - w_lastchange = curtime; - w_loops = World::m_worldLoopCounter; - } - // possible freeze - else if (WorldTimer::getMSTimeDiff(w_lastchange, curtime) > _delaytime) - { - sLog.outError("World Thread hangs, kicking out server!"); - *((uint32 volatile*)NULL) = 0; // bang crash + ACE_Based::Thread::Sleep(1000); + + uint32 curtime = WorldTimer::getMSTime(); + //DEBUG_LOG("anti-freeze: time=%u, counters=[%u; %u]",curtime,Master::m_masterLoopCounter,World::m_worldLoopCounter); + + // normal work + if (w_loops != World::m_worldLoopCounter) + { + w_lastchange = curtime; + w_loops = World::m_worldLoopCounter; + } + // possible freeze + else if (WorldTimer::getMSTimeDiff(w_lastchange, curtime) > _delaytime) + { + sLog.outError("World Thread hangs, kicking out server!"); + *((uint32 volatile*)NULL) = 0; // bang crash + } } + sLog.outString("Anti-freeze thread exiting without problems."); } - sLog.outString("Anti-freeze thread exiting without problems."); - } }; class RARunnable : public ACE_Based::Runnable { -private: - ACE_Reactor *m_Reactor; - RASocket::Acceptor *m_Acceptor; -public: - RARunnable() - { - ACE_Reactor_Impl* imp = 0; - - #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) - - imp = new ACE_Dev_Poll_Reactor (); - - imp->max_notify_iterations (128); - imp->restart (1); - - #else - - imp = new ACE_TP_Reactor (); - imp->max_notify_iterations (128); - - #endif - - m_Reactor = new ACE_Reactor (imp, 1 /* 1= delete implementation so we don't have to care */); - - m_Acceptor = new RASocket::Acceptor; - - } - - ~RARunnable() - { - delete m_Reactor; - delete m_Acceptor; - } - - void run () - { - uint16 raport = sConfig.GetIntDefault ("Ra.Port", 3443); - std::string stringip = sConfig.GetStringDefault ("Ra.IP", "0.0.0.0"); - - ACE_INET_Addr listen_addr(raport, stringip.c_str()); - - if (m_Acceptor->open (listen_addr, m_Reactor, ACE_NONBLOCK) == -1) + private: + ACE_Reactor* m_Reactor; + RASocket::Acceptor* m_Acceptor; + public: + RARunnable() { - sLog.outError ("MaNGOS RA can not bind to port %d on %s", raport, stringip.c_str ()); + ACE_Reactor_Impl* imp = 0; + +#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) + + imp = new ACE_Dev_Poll_Reactor(); + + imp->max_notify_iterations(128); + imp->restart(1); + +#else + + imp = new ACE_TP_Reactor(); + imp->max_notify_iterations(128); + +#endif + + m_Reactor = new ACE_Reactor(imp, 1 /* 1= delete implementation so we don't have to care */); + + m_Acceptor = new RASocket::Acceptor; + } - sLog.outString ("Starting Remote access listner on port %d on %s", raport, stringip.c_str ()); - - while (!m_Reactor->reactor_event_loop_done()) + ~RARunnable() { - ACE_Time_Value interval (0, 10000); + delete m_Reactor; + delete m_Acceptor; + } - if (m_Reactor->run_reactor_event_loop (interval) == -1) - break; + void run() + { + uint16 raport = sConfig.GetIntDefault("Ra.Port", 3443); + std::string stringip = sConfig.GetStringDefault("Ra.IP", "0.0.0.0"); - if(World::IsStopped()) + ACE_INET_Addr listen_addr(raport, stringip.c_str()); + + if (m_Acceptor->open(listen_addr, m_Reactor, ACE_NONBLOCK) == -1) { - m_Acceptor->close(); - break; + sLog.outError("MaNGOS RA can not bind to port %d on %s", raport, stringip.c_str()); } + + sLog.outString("Starting Remote access listner on port %d on %s", raport, stringip.c_str()); + + while (!m_Reactor->reactor_event_loop_done()) + { + ACE_Time_Value interval(0, 10000); + + if (m_Reactor->run_reactor_event_loop(interval) == -1) + break; + + if (World::IsStopped()) + { + m_Acceptor->close(); + break; + } + } + sLog.outString("RARunnable thread ended"); } - sLog.outString("RARunnable thread ended"); - } }; Master::Master() @@ -178,17 +178,17 @@ int Master::Run() { /// worldd PID file creation std::string pidfile = sConfig.GetStringDefault("PidFile", ""); - if(!pidfile.empty()) + if (!pidfile.empty()) { uint32 pid = CreatePIDFile(pidfile); - if( !pid ) + if (!pid) { - sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() ); + sLog.outError("Cannot create PID file %s.\n", pidfile.c_str()); Log::WaitBeforeContinueIfNeed(); return 1; } - sLog.outString( "Daemon PID: %u\n", pid ); + sLog.outString("Daemon PID: %u\n", pid); } ///- Start the databases @@ -201,9 +201,9 @@ int Master::Run() ///- Initialize the World sWorld.SetInitialWorldSettings(); - #ifndef WIN32 +#ifndef WIN32 detachDaemon(); - #endif +#endif //server loaded successfully => enable async DB requests //this is done to forbid any async transactions during server startup! CharacterDatabase.AllowAsyncTransactions(); @@ -237,33 +237,33 @@ int Master::Run() } ACE_Based::Thread* rar_thread = NULL; - if(sConfig.GetBoolDefault ("Ra.Enable", false)) + if (sConfig.GetBoolDefault("Ra.Enable", false)) { rar_thread = new ACE_Based::Thread(new RARunnable); } ///- Handle affinity for multiple processors and process priority on Windows - #ifdef WIN32 +#ifdef WIN32 { HANDLE hProcess = GetCurrentProcess(); uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0); - if(Aff > 0) + if (Aff > 0) { ULONG_PTR appAff; ULONG_PTR sysAff; - if(GetProcessAffinityMask(hProcess,&appAff,&sysAff)) + if (GetProcessAffinityMask(hProcess,&appAff,&sysAff)) { ULONG_PTR curAff = Aff & appAff; // remove non accessible processors - if(!curAff ) + if (!curAff) { sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for mangosd. Accessible processors bitmask (hex): %x",Aff,appAff); } else { - if(SetProcessAffinityMask(hProcess,curAff)) + if (SetProcessAffinityMask(hProcess,curAff)) sLog.outString("Using processors (bitmask, hex): %x", curAff); else sLog.outError("Can't set used processors (hex): %x",curAff); @@ -275,23 +275,23 @@ int Master::Run() bool Prio = sConfig.GetBoolDefault("ProcessPriority", false); // if(Prio && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/) - if(Prio) + if (Prio) { - if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS)) + if (SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS)) sLog.outString("mangosd process priority class set to HIGH"); else sLog.outError("Can't set mangosd process priority class."); sLog.outString(); } } - #endif +#endif ///- Start soap serving thread ACE_Based::Thread* soap_thread = NULL; - if(sConfig.GetBoolDefault("SOAP.Enabled", false)) + if (sConfig.GetBoolDefault("SOAP.Enabled", false)) { - MaNGOSsoapRunnable *runnable = new MaNGOSsoapRunnable(); + MaNGOSsoapRunnable* runnable = new MaNGOSsoapRunnable(); runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878)); soap_thread = new ACE_Based::Thread(runnable); @@ -299,27 +299,27 @@ int Master::Run() ///- Start up freeze catcher thread ACE_Based::Thread* freeze_thread = NULL; - if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0)) + if (uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0)) { - FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable(); + FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable(); fdr->SetDelayTime(freeze_delay*1000); freeze_thread = new ACE_Based::Thread(fdr); freeze_thread->setPriority(ACE_Based::Highest); } ///- Launch the world listener socket - uint16 wsport = sWorld.getConfig (CONFIG_UINT32_PORT_WORLD); - std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0"); + uint16 wsport = sWorld.getConfig(CONFIG_UINT32_PORT_WORLD); + std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0"); - if (sWorldSocketMgr->StartNetwork (wsport, bind_ip) == -1) + if (sWorldSocketMgr->StartNetwork(wsport, bind_ip) == -1) { - sLog.outError ("Failed to start network"); + sLog.outError("Failed to start network"); Log::WaitBeforeContinueIfNeed(); World::StopNow(ERROR_EXIT_CODE); // go down and shutdown the server } - sWorldSocketMgr->Wait (); + sWorldSocketMgr->Wait(); ///- Stop freeze protection before shutdown tasks if (freeze_thread) @@ -329,7 +329,7 @@ int Master::Run() } ///- Stop soap thread - if(soap_thread) + if (soap_thread) { soap_thread->wait(); soap_thread->destroy(); @@ -346,7 +346,7 @@ int Master::Run() // since worldrunnable uses them, it will crash if unloaded after master world_thread.wait(); - if(rar_thread) + if (rar_thread) { rar_thread->wait(); rar_thread->destroy(); @@ -364,11 +364,11 @@ int Master::Run() WorldDatabase.HaltDelayThread(); LoginDatabase.HaltDelayThread(); - sLog.outString( "Halting process..." ); + sLog.outString("Halting process..."); if (cliThread) { - #ifdef WIN32 +#ifdef WIN32 // this only way to terminate CLI thread exist at Win32 (alt. way exist only in Windows Vista API) //_exit(1); @@ -407,11 +407,11 @@ int Master::Run() cliThread->wait(); - #else +#else cliThread->destroy(); - #endif +#endif delete cliThread; } @@ -426,7 +426,7 @@ bool Master::_StartDB() ///- Get world database info from configuration file std::string dbstring = sConfig.GetStringDefault("WorldDatabaseInfo", ""); int nConnections = sConfig.GetIntDefault("WorldDatabaseConnections", 1); - if(dbstring.empty()) + if (dbstring.empty()) { sLog.outError("Database not specified in configuration file"); return false; @@ -434,13 +434,13 @@ bool Master::_StartDB() sLog.outString("World Database total connections: %i", nConnections + 1); ///- Initialise the world database - if(!WorldDatabase.Initialize(dbstring.c_str(), nConnections)) + if (!WorldDatabase.Initialize(dbstring.c_str(), nConnections)) { sLog.outError("Cannot connect to world database %s",dbstring.c_str()); return false; } - if(!WorldDatabase.CheckRequiredField("db_version",REVISION_DB_MANGOS)) + if (!WorldDatabase.CheckRequiredField("db_version",REVISION_DB_MANGOS)) { ///- Wait for already started DB delay threads to end WorldDatabase.HaltDelayThread(); @@ -449,7 +449,7 @@ bool Master::_StartDB() dbstring = sConfig.GetStringDefault("CharacterDatabaseInfo", ""); nConnections = sConfig.GetIntDefault("CharacterDatabaseConnections", 1); - if(dbstring.empty()) + if (dbstring.empty()) { sLog.outError("Character Database not specified in configuration file"); @@ -460,7 +460,7 @@ bool Master::_StartDB() sLog.outString("Character Database total connections: %i", nConnections + 1); ///- Initialise the Character database - if(!CharacterDatabase.Initialize(dbstring.c_str(), nConnections)) + if (!CharacterDatabase.Initialize(dbstring.c_str(), nConnections)) { sLog.outError("Cannot connect to Character database %s",dbstring.c_str()); @@ -469,7 +469,7 @@ bool Master::_StartDB() return false; } - if(!CharacterDatabase.CheckRequiredField("character_db_version",REVISION_DB_CHARACTERS)) + if (!CharacterDatabase.CheckRequiredField("character_db_version",REVISION_DB_CHARACTERS)) { ///- Wait for already started DB delay threads to end WorldDatabase.HaltDelayThread(); @@ -480,7 +480,7 @@ bool Master::_StartDB() ///- Get login database info from configuration file dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", ""); nConnections = sConfig.GetIntDefault("LoginDatabaseConnections", 1); - if(dbstring.empty()) + if (dbstring.empty()) { sLog.outError("Login database not specified in configuration file"); @@ -492,7 +492,7 @@ bool Master::_StartDB() ///- Initialise the login database sLog.outString("Login Database total connections: %i", nConnections + 1); - if(!LoginDatabase.Initialize(dbstring.c_str(), nConnections)) + if (!LoginDatabase.Initialize(dbstring.c_str(), nConnections)) { sLog.outError("Cannot connect to login database %s",dbstring.c_str()); @@ -502,7 +502,7 @@ bool Master::_StartDB() return false; } - if(!LoginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD)) + if (!LoginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD)) { ///- Wait for already started DB delay threads to end WorldDatabase.HaltDelayThread(); @@ -513,7 +513,7 @@ bool Master::_StartDB() ///- Get the realm Id from the configuration file realmID = sConfig.GetIntDefault("RealmID", 0); - if(!realmID) + if (!realmID) { sLog.outError("Realm ID not defined in configuration file"); @@ -558,9 +558,9 @@ void Master::_OnSignal(int s) World::StopNow(RESTART_EXIT_CODE); break; case SIGTERM: - #ifdef _WIN32 +#ifdef _WIN32 case SIGBREAK: - #endif +#endif World::StopNow(SHUTDOWN_EXIT_CODE); break; } @@ -573,9 +573,9 @@ void Master::_HookSignals() { signal(SIGINT, _OnSignal); signal(SIGTERM, _OnSignal); - #ifdef _WIN32 +#ifdef _WIN32 signal(SIGBREAK, _OnSignal); - #endif +#endif } /// Unhook the signals before leaving @@ -583,7 +583,7 @@ void Master::_UnhookSignals() { signal(SIGINT, 0); signal(SIGTERM, 0); - #ifdef _WIN32 +#ifdef _WIN32 signal(SIGBREAK, 0); - #endif +#endif } diff --git a/src/mangosd/RASocket.cpp b/src/mangosd/RASocket.cpp index 02cad494c..91c7cc572 100644 --- a/src/mangosd/RASocket.cpp +++ b/src/mangosd/RASocket.cpp @@ -33,18 +33,18 @@ /// RASocket constructor RASocket::RASocket() -:RAHandler(), -pendingCommands(0, USYNC_THREAD, "pendingCommands"), -outActive(false), -inputBufferLen(0), -outputBufferLen(0), -stage(NONE) + :RAHandler(), + pendingCommands(0, USYNC_THREAD, "pendingCommands"), + outActive(false), + inputBufferLen(0), + outputBufferLen(0), + stage(NONE) { ///- Get the config parameters - bSecure = sConfig.GetBoolDefault( "RA.Secure", true ); - bStricted = sConfig.GetBoolDefault( "RA.Stricted", false ); - iMinLevel = AccountTypes(sConfig.GetIntDefault( "RA.MinLevel", SEC_ADMINISTRATOR )); - reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + bSecure = sConfig.GetBoolDefault("RA.Secure", true); + bStricted = sConfig.GetBoolDefault("RA.Stricted", false); + iMinLevel = AccountTypes(sConfig.GetIntDefault("RA.MinLevel", SEC_ADMINISTRATOR)); + reference_counting_policy().value(ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } /// RASocket destructor @@ -55,19 +55,19 @@ RASocket::~RASocket() } /// Accept an incoming connection -int RASocket::open(void* ) +int RASocket::open(void*) { - if (reactor ()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) + if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) { - sLog.outError ("RASocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); + sLog.outError("RASocket::open: unable to register client handler errno = %s", ACE_OS::strerror(errno)); return -1; } ACE_INET_Addr remote_addr; - if (peer ().get_remote_addr (remote_addr) == -1) + if (peer().get_remote_addr(remote_addr) == -1) { - sLog.outError ("RASocket::open: peer ().get_remote_addr errno = %s", ACE_OS::strerror (errno)); + sLog.outError("RASocket::open: peer ().get_remote_addr errno = %s", ACE_OS::strerror(errno)); return -1; } @@ -84,7 +84,7 @@ int RASocket::open(void* ) int RASocket::close(int) { - if(closing_) + if (closing_) return -1; DEBUG_LOG("RASocket::close"); shutdown(); @@ -95,45 +95,45 @@ int RASocket::close(int) return 0; } -int RASocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask) +int RASocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask) { - if(closing_) + if (closing_) return -1; DEBUG_LOG("RASocket::handle_close"); - ACE_GUARD_RETURN (ACE_Thread_Mutex, Guard, outBufferLock, -1); + ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, outBufferLock, -1); closing_ = true; if (h == ACE_INVALID_HANDLE) - peer ().close_writer (); + peer().close_writer(); remove_reference(); return 0; } -int RASocket::handle_output (ACE_HANDLE) +int RASocket::handle_output(ACE_HANDLE) { - ACE_GUARD_RETURN (ACE_Thread_Mutex, Guard, outBufferLock, -1); + ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, outBufferLock, -1); - if(closing_) + if (closing_) return -1; if (!outputBufferLen) { - if(reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1) + if (reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1) { - sLog.outError ("RASocket::handle_output: error while cancel_wakeup"); + sLog.outError("RASocket::handle_output: error while cancel_wakeup"); return -1; } outActive = false; return 0; } #ifdef MSG_NOSIGNAL - ssize_t n = peer ().send (outputBuffer, outputBufferLen, MSG_NOSIGNAL); + ssize_t n = peer().send(outputBuffer, outputBufferLen, MSG_NOSIGNAL); #else - ssize_t n = peer ().send (outputBuffer, outputBufferLen); + ssize_t n = peer().send(outputBuffer, outputBufferLen); #endif // MSG_NOSIGNAL - if(n<=0) + if (n<=0) return -1; ACE_OS::memmove(outputBuffer, outputBuffer+n, outputBufferLen-n); @@ -147,7 +147,7 @@ int RASocket::handle_output (ACE_HANDLE) int RASocket::handle_input(ACE_HANDLE) { DEBUG_LOG("RASocket::handle_input"); - if(closing_) + if (closing_) { sLog.outError("Called RASocket::handle_input with closing_ = true"); return -1; @@ -155,7 +155,7 @@ int RASocket::handle_input(ACE_HANDLE) size_t readBytes = peer().recv(inputBuffer+inputBufferLen, RA_BUFF_SIZE-inputBufferLen-1); - if(readBytes <= 0) + if (readBytes <= 0) { DEBUG_LOG("read %u bytes in RASocket::handle_input", readBytes); return -1; @@ -163,7 +163,7 @@ int RASocket::handle_input(ACE_HANDLE) ///- Discard data after line break or line feed bool gotenter=false; - for(; readBytes > 0 ; --readBytes) + for (; readBytes > 0 ; --readBytes) { char c = inputBuffer[inputBufferLen]; if (c=='\r'|| c=='\n') @@ -178,9 +178,9 @@ int RASocket::handle_input(ACE_HANDLE) { inputBuffer[inputBufferLen]=0; inputBufferLen=0; - switch(stage) + switch (stage) { - ///
  • If the input is '' + ///
    • If the input is '' case NONE: { std::string szLogin=inputBuffer; @@ -188,11 +188,11 @@ int RASocket::handle_input(ACE_HANDLE) accId = sAccountMgr.GetId(szLogin); ///- If the user is not found, deny access - if(!accId) + if (!accId) { sendf("-No such user.\r\n"); sLog.outRALog("User %s does not exist.",szLogin.c_str()); - if(bSecure) + if (bSecure) { handle_output(); return -1; @@ -209,7 +209,7 @@ int RASocket::handle_input(ACE_HANDLE) { sendf("-Not enough privileges.\r\n"); sLog.outRALog("User %s has no privilege.",szLogin.c_str()); - if(bSecure) + if (bSecure) { handle_output(); return -1; @@ -229,7 +229,8 @@ int RASocket::handle_input(ACE_HANDLE) } ///
    • If the input is '' (and the user already gave his username) case LG: - { //login+pass ok + { + //login+pass ok std::string pw = inputBuffer; if (sAccountMgr.CheckPassword(accId, pw)) @@ -245,7 +246,7 @@ int RASocket::handle_input(ACE_HANDLE) ///- Else deny access sendf("-Wrong pass.\r\n"); sLog.outRALog("User account %u has failed to log in.", accId); - if(bSecure) + if (bSecure) { handle_output(); return -1; @@ -272,7 +273,7 @@ int RASocket::handle_input(ACE_HANDLE) else sendf("mangos>"); break; - ///
    + ///
}; } @@ -281,9 +282,9 @@ int RASocket::handle_input(ACE_HANDLE) } /// Output function -void RASocket::zprint(void* callbackArg, const char * szText ) +void RASocket::zprint(void* callbackArg, const char* szText) { - if( !szText ) + if (!szText) return; ((RASocket*)callbackArg)->sendf(szText); @@ -298,25 +299,25 @@ void RASocket::commandFinished(void* callbackArg, bool success) int RASocket::sendf(const char* msg) { - ACE_GUARD_RETURN (ACE_Thread_Mutex, Guard, outBufferLock, -1); + ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, outBufferLock, -1); - if(closing_) + if (closing_) return -1; int msgLen = strlen(msg); - if(msgLen+outputBufferLen > RA_BUFF_SIZE) + if (msgLen+outputBufferLen > RA_BUFF_SIZE) return -1; ACE_OS::memcpy(outputBuffer+outputBufferLen, msg, msgLen); outputBufferLen += msgLen; - if(!outActive) + if (!outActive) { - if (reactor ()->schedule_wakeup - (this, ACE_Event_Handler::WRITE_MASK) == -1) + if (reactor()->schedule_wakeup + (this, ACE_Event_Handler::WRITE_MASK) == -1) { - sLog.outError ("RASocket::sendf error while schedule_wakeup"); + sLog.outError("RASocket::sendf error while schedule_wakeup"); return -1; } outActive = true; diff --git a/src/mangosd/RASocket.h b/src/mangosd/RASocket.h index 785957f2f..da7a4e780 100644 --- a/src/mangosd/RASocket.h +++ b/src/mangosd/RASocket.h @@ -51,20 +51,20 @@ class RASocket: protected RAHandler virtual ~RASocket(void); /// Called on open ,the void* is the acceptor. - virtual int open (void *); + virtual int open(void*); /// Called on failures inside of the acceptor, don't call from your code. - virtual int close (int); + virtual int close(int); /// Called when we can read from the socket. - virtual int handle_input (ACE_HANDLE = ACE_INVALID_HANDLE); + virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE); /// Called when the socket can write. - virtual int handle_output (ACE_HANDLE = ACE_INVALID_HANDLE); + virtual int handle_output(ACE_HANDLE = ACE_INVALID_HANDLE); /// Called when connection is closed or error happens. - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); private: bool outActive; @@ -87,9 +87,9 @@ class RASocket: protected RAHandler NONE, //initial value LG, //only login was entered OK, //both login and pass were given, they were correct and user has enough priv. - }stage; + } stage; - static void zprint(void* callbackArg, const char * szText ); + static void zprint(void* callbackArg, const char* szText); static void commandFinished(void* callbackArg, bool success); }; #endif diff --git a/src/mangosd/WorldRunnable.cpp b/src/mangosd/WorldRunnable.cpp index 00c817484..c9f5b599f 100644 --- a/src/mangosd/WorldRunnable.cpp +++ b/src/mangosd/WorldRunnable.cpp @@ -57,7 +57,7 @@ void WorldRunnable::run() uint32 diff = WorldTimer::tick(); - sWorld.Update( diff ); + sWorld.Update(diff); realPrevTime = realCurrTime; // diff (D0) include time of previous sleep (d0) + tick time (t0) @@ -72,14 +72,14 @@ void WorldRunnable::run() else prevSleepTime = 0; - #ifdef WIN32 - if (m_ServiceStatus == 0) World::StopNow(SHUTDOWN_EXIT_CODE); - while (m_ServiceStatus == 2) Sleep(1000); - #endif +#ifdef WIN32 + if (m_ServiceStatus == 0) World::StopNow(SHUTDOWN_EXIT_CODE); + while (m_ServiceStatus == 2) Sleep(1000); +#endif } sWorld.KickAll(); // save and kick all players - sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call + sWorld.UpdateSessions(1); // real players unload required UpdateSessions call // unload battleground templates before different singletons destroyed sBattleGroundMgr.DeleteAllBattleGrounds(); diff --git a/src/mangosd/soapC.cpp b/src/mangosd/soapC.cpp index 22815a911..87156be18 100644 --- a/src/mangosd/soapC.cpp +++ b/src/mangosd/soapC.cpp @@ -12,16 +12,17 @@ SOAP_SOURCE_STAMP("@(#) soapC.cpp ver 2.7.10 2010-02-18 18:41:56 GMT") #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap) +SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap* soap) { if (soap->header) soap_serialize_SOAP_ENV__Header(soap, soap->header); } -SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) +SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap* soap) { if (soap->header) - { soap->part = SOAP_IN_HEADER; + { + soap->part = SOAP_IN_HEADER; if (soap_out_SOAP_ENV__Header(soap, "SOAP-ENV:Header", 0, soap->header, NULL)) return soap->error; soap->part = SOAP_END_HEADER; @@ -29,7 +30,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) return SOAP_OK; } -SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap) +SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap* soap) { soap->part = SOAP_IN_HEADER; soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", NULL, NULL); @@ -37,50 +38,54 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap) return soap->header == NULL; } -SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap *soap) +SOAP_FMAC3 void SOAP_FMAC4 soap_header(struct soap* soap) { if (!soap->header) - { soap->header = soap_new_SOAP_ENV__Header(soap, -1); + { + soap->header = soap_new_SOAP_ENV__Header(soap, -1); soap_default_SOAP_ENV__Header(soap, soap->header); } } -SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap *soap) +SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap* soap) { if (!soap->fault) - { soap->fault = soap_new_SOAP_ENV__Fault(soap, -1); + { + soap->fault = soap_new_SOAP_ENV__Fault(soap, -1); soap_default_SOAP_ENV__Fault(soap, soap->fault); } if (soap->version == 2 && !soap->fault->SOAP_ENV__Code) - { soap->fault->SOAP_ENV__Code = soap_new_SOAP_ENV__Code(soap, -1); + { + soap->fault->SOAP_ENV__Code = soap_new_SOAP_ENV__Code(soap, -1); soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code); } if (soap->version == 2 && !soap->fault->SOAP_ENV__Reason) - { soap->fault->SOAP_ENV__Reason = soap_new_SOAP_ENV__Reason(soap, -1); + { + soap->fault->SOAP_ENV__Reason = soap_new_SOAP_ENV__Reason(soap, -1); soap_default_SOAP_ENV__Reason(soap, soap->fault->SOAP_ENV__Reason); } } -SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap *soap) +SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap* soap) { soap_fault(soap); if (soap->fault) soap_serialize_SOAP_ENV__Fault(soap, soap->fault); } -SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap *soap) +SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap* soap) { if (soap->fault) return soap_put_SOAP_ENV__Fault(soap, soap->fault, "SOAP-ENV:Fault", NULL); return SOAP_OK; } -SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap) +SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap* soap) { return (soap->fault = soap_get_SOAP_ENV__Fault(soap, NULL, "SOAP-ENV:Fault", NULL)) == NULL; } -SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap) +SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultcode(struct soap* soap) { soap_fault(soap); if (soap->version == 2) @@ -88,12 +93,14 @@ SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap) return (const char**)&soap->fault->faultcode; } -SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultsubcode(struct soap *soap) +SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultsubcode(struct soap* soap) { soap_fault(soap); if (soap->version == 2) - { if (!soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode) - { soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode = soap_new_SOAP_ENV__Code(soap, -1); + { + if (!soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode) + { + soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode = soap_new_SOAP_ENV__Code(soap, -1); soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode); } return (const char**)&soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode->SOAP_ENV__Value; @@ -101,7 +108,7 @@ SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultsubcode(struct soap *soap) return (const char**)&soap->fault->faultcode; } -SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultstring(struct soap *soap) +SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultstring(struct soap* soap) { soap_fault(soap); if (soap->version == 2) @@ -109,18 +116,21 @@ SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultstring(struct soap *soap) return (const char**)&soap->fault->faultstring; } -SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultdetail(struct soap *soap) +SOAP_FMAC3 const char** SOAP_FMAC4 soap_faultdetail(struct soap* soap) { soap_fault(soap); if (soap->version == 1) - { if (!soap->fault->detail) - { soap->fault->detail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail)); + { + if (!soap->fault->detail) + { + soap->fault->detail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail)); soap_default_SOAP_ENV__Detail(soap, soap->fault->detail); } return (const char**)&soap->fault->detail->__any; } if (!soap->fault->SOAP_ENV__Detail) - { soap->fault->SOAP_ENV__Detail = soap_new_SOAP_ENV__Detail(soap, -1); + { + soap->fault->SOAP_ENV__Detail = soap_new_SOAP_ENV__Detail(soap, -1); soap_default_SOAP_ENV__Detail(soap, soap->fault->SOAP_ENV__Detail); } return (const char**)&soap->fault->SOAP_ENV__Detail->__any; @@ -129,7 +139,7 @@ SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultdetail(struct soap *soap) #endif #ifndef WITH_NOIDREF -SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap *soap) +SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap* soap) { int t; for (;;) @@ -147,93 +157,105 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap *soap) #ifdef __cplusplus extern "C" { #endif -SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) -{ - if (soap_peek_element(soap)) - return NULL; - if (!*soap->id || !(*type = soap_lookup_type(soap, soap->id))) - *type = soap_lookup_type(soap, soap->href); - switch (*type) + SOAP_FMAC3 void* SOAP_FMAC4 soap_getelement(struct soap* soap, int* type) { - case SOAP_TYPE_byte: - return soap_in_byte(soap, NULL, NULL, "xsd:byte"); - case SOAP_TYPE_int: - return soap_in_int(soap, NULL, NULL, "xsd:int"); - case SOAP_TYPE_ns1__executeCommand: - return soap_in_ns1__executeCommand(soap, NULL, NULL, "ns1:executeCommand"); - case SOAP_TYPE_ns1__executeCommandResponse: - return soap_in_ns1__executeCommandResponse(soap, NULL, NULL, "ns1:executeCommandResponse"); - case SOAP_TYPE_PointerTostring: - return soap_in_PointerTostring(soap, NULL, NULL, "xsd:string"); - case SOAP_TYPE_string: - { char **s; - s = soap_in_string(soap, NULL, NULL, "xsd:string"); - return s ? *s : NULL; + if (soap_peek_element(soap)) + return NULL; + if (!*soap->id || !(*type = soap_lookup_type(soap, soap->id))) + *type = soap_lookup_type(soap, soap->href); + switch (*type) + { + case SOAP_TYPE_byte: + return soap_in_byte(soap, NULL, NULL, "xsd:byte"); + case SOAP_TYPE_int: + return soap_in_int(soap, NULL, NULL, "xsd:int"); + case SOAP_TYPE_ns1__executeCommand: + return soap_in_ns1__executeCommand(soap, NULL, NULL, "ns1:executeCommand"); + case SOAP_TYPE_ns1__executeCommandResponse: + return soap_in_ns1__executeCommandResponse(soap, NULL, NULL, "ns1:executeCommandResponse"); + case SOAP_TYPE_PointerTostring: + return soap_in_PointerTostring(soap, NULL, NULL, "xsd:string"); + case SOAP_TYPE_string: + { + char** s; + s = soap_in_string(soap, NULL, NULL, "xsd:string"); + return s ? *s : NULL; + } + default: + { + const char* t = soap->type; + if (!*t) + t = soap->tag; + if (!soap_match_tag(soap, t, "xsd:byte")) + { + *type = SOAP_TYPE_byte; + return soap_in_byte(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "xsd:int")) + { + *type = SOAP_TYPE_int; + return soap_in_int(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "ns1:executeCommand")) + { + *type = SOAP_TYPE_ns1__executeCommand; + return soap_in_ns1__executeCommand(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "ns1:executeCommandResponse")) + { + *type = SOAP_TYPE_ns1__executeCommandResponse; + return soap_in_ns1__executeCommandResponse(soap, NULL, NULL, NULL); + } + if (!soap_match_tag(soap, t, "xsd:string")) + { + char** s; + *type = SOAP_TYPE_string; + s = soap_in_string(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + t = soap->tag; + if (!soap_match_tag(soap, t, "xsd:QName")) + { + char** s; + *type = SOAP_TYPE__QName; + s = soap_in__QName(soap, NULL, NULL, NULL); + return s ? *s : NULL; + } + } + } + soap->error = SOAP_TAG_MISMATCH; + return NULL; } - default: - { const char *t = soap->type; - if (!*t) - t = soap->tag; - if (!soap_match_tag(soap, t, "xsd:byte")) - { *type = SOAP_TYPE_byte; - return soap_in_byte(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:int")) - { *type = SOAP_TYPE_int; - return soap_in_int(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "ns1:executeCommand")) - { *type = SOAP_TYPE_ns1__executeCommand; - return soap_in_ns1__executeCommand(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "ns1:executeCommandResponse")) - { *type = SOAP_TYPE_ns1__executeCommandResponse; - return soap_in_ns1__executeCommandResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:string")) - { char **s; - *type = SOAP_TYPE_string; - s = soap_in_string(soap, NULL, NULL, NULL); - return s ? *s : NULL; - } - t = soap->tag; - if (!soap_match_tag(soap, t, "xsd:QName")) - { char **s; - *type = SOAP_TYPE__QName; - s = soap_in__QName(soap, NULL, NULL, NULL); - return s ? *s : NULL; - } - } - } - soap->error = SOAP_TAG_MISMATCH; - return NULL; -} #ifdef __cplusplus } #endif #endif -SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap *soap) +SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap* soap) { if (!soap_peek_element(soap)) - { int t; + { + int t; DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unexpected element '%s' in input (level=%u, %d)\n", soap->tag, soap->level, soap->body)); if (soap->mustUnderstand && !soap->other) return soap->error = SOAP_MUSTUNDERSTAND; if (((soap->mode & SOAP_XML_STRICT) && soap->part != SOAP_IN_HEADER) || !soap_match_tag(soap, soap->tag, "SOAP-ENV:")) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "REJECTING element '%s'\n", soap->tag)); + { + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "REJECTING element '%s'\n", soap->tag)); return soap->error = SOAP_TAG_MISMATCH; } if (!*soap->id || !soap_getelement(soap, &t)) - { soap->peeked = 0; + { + soap->peeked = 0; if (soap->fignore) soap->error = soap->fignore(soap, soap->tag); else soap->error = SOAP_OK; DBGLOG(TEST, if (!soap->error) SOAP_MESSAGE(fdebug, "IGNORING element '%s'\n", soap->tag)); if (!soap->error && soap->body) - { soap->level++; + { + soap->level++; while (!soap_ignore_element(soap)) ; if (soap->error == SOAP_NO_TAG) @@ -245,10 +267,10 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap *soap) } #ifndef WITH_NOIDREF -SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap *soap) +SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap* soap) { int i; - struct soap_plist *pp; + struct soap_plist* pp; if (soap->version == 1 && soap->encodingStyle && !(soap->mode & (SOAP_XML_TREE | SOAP_XML_GRAPH))) for (i = 0; i < SOAP_PTRHASH; i++) for (pp = soap->pht[i]; pp; pp = pp->next) @@ -264,27 +286,27 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap *soap) #ifdef __cplusplus extern "C" { #endif -SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap *soap, const void *ptr, const char *tag, int id, int type) -{ - switch (type) + SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap* soap, const void* ptr, const char* tag, int id, int type) { - case SOAP_TYPE_byte: - return soap_out_byte(soap, tag, id, (const char *)ptr, "xsd:byte"); - case SOAP_TYPE_int: - return soap_out_int(soap, tag, id, (const int *)ptr, "xsd:int"); - case SOAP_TYPE_ns1__executeCommand: - return soap_out_ns1__executeCommand(soap, tag, id, (const struct ns1__executeCommand *)ptr, "ns1:executeCommand"); - case SOAP_TYPE_ns1__executeCommandResponse: - return soap_out_ns1__executeCommandResponse(soap, tag, id, (const struct ns1__executeCommandResponse *)ptr, "ns1:executeCommandResponse"); - case SOAP_TYPE_PointerTostring: - return soap_out_PointerTostring(soap, tag, id, (char **const*)ptr, "xsd:string"); - case SOAP_TYPE__QName: - return soap_out_string(soap, "xsd:QName", id, (char*const*)&ptr, NULL); - case SOAP_TYPE_string: - return soap_out_string(soap, tag, id, (char*const*)&ptr, "xsd:string"); + switch (type) + { + case SOAP_TYPE_byte: + return soap_out_byte(soap, tag, id, (const char*)ptr, "xsd:byte"); + case SOAP_TYPE_int: + return soap_out_int(soap, tag, id, (const int*)ptr, "xsd:int"); + case SOAP_TYPE_ns1__executeCommand: + return soap_out_ns1__executeCommand(soap, tag, id, (const struct ns1__executeCommand*)ptr, "ns1:executeCommand"); + case SOAP_TYPE_ns1__executeCommandResponse: + return soap_out_ns1__executeCommandResponse(soap, tag, id, (const struct ns1__executeCommandResponse*)ptr, "ns1:executeCommandResponse"); + case SOAP_TYPE_PointerTostring: + return soap_out_PointerTostring(soap, tag, id, (char** const*)ptr, "xsd:string"); + case SOAP_TYPE__QName: + return soap_out_string(soap, "xsd:QName", id, (char*const*)&ptr, NULL); + case SOAP_TYPE_string: + return soap_out_string(soap, tag, id, (char*const*)&ptr, "xsd:string"); + } + return SOAP_OK; } - return SOAP_OK; -} #ifdef __cplusplus } @@ -296,122 +318,125 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap *soap, const void *ptr, co #ifdef __cplusplus extern "C" { #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap *soap, const void *ptr, int type) -{ - (void)soap; (void)ptr; (void)type; /* appease -Wall -Werror */ - switch (type) + SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap* soap, const void* ptr, int type) { - case SOAP_TYPE_ns1__executeCommand: - soap_serialize_ns1__executeCommand(soap, (const struct ns1__executeCommand *)ptr); - break; - case SOAP_TYPE_ns1__executeCommandResponse: - soap_serialize_ns1__executeCommandResponse(soap, (const struct ns1__executeCommandResponse *)ptr); - break; - case SOAP_TYPE_PointerTostring: - soap_serialize_PointerTostring(soap, (char **const*)ptr); - break; - case SOAP_TYPE__QName: - soap_serialize_string(soap, (char*const*)&ptr); - break; - case SOAP_TYPE_string: - soap_serialize_string(soap, (char*const*)&ptr); - break; + (void)soap; (void)ptr; (void)type; /* appease -Wall -Werror */ + switch (type) + { + case SOAP_TYPE_ns1__executeCommand: + soap_serialize_ns1__executeCommand(soap, (const struct ns1__executeCommand*)ptr); + break; + case SOAP_TYPE_ns1__executeCommandResponse: + soap_serialize_ns1__executeCommandResponse(soap, (const struct ns1__executeCommandResponse*)ptr); + break; + case SOAP_TYPE_PointerTostring: + soap_serialize_PointerTostring(soap, (char** const*)ptr); + break; + case SOAP_TYPE__QName: + soap_serialize_string(soap, (char*const*)&ptr); + break; + case SOAP_TYPE_string: + soap_serialize_string(soap, (char*const*)&ptr); + break; + } } -} #ifdef __cplusplus } #endif #endif -SOAP_FMAC3 void * SOAP_FMAC4 soap_instantiate(struct soap *soap, int t, const char *type, const char *arrayType, size_t *n) +SOAP_FMAC3 void* SOAP_FMAC4 soap_instantiate(struct soap* soap, int t, const char* type, const char* arrayType, size_t* n) { switch (t) { - case SOAP_TYPE_ns1__executeCommandResponse: - return (void*)soap_instantiate_ns1__executeCommandResponse(soap, -1, type, arrayType, n); - case SOAP_TYPE_ns1__executeCommand: - return (void*)soap_instantiate_ns1__executeCommand(soap, -1, type, arrayType, n); + case SOAP_TYPE_ns1__executeCommandResponse: + return (void*)soap_instantiate_ns1__executeCommandResponse(soap, -1, type, arrayType, n); + case SOAP_TYPE_ns1__executeCommand: + return (void*)soap_instantiate_ns1__executeCommand(soap, -1, type, arrayType, n); #ifndef WITH_NOGLOBAL - case SOAP_TYPE_SOAP_ENV__Header: - return (void*)soap_instantiate_SOAP_ENV__Header(soap, -1, type, arrayType, n); + case SOAP_TYPE_SOAP_ENV__Header: + return (void*)soap_instantiate_SOAP_ENV__Header(soap, -1, type, arrayType, n); #endif #ifndef WITH_NOGLOBAL - case SOAP_TYPE_SOAP_ENV__Code: - return (void*)soap_instantiate_SOAP_ENV__Code(soap, -1, type, arrayType, n); + case SOAP_TYPE_SOAP_ENV__Code: + return (void*)soap_instantiate_SOAP_ENV__Code(soap, -1, type, arrayType, n); #endif #ifndef WITH_NOGLOBAL - case SOAP_TYPE_SOAP_ENV__Detail: - return (void*)soap_instantiate_SOAP_ENV__Detail(soap, -1, type, arrayType, n); + case SOAP_TYPE_SOAP_ENV__Detail: + return (void*)soap_instantiate_SOAP_ENV__Detail(soap, -1, type, arrayType, n); #endif #ifndef WITH_NOGLOBAL - case SOAP_TYPE_SOAP_ENV__Reason: - return (void*)soap_instantiate_SOAP_ENV__Reason(soap, -1, type, arrayType, n); + case SOAP_TYPE_SOAP_ENV__Reason: + return (void*)soap_instantiate_SOAP_ENV__Reason(soap, -1, type, arrayType, n); #endif #ifndef WITH_NOGLOBAL - case SOAP_TYPE_SOAP_ENV__Fault: - return (void*)soap_instantiate_SOAP_ENV__Fault(soap, -1, type, arrayType, n); + case SOAP_TYPE_SOAP_ENV__Fault: + return (void*)soap_instantiate_SOAP_ENV__Fault(soap, -1, type, arrayType, n); #endif } return NULL; } -SOAP_FMAC3 int SOAP_FMAC4 soap_fdelete(struct soap_clist *p) -{ switch (p->type) +SOAP_FMAC3 int SOAP_FMAC4 soap_fdelete(struct soap_clist* p) +{ + switch (p->type) { - case SOAP_TYPE_ns1__executeCommandResponse: - if (p->size < 0) - delete (struct ns1__executeCommandResponse*)p->ptr; - else - delete[] (struct ns1__executeCommandResponse*)p->ptr; - break; - case SOAP_TYPE_ns1__executeCommand: - if (p->size < 0) - delete (struct ns1__executeCommand*)p->ptr; - else - delete[] (struct ns1__executeCommand*)p->ptr; - break; - case SOAP_TYPE_SOAP_ENV__Header: - if (p->size < 0) - delete (struct SOAP_ENV__Header*)p->ptr; - else - delete[] (struct SOAP_ENV__Header*)p->ptr; - break; - case SOAP_TYPE_SOAP_ENV__Code: - if (p->size < 0) - delete (struct SOAP_ENV__Code*)p->ptr; - else - delete[] (struct SOAP_ENV__Code*)p->ptr; - break; - case SOAP_TYPE_SOAP_ENV__Detail: - if (p->size < 0) - delete (struct SOAP_ENV__Detail*)p->ptr; - else - delete[] (struct SOAP_ENV__Detail*)p->ptr; - break; - case SOAP_TYPE_SOAP_ENV__Reason: - if (p->size < 0) - delete (struct SOAP_ENV__Reason*)p->ptr; - else - delete[] (struct SOAP_ENV__Reason*)p->ptr; - break; - case SOAP_TYPE_SOAP_ENV__Fault: - if (p->size < 0) - delete (struct SOAP_ENV__Fault*)p->ptr; - else - delete[] (struct SOAP_ENV__Fault*)p->ptr; - break; - default: return SOAP_ERR; + case SOAP_TYPE_ns1__executeCommandResponse: + if (p->size < 0) + delete(struct ns1__executeCommandResponse*)p->ptr; + else + delete[](struct ns1__executeCommandResponse*)p->ptr; + break; + case SOAP_TYPE_ns1__executeCommand: + if (p->size < 0) + delete(struct ns1__executeCommand*)p->ptr; + else + delete[](struct ns1__executeCommand*)p->ptr; + break; + case SOAP_TYPE_SOAP_ENV__Header: + if (p->size < 0) + delete(struct SOAP_ENV__Header*)p->ptr; + else + delete[](struct SOAP_ENV__Header*)p->ptr; + break; + case SOAP_TYPE_SOAP_ENV__Code: + if (p->size < 0) + delete(struct SOAP_ENV__Code*)p->ptr; + else + delete[](struct SOAP_ENV__Code*)p->ptr; + break; + case SOAP_TYPE_SOAP_ENV__Detail: + if (p->size < 0) + delete(struct SOAP_ENV__Detail*)p->ptr; + else + delete[](struct SOAP_ENV__Detail*)p->ptr; + break; + case SOAP_TYPE_SOAP_ENV__Reason: + if (p->size < 0) + delete(struct SOAP_ENV__Reason*)p->ptr; + else + delete[](struct SOAP_ENV__Reason*)p->ptr; + break; + case SOAP_TYPE_SOAP_ENV__Fault: + if (p->size < 0) + delete(struct SOAP_ENV__Fault*)p->ptr; + else + delete[](struct SOAP_ENV__Fault*)p->ptr; + break; + default: return SOAP_ERR; } return SOAP_OK; } -SOAP_FMAC3 void* SOAP_FMAC4 soap_class_id_enter(struct soap *soap, const char *id, void *p, int t, size_t n, const char *type, const char *arrayType) -{ return soap_id_enter(soap, id, p, t, n, 0, type, arrayType, soap_instantiate); +SOAP_FMAC3 void* SOAP_FMAC4 soap_class_id_enter(struct soap* soap, const char* id, void* p, int t, size_t n, const char* type, const char* arrayType) +{ + return soap_id_enter(soap, id, p, t, n, 0, type, arrayType, soap_instantiate); } -SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap *soap, char *a) -{ (void)soap; /* appease -Wall -Werror */ +SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap* soap, char* a) +{ + (void)soap; /* appease -Wall -Werror */ #ifdef SOAP_DEFAULT_byte *a = SOAP_DEFAULT_byte; #else @@ -419,7 +444,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap *soap, char *a) #endif } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap *soap, const char *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap* soap, const char* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_byte); if (soap_out_byte(soap, tag, id, a, type)) @@ -427,12 +452,12 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap *soap, const char *a, const return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap *soap, const char *tag, int id, const char *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap* soap, const char* tag, int id, const char* a, const char* type) { return soap_outbyte(soap, tag, id, a, type, SOAP_TYPE_byte); } -SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap *soap, char *p, const char *tag, const char *type) +SOAP_FMAC3 char* SOAP_FMAC4 soap_get_byte(struct soap* soap, char* p, const char* tag, const char* type) { if ((p = soap_in_byte(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -440,13 +465,14 @@ SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap *soap, char *p, const cha return p; } -SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap *soap, const char *tag, char *a, const char *type) +SOAP_FMAC3 char* SOAP_FMAC4 soap_in_byte(struct soap* soap, const char* tag, char* a, const char* type) { return soap_inbyte(soap, tag, a, type, SOAP_TYPE_byte); } -SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap *soap, int *a) -{ (void)soap; /* appease -Wall -Werror */ +SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap* soap, int* a) +{ + (void)soap; /* appease -Wall -Werror */ #ifdef SOAP_DEFAULT_int *a = SOAP_DEFAULT_int; #else @@ -454,7 +480,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap *soap, int *a) #endif } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap *soap, const int *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap* soap, const int* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_int); if (soap_out_int(soap, tag, id, a, type)) @@ -462,12 +488,12 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap *soap, const int *a, const ch return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap *soap, const char *tag, int id, const int *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap* soap, const char* tag, int id, const int* a, const char* type) { return soap_outint(soap, tag, id, a, type, SOAP_TYPE_int); } -SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap *soap, int *p, const char *tag, const char *type) +SOAP_FMAC3 int* SOAP_FMAC4 soap_get_int(struct soap* soap, int* p, const char* tag, const char* type) { if ((p = soap_in_int(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -475,14 +501,14 @@ SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap *soap, int *p, const char * return p; } -SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap *soap, const char *tag, int *a, const char *type) +SOAP_FMAC3 int* SOAP_FMAC4 soap_in_int(struct soap* soap, const char* tag, int* a, const char* type) { return soap_inint(soap, tag, a, type, SOAP_TYPE_int); } #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap* soap, struct SOAP_ENV__Fault* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_default__QName(soap, &a->faultcode); @@ -496,7 +522,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap *soap, struc a->SOAP_ENV__Detail = NULL; } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap* soap, const struct SOAP_ENV__Fault* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_serialize__QName(soap, &a->faultcode); @@ -510,7 +536,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, con soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->SOAP_ENV__Detail); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap* soap, const struct SOAP_ENV__Fault* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Fault); if (soap_out_SOAP_ENV__Fault(soap, tag, id, a, type)) @@ -518,9 +544,9 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap *soap, const stru return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Fault *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap* soap, const char* tag, int id, const struct SOAP_ENV__Fault* a, const char* type) { - const char *soap_tmp_faultcode = soap_QName2s(soap, a->faultcode); + const char* soap_tmp_faultcode = soap_QName2s(soap, a->faultcode); if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Fault), type)) return soap->error; if (soap_out__QName(soap, "faultcode", -1, (char*const*)&soap_tmp_faultcode, "")) @@ -544,7 +570,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap *soap, const char return soap_element_end_out(soap, tag); } -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *p, const char *tag, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Fault* SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap* soap, struct SOAP_ENV__Fault* p, const char* tag, const char* type) { if ((p = soap_in_SOAP_ENV__Fault(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -552,62 +578,72 @@ SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct s return p; } -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap *soap, const char *tag, struct SOAP_ENV__Fault *a, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Fault* SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap* soap, const char* tag, struct SOAP_ENV__Fault* a, const char* type) { short soap_flag_faultcode = 1, soap_flag_faultstring = 1, soap_flag_faultactor = 1, soap_flag_detail = 1, soap_flag_SOAP_ENV__Code = 1, soap_flag_SOAP_ENV__Reason = 1, soap_flag_SOAP_ENV__Node = 1, soap_flag_SOAP_ENV__Role = 1, soap_flag_SOAP_ENV__Detail = 1; if (soap_element_begin_in(soap, tag, 0, type)) return NULL; - a = (struct SOAP_ENV__Fault *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Fault, sizeof(struct SOAP_ENV__Fault), 0, NULL, NULL, NULL); + a = (struct SOAP_ENV__Fault*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Fault, sizeof(struct SOAP_ENV__Fault), 0, NULL, NULL, NULL); if (!a) return NULL; soap_default_SOAP_ENV__Fault(soap, a); if (soap->body && !*soap->href) { for (;;) - { soap->error = SOAP_TAG_MISMATCH; + { + soap->error = SOAP_TAG_MISMATCH; if (soap_flag_faultcode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in__QName(soap, "faultcode", &a->faultcode, "")) - { soap_flag_faultcode--; + { + soap_flag_faultcode--; continue; } if (soap_flag_faultstring && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "faultstring", &a->faultstring, "xsd:string")) - { soap_flag_faultstring--; + { + soap_flag_faultstring--; continue; } if (soap_flag_faultactor && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "faultactor", &a->faultactor, "xsd:string")) - { soap_flag_faultactor--; + { + soap_flag_faultactor--; continue; } if (soap_flag_detail && soap->error == SOAP_TAG_MISMATCH) if (soap_in_PointerToSOAP_ENV__Detail(soap, "detail", &a->detail, "")) - { soap_flag_detail--; + { + soap_flag_detail--; continue; } if (soap_flag_SOAP_ENV__Code && soap->error == SOAP_TAG_MISMATCH) if (soap_in_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Code", &a->SOAP_ENV__Code, "")) - { soap_flag_SOAP_ENV__Code--; + { + soap_flag_SOAP_ENV__Code--; continue; } if (soap_flag_SOAP_ENV__Reason && soap->error == SOAP_TAG_MISMATCH) if (soap_in_PointerToSOAP_ENV__Reason(soap, "SOAP-ENV:Reason", &a->SOAP_ENV__Reason, "")) - { soap_flag_SOAP_ENV__Reason--; + { + soap_flag_SOAP_ENV__Reason--; continue; } if (soap_flag_SOAP_ENV__Node && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "SOAP-ENV:Node", &a->SOAP_ENV__Node, "xsd:string")) - { soap_flag_SOAP_ENV__Node--; + { + soap_flag_SOAP_ENV__Node--; continue; } if (soap_flag_SOAP_ENV__Role && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "SOAP-ENV:Role", &a->SOAP_ENV__Role, "xsd:string")) - { soap_flag_SOAP_ENV__Role--; + { + soap_flag_SOAP_ENV__Role--; continue; } if (soap_flag_SOAP_ENV__Detail && soap->error == SOAP_TAG_MISMATCH) if (soap_in_PointerToSOAP_ENV__Detail(soap, "SOAP-ENV:Detail", &a->SOAP_ENV__Detail, "")) - { soap_flag_SOAP_ENV__Detail--; + { + soap_flag_SOAP_ENV__Detail--; continue; } if (soap->error == SOAP_TAG_MISMATCH) @@ -621,45 +657,51 @@ SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct so return NULL; } else - { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL); + { + a = (struct SOAP_ENV__Fault*)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; } -SOAP_FMAC5 struct SOAP_ENV__Fault * SOAP_FMAC6 soap_new_SOAP_ENV__Fault(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Fault(soap, n, NULL, NULL, NULL); +SOAP_FMAC5 struct SOAP_ENV__Fault* SOAP_FMAC6 soap_new_SOAP_ENV__Fault(struct soap* soap, int n) +{ + return soap_instantiate_SOAP_ENV__Fault(soap, n, NULL, NULL, NULL); } -SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *p) -{ soap_delete(soap, p); +SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Fault(struct soap* soap, struct SOAP_ENV__Fault* p) +{ + soap_delete(soap, p); } -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Fault(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) +SOAP_FMAC3 struct SOAP_ENV__Fault* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Fault(struct soap* soap, int n, const char* type, const char* arrayType, size_t* size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Fault(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Fault, n, soap_fdelete); + struct soap_clist* cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Fault, n, soap_fdelete); if (!cp) return NULL; if (n < 0) - { cp->ptr = (void*)new struct SOAP_ENV__Fault; + { + cp->ptr = (void*)new struct SOAP_ENV__Fault; if (size) *size = sizeof(struct SOAP_ENV__Fault); } else - { cp->ptr = (void*)new struct SOAP_ENV__Fault[n]; + { + cp->ptr = (void*)new struct SOAP_ENV__Fault[n]; if (!cp->ptr) - { soap->error = SOAP_EOM; + { + soap->error = SOAP_EOM; return NULL; } if (size) *size = n * sizeof(struct SOAP_ENV__Fault); } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); return (struct SOAP_ENV__Fault*)cp->ptr; } -SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) +SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap* soap, int st, int tt, void* p, size_t len, const void* q, size_t n) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Fault %p -> %p\n", q, p)); *(struct SOAP_ENV__Fault*)p = *(struct SOAP_ENV__Fault*)q; @@ -669,19 +711,19 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap *soap, int st, #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap* soap, struct SOAP_ENV__Reason* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_default_string(soap, &a->SOAP_ENV__Text); } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap* soap, const struct SOAP_ENV__Reason* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_serialize_string(soap, &a->SOAP_ENV__Text); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap* soap, const struct SOAP_ENV__Reason* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Reason); if (soap_out_SOAP_ENV__Reason(soap, tag, id, a, type)) @@ -689,7 +731,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap *soap, const str return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Reason *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap* soap, const char* tag, int id, const struct SOAP_ENV__Reason* a, const char* type) { if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Reason), type)) return soap->error; @@ -698,7 +740,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap *soap, const cha return soap_element_end_out(soap, tag); } -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *p, const char *tag, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Reason* SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap* soap, struct SOAP_ENV__Reason* p, const char* tag, const char* type) { if ((p = soap_in_SOAP_ENV__Reason(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -706,22 +748,24 @@ SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct return p; } -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason *a, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Reason* SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap* soap, const char* tag, struct SOAP_ENV__Reason* a, const char* type) { short soap_flag_SOAP_ENV__Text = 1; if (soap_element_begin_in(soap, tag, 0, type)) return NULL; - a = (struct SOAP_ENV__Reason *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0, NULL, NULL, NULL); + a = (struct SOAP_ENV__Reason*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0, NULL, NULL, NULL); if (!a) return NULL; soap_default_SOAP_ENV__Reason(soap, a); if (soap->body && !*soap->href) { for (;;) - { soap->error = SOAP_TAG_MISMATCH; + { + soap->error = SOAP_TAG_MISMATCH; if (soap_flag_SOAP_ENV__Text && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "SOAP-ENV:Text", &a->SOAP_ENV__Text, "xsd:string")) - { soap_flag_SOAP_ENV__Text--; + { + soap_flag_SOAP_ENV__Text--; continue; } if (soap->error == SOAP_TAG_MISMATCH) @@ -735,45 +779,51 @@ SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct return NULL; } else - { a = (struct SOAP_ENV__Reason *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, NULL); + { + a = (struct SOAP_ENV__Reason*)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; } -SOAP_FMAC5 struct SOAP_ENV__Reason * SOAP_FMAC6 soap_new_SOAP_ENV__Reason(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Reason(soap, n, NULL, NULL, NULL); +SOAP_FMAC5 struct SOAP_ENV__Reason* SOAP_FMAC6 soap_new_SOAP_ENV__Reason(struct soap* soap, int n) +{ + return soap_instantiate_SOAP_ENV__Reason(soap, n, NULL, NULL, NULL); } -SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *p) -{ soap_delete(soap, p); +SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Reason(struct soap* soap, struct SOAP_ENV__Reason* p) +{ + soap_delete(soap, p); } -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Reason(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) +SOAP_FMAC3 struct SOAP_ENV__Reason* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Reason(struct soap* soap, int n, const char* type, const char* arrayType, size_t* size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Reason(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Reason, n, soap_fdelete); + struct soap_clist* cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Reason, n, soap_fdelete); if (!cp) return NULL; if (n < 0) - { cp->ptr = (void*)new struct SOAP_ENV__Reason; + { + cp->ptr = (void*)new struct SOAP_ENV__Reason; if (size) *size = sizeof(struct SOAP_ENV__Reason); } else - { cp->ptr = (void*)new struct SOAP_ENV__Reason[n]; + { + cp->ptr = (void*)new struct SOAP_ENV__Reason[n]; if (!cp->ptr) - { soap->error = SOAP_EOM; + { + soap->error = SOAP_EOM; return NULL; } if (size) *size = n * sizeof(struct SOAP_ENV__Reason); } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); return (struct SOAP_ENV__Reason*)cp->ptr; } -SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) +SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap* soap, int st, int tt, void* p, size_t len, const void* q, size_t n) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Reason %p -> %p\n", q, p)); *(struct SOAP_ENV__Reason*)p = *(struct SOAP_ENV__Reason*)q; @@ -783,7 +833,7 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap *soap, int st, #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap* soap, struct SOAP_ENV__Detail* a) { (void)soap; (void)a; /* appease -Wall -Werror */ a->__type = 0; @@ -791,13 +841,13 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap *soap, stru a->__any = NULL; } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap* soap, const struct SOAP_ENV__Detail* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_markelement(soap, a->fault, a->__type); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap* soap, const struct SOAP_ENV__Detail* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Detail); if (soap_out_SOAP_ENV__Detail(soap, tag, id, a, type)) @@ -805,7 +855,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap *soap, const str return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Detail *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap* soap, const char* tag, int id, const struct SOAP_ENV__Detail* a, const char* type) { if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Detail), type)) return soap->error; @@ -815,7 +865,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const cha return soap_element_end_out(soap, tag); } -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *p, const char *tag, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Detail* SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap* soap, struct SOAP_ENV__Detail* p, const char* tag, const char* type) { if ((p = soap_in_SOAP_ENV__Detail(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -823,27 +873,30 @@ SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct return p; } -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail *a, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Detail* SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap* soap, const char* tag, struct SOAP_ENV__Detail* a, const char* type) { short soap_flag_fault = 1, soap_flag___any = 1; if (soap_element_begin_in(soap, tag, 0, type)) return NULL; - a = (struct SOAP_ENV__Detail *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0, NULL, NULL, NULL); + a = (struct SOAP_ENV__Detail*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0, NULL, NULL, NULL); if (!a) return NULL; soap_default_SOAP_ENV__Detail(soap, a); if (soap->body && !*soap->href) { for (;;) - { soap->error = SOAP_TAG_MISMATCH; + { + soap->error = SOAP_TAG_MISMATCH; if (soap_flag_fault && soap->error == SOAP_TAG_MISMATCH) if ((a->fault = soap_getelement(soap, &a->__type))) - { soap_flag_fault = 0; + { + soap_flag_fault = 0; continue; } if (soap_flag___any && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_inliteral(soap, "-any", &a->__any)) - { soap_flag___any--; + { + soap_flag___any--; continue; } if (soap->error == SOAP_TAG_MISMATCH) @@ -857,45 +910,51 @@ SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct return NULL; } else - { a = (struct SOAP_ENV__Detail *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL); + { + a = (struct SOAP_ENV__Detail*)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; } -SOAP_FMAC5 struct SOAP_ENV__Detail * SOAP_FMAC6 soap_new_SOAP_ENV__Detail(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Detail(soap, n, NULL, NULL, NULL); +SOAP_FMAC5 struct SOAP_ENV__Detail* SOAP_FMAC6 soap_new_SOAP_ENV__Detail(struct soap* soap, int n) +{ + return soap_instantiate_SOAP_ENV__Detail(soap, n, NULL, NULL, NULL); } -SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *p) -{ soap_delete(soap, p); +SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Detail(struct soap* soap, struct SOAP_ENV__Detail* p) +{ + soap_delete(soap, p); } -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Detail(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) +SOAP_FMAC3 struct SOAP_ENV__Detail* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Detail(struct soap* soap, int n, const char* type, const char* arrayType, size_t* size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Detail(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Detail, n, soap_fdelete); + struct soap_clist* cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Detail, n, soap_fdelete); if (!cp) return NULL; if (n < 0) - { cp->ptr = (void*)new struct SOAP_ENV__Detail; + { + cp->ptr = (void*)new struct SOAP_ENV__Detail; if (size) *size = sizeof(struct SOAP_ENV__Detail); } else - { cp->ptr = (void*)new struct SOAP_ENV__Detail[n]; + { + cp->ptr = (void*)new struct SOAP_ENV__Detail[n]; if (!cp->ptr) - { soap->error = SOAP_EOM; + { + soap->error = SOAP_EOM; return NULL; } if (size) *size = n * sizeof(struct SOAP_ENV__Detail); } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); return (struct SOAP_ENV__Detail*)cp->ptr; } -SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) +SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap* soap, int st, int tt, void* p, size_t len, const void* q, size_t n) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Detail %p -> %p\n", q, p)); *(struct SOAP_ENV__Detail*)p = *(struct SOAP_ENV__Detail*)q; @@ -905,21 +964,21 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap *soap, int st, #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap* soap, struct SOAP_ENV__Code* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_default__QName(soap, &a->SOAP_ENV__Value); a->SOAP_ENV__Subcode = NULL; } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap* soap, const struct SOAP_ENV__Code* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_serialize__QName(soap, &a->SOAP_ENV__Value); soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Subcode); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap* soap, const struct SOAP_ENV__Code* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Code); if (soap_out_SOAP_ENV__Code(soap, tag, id, a, type)) @@ -927,9 +986,9 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap *soap, const struc return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Code *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap* soap, const char* tag, int id, const struct SOAP_ENV__Code* a, const char* type) { - const char *soap_tmp_SOAP_ENV__Value = soap_QName2s(soap, a->SOAP_ENV__Value); + const char* soap_tmp_SOAP_ENV__Value = soap_QName2s(soap, a->SOAP_ENV__Value); if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Code), type)) return soap->error; if (soap_out__QName(soap, "SOAP-ENV:Value", -1, (char*const*)&soap_tmp_SOAP_ENV__Value, "")) @@ -939,7 +998,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap *soap, const char return soap_element_end_out(soap, tag); } -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *p, const char *tag, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Code* SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap* soap, struct SOAP_ENV__Code* p, const char* tag, const char* type) { if ((p = soap_in_SOAP_ENV__Code(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -947,27 +1006,30 @@ SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soa return p; } -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code *a, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Code* SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap* soap, const char* tag, struct SOAP_ENV__Code* a, const char* type) { short soap_flag_SOAP_ENV__Value = 1, soap_flag_SOAP_ENV__Subcode = 1; if (soap_element_begin_in(soap, tag, 0, type)) return NULL; - a = (struct SOAP_ENV__Code *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0, NULL, NULL, NULL); + a = (struct SOAP_ENV__Code*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0, NULL, NULL, NULL); if (!a) return NULL; soap_default_SOAP_ENV__Code(soap, a); if (soap->body && !*soap->href) { for (;;) - { soap->error = SOAP_TAG_MISMATCH; + { + soap->error = SOAP_TAG_MISMATCH; if (soap_flag_SOAP_ENV__Value && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in__QName(soap, "SOAP-ENV:Value", &a->SOAP_ENV__Value, "")) - { soap_flag_SOAP_ENV__Value--; + { + soap_flag_SOAP_ENV__Value--; continue; } if (soap_flag_SOAP_ENV__Subcode && soap->error == SOAP_TAG_MISMATCH) if (soap_in_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", &a->SOAP_ENV__Subcode, "")) - { soap_flag_SOAP_ENV__Subcode--; + { + soap_flag_SOAP_ENV__Subcode--; continue; } if (soap->error == SOAP_TAG_MISMATCH) @@ -981,45 +1043,51 @@ SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap return NULL; } else - { a = (struct SOAP_ENV__Code *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL); + { + a = (struct SOAP_ENV__Code*)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; } -SOAP_FMAC5 struct SOAP_ENV__Code * SOAP_FMAC6 soap_new_SOAP_ENV__Code(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Code(soap, n, NULL, NULL, NULL); +SOAP_FMAC5 struct SOAP_ENV__Code* SOAP_FMAC6 soap_new_SOAP_ENV__Code(struct soap* soap, int n) +{ + return soap_instantiate_SOAP_ENV__Code(soap, n, NULL, NULL, NULL); } -SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *p) -{ soap_delete(soap, p); +SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Code(struct soap* soap, struct SOAP_ENV__Code* p) +{ + soap_delete(soap, p); } -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Code(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) +SOAP_FMAC3 struct SOAP_ENV__Code* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Code(struct soap* soap, int n, const char* type, const char* arrayType, size_t* size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Code(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Code, n, soap_fdelete); + struct soap_clist* cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Code, n, soap_fdelete); if (!cp) return NULL; if (n < 0) - { cp->ptr = (void*)new struct SOAP_ENV__Code; + { + cp->ptr = (void*)new struct SOAP_ENV__Code; if (size) *size = sizeof(struct SOAP_ENV__Code); } else - { cp->ptr = (void*)new struct SOAP_ENV__Code[n]; + { + cp->ptr = (void*)new struct SOAP_ENV__Code[n]; if (!cp->ptr) - { soap->error = SOAP_EOM; + { + soap->error = SOAP_EOM; return NULL; } if (size) *size = n * sizeof(struct SOAP_ENV__Code); } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); return (struct SOAP_ENV__Code*)cp->ptr; } -SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) +SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap* soap, int st, int tt, void* p, size_t len, const void* q, size_t n) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Code %p -> %p\n", q, p)); *(struct SOAP_ENV__Code*)p = *(struct SOAP_ENV__Code*)q; @@ -1029,17 +1097,17 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap *soap, int st, i #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap* soap, struct SOAP_ENV__Header* a) { (void)soap; (void)a; /* appease -Wall -Werror */ } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap* soap, const struct SOAP_ENV__Header* a) { (void)soap; (void)a; /* appease -Wall -Werror */ } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap* soap, const struct SOAP_ENV__Header* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Header); if (soap_out_SOAP_ENV__Header(soap, tag, id, a, type)) @@ -1047,14 +1115,14 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap *soap, const str return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap* soap, const char* tag, int id, const struct SOAP_ENV__Header* a, const char* type) { if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type)) return soap->error; return soap_element_end_out(soap, tag); } -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *p, const char *tag, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Header* SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap* soap, struct SOAP_ENV__Header* p, const char* tag, const char* type) { if ((p = soap_in_SOAP_ENV__Header(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1062,18 +1130,19 @@ SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct return p; } -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap *soap, const char *tag, struct SOAP_ENV__Header *a, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Header* SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap* soap, const char* tag, struct SOAP_ENV__Header* a, const char* type) { if (soap_element_begin_in(soap, tag, 0, type)) return NULL; - a = (struct SOAP_ENV__Header *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header, sizeof(struct SOAP_ENV__Header), 0, NULL, NULL, NULL); + a = (struct SOAP_ENV__Header*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header, sizeof(struct SOAP_ENV__Header), 0, NULL, NULL, NULL); if (!a) return NULL; soap_default_SOAP_ENV__Header(soap, a); if (soap->body && !*soap->href) { for (;;) - { soap->error = SOAP_TAG_MISMATCH; + { + soap->error = SOAP_TAG_MISMATCH; if (soap->error == SOAP_TAG_MISMATCH) soap->error = soap_ignore_element(soap); if (soap->error == SOAP_NO_TAG) @@ -1085,45 +1154,51 @@ SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct return NULL; } else - { a = (struct SOAP_ENV__Header *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL); + { + a = (struct SOAP_ENV__Header*)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; } -SOAP_FMAC5 struct SOAP_ENV__Header * SOAP_FMAC6 soap_new_SOAP_ENV__Header(struct soap *soap, int n) -{ return soap_instantiate_SOAP_ENV__Header(soap, n, NULL, NULL, NULL); +SOAP_FMAC5 struct SOAP_ENV__Header* SOAP_FMAC6 soap_new_SOAP_ENV__Header(struct soap* soap, int n) +{ + return soap_instantiate_SOAP_ENV__Header(soap, n, NULL, NULL, NULL); } -SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *p) -{ soap_delete(soap, p); +SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Header(struct soap* soap, struct SOAP_ENV__Header* p) +{ + soap_delete(soap, p); } -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Header(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) +SOAP_FMAC3 struct SOAP_ENV__Header* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Header(struct soap* soap, int n, const char* type, const char* arrayType, size_t* size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_SOAP_ENV__Header(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Header, n, soap_fdelete); + struct soap_clist* cp = soap_link(soap, NULL, SOAP_TYPE_SOAP_ENV__Header, n, soap_fdelete); if (!cp) return NULL; if (n < 0) - { cp->ptr = (void*)new struct SOAP_ENV__Header; + { + cp->ptr = (void*)new struct SOAP_ENV__Header; if (size) *size = sizeof(struct SOAP_ENV__Header); } else - { cp->ptr = (void*)new struct SOAP_ENV__Header[n]; + { + cp->ptr = (void*)new struct SOAP_ENV__Header[n]; if (!cp->ptr) - { soap->error = SOAP_EOM; + { + soap->error = SOAP_EOM; return NULL; } if (size) *size = n * sizeof(struct SOAP_ENV__Header); } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); return (struct SOAP_ENV__Header*)cp->ptr; } -SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) +SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap* soap, int st, int tt, void* p, size_t len, const void* q, size_t n) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct SOAP_ENV__Header %p -> %p\n", q, p)); *(struct SOAP_ENV__Header*)p = *(struct SOAP_ENV__Header*)q; @@ -1131,19 +1206,19 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap *soap, int st, #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommand(struct soap *soap, struct ns1__executeCommand *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommand(struct soap* soap, struct ns1__executeCommand* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_default_string(soap, &a->command); } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommand(struct soap *soap, const struct ns1__executeCommand *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommand(struct soap* soap, const struct ns1__executeCommand* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_serialize_string(soap, &a->command); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommand(struct soap *soap, const struct ns1__executeCommand *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommand(struct soap* soap, const struct ns1__executeCommand* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__executeCommand); if (soap_out_ns1__executeCommand(soap, tag, id, a, type)) @@ -1151,7 +1226,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommand(struct soap *soap, const return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommand(struct soap *soap, const char *tag, int id, const struct ns1__executeCommand *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommand(struct soap* soap, const char* tag, int id, const struct ns1__executeCommand* a, const char* type) { if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__executeCommand), type)) return soap->error; @@ -1160,7 +1235,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommand(struct soap *soap, const return soap_element_end_out(soap, tag); } -SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_get_ns1__executeCommand(struct soap *soap, struct ns1__executeCommand *p, const char *tag, const char *type) +SOAP_FMAC3 struct ns1__executeCommand* SOAP_FMAC4 soap_get_ns1__executeCommand(struct soap* soap, struct ns1__executeCommand* p, const char* tag, const char* type) { if ((p = soap_in_ns1__executeCommand(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1168,22 +1243,24 @@ SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_get_ns1__executeCommand( return p; } -SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_in_ns1__executeCommand(struct soap *soap, const char *tag, struct ns1__executeCommand *a, const char *type) +SOAP_FMAC3 struct ns1__executeCommand* SOAP_FMAC4 soap_in_ns1__executeCommand(struct soap* soap, const char* tag, struct ns1__executeCommand* a, const char* type) { short soap_flag_command = 1; if (soap_element_begin_in(soap, tag, 0, type)) return NULL; - a = (struct ns1__executeCommand *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__executeCommand, sizeof(struct ns1__executeCommand), 0, NULL, NULL, NULL); + a = (struct ns1__executeCommand*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__executeCommand, sizeof(struct ns1__executeCommand), 0, NULL, NULL, NULL); if (!a) return NULL; soap_default_ns1__executeCommand(soap, a); if (soap->body && !*soap->href) { for (;;) - { soap->error = SOAP_TAG_MISMATCH; + { + soap->error = SOAP_TAG_MISMATCH; if (soap_flag_command && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) if (soap_in_string(soap, "command", &a->command, "xsd:string")) - { soap_flag_command--; + { + soap_flag_command--; continue; } if (soap->error == SOAP_TAG_MISMATCH) @@ -1197,63 +1274,69 @@ SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_in_ns1__executeCommand(s return NULL; } else - { a = (struct ns1__executeCommand *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__executeCommand, 0, sizeof(struct ns1__executeCommand), 0, NULL); + { + a = (struct ns1__executeCommand*)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__executeCommand, 0, sizeof(struct ns1__executeCommand), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; } -SOAP_FMAC5 struct ns1__executeCommand * SOAP_FMAC6 soap_new_ns1__executeCommand(struct soap *soap, int n) -{ return soap_instantiate_ns1__executeCommand(soap, n, NULL, NULL, NULL); +SOAP_FMAC5 struct ns1__executeCommand* SOAP_FMAC6 soap_new_ns1__executeCommand(struct soap* soap, int n) +{ + return soap_instantiate_ns1__executeCommand(soap, n, NULL, NULL, NULL); } -SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommand(struct soap *soap, struct ns1__executeCommand *p) -{ soap_delete(soap, p); +SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommand(struct soap* soap, struct ns1__executeCommand* p) +{ + soap_delete(soap, p); } -SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_instantiate_ns1__executeCommand(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) +SOAP_FMAC3 struct ns1__executeCommand* SOAP_FMAC4 soap_instantiate_ns1__executeCommand(struct soap* soap, int n, const char* type, const char* arrayType, size_t* size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_ns1__executeCommand(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_ns1__executeCommand, n, soap_fdelete); + struct soap_clist* cp = soap_link(soap, NULL, SOAP_TYPE_ns1__executeCommand, n, soap_fdelete); if (!cp) return NULL; if (n < 0) - { cp->ptr = (void*)new struct ns1__executeCommand; + { + cp->ptr = (void*)new struct ns1__executeCommand; if (size) *size = sizeof(struct ns1__executeCommand); } else - { cp->ptr = (void*)new struct ns1__executeCommand[n]; + { + cp->ptr = (void*)new struct ns1__executeCommand[n]; if (!cp->ptr) - { soap->error = SOAP_EOM; + { + soap->error = SOAP_EOM; return NULL; } if (size) *size = n * sizeof(struct ns1__executeCommand); } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); return (struct ns1__executeCommand*)cp->ptr; } -SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommand(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) +SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommand(struct soap* soap, int st, int tt, void* p, size_t len, const void* q, size_t n) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct ns1__executeCommand %p -> %p\n", q, p)); *(struct ns1__executeCommand*)p = *(struct ns1__executeCommand*)q; } -SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommandResponse(struct soap *soap, struct ns1__executeCommandResponse *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommandResponse(struct soap* soap, struct ns1__executeCommandResponse* a) { (void)soap; (void)a; /* appease -Wall -Werror */ a->result = NULL; } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soap *soap, const struct ns1__executeCommandResponse *a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soap* soap, const struct ns1__executeCommandResponse* a) { (void)soap; (void)a; /* appease -Wall -Werror */ soap_serialize_PointerTostring(soap, &a->result); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommandResponse(struct soap *soap, const struct ns1__executeCommandResponse *a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommandResponse(struct soap* soap, const struct ns1__executeCommandResponse* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_ns1__executeCommandResponse); if (soap_out_ns1__executeCommandResponse(soap, tag, id, a, type)) @@ -1261,7 +1344,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommandResponse(struct soap *soap return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommandResponse(struct soap *soap, const char *tag, int id, const struct ns1__executeCommandResponse *a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommandResponse(struct soap* soap, const char* tag, int id, const struct ns1__executeCommandResponse* a, const char* type) { if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_ns1__executeCommandResponse), type)) return soap->error; @@ -1270,7 +1353,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommandResponse(struct soap *soap return soap_element_end_out(soap, tag); } -SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_get_ns1__executeCommandResponse(struct soap *soap, struct ns1__executeCommandResponse *p, const char *tag, const char *type) +SOAP_FMAC3 struct ns1__executeCommandResponse* SOAP_FMAC4 soap_get_ns1__executeCommandResponse(struct soap* soap, struct ns1__executeCommandResponse* p, const char* tag, const char* type) { if ((p = soap_in_ns1__executeCommandResponse(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1278,22 +1361,24 @@ SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_get_ns1__execute return p; } -SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_in_ns1__executeCommandResponse(struct soap *soap, const char *tag, struct ns1__executeCommandResponse *a, const char *type) +SOAP_FMAC3 struct ns1__executeCommandResponse* SOAP_FMAC4 soap_in_ns1__executeCommandResponse(struct soap* soap, const char* tag, struct ns1__executeCommandResponse* a, const char* type) { short soap_flag_result = 1; if (soap_element_begin_in(soap, tag, 0, type)) return NULL; - a = (struct ns1__executeCommandResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__executeCommandResponse, sizeof(struct ns1__executeCommandResponse), 0, NULL, NULL, NULL); + a = (struct ns1__executeCommandResponse*)soap_id_enter(soap, soap->id, a, SOAP_TYPE_ns1__executeCommandResponse, sizeof(struct ns1__executeCommandResponse), 0, NULL, NULL, NULL); if (!a) return NULL; soap_default_ns1__executeCommandResponse(soap, a); if (soap->body && !*soap->href) { for (;;) - { soap->error = SOAP_TAG_MISMATCH; + { + soap->error = SOAP_TAG_MISMATCH; if (soap_flag_result && soap->error == SOAP_TAG_MISMATCH) if (soap_in_PointerTostring(soap, "result", &a->result, "xsd:string")) - { soap_flag_result--; + { + soap_flag_result--; continue; } if (soap->error == SOAP_TAG_MISMATCH) @@ -1307,45 +1392,51 @@ SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_in_ns1__executeC return NULL; } else - { a = (struct ns1__executeCommandResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__executeCommandResponse, 0, sizeof(struct ns1__executeCommandResponse), 0, NULL); + { + a = (struct ns1__executeCommandResponse*)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_ns1__executeCommandResponse, 0, sizeof(struct ns1__executeCommandResponse), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; } -SOAP_FMAC5 struct ns1__executeCommandResponse * SOAP_FMAC6 soap_new_ns1__executeCommandResponse(struct soap *soap, int n) -{ return soap_instantiate_ns1__executeCommandResponse(soap, n, NULL, NULL, NULL); +SOAP_FMAC5 struct ns1__executeCommandResponse* SOAP_FMAC6 soap_new_ns1__executeCommandResponse(struct soap* soap, int n) +{ + return soap_instantiate_ns1__executeCommandResponse(soap, n, NULL, NULL, NULL); } -SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommandResponse(struct soap *soap, struct ns1__executeCommandResponse *p) -{ soap_delete(soap, p); +SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommandResponse(struct soap* soap, struct ns1__executeCommandResponse* p) +{ + soap_delete(soap, p); } -SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_instantiate_ns1__executeCommandResponse(struct soap *soap, int n, const char *type, const char *arrayType, size_t *size) +SOAP_FMAC3 struct ns1__executeCommandResponse* SOAP_FMAC4 soap_instantiate_ns1__executeCommandResponse(struct soap* soap, int n, const char* type, const char* arrayType, size_t* size) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "soap_instantiate_ns1__executeCommandResponse(%d, %s, %s)\n", n, type?type:"", arrayType?arrayType:"")); - struct soap_clist *cp = soap_link(soap, NULL, SOAP_TYPE_ns1__executeCommandResponse, n, soap_fdelete); + struct soap_clist* cp = soap_link(soap, NULL, SOAP_TYPE_ns1__executeCommandResponse, n, soap_fdelete); if (!cp) return NULL; if (n < 0) - { cp->ptr = (void*)new struct ns1__executeCommandResponse; + { + cp->ptr = (void*)new struct ns1__executeCommandResponse; if (size) *size = sizeof(struct ns1__executeCommandResponse); } else - { cp->ptr = (void*)new struct ns1__executeCommandResponse[n]; + { + cp->ptr = (void*)new struct ns1__executeCommandResponse[n]; if (!cp->ptr) - { soap->error = SOAP_EOM; + { + soap->error = SOAP_EOM; return NULL; } if (size) *size = n * sizeof(struct ns1__executeCommandResponse); } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Instantiated location=%p\n", cp->ptr)); return (struct ns1__executeCommandResponse*)cp->ptr; } -SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommandResponse(struct soap *soap, int st, int tt, void *p, size_t len, const void *q, size_t n) +SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommandResponse(struct soap* soap, int st, int tt, void* p, size_t len, const void* q, size_t n) { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying struct ns1__executeCommandResponse %p -> %p\n", q, p)); *(struct ns1__executeCommandResponse*)p = *(struct ns1__executeCommandResponse*)q; @@ -1353,13 +1444,13 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommandResponse(struct soap *so #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap* soap, struct SOAP_ENV__Reason* const* a) { if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Reason)) soap_serialize_SOAP_ENV__Reason(soap, *a); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap* soap, struct SOAP_ENV__Reason* const* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Reason); if (soap_out_PointerToSOAP_ENV__Reason(soap, tag, id, a, type)) @@ -1367,7 +1458,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap *soap, return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Reason *const*a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap* soap, const char* tag, int id, struct SOAP_ENV__Reason* const* a, const char* type) { id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Reason); if (id < 0) @@ -1375,7 +1466,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap *soap, return soap_out_SOAP_ENV__Reason(soap, tag, id, *a, type); } -SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason **p, const char *tag, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Reason** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap* soap, struct SOAP_ENV__Reason** p, const char* tag, const char* type) { if ((p = soap_in_PointerToSOAP_ENV__Reason(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1383,21 +1474,23 @@ SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Rea return p; } -SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason **a, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Reason** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap* soap, const char* tag, struct SOAP_ENV__Reason** a, const char* type) { if (soap_element_begin_in(soap, tag, 1, NULL)) return NULL; if (!a) - if (!(a = (struct SOAP_ENV__Reason **)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason *)))) + if (!(a = (struct SOAP_ENV__Reason**)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason*)))) return NULL; *a = NULL; if (!soap->null && *soap->href != '#') - { soap_revert(soap); + { + soap_revert(soap); if (!(*a = soap_in_SOAP_ENV__Reason(soap, tag, *a, type))) return NULL; } else - { a = (struct SOAP_ENV__Reason **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0); + { + a = (struct SOAP_ENV__Reason**)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1408,13 +1501,13 @@ SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reas #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *const*a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap* soap, struct SOAP_ENV__Detail* const* a) { if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Detail)) soap_serialize_SOAP_ENV__Detail(soap, *a); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *const*a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap* soap, struct SOAP_ENV__Detail* const* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Detail); if (soap_out_PointerToSOAP_ENV__Detail(soap, tag, id, a, type)) @@ -1422,7 +1515,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap *soap, return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Detail *const*a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap* soap, const char* tag, int id, struct SOAP_ENV__Detail* const* a, const char* type) { id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Detail); if (id < 0) @@ -1430,7 +1523,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap *soap, return soap_out_SOAP_ENV__Detail(soap, tag, id, *a, type); } -SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail **p, const char *tag, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Detail** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap* soap, struct SOAP_ENV__Detail** p, const char* tag, const char* type) { if ((p = soap_in_PointerToSOAP_ENV__Detail(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1438,21 +1531,23 @@ SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Det return p; } -SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail **a, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Detail** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap* soap, const char* tag, struct SOAP_ENV__Detail** a, const char* type) { if (soap_element_begin_in(soap, tag, 1, NULL)) return NULL; if (!a) - if (!(a = (struct SOAP_ENV__Detail **)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail *)))) + if (!(a = (struct SOAP_ENV__Detail**)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail*)))) return NULL; *a = NULL; if (!soap->null && *soap->href != '#') - { soap_revert(soap); + { + soap_revert(soap); if (!(*a = soap_in_SOAP_ENV__Detail(soap, tag, *a, type))) return NULL; } else - { a = (struct SOAP_ENV__Detail **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0); + { + a = (struct SOAP_ENV__Detail**)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1463,13 +1558,13 @@ SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Deta #ifndef WITH_NOGLOBAL -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *const*a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap* soap, struct SOAP_ENV__Code* const* a) { if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Code)) soap_serialize_SOAP_ENV__Code(soap, *a); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *const*a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap* soap, struct SOAP_ENV__Code* const* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Code); if (soap_out_PointerToSOAP_ENV__Code(soap, tag, id, a, type)) @@ -1477,7 +1572,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap *soap, st return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Code *const*a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap* soap, const char* tag, int id, struct SOAP_ENV__Code* const* a, const char* type) { id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Code); if (id < 0) @@ -1485,7 +1580,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap *soap, co return soap_out_SOAP_ENV__Code(soap, tag, id, *a, type); } -SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code **p, const char *tag, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Code** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap* soap, struct SOAP_ENV__Code** p, const char* tag, const char* type) { if ((p = soap_in_PointerToSOAP_ENV__Code(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1493,21 +1588,23 @@ SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code( return p; } -SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code **a, const char *type) +SOAP_FMAC3 struct SOAP_ENV__Code** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap* soap, const char* tag, struct SOAP_ENV__Code** a, const char* type) { if (soap_element_begin_in(soap, tag, 1, NULL)) return NULL; if (!a) - if (!(a = (struct SOAP_ENV__Code **)soap_malloc(soap, sizeof(struct SOAP_ENV__Code *)))) + if (!(a = (struct SOAP_ENV__Code**)soap_malloc(soap, sizeof(struct SOAP_ENV__Code*)))) return NULL; *a = NULL; if (!soap->null && *soap->href != '#') - { soap_revert(soap); + { + soap_revert(soap); if (!(*a = soap_in_SOAP_ENV__Code(soap, tag, *a, type))) return NULL; } else - { a = (struct SOAP_ENV__Code **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0); + { + a = (struct SOAP_ENV__Code**)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1516,13 +1613,13 @@ SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(s #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTostring(struct soap *soap, char **const*a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTostring(struct soap* soap, char** const* a) { if (!soap_reference(soap, *a, SOAP_TYPE_string)) soap_serialize_string(soap, *a); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap *soap, char **const*a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap* soap, char** const* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTostring); if (soap_out_PointerTostring(soap, tag, id, a, type)) @@ -1530,7 +1627,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap *soap, char **con return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap *soap, const char *tag, int id, char **const*a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap* soap, const char* tag, int id, char** const* a, const char* type) { id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_string); if (id < 0) @@ -1538,7 +1635,7 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap *soap, const char return soap_out_string(soap, tag, id, *a, type); } -SOAP_FMAC3 char *** SOAP_FMAC4 soap_get_PointerTostring(struct soap *soap, char ***p, const char *tag, const char *type) +SOAP_FMAC3 char*** SOAP_FMAC4 soap_get_PointerTostring(struct soap* soap, char** *p, const char* tag, const char* type) { if ((p = soap_in_PointerTostring(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1546,36 +1643,40 @@ SOAP_FMAC3 char *** SOAP_FMAC4 soap_get_PointerTostring(struct soap *soap, char return p; } -SOAP_FMAC3 char *** SOAP_FMAC4 soap_in_PointerTostring(struct soap *soap, const char *tag, char ***a, const char *type) +SOAP_FMAC3 char*** SOAP_FMAC4 soap_in_PointerTostring(struct soap* soap, const char* tag, char** *a, const char* type) { if (soap_element_begin_in(soap, tag, 1, NULL)) return NULL; if (!a) - if (!(a = (char ***)soap_malloc(soap, sizeof(char **)))) + if (!(a = (char***)soap_malloc(soap, sizeof(char**)))) return NULL; *a = NULL; if (!soap->null && *soap->href != '#') - { soap_revert(soap); + { + soap_revert(soap); if (!(*a = soap_in_string(soap, tag, *a, type))) return NULL; } else - { a = (char ***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_string, sizeof(char *), 1); + { + a = (char***)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_string, sizeof(char*), 1); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } return a; } -SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap *soap, char **a) -{ soap_default_string(soap, a); +SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap* soap, char** a) +{ + soap_default_string(soap, a); } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap *soap, char *const*a) -{ soap_serialize_string(soap, a); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap* soap, char* const* a) +{ + soap_serialize_string(soap, a); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap *soap, char *const*a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap* soap, char* const* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__QName); if (soap_out__QName(soap, tag, id, a, type)) @@ -1583,12 +1684,12 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap *soap, char *const*a, cons return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap* soap, const char* tag, int id, char* const* a, const char* type) { return soap_outstring(soap, tag, id, a, type, SOAP_TYPE__QName); } -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap *soap, char **p, const char *tag, const char *type) +SOAP_FMAC3 char** SOAP_FMAC4 soap_get__QName(struct soap* soap, char** p, const char* tag, const char* type) { if ((p = soap_in__QName(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1596,26 +1697,27 @@ SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap *soap, char **p, const return p; } -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap *soap, const char *tag, char **a, const char *type) +SOAP_FMAC3 char** SOAP_FMAC4 soap_in__QName(struct soap* soap, const char* tag, char** a, const char* type) { return soap_instring(soap, tag, a, type, SOAP_TYPE__QName, 2, -1, -1); } -SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap *soap, char **a) -{ (void)soap; /* appease -Wall -Werror */ +SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap* soap, char** a) +{ + (void)soap; /* appease -Wall -Werror */ #ifdef SOAP_DEFAULT_string *a = SOAP_DEFAULT_string; #else - *a = (char *)0; + *a = (char*)0; #endif } -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap *soap, char *const*a) +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap* soap, char* const* a) { soap_reference(soap, *a, SOAP_TYPE_string); } -SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap *soap, char *const*a, const char *tag, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap* soap, char* const* a, const char* tag, const char* type) { register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_string); if (soap_out_string(soap, tag, id, a, type)) @@ -1623,12 +1725,12 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap *soap, char *const*a, cons return soap_putindependent(soap); } -SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap *soap, const char *tag, int id, char *const*a, const char *type) +SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap* soap, const char* tag, int id, char* const* a, const char* type) { return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_string); } -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap *soap, char **p, const char *tag, const char *type) +SOAP_FMAC3 char** SOAP_FMAC4 soap_get_string(struct soap* soap, char** p, const char* tag, const char* type) { if ((p = soap_in_string(soap, tag, p, type))) if (soap_getindependent(soap)) @@ -1636,7 +1738,7 @@ SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap *soap, char **p, const return p; } -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap *soap, const char *tag, char **a, const char *type) +SOAP_FMAC3 char** SOAP_FMAC4 soap_in_string(struct soap* soap, const char* tag, char** a, const char* type) { return soap_instring(soap, tag, a, type, SOAP_TYPE_string, 1, -1, -1); } diff --git a/src/mangosd/soapH.h b/src/mangosd/soapH.h index a67e4532b..9676e7206 100644 --- a/src/mangosd/soapH.h +++ b/src/mangosd/soapH.h @@ -13,9 +13,9 @@ #ifdef __cplusplus extern "C" { #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int); -SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int); -SOAP_FMAC3 void *SOAP_FMAC4 soap_getelement(struct soap*, int*); + SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int); + SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int); + SOAP_FMAC3 void* SOAP_FMAC4 soap_getelement(struct soap*, int*); #ifdef __cplusplus } @@ -25,42 +25,42 @@ SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap*); #endif SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap*); -SOAP_FMAC3 void * SOAP_FMAC4 soap_instantiate(struct soap*, int, const char*, const char*, size_t*); +SOAP_FMAC3 void* SOAP_FMAC4 soap_instantiate(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 int SOAP_FMAC4 soap_fdelete(struct soap_clist*); SOAP_FMAC3 void* SOAP_FMAC4 soap_class_id_enter(struct soap*, const char*, void*, int, size_t, const char*, const char*); #ifndef SOAP_TYPE_byte #define SOAP_TYPE_byte (3) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap*, char *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap*, const char *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap*, const char*, int, const char *, const char*); -SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap*, char *, const char*, const char*); -SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap*, const char*, char *, const char*); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap*, char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap*, const char*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap*, const char*, int, const char*, const char*); +SOAP_FMAC3 char* SOAP_FMAC4 soap_get_byte(struct soap*, char*, const char*, const char*); +SOAP_FMAC3 char* SOAP_FMAC4 soap_in_byte(struct soap*, const char*, char*, const char*); #ifndef SOAP_TYPE_int #define SOAP_TYPE_int (1) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap*, int *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap*, const int *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap*, const char*, int, const int *, const char*); -SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap*, int *, const char*, const char*); -SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap*, const char*, int *, const char*); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap*, int*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap*, const int*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap*, const char*, int, const int*, const char*); +SOAP_FMAC3 int* SOAP_FMAC4 soap_get_int(struct soap*, int*, const char*, const char*); +SOAP_FMAC3 int* SOAP_FMAC4 soap_in_int(struct soap*, const char*, int*, const char*); #ifndef WITH_NOGLOBAL #ifndef SOAP_TYPE_SOAP_ENV__Fault #define SOAP_TYPE_SOAP_ENV__Fault (18) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap*, const char*, int, const struct SOAP_ENV__Fault *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap*, const char*, struct SOAP_ENV__Fault *, const char*); -SOAP_FMAC5 struct SOAP_ENV__Fault * SOAP_FMAC6 soap_new_SOAP_ENV__Fault(struct soap*, int); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap*, const char*, int, const struct SOAP_ENV__Fault*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Fault* SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault*, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Fault* SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap*, const char*, struct SOAP_ENV__Fault*, const char*); +SOAP_FMAC5 struct SOAP_ENV__Fault* SOAP_FMAC6 soap_new_SOAP_ENV__Fault(struct soap*, int); SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault*); -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Fault(struct soap*, int, const char*, const char*, size_t*); +SOAP_FMAC3 struct SOAP_ENV__Fault* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Fault(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap*, int, int, void*, size_t, const void*, size_t); #endif @@ -70,15 +70,15 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Fault(struct soap*, int, int, voi #ifndef SOAP_TYPE_SOAP_ENV__Reason #define SOAP_TYPE_SOAP_ENV__Reason (17) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap*, const char*, int, const struct SOAP_ENV__Reason *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason *, const char*); -SOAP_FMAC5 struct SOAP_ENV__Reason * SOAP_FMAC6 soap_new_SOAP_ENV__Reason(struct soap*, int); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap*, const char*, int, const struct SOAP_ENV__Reason*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Reason* SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason*, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Reason* SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason*, const char*); +SOAP_FMAC5 struct SOAP_ENV__Reason* SOAP_FMAC6 soap_new_SOAP_ENV__Reason(struct soap*, int); SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason*); -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Reason(struct soap*, int, const char*, const char*, size_t*); +SOAP_FMAC3 struct SOAP_ENV__Reason* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Reason(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap*, int, int, void*, size_t, const void*, size_t); #endif @@ -88,15 +88,15 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Reason(struct soap*, int, int, vo #ifndef SOAP_TYPE_SOAP_ENV__Detail #define SOAP_TYPE_SOAP_ENV__Detail (14) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap*, const char*, int, const struct SOAP_ENV__Detail *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail *, const char*); -SOAP_FMAC5 struct SOAP_ENV__Detail * SOAP_FMAC6 soap_new_SOAP_ENV__Detail(struct soap*, int); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap*, const char*, int, const struct SOAP_ENV__Detail*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Detail* SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail*, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Detail* SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail*, const char*); +SOAP_FMAC5 struct SOAP_ENV__Detail* SOAP_FMAC6 soap_new_SOAP_ENV__Detail(struct soap*, int); SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail*); -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Detail(struct soap*, int, const char*, const char*, size_t*); +SOAP_FMAC3 struct SOAP_ENV__Detail* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Detail(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap*, int, int, void*, size_t, const void*, size_t); #endif @@ -106,15 +106,15 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Detail(struct soap*, int, int, vo #ifndef SOAP_TYPE_SOAP_ENV__Code #define SOAP_TYPE_SOAP_ENV__Code (12) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap*, const char*, int, const struct SOAP_ENV__Code *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code *, const char*); -SOAP_FMAC5 struct SOAP_ENV__Code * SOAP_FMAC6 soap_new_SOAP_ENV__Code(struct soap*, int); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap*, const char*, int, const struct SOAP_ENV__Code*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Code* SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code*, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Code* SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code*, const char*); +SOAP_FMAC5 struct SOAP_ENV__Code* SOAP_FMAC6 soap_new_SOAP_ENV__Code(struct soap*, int); SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code*); -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Code(struct soap*, int, const char*, const char*, size_t*); +SOAP_FMAC3 struct SOAP_ENV__Code* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Code(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap*, int, int, void*, size_t, const void*, size_t); #endif @@ -124,15 +124,15 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Code(struct soap*, int, int, void #ifndef SOAP_TYPE_SOAP_ENV__Header #define SOAP_TYPE_SOAP_ENV__Header (11) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap*, const char*, int, const struct SOAP_ENV__Header *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap*, const char*, struct SOAP_ENV__Header *, const char*); -SOAP_FMAC5 struct SOAP_ENV__Header * SOAP_FMAC6 soap_new_SOAP_ENV__Header(struct soap*, int); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap*, const char*, int, const struct SOAP_ENV__Header*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Header* SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header*, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Header* SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap*, const char*, struct SOAP_ENV__Header*, const char*); +SOAP_FMAC5 struct SOAP_ENV__Header* SOAP_FMAC6 soap_new_SOAP_ENV__Header(struct soap*, int); SOAP_FMAC5 void SOAP_FMAC6 soap_delete_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header*); -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_instantiate_SOAP_ENV__Header(struct soap*, int, const char*, const char*, size_t*); +SOAP_FMAC3 struct SOAP_ENV__Header* SOAP_FMAC4 soap_instantiate_SOAP_ENV__Header(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap*, int, int, void*, size_t, const void*, size_t); #endif @@ -140,29 +140,29 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_SOAP_ENV__Header(struct soap*, int, int, vo #ifndef SOAP_TYPE_ns1__executeCommand #define SOAP_TYPE_ns1__executeCommand (10) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommand(struct soap*, struct ns1__executeCommand *); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommand(struct soap*, const struct ns1__executeCommand *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommand(struct soap*, const struct ns1__executeCommand *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommand(struct soap*, const char*, int, const struct ns1__executeCommand *, const char*); -SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_get_ns1__executeCommand(struct soap*, struct ns1__executeCommand *, const char*, const char*); -SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_in_ns1__executeCommand(struct soap*, const char*, struct ns1__executeCommand *, const char*); -SOAP_FMAC5 struct ns1__executeCommand * SOAP_FMAC6 soap_new_ns1__executeCommand(struct soap*, int); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommand(struct soap*, struct ns1__executeCommand*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommand(struct soap*, const struct ns1__executeCommand*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommand(struct soap*, const struct ns1__executeCommand*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommand(struct soap*, const char*, int, const struct ns1__executeCommand*, const char*); +SOAP_FMAC3 struct ns1__executeCommand* SOAP_FMAC4 soap_get_ns1__executeCommand(struct soap*, struct ns1__executeCommand*, const char*, const char*); +SOAP_FMAC3 struct ns1__executeCommand* SOAP_FMAC4 soap_in_ns1__executeCommand(struct soap*, const char*, struct ns1__executeCommand*, const char*); +SOAP_FMAC5 struct ns1__executeCommand* SOAP_FMAC6 soap_new_ns1__executeCommand(struct soap*, int); SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommand(struct soap*, struct ns1__executeCommand*); -SOAP_FMAC3 struct ns1__executeCommand * SOAP_FMAC4 soap_instantiate_ns1__executeCommand(struct soap*, int, const char*, const char*, size_t*); +SOAP_FMAC3 struct ns1__executeCommand* SOAP_FMAC4 soap_instantiate_ns1__executeCommand(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommand(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef SOAP_TYPE_ns1__executeCommandResponse #define SOAP_TYPE_ns1__executeCommandResponse (9) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommandResponse(struct soap*, struct ns1__executeCommandResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soap*, const struct ns1__executeCommandResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommandResponse(struct soap*, const struct ns1__executeCommandResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommandResponse(struct soap*, const char*, int, const struct ns1__executeCommandResponse *, const char*); -SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_get_ns1__executeCommandResponse(struct soap*, struct ns1__executeCommandResponse *, const char*, const char*); -SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_in_ns1__executeCommandResponse(struct soap*, const char*, struct ns1__executeCommandResponse *, const char*); -SOAP_FMAC5 struct ns1__executeCommandResponse * SOAP_FMAC6 soap_new_ns1__executeCommandResponse(struct soap*, int); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_ns1__executeCommandResponse(struct soap*, struct ns1__executeCommandResponse*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_ns1__executeCommandResponse(struct soap*, const struct ns1__executeCommandResponse*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_ns1__executeCommandResponse(struct soap*, const struct ns1__executeCommandResponse*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_ns1__executeCommandResponse(struct soap*, const char*, int, const struct ns1__executeCommandResponse*, const char*); +SOAP_FMAC3 struct ns1__executeCommandResponse* SOAP_FMAC4 soap_get_ns1__executeCommandResponse(struct soap*, struct ns1__executeCommandResponse*, const char*, const char*); +SOAP_FMAC3 struct ns1__executeCommandResponse* SOAP_FMAC4 soap_in_ns1__executeCommandResponse(struct soap*, const char*, struct ns1__executeCommandResponse*, const char*); +SOAP_FMAC5 struct ns1__executeCommandResponse* SOAP_FMAC6 soap_new_ns1__executeCommandResponse(struct soap*, int); SOAP_FMAC5 void SOAP_FMAC6 soap_delete_ns1__executeCommandResponse(struct soap*, struct ns1__executeCommandResponse*); -SOAP_FMAC3 struct ns1__executeCommandResponse * SOAP_FMAC4 soap_instantiate_ns1__executeCommandResponse(struct soap*, int, const char*, const char*, size_t*); +SOAP_FMAC3 struct ns1__executeCommandResponse* SOAP_FMAC4 soap_instantiate_ns1__executeCommandResponse(struct soap*, int, const char*, const char*, size_t*); SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommandResponse(struct soap*, int, int, void*, size_t, const void*, size_t); #ifndef WITH_NOGLOBAL @@ -170,11 +170,11 @@ SOAP_FMAC3 void SOAP_FMAC4 soap_copy_ns1__executeCommandResponse(struct soap*, i #ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason #define SOAP_TYPE_PointerToSOAP_ENV__Reason (20) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap*, const char *, int, struct SOAP_ENV__Reason *const*, const char *); -SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason **, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason **, const char*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason* const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason* const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap*, const char*, int, struct SOAP_ENV__Reason* const*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Reason** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason**, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Reason** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason**, const char*); #endif @@ -183,11 +183,11 @@ SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reas #ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail #define SOAP_TYPE_PointerToSOAP_ENV__Detail (19) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap*, const char *, int, struct SOAP_ENV__Detail *const*, const char *); -SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail **, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail **, const char*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail* const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail* const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap*, const char*, int, struct SOAP_ENV__Detail* const*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Detail** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail**, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Detail** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail**, const char*); #endif @@ -196,42 +196,42 @@ SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Deta #ifndef SOAP_TYPE_PointerToSOAP_ENV__Code #define SOAP_TYPE_PointerToSOAP_ENV__Code (13) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap*, const char *, int, struct SOAP_ENV__Code *const*, const char *); -SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code **, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code **, const char*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code* const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code* const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap*, const char*, int, struct SOAP_ENV__Code* const*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Code** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code**, const char*, const char*); +SOAP_FMAC3 struct SOAP_ENV__Code** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code**, const char*); #endif #ifndef SOAP_TYPE_PointerTostring #define SOAP_TYPE_PointerTostring (7) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTostring(struct soap*, char **const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap*, char **const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap*, const char *, int, char **const*, const char *); -SOAP_FMAC3 char *** SOAP_FMAC4 soap_get_PointerTostring(struct soap*, char ***, const char*, const char*); -SOAP_FMAC3 char *** SOAP_FMAC4 soap_in_PointerTostring(struct soap*, const char*, char ***, const char*); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTostring(struct soap*, char** const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTostring(struct soap*, char** const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTostring(struct soap*, const char*, int, char** const*, const char*); +SOAP_FMAC3 char*** SOAP_FMAC4 soap_get_PointerTostring(struct soap*, char***, const char*, const char*); +SOAP_FMAC3 char*** SOAP_FMAC4 soap_in_PointerTostring(struct soap*, const char*, char***, const char*); #ifndef SOAP_TYPE__QName #define SOAP_TYPE__QName (5) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap*, char **); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap*, char *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap*, char *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap*, const char*, int, char*const*, const char*); -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap*, char **, const char*, const char*); -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap*, const char*, char **, const char*); +SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap*, char**); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap*, char* const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap*, char* const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap*, const char*, int, char* const*, const char*); +SOAP_FMAC3 char** SOAP_FMAC4 soap_get__QName(struct soap*, char**, const char*, const char*); +SOAP_FMAC3 char** SOAP_FMAC4 soap_in__QName(struct soap*, const char*, char**, const char*); #ifndef SOAP_TYPE_string #define SOAP_TYPE_string (4) #endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap*, char **); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap*, char *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap*, char *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap*, const char*, int, char*const*, const char*); -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap*, char **, const char*, const char*); -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap*, const char*, char **, const char*); +SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap*, char**); +SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap*, char* const*); +SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap*, char* const*, const char*, const char*); +SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap*, const char*, int, char* const*, const char*); +SOAP_FMAC3 char** SOAP_FMAC4 soap_get_string(struct soap*, char**, const char*, const char*); +SOAP_FMAC3 char** SOAP_FMAC4 soap_in_string(struct soap*, const char*, char**, const char*); #endif diff --git a/src/mangosd/soapServer.cpp b/src/mangosd/soapServer.cpp index 8be139353..6118db2d3 100644 --- a/src/mangosd/soapServer.cpp +++ b/src/mangosd/soapServer.cpp @@ -9,7 +9,7 @@ SOAP_SOURCE_STAMP("@(#) soapServer.cpp ver 2.7.10 2010-02-18 18:41:56 GMT") -SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap) +SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap* soap) { #ifndef WITH_FASTCGI unsigned int k = soap->max_keep_alive; @@ -33,7 +33,8 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap) #endif if (soap_begin_recv(soap)) - { if (soap->error < SOAP_STOP) + { + if (soap->error < SOAP_STOP) { #ifdef WITH_FASTCGI soap_send_fault(soap); @@ -47,10 +48,10 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap) } if (soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap) - || soap_serve_request(soap) - || (soap->fserveloop && soap->fserveloop(soap))) + || soap_recv_header(soap) + || soap_body_begin_in(soap) + || soap_serve_request(soap) + || (soap->fserveloop && soap->fserveloop(soap))) { #ifdef WITH_FASTCGI soap_send_fault(soap); @@ -62,7 +63,8 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap) #ifdef WITH_FASTCGI soap_destroy(soap); soap_end(soap); - } while (1); + } + while (1); #else } while (soap->keep_alive); #endif @@ -70,7 +72,7 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap) } #ifndef WITH_NOSERVEREQUEST -SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct soap *soap) +SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct soap* soap) { soap_peek_element(soap); if (!soap_match_tag(soap, soap->tag, "ns1:executeCommand")) @@ -79,10 +81,11 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct soap *soap) } #endif -SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap *soap) -{ struct ns1__executeCommand soap_tmp_ns1__executeCommand; +SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap* soap) +{ + struct ns1__executeCommand soap_tmp_ns1__executeCommand; struct ns1__executeCommandResponse soap_tmp_ns1__executeCommandResponse; - char * soap_tmp_string; + char* soap_tmp_string; soap_default_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse); soap_tmp_string = NULL; soap_tmp_ns1__executeCommandResponse.result = &soap_tmp_string; @@ -91,8 +94,8 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap *soap) if (!soap_get_ns1__executeCommand(soap, &soap_tmp_ns1__executeCommand, "ns1:executeCommand", NULL)) return soap->error; if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) + || soap_envelope_end_in(soap) + || soap_end_recv(soap)) return soap->error; soap->error = ns1__executeCommand(soap, soap_tmp_ns1__executeCommand.command, &soap_tmp_string); if (soap->error) @@ -102,23 +105,24 @@ SOAP_FMAC5 int SOAP_FMAC6 soap_serve_ns1__executeCommand(struct soap *soap) if (soap_begin_count(soap)) return soap->error; if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse, "ns1:executeCommandResponse", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; + { + if (soap_envelope_begin_out(soap) + || soap_putheader(soap) + || soap_body_begin_out(soap) + || soap_put_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse, "ns1:executeCommandResponse", "") + || soap_body_end_out(soap) + || soap_envelope_end_out(soap)) + return soap->error; }; if (soap_end_count(soap) - || soap_response(soap, SOAP_OK) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse, "ns1:executeCommandResponse", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) + || soap_response(soap, SOAP_OK) + || soap_envelope_begin_out(soap) + || soap_putheader(soap) + || soap_body_begin_out(soap) + || soap_put_ns1__executeCommandResponse(soap, &soap_tmp_ns1__executeCommandResponse, "ns1:executeCommandResponse", "") + || soap_body_end_out(soap) + || soap_envelope_end_out(soap) + || soap_end_send(soap)) return soap->error; return soap_closesock(soap); } diff --git a/src/mangosd/soapStub.h b/src/mangosd/soapStub.h index 08ee17cc5..f305393ff 100644 --- a/src/mangosd/soapStub.h +++ b/src/mangosd/soapStub.h @@ -32,8 +32,8 @@ /* ns1:executeCommandResponse */ struct ns1__executeCommandResponse { -public: - char **result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:string */ + public: + char** result; /* SOAP 1.2 RPC return element (when namespace qualified) */ /* optional element of type xsd:string */ }; #endif @@ -42,8 +42,8 @@ public: /* ns1:executeCommand */ struct ns1__executeCommand { -public: - char *command; /* optional element of type xsd:string */ + public: + char* command; /* optional element of type xsd:string */ }; #endif @@ -53,8 +53,8 @@ public: struct SOAP_ENV__Header { #ifdef WITH_NOEMPTYSTRUCT -private: - char dummy; /* dummy member to enable compilation */ + private: + char dummy; /* dummy member to enable compilation */ #endif }; #endif @@ -64,9 +64,9 @@ private: /* SOAP Fault Code: */ struct SOAP_ENV__Code { -public: - char *SOAP_ENV__Value; /* optional element of type xsd:QName */ - struct SOAP_ENV__Code *SOAP_ENV__Subcode; /* optional element of type SOAP-ENV:Code */ + public: + char* SOAP_ENV__Value; /* optional element of type xsd:QName */ + struct SOAP_ENV__Code* SOAP_ENV__Subcode; /* optional element of type SOAP-ENV:Code */ }; #endif @@ -75,10 +75,10 @@ public: /* SOAP-ENV:Detail */ struct SOAP_ENV__Detail { -public: - int __type; /* any type of element (defined below) */ - void *fault; /* transient */ - char *__any; + public: + int __type; /* any type of element (defined below) */ + void* fault; /* transient */ + char* __any; }; #endif @@ -87,8 +87,8 @@ public: /* SOAP-ENV:Reason */ struct SOAP_ENV__Reason { -public: - char *SOAP_ENV__Text; /* optional element of type xsd:string */ + public: + char* SOAP_ENV__Text; /* optional element of type xsd:string */ }; #endif @@ -97,16 +97,16 @@ public: /* SOAP Fault: */ struct SOAP_ENV__Fault { -public: - char *faultcode; /* optional element of type xsd:QName */ - char *faultstring; /* optional element of type xsd:string */ - char *faultactor; /* optional element of type xsd:string */ - struct SOAP_ENV__Detail *detail; /* optional element of type SOAP-ENV:Detail */ - struct SOAP_ENV__Code *SOAP_ENV__Code; /* optional element of type SOAP-ENV:Code */ - struct SOAP_ENV__Reason *SOAP_ENV__Reason; /* optional element of type SOAP-ENV:Reason */ - char *SOAP_ENV__Node; /* optional element of type xsd:string */ - char *SOAP_ENV__Role; /* optional element of type xsd:string */ - struct SOAP_ENV__Detail *SOAP_ENV__Detail; /* optional element of type SOAP-ENV:Detail */ + public: + char* faultcode; /* optional element of type xsd:QName */ + char* faultstring; /* optional element of type xsd:string */ + char* faultactor; /* optional element of type xsd:string */ + struct SOAP_ENV__Detail* detail; /* optional element of type SOAP-ENV:Detail */ + struct SOAP_ENV__Code* SOAP_ENV__Code; /* optional element of type SOAP-ENV:Code */ + struct SOAP_ENV__Reason* SOAP_ENV__Reason; /* optional element of type SOAP-ENV:Reason */ + char* SOAP_ENV__Node; /* optional element of type xsd:string */ + char* SOAP_ENV__Role; /* optional element of type xsd:string */ + struct SOAP_ENV__Detail* SOAP_ENV__Detail; /* optional element of type SOAP-ENV:Detail */ }; #endif @@ -125,12 +125,12 @@ public: #ifndef SOAP_TYPE__QName #define SOAP_TYPE__QName (5) -typedef char *_QName; +typedef char* _QName; #endif #ifndef SOAP_TYPE__XML #define SOAP_TYPE__XML (6) -typedef char *_XML; +typedef char* _XML; #endif @@ -155,7 +155,7 @@ typedef char *_XML; \******************************************************************************/ -SOAP_FMAC5 int SOAP_FMAC6 ns1__executeCommand(struct soap*, char *command, char **result); +SOAP_FMAC5 int SOAP_FMAC6 ns1__executeCommand(struct soap*, char* command, char** result); /******************************************************************************\ * * @@ -164,7 +164,7 @@ SOAP_FMAC5 int SOAP_FMAC6 ns1__executeCommand(struct soap*, char *command, char \******************************************************************************/ -SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__executeCommand(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *command, char **result); +SOAP_FMAC5 int SOAP_FMAC6 soap_call_ns1__executeCommand(struct soap* soap, const char* soap_endpoint, const char* soap_action, char* command, char** result); /******************************************************************************\ * * diff --git a/src/shared/Auth/AuthCrypt.cpp b/src/shared/Auth/AuthCrypt.cpp index 699247ddd..15e104882 100644 --- a/src/shared/Auth/AuthCrypt.cpp +++ b/src/shared/Auth/AuthCrypt.cpp @@ -31,17 +31,17 @@ AuthCrypt::~AuthCrypt() } -void AuthCrypt::Init(BigNumber *K) +void AuthCrypt::Init(BigNumber* K) { uint8 ServerEncryptionKey[SEED_KEY_SIZE] = { 0xCC, 0x98, 0xAE, 0x04, 0xE8, 0x97, 0xEA, 0xCA, 0x12, 0xDD, 0xC0, 0x93, 0x42, 0x91, 0x53, 0x57 }; HMACSHA1 serverEncryptHmac(SEED_KEY_SIZE, (uint8*)ServerEncryptionKey); - uint8 *encryptHash = serverEncryptHmac.ComputeHash(K); + uint8* encryptHash = serverEncryptHmac.ComputeHash(K); uint8 ServerDecryptionKey[SEED_KEY_SIZE] = { 0xC2, 0xB3, 0x72, 0x3C, 0xC6, 0xAE, 0xD9, 0xB5, 0x34, 0x3C, 0x53, 0xEE, 0x2F, 0x43, 0x67, 0xCE }; HMACSHA1 clientDecryptHmac(SEED_KEY_SIZE, (uint8*)ServerDecryptionKey); - uint8 *decryptHash = clientDecryptHmac.ComputeHash(K); + uint8* decryptHash = clientDecryptHmac.ComputeHash(K); //SARC4 _serverDecrypt(encryptHash); _clientDecrypt.Init(decryptHash); @@ -63,7 +63,7 @@ void AuthCrypt::Init(BigNumber *K) _initialized = true; } -void AuthCrypt::DecryptRecv(uint8 *data, size_t len) +void AuthCrypt::DecryptRecv(uint8* data, size_t len) { if (!_initialized) return; @@ -71,7 +71,7 @@ void AuthCrypt::DecryptRecv(uint8 *data, size_t len) _clientDecrypt.UpdateData(len, data); } -void AuthCrypt::EncryptSend(uint8 *data, size_t len) +void AuthCrypt::EncryptSend(uint8* data, size_t len) { if (!_initialized) return; diff --git a/src/shared/Auth/AuthCrypt.h b/src/shared/Auth/AuthCrypt.h index 9cb868222..739a3d81f 100644 --- a/src/shared/Auth/AuthCrypt.h +++ b/src/shared/Auth/AuthCrypt.h @@ -30,9 +30,9 @@ class AuthCrypt AuthCrypt(); ~AuthCrypt(); - void Init(BigNumber *K); - void DecryptRecv(uint8 *, size_t); - void EncryptSend(uint8 *, size_t); + void Init(BigNumber* K); + void DecryptRecv(uint8*, size_t); + void EncryptSend(uint8*, size_t); bool IsInitialized() { return _initialized; } diff --git a/src/shared/Auth/BigNumber.cpp b/src/shared/Auth/BigNumber.cpp index 1ea16f2d1..11f850c3e 100644 --- a/src/shared/Auth/BigNumber.cpp +++ b/src/shared/Auth/BigNumber.cpp @@ -26,7 +26,7 @@ BigNumber::BigNumber() _array = NULL; } -BigNumber::BigNumber(const BigNumber &bn) +BigNumber::BigNumber(const BigNumber& bn) { _bn = BN_dup(bn._bn); _array = NULL; @@ -42,7 +42,7 @@ BigNumber::BigNumber(uint32 val) BigNumber::~BigNumber() { BN_free(_bn); - if(_array) delete[] _array; + if (_array) delete[] _array; } void BigNumber::SetDword(uint32 val) @@ -57,7 +57,7 @@ void BigNumber::SetQword(uint64 val) BN_add_word(_bn, (uint32)(val & 0xFFFFFFFF)); } -void BigNumber::SetBinary(const uint8 *bytes, int len) +void BigNumber::SetBinary(const uint8* bytes, int len) { uint8 t[1000]; for (int i = 0; i < len; i++) @@ -65,7 +65,7 @@ void BigNumber::SetBinary(const uint8 *bytes, int len) BN_bin2bn(t, len, _bn); } -void BigNumber::SetHexStr(const char *str) +void BigNumber::SetHexStr(const char* str) { BN_hex2bn(&_bn, str); } @@ -75,27 +75,27 @@ void BigNumber::SetRand(int numbits) BN_rand(_bn, numbits, 0, 1); } -BigNumber BigNumber::operator=(const BigNumber &bn) +BigNumber BigNumber::operator=(const BigNumber& bn) { BN_copy(_bn, bn._bn); return *this; } -BigNumber BigNumber::operator+=(const BigNumber &bn) +BigNumber BigNumber::operator+=(const BigNumber& bn) { BN_add(_bn, _bn, bn._bn); return *this; } -BigNumber BigNumber::operator-=(const BigNumber &bn) +BigNumber BigNumber::operator-=(const BigNumber& bn) { BN_sub(_bn, _bn, bn._bn); return *this; } -BigNumber BigNumber::operator*=(const BigNumber &bn) +BigNumber BigNumber::operator*=(const BigNumber& bn) { - BN_CTX *bnctx; + BN_CTX* bnctx; bnctx = BN_CTX_new(); BN_mul(_bn, _bn, bn._bn, bnctx); @@ -104,9 +104,9 @@ BigNumber BigNumber::operator*=(const BigNumber &bn) return *this; } -BigNumber BigNumber::operator/=(const BigNumber &bn) +BigNumber BigNumber::operator/=(const BigNumber& bn) { - BN_CTX *bnctx; + BN_CTX* bnctx; bnctx = BN_CTX_new(); BN_div(_bn, NULL, _bn, bn._bn, bnctx); @@ -115,9 +115,9 @@ BigNumber BigNumber::operator/=(const BigNumber &bn) return *this; } -BigNumber BigNumber::operator%=(const BigNumber &bn) +BigNumber BigNumber::operator%=(const BigNumber& bn) { - BN_CTX *bnctx; + BN_CTX* bnctx; bnctx = BN_CTX_new(); BN_mod(_bn, _bn, bn._bn, bnctx); @@ -126,10 +126,10 @@ BigNumber BigNumber::operator%=(const BigNumber &bn) return *this; } -BigNumber BigNumber::Exp(const BigNumber &bn) +BigNumber BigNumber::Exp(const BigNumber& bn) { BigNumber ret; - BN_CTX *bnctx; + BN_CTX* bnctx; bnctx = BN_CTX_new(); BN_exp(ret._bn, _bn, bn._bn, bnctx); @@ -138,10 +138,10 @@ BigNumber BigNumber::Exp(const BigNumber &bn) return ret; } -BigNumber BigNumber::ModExp(const BigNumber &bn1, const BigNumber &bn2) +BigNumber BigNumber::ModExp(const BigNumber& bn1, const BigNumber& bn2) { BigNumber ret; - BN_CTX *bnctx; + BN_CTX* bnctx; bnctx = BN_CTX_new(); BN_mod_exp(ret._bn, _bn, bn1._bn, bn2._bn, bnctx); @@ -165,7 +165,7 @@ bool BigNumber::isZero() const return BN_is_zero(_bn)!=0; } -uint8 *BigNumber::AsByteArray(int minSize, bool reverse) +uint8* BigNumber::AsByteArray(int minSize, bool reverse) { int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes(); @@ -180,7 +180,7 @@ uint8 *BigNumber::AsByteArray(int minSize, bool reverse) if (length > GetNumBytes()) memset((void*)_array, 0, length); - BN_bn2bin(_bn, (unsigned char *)_array); + BN_bn2bin(_bn, (unsigned char*)_array); if (reverse) std::reverse(_array, _array + length); @@ -188,12 +188,12 @@ uint8 *BigNumber::AsByteArray(int minSize, bool reverse) return _array; } -const char *BigNumber::AsHexStr() +const char* BigNumber::AsHexStr() { return BN_bn2hex(_bn); } -const char *BigNumber::AsDecStr() +const char* BigNumber::AsDecStr() { return BN_bn2dec(_bn); } diff --git a/src/shared/Auth/BigNumber.h b/src/shared/Auth/BigNumber.h index 3d5c68f2e..e2f07edd9 100644 --- a/src/shared/Auth/BigNumber.h +++ b/src/shared/Auth/BigNumber.h @@ -27,45 +27,45 @@ class BigNumber { public: BigNumber(); - BigNumber(const BigNumber &bn); + BigNumber(const BigNumber& bn); BigNumber(uint32); ~BigNumber(); void SetDword(uint32); void SetQword(uint64); - void SetBinary(const uint8 *bytes, int len); - void SetHexStr(const char *str); + void SetBinary(const uint8* bytes, int len); + void SetHexStr(const char* str); void SetRand(int numbits); - BigNumber operator=(const BigNumber &bn); + BigNumber operator=(const BigNumber& bn); - BigNumber operator+=(const BigNumber &bn); - BigNumber operator+(const BigNumber &bn) + BigNumber operator+=(const BigNumber& bn); + BigNumber operator+(const BigNumber& bn) { BigNumber t(*this); return t += bn; } - BigNumber operator-=(const BigNumber &bn); - BigNumber operator-(const BigNumber &bn) + BigNumber operator-=(const BigNumber& bn); + BigNumber operator-(const BigNumber& bn) { BigNumber t(*this); return t -= bn; } - BigNumber operator*=(const BigNumber &bn); - BigNumber operator*(const BigNumber &bn) + BigNumber operator*=(const BigNumber& bn); + BigNumber operator*(const BigNumber& bn) { BigNumber t(*this); return t *= bn; } - BigNumber operator/=(const BigNumber &bn); - BigNumber operator/(const BigNumber &bn) + BigNumber operator/=(const BigNumber& bn); + BigNumber operator/(const BigNumber& bn) { BigNumber t(*this); return t /= bn; } - BigNumber operator%=(const BigNumber &bn); - BigNumber operator%(const BigNumber &bn) + BigNumber operator%=(const BigNumber& bn); + BigNumber operator%(const BigNumber& bn) { BigNumber t(*this); return t %= bn; @@ -73,21 +73,21 @@ class BigNumber bool isZero() const; - BigNumber ModExp(const BigNumber &bn1, const BigNumber &bn2); - BigNumber Exp(const BigNumber &); + BigNumber ModExp(const BigNumber& bn1, const BigNumber& bn2); + BigNumber Exp(const BigNumber&); int GetNumBytes(void); - struct bignum_st *BN() { return _bn; } + struct bignum_st* BN() { return _bn; } uint32 AsDword(); uint8* AsByteArray(int minSize = 0, bool reverse = true); - const char *AsHexStr(); - const char *AsDecStr(); + const char* AsHexStr(); + const char* AsDecStr(); private: - struct bignum_st *_bn; - uint8 *_array; + struct bignum_st* _bn; + uint8* _array; }; #endif diff --git a/src/shared/Auth/HMACSHA1.cpp b/src/shared/Auth/HMACSHA1.cpp index 1990ddc76..f515e4ee1 100644 --- a/src/shared/Auth/HMACSHA1.cpp +++ b/src/shared/Auth/HMACSHA1.cpp @@ -19,7 +19,7 @@ #include "Auth/HMACSHA1.h" #include "BigNumber.h" -HMACSHA1::HMACSHA1(uint32 len, uint8 *seed) +HMACSHA1::HMACSHA1(uint32 len, uint8* seed) { HMAC_CTX_init(&m_ctx); HMAC_Init_ex(&m_ctx, seed, len, EVP_sha1(), NULL); @@ -30,17 +30,17 @@ HMACSHA1::~HMACSHA1() HMAC_CTX_cleanup(&m_ctx); } -void HMACSHA1::UpdateBigNumber(BigNumber *bn) +void HMACSHA1::UpdateBigNumber(BigNumber* bn) { UpdateData(bn->AsByteArray(), bn->GetNumBytes()); } -void HMACSHA1::UpdateData(const uint8 *data, int length) +void HMACSHA1::UpdateData(const uint8* data, int length) { HMAC_Update(&m_ctx, data, length); } -void HMACSHA1::UpdateData(const std::string &str) +void HMACSHA1::UpdateData(const std::string& str) { UpdateData((uint8 const*)str.c_str(), str.length()); } @@ -52,7 +52,7 @@ void HMACSHA1::Finalize() MANGOS_ASSERT(length == SHA_DIGEST_LENGTH); } -uint8 *HMACSHA1::ComputeHash(BigNumber *bn) +uint8* HMACSHA1::ComputeHash(BigNumber* bn) { HMAC_Update(&m_ctx, bn->AsByteArray(), bn->GetNumBytes()); Finalize(); diff --git a/src/shared/Auth/HMACSHA1.h b/src/shared/Auth/HMACSHA1.h index 28f2b9e8e..4851128e8 100644 --- a/src/shared/Auth/HMACSHA1.h +++ b/src/shared/Auth/HMACSHA1.h @@ -30,14 +30,14 @@ class BigNumber; class HMACSHA1 { public: - HMACSHA1(uint32 len, uint8 *seed); + HMACSHA1(uint32 len, uint8* seed); ~HMACSHA1(); - void UpdateBigNumber(BigNumber *bn); - void UpdateData(const uint8 *data, int length); - void UpdateData(const std::string &str); + void UpdateBigNumber(BigNumber* bn); + void UpdateData(const uint8* data, int length); + void UpdateData(const std::string& str); void Finalize(); - uint8 *ComputeHash(BigNumber *bn); - uint8 *GetDigest() { return (uint8*)m_digest; } + uint8* ComputeHash(BigNumber* bn); + uint8* GetDigest() { return (uint8*)m_digest; } int GetLength() { return SHA_DIGEST_LENGTH; } private: HMAC_CTX m_ctx; diff --git a/src/shared/Auth/SARC4.cpp b/src/shared/Auth/SARC4.cpp index 037ee961c..e3c8b6539 100644 --- a/src/shared/Auth/SARC4.cpp +++ b/src/shared/Auth/SARC4.cpp @@ -26,7 +26,7 @@ SARC4::SARC4(uint8 len) EVP_CIPHER_CTX_set_key_length(&m_ctx, len); } -SARC4::SARC4(uint8 *seed, uint8 len) +SARC4::SARC4(uint8* seed, uint8 len) { EVP_CIPHER_CTX_init(&m_ctx); EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULL, NULL, NULL); @@ -39,12 +39,12 @@ SARC4::~SARC4() EVP_CIPHER_CTX_cleanup(&m_ctx); } -void SARC4::Init(uint8 *seed) +void SARC4::Init(uint8* seed) { EVP_EncryptInit_ex(&m_ctx, NULL, NULL, seed, NULL); } -void SARC4::UpdateData(int len, uint8 *data) +void SARC4::UpdateData(int len, uint8* data) { int outlen = 0; EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len); diff --git a/src/shared/Auth/SARC4.h b/src/shared/Auth/SARC4.h index 8aff1e01a..536308a88 100644 --- a/src/shared/Auth/SARC4.h +++ b/src/shared/Auth/SARC4.h @@ -26,10 +26,10 @@ class SARC4 { public: SARC4(uint8 len); - SARC4(uint8 *seed, uint8 len); + SARC4(uint8* seed, uint8 len); ~SARC4(); - void Init(uint8 *seed); - void UpdateData(int len, uint8 *data); + void Init(uint8* seed); + void UpdateData(int len, uint8* data); private: EVP_CIPHER_CTX m_ctx; }; diff --git a/src/shared/Auth/Sha1.cpp b/src/shared/Auth/Sha1.cpp index d6eb05f0b..b0034151d 100644 --- a/src/shared/Auth/Sha1.cpp +++ b/src/shared/Auth/Sha1.cpp @@ -30,27 +30,27 @@ Sha1Hash::~Sha1Hash() SHA1_Init(&mC); } -void Sha1Hash::UpdateData(const uint8 *dta, int len) +void Sha1Hash::UpdateData(const uint8* dta, int len) { SHA1_Update(&mC, dta, len); } -void Sha1Hash::UpdateData(const std::string &str) +void Sha1Hash::UpdateData(const std::string& str) { UpdateData((uint8 const*)str.c_str(), str.length()); } -void Sha1Hash::UpdateBigNumbers(BigNumber *bn0, ...) +void Sha1Hash::UpdateBigNumbers(BigNumber* bn0, ...) { va_list v; - BigNumber *bn; + BigNumber* bn; va_start(v, bn0); bn = bn0; while (bn) { UpdateData(bn->AsByteArray(), bn->GetNumBytes()); - bn = va_arg(v, BigNumber *); + bn = va_arg(v, BigNumber*); } va_end(v); } diff --git a/src/shared/Auth/Sha1.h b/src/shared/Auth/Sha1.h index 4ffb868de..562c8caee 100644 --- a/src/shared/Auth/Sha1.h +++ b/src/shared/Auth/Sha1.h @@ -31,15 +31,15 @@ class Sha1Hash Sha1Hash(); ~Sha1Hash(); - void UpdateBigNumbers(BigNumber *bn0, ...); + void UpdateBigNumbers(BigNumber* bn0, ...); - void UpdateData(const uint8 *dta, int len); - void UpdateData(const std::string &str); + void UpdateData(const uint8* dta, int len); + void UpdateData(const std::string& str); void Initialize(); void Finalize(); - uint8 *GetDigest(void) { return mDigest; }; + uint8* GetDigest(void) { return mDigest; }; int GetLength(void) { return SHA_DIGEST_LENGTH; }; private: diff --git a/src/shared/Auth/md5.h b/src/shared/Auth/md5.h index fa2937e13..90f2ebb04 100644 --- a/src/shared/Auth/md5.h +++ b/src/shared/Auth/md5.h @@ -74,18 +74,18 @@ typedef struct md5_state_s #ifdef __cplusplus extern "C" { - #endif +#endif /* Initialize the algorithm. */ - void md5_init(md5_state_t *pms); + void md5_init(md5_state_t* pms); /* Append a string to the message. */ - void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); + void md5_append(md5_state_t* pms, const md5_byte_t* data, int nbytes); /* Finish the message and return the digest. */ - void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); + void md5_finish(md5_state_t* pms, md5_byte_t digest[16]); - #ifdef __cplusplus +#ifdef __cplusplus } /* end extern "C" */ #endif #endif /* md5_INCLUDED */ diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 137336253..705c0cb65 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -35,7 +35,7 @@ class ByteBufferException void PrintPosError() const { sLog.outError("Attempted to %s in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") value with size: " SIZEFMTD, - (add ? "put" : "get"), pos, size, esize); + (add ? "put" : "get"), pos, size, esize); } private: bool add; @@ -68,7 +68,7 @@ class ByteBuffer } // copy constructor - ByteBuffer(const ByteBuffer &buf): _rpos(buf._rpos), _wpos(buf._wpos), _storage(buf._storage) { } + ByteBuffer(const ByteBuffer& buf): _rpos(buf._rpos), _wpos(buf._wpos), _storage(buf._storage) { } void clear() { @@ -79,153 +79,153 @@ class ByteBuffer template void put(size_t pos,T value) { EndianConvert(value); - put(pos,(uint8 *)&value,sizeof(value)); + put(pos,(uint8*)&value,sizeof(value)); } - ByteBuffer &operator<<(uint8 value) + ByteBuffer& operator<<(uint8 value) { append(value); return *this; } - ByteBuffer &operator<<(uint16 value) + ByteBuffer& operator<<(uint16 value) { append(value); return *this; } - ByteBuffer &operator<<(uint32 value) + ByteBuffer& operator<<(uint32 value) { append(value); return *this; } - ByteBuffer &operator<<(uint64 value) + ByteBuffer& operator<<(uint64 value) { append(value); return *this; } // signed as in 2e complement - ByteBuffer &operator<<(int8 value) + ByteBuffer& operator<<(int8 value) { append(value); return *this; } - ByteBuffer &operator<<(int16 value) + ByteBuffer& operator<<(int16 value) { append(value); return *this; } - ByteBuffer &operator<<(int32 value) + ByteBuffer& operator<<(int32 value) { append(value); return *this; } - ByteBuffer &operator<<(int64 value) + ByteBuffer& operator<<(int64 value) { append(value); return *this; } // floating points - ByteBuffer &operator<<(float value) + ByteBuffer& operator<<(float value) { append(value); return *this; } - ByteBuffer &operator<<(double value) + ByteBuffer& operator<<(double value) { append(value); return *this; } - ByteBuffer &operator<<(const std::string &value) + ByteBuffer& operator<<(const std::string& value) { - append((uint8 const *)value.c_str(), value.length()); + append((uint8 const*)value.c_str(), value.length()); append((uint8)0); return *this; } - ByteBuffer &operator<<(const char *str) + ByteBuffer& operator<<(const char* str) { - append((uint8 const *)str, str ? strlen(str) : 0); + append((uint8 const*)str, str ? strlen(str) : 0); append((uint8)0); return *this; } - ByteBuffer &operator>>(bool &value) + ByteBuffer& operator>>(bool& value) { value = read() > 0 ? true : false; return *this; } - ByteBuffer &operator>>(uint8 &value) + ByteBuffer& operator>>(uint8& value) { value = read(); return *this; } - ByteBuffer &operator>>(uint16 &value) + ByteBuffer& operator>>(uint16& value) { value = read(); return *this; } - ByteBuffer &operator>>(uint32 &value) + ByteBuffer& operator>>(uint32& value) { value = read(); return *this; } - ByteBuffer &operator>>(uint64 &value) + ByteBuffer& operator>>(uint64& value) { value = read(); return *this; } //signed as in 2e complement - ByteBuffer &operator>>(int8 &value) + ByteBuffer& operator>>(int8& value) { value = read(); return *this; } - ByteBuffer &operator>>(int16 &value) + ByteBuffer& operator>>(int16& value) { value = read(); return *this; } - ByteBuffer &operator>>(int32 &value) + ByteBuffer& operator>>(int32& value) { value = read(); return *this; } - ByteBuffer &operator>>(int64 &value) + ByteBuffer& operator>>(int64& value) { value = read(); return *this; } - ByteBuffer &operator>>(float &value) + ByteBuffer& operator>>(float& value) { value = read(); return *this; } - ByteBuffer &operator>>(double &value) + ByteBuffer& operator>>(double& value) { value = read(); return *this; } - ByteBuffer &operator>>(std::string& value) + ByteBuffer& operator>>(std::string& value) { value.clear(); while (rpos() < size()) // prevent crash at wrong string format in packet @@ -239,7 +239,7 @@ class ByteBuffer } template - ByteBuffer &operator>>(Unused const&) + ByteBuffer& operator>>(Unused const&) { read_skip(); return *this; @@ -272,7 +272,7 @@ class ByteBuffer void read_skip(size_t skip) { - if(_rpos + skip > size()) + if (_rpos + skip > size()) throw ByteBufferException(false, _rpos, skip, size()); _rpos += skip; } @@ -286,16 +286,16 @@ class ByteBuffer template T read(size_t pos) const { - if(pos + sizeof(T) > size()) + if (pos + sizeof(T) > size()) throw ByteBufferException(false, pos, sizeof(T), size()); T val = *((T const*)&_storage[pos]); EndianConvert(val); return val; } - void read(uint8 *dest, size_t len) + void read(uint8* dest, size_t len) { - if(_rpos + len > size()) + if (_rpos + len > size()) throw ByteBufferException(false, _rpos, len, size()); memcpy(dest, &_storage[_rpos], len); _rpos += len; @@ -307,9 +307,9 @@ class ByteBuffer uint8 guidmark = 0; (*this) >> guidmark; - for(int i = 0; i < 8; ++i) + for (int i = 0; i < 8; ++i) { - if(guidmark & (uint8(1) << i)) + if (guidmark & (uint8(1) << i)) { uint8 bit; (*this) >> bit; @@ -320,7 +320,7 @@ class ByteBuffer return guid; } - const uint8 *contents() const { return &_storage[0]; } + const uint8* contents() const { return &_storage[0]; } size_t size() const { return _storage.size(); } bool empty() const { return _storage.empty(); } @@ -343,17 +343,17 @@ class ByteBuffer append((uint8 const*)str.c_str(), str.size() + 1); } - void append(const char *src, size_t cnt) + void append(const char* src, size_t cnt) { - return append((const uint8 *)src, cnt); + return append((const uint8*)src, cnt); } - template void append(const T *src, size_t cnt) + template void append(const T* src, size_t cnt) { - return append((const uint8 *)src, cnt * sizeof(T)); + return append((const uint8*)src, cnt * sizeof(T)); } - void append(const uint8 *src, size_t cnt) + void append(const uint8* src, size_t cnt) { if (!cnt) return; @@ -368,7 +368,7 @@ class ByteBuffer void append(const ByteBuffer& buffer) { - if(buffer.wpos()) + if (buffer.wpos()) append(buffer.contents(), buffer.wpos()); } @@ -402,9 +402,9 @@ class ByteBuffer append(packGUID, size); } - void put(size_t pos, const uint8 *src, size_t cnt) + void put(size_t pos, const uint8* src, size_t cnt) { - if(pos + cnt > size()) + if (pos + cnt > size()) throw ByteBufferException(true, pos, cnt, size()); memcpy(&_storage[pos], src, cnt); } @@ -487,7 +487,7 @@ class ByteBuffer template void append(T value) { EndianConvert(value); - append((uint8 *)&value, sizeof(value)); + append((uint8*)&value, sizeof(value)); } protected: @@ -496,7 +496,7 @@ class ByteBuffer }; template -inline ByteBuffer &operator<<(ByteBuffer &b, std::vector const& v) +inline ByteBuffer& operator<<(ByteBuffer& b, std::vector const& v) { b << (uint32)v.size(); for (typename std::vector::iterator i = v.begin(); i != v.end(); ++i) @@ -507,12 +507,12 @@ inline ByteBuffer &operator<<(ByteBuffer &b, std::vector const& v) } template -inline ByteBuffer &operator>>(ByteBuffer &b, std::vector &v) +inline ByteBuffer& operator>>(ByteBuffer& b, std::vector& v) { uint32 vsize; b >> vsize; v.clear(); - while(vsize--) + while (vsize--) { T t; b >> t; @@ -522,7 +522,7 @@ inline ByteBuffer &operator>>(ByteBuffer &b, std::vector &v) } template -inline ByteBuffer &operator<<(ByteBuffer &b, std::list const& v) +inline ByteBuffer& operator<<(ByteBuffer& b, std::list const& v) { b << (uint32)v.size(); for (typename std::list::iterator i = v.begin(); i != v.end(); ++i) @@ -533,12 +533,12 @@ inline ByteBuffer &operator<<(ByteBuffer &b, std::list const& v) } template -inline ByteBuffer &operator>>(ByteBuffer &b, std::list &v) +inline ByteBuffer& operator>>(ByteBuffer& b, std::list& v) { uint32 vsize; b >> vsize; v.clear(); - while(vsize--) + while (vsize--) { T t; b >> t; @@ -548,7 +548,7 @@ inline ByteBuffer &operator>>(ByteBuffer &b, std::list &v) } template -inline ByteBuffer &operator<<(ByteBuffer &b, std::map &m) +inline ByteBuffer& operator<<(ByteBuffer& b, std::map& m) { b << (uint32)m.size(); for (typename std::map::iterator i = m.begin(); i != m.end(); ++i) @@ -559,12 +559,12 @@ inline ByteBuffer &operator<<(ByteBuffer &b, std::map &m) } template -inline ByteBuffer &operator>>(ByteBuffer &b, std::map &m) +inline ByteBuffer& operator>>(ByteBuffer& b, std::map& m) { uint32 msize; b >> msize; m.clear(); - while(msize--) + while (msize--) { K k; V v; diff --git a/src/shared/Common.cpp b/src/shared/Common.cpp index d0cd50b38..3acb03bdd 100644 --- a/src/shared/Common.cpp +++ b/src/shared/Common.cpp @@ -18,16 +18,17 @@ #include "Common.h" -char const* localeNames[MAX_LOCALE] = { - "enUS", // also enGB - "koKR", - "frFR", - "deDE", - "zhCN", - "zhTW", - "esES", - "esMX", - "ruRU" +char const* localeNames[MAX_LOCALE] = +{ + "enUS", // also enGB + "koKR", + "frFR", + "deDE", + "zhCN", + "zhTW", + "esES", + "esMX", + "ruRU" }; // used for search by name or iterate all names @@ -48,7 +49,7 @@ LocaleNameStr const fullLocaleNameList[] = LocaleConstant GetLocaleByName(const std::string& name) { - for(LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr) + for (LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr) if (name==itr->name) return itr->locale; diff --git a/src/shared/Common.h b/src/shared/Common.h index 100d1122b..2a41baa67 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -226,9 +226,9 @@ struct LocaleNameStr extern LocaleNameStr const fullLocaleNameList[]; //operator new[] based version of strdup() function! Release memory by using operator delete[] ! -inline char * mangos_strdup(const char * source) +inline char* mangos_strdup(const char* source) { - char * dest = new char[strlen(source) + 1]; + char* dest = new char[strlen(source) + 1]; strcpy(dest, source); return dest; } diff --git a/src/shared/Config/Config.cpp b/src/shared/Config/Config.cpp index 8365c4307..3070f95f8 100644 --- a/src/shared/Config/Config.cpp +++ b/src/shared/Config/Config.cpp @@ -23,7 +23,7 @@ INSTANTIATE_SINGLETON_1(Config); -static bool GetValueHelper(ACE_Configuration_Heap *mConf, const char *name, ACE_TString &result) +static bool GetValueHelper(ACE_Configuration_Heap* mConf, const char* name, ACE_TString& result) { if (!mConf) return false; @@ -45,7 +45,7 @@ static bool GetValueHelper(ACE_Configuration_Heap *mConf, const char *name, ACE_ } Config::Config() -: mConf(NULL) + : mConf(NULL) { } @@ -54,7 +54,7 @@ Config::~Config() delete mConf; } -bool Config::SetSource(const char *file) +bool Config::SetSource(const char* file) { mFilename = file; @@ -92,8 +92,8 @@ bool Config::GetBoolDefault(const char* name, bool def) const char* str = val.c_str(); if (strcmp(str, "true") == 0 || strcmp(str, "TRUE") == 0 || - strcmp(str, "yes") == 0 || strcmp(str, "YES") == 0 || - strcmp(str, "1") == 0) + strcmp(str, "yes") == 0 || strcmp(str, "YES") == 0 || + strcmp(str, "1") == 0) return true; else return false; diff --git a/src/shared/Config/Config.h b/src/shared/Config/Config.h index f9c215b96..050a63529 100644 --- a/src/shared/Config/Config.h +++ b/src/shared/Config/Config.h @@ -32,7 +32,7 @@ class MANGOS_DLL_SPEC Config Config(); ~Config(); - bool SetSource(const char *file); + bool SetSource(const char* file); bool Reload(); std::string GetStringDefault(const char* name, const char* def); @@ -45,7 +45,7 @@ class MANGOS_DLL_SPEC Config private: std::string mFilename; - ACE_Configuration_Heap *mConf; + ACE_Configuration_Heap* mConf; }; #define sConfig MaNGOS::Singleton::Instance() diff --git a/src/shared/LockedQueue.h b/src/shared/LockedQueue.h index 72f699fa6..7a22736b2 100644 --- a/src/shared/LockedQueue.h +++ b/src/shared/LockedQueue.h @@ -28,16 +28,16 @@ namespace ACE_Based { template > - class LockedQueue + class LockedQueue { - //! Lock access to the queue. - LockType _lock; + //! Lock access to the queue. + LockType _lock; - //! Storage backing the queue. - StorageType _queue; + //! Storage backing the queue. + StorageType _queue; - //! Cancellation flag. - /*volatile*/ bool _canceled; + //! Cancellation flag. + /*volatile*/ bool _canceled; public: @@ -62,7 +62,7 @@ namespace ACE_Based //! Gets the next result in the queue, if any. bool next(T& result) { - ACE_GUARD_RETURN (LockType, g, this->_lock, false); + ACE_GUARD_RETURN(LockType, g, this->_lock, false); if (_queue.empty()) return false; @@ -76,13 +76,13 @@ namespace ACE_Based template bool next(T& result, Checker& check) { - ACE_GUARD_RETURN (LockType, g, this->_lock, false); + ACE_GUARD_RETURN(LockType, g, this->_lock, false); if (_queue.empty()) return false; result = _queue.front(); - if(!check.Process(result)) + if (!check.Process(result)) return false; _queue.pop_front(); diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 8921f956e..8d38eb95b 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -30,7 +30,7 @@ #include "ace/OS_NS_unistd.h" -INSTANTIATE_SINGLETON_1( Log ); +INSTANTIATE_SINGLETON_1(Log); LogFilterData logFilterData[LOG_FILTER_COUNT] = { @@ -82,18 +82,18 @@ void Log::InitColors(const std::string& str) std::istringstream ss(str); - for(int i = 0; i < LogType_count; ++i) + for (int i = 0; i < LogType_count; ++i) { ss >> color[i]; - if(!ss) + if (!ss) return; - if(color[i] < 0 || color[i] >= Color_count) + if (color[i] < 0 || color[i] >= Color_count) return; } - for(int i = 0; i < LogType_count; ++i) + for (int i = 0; i < LogType_count; ++i) m_colors[i] = Color(color[i]); m_colored = true; @@ -101,7 +101,7 @@ void Log::InitColors(const std::string& str) void Log::SetColor(bool stdout_stream, Color color) { - #if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS static WORD WinColorFG[Color_count] = { @@ -113,24 +113,24 @@ void Log::SetColor(bool stdout_stream, Color color) FOREGROUND_RED | FOREGROUND_BLUE,// MAGENTA FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,// WHITE - // YELLOW + // YELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY, - // RED_BOLD + // RED_BOLD FOREGROUND_RED | FOREGROUND_INTENSITY, - // GREEN_BOLD + // GREEN_BOLD FOREGROUND_GREEN | FOREGROUND_INTENSITY, FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD - // MAGENTA_BOLD + // MAGENTA_BOLD FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY, - // CYAN_BOLD + // CYAN_BOLD FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY, - // WHITE_BOLD + // WHITE_BOLD FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY }; - HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE ); + HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); SetConsoleTextAttribute(hConsole, WinColorFG[color]); - #else +#else enum ANSITextAttr { @@ -172,17 +172,17 @@ void Log::SetColor(bool stdout_stream, Color color) }; fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm",UnixColorFG[color],(color>=YELLOW&&color= LOG_LVL_BASIC) @@ -543,7 +543,7 @@ void Log::outBasic( const char * str, ... ) outTimestamp(logfile); va_start(ap, str); vfprintf(logfile, str, ap); - fprintf(logfile, "\n" ); + fprintf(logfile, "\n"); va_end(ap); fflush(logfile); } @@ -551,7 +551,7 @@ void Log::outBasic( const char * str, ... ) fflush(stdout); } -void Log::outDetail( const char * str, ... ) +void Log::outDetail(const char* str, ...) { if (!str) return; @@ -573,7 +573,7 @@ void Log::outDetail( const char * str, ... ) if (m_colored) ResetColor(true); - printf( "\n" ); + printf("\n"); } if (logfile && m_logFileLevel >= LOG_LVL_DETAIL) @@ -585,14 +585,14 @@ void Log::outDetail( const char * str, ... ) vfprintf(logfile, str, ap); va_end(ap); - fprintf(logfile, "\n" ); + fprintf(logfile, "\n"); fflush(logfile); } fflush(stdout); } -void Log::outDebug( const char * str, ... ) +void Log::outDebug(const char* str, ...) { if (!str) return; @@ -613,7 +613,7 @@ void Log::outDebug( const char * str, ... ) if (m_colored) ResetColor(true); - printf( "\n" ); + printf("\n"); } if (logfile && m_logFileLevel >= LOG_LVL_DEBUG) @@ -625,14 +625,14 @@ void Log::outDebug( const char * str, ... ) vfprintf(logfile, str, ap); va_end(ap); - fprintf(logfile, "\n" ); + fprintf(logfile, "\n"); fflush(logfile); } fflush(stdout); } -void Log::outCommand( uint32 account, const char * str, ... ) +void Log::outCommand(uint32 account, const char* str, ...) { if (!str) return; @@ -653,7 +653,7 @@ void Log::outCommand( uint32 account, const char * str, ... ) if (m_colored) ResetColor(true); - printf( "\n" ); + printf("\n"); } if (logfile && m_logFileLevel >= LOG_LVL_DETAIL) @@ -662,20 +662,20 @@ void Log::outCommand( uint32 account, const char * str, ... ) outTimestamp(logfile); va_start(ap, str); vfprintf(logfile, str, ap); - fprintf(logfile, "\n" ); + fprintf(logfile, "\n"); va_end(ap); fflush(logfile); } if (m_gmlog_per_account) { - if (FILE* per_file = openGmlogPerAccount (account)) + if (FILE* per_file = openGmlogPerAccount(account)) { va_list ap; outTimestamp(per_file); va_start(ap, str); vfprintf(per_file, str, ap); - fprintf(per_file, "\n" ); + fprintf(per_file, "\n"); va_end(ap); fclose(per_file); } @@ -686,7 +686,7 @@ void Log::outCommand( uint32 account, const char * str, ... ) outTimestamp(gmLogfile); va_start(ap, str); vfprintf(gmLogfile, str, ap); - fprintf(gmLogfile, "\n" ); + fprintf(gmLogfile, "\n"); va_end(ap); fflush(gmLogfile); } @@ -694,7 +694,7 @@ void Log::outCommand( uint32 account, const char * str, ... ) fflush(stdout); } -void Log::outChar(const char * str, ... ) +void Log::outChar(const char* str, ...) { if (!str) @@ -706,13 +706,13 @@ void Log::outChar(const char * str, ... ) outTimestamp(charLogfile); va_start(ap, str); vfprintf(charLogfile, str, ap); - fprintf(charLogfile, "\n" ); + fprintf(charLogfile, "\n"); va_end(ap); fflush(charLogfile); } } -void Log::outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeName, ByteBuffer const* packet, bool incoming ) +void Log::outWorldPacketDump(uint32 socket, uint32 opcode, char const* opcodeName, ByteBuffer const* packet, bool incoming) { if (!worldLogfile) return; @@ -720,8 +720,8 @@ void Log::outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeNa outTimestamp(worldLogfile); fprintf(worldLogfile,"\n%s:\nSOCKET: %u\nLENGTH: " SIZEFMTD "\nOPCODE: %s (0x%.4X)\nDATA:\n", - incoming ? "CLIENT" : "SERVER", - socket, packet->size(), opcodeName, opcode); + incoming ? "CLIENT" : "SERVER", + socket, packet->size(), opcodeName, opcode); size_t p = 0; while (p < packet->size()) @@ -736,16 +736,16 @@ void Log::outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeNa fflush(worldLogfile); } -void Log::outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name ) +void Log::outCharDump(const char* str, uint32 account_id, uint32 guid, const char* name) { if (charLogfile) { - fprintf(charLogfile, "== START DUMP == (account: %u guid: %u name: %s )\n%s\n== END DUMP ==\n",account_id,guid,name,str ); + fprintf(charLogfile, "== START DUMP == (account: %u guid: %u name: %s )\n%s\n== END DUMP ==\n",account_id,guid,name,str); fflush(charLogfile); } } -void Log::outRALog( const char * str, ... ) +void Log::outRALog(const char* str, ...) { if (!str) return; @@ -756,7 +756,7 @@ void Log::outRALog( const char * str, ... ) outTimestamp(raLogfile); va_start(ap, str); vfprintf(raLogfile, str, ap); - fprintf(raLogfile, "\n" ); + fprintf(raLogfile, "\n"); va_end(ap); fflush(raLogfile); } @@ -773,13 +773,13 @@ void Log::WaitBeforeContinueIfNeed() printf("\nPress for continue\n"); std::string line; - std::getline (std::cin, line); + std::getline(std::cin, line); } else if (mode > 0) { printf("\nWait %u secs for continue.\n",mode); BarGoLink bar(mode); - for(int i = 0; i < mode; ++i) + for (int i = 0; i < mode; ++i) { bar.step(); ACE_OS::sleep(1); @@ -787,7 +787,7 @@ void Log::WaitBeforeContinueIfNeed() } } -void outstring_log(const char * str, ...) +void outstring_log(const char* str, ...) { if (!str) return; @@ -801,7 +801,7 @@ void outstring_log(const char * str, ...) sLog.outString("%s", buf); } -void detail_log(const char * str, ...) +void detail_log(const char* str, ...) { if (!str) return; @@ -815,7 +815,7 @@ void detail_log(const char * str, ...) sLog.outDetail("%s", buf); } -void debug_log(const char * str, ...) +void debug_log(const char* str, ...) { if (!str) return; @@ -829,7 +829,7 @@ void debug_log(const char * str, ...) DEBUG_LOG("%s", buf); } -void error_log(const char * str, ...) +void error_log(const char* str, ...) { if (!str) return; @@ -843,7 +843,7 @@ void error_log(const char * str, ...) sLog.outError("%s", buf); } -void error_db_log(const char * str, ...) +void error_db_log(const char* str, ...) { if (!str) return; diff --git a/src/shared/Log.h b/src/shared/Log.h index 491ba7b96..bb6fe5d87 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -89,65 +89,65 @@ const int Color_count = int(WHITE)+1; class Log : public MaNGOS::Singleton > { - friend class MaNGOS::OperatorNew; - Log(); + friend class MaNGOS::OperatorNew; + Log(); - ~Log() - { - if( logfile != NULL ) - fclose(logfile); - logfile = NULL; + ~Log() + { + if (logfile != NULL) + fclose(logfile); + logfile = NULL; - if( gmLogfile != NULL ) - fclose(gmLogfile); - gmLogfile = NULL; + if (gmLogfile != NULL) + fclose(gmLogfile); + gmLogfile = NULL; - if (charLogfile != NULL) - fclose(charLogfile); - charLogfile = NULL; + if (charLogfile != NULL) + fclose(charLogfile); + charLogfile = NULL; - if( dberLogfile != NULL ) - fclose(dberLogfile); - dberLogfile = NULL; + if (dberLogfile != NULL) + fclose(dberLogfile); + dberLogfile = NULL; - if (raLogfile != NULL) - fclose(raLogfile); - raLogfile = NULL; + if (raLogfile != NULL) + fclose(raLogfile); + raLogfile = NULL; - if (worldLogfile != NULL) - fclose(worldLogfile); - worldLogfile = NULL; - } + if (worldLogfile != NULL) + fclose(worldLogfile); + worldLogfile = NULL; + } public: void Initialize(); void InitColors(const std::string& init_str); - void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4); + void outCommand(uint32 account, const char* str, ...) ATTR_PRINTF(3,4); void outString(); // any log level - // any log level - void outString( const char * str, ... ) ATTR_PRINTF(2,3); - // any log level - void outError( const char * err, ... ) ATTR_PRINTF(2,3); - // log level >= 1 - void outBasic( const char * str, ... ) ATTR_PRINTF(2,3); - // log level >= 2 - void outDetail( const char * str, ... ) ATTR_PRINTF(2,3); - // log level >= 3 - void outDebug( const char * str, ... ) ATTR_PRINTF(2,3); + // any log level + void outString(const char* str, ...) ATTR_PRINTF(2,3); + // any log level + void outError(const char* err, ...) ATTR_PRINTF(2,3); + // log level >= 1 + void outBasic(const char* str, ...) ATTR_PRINTF(2,3); + // log level >= 2 + void outDetail(const char* str, ...) ATTR_PRINTF(2,3); + // log level >= 3 + void outDebug(const char* str, ...) ATTR_PRINTF(2,3); void outErrorDb(); // any log level - // any log level - void outErrorDb( const char * str, ... ) ATTR_PRINTF(2,3); - // any log level - void outChar( const char * str, ... ) ATTR_PRINTF(2,3); - // any log level - void outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeName, ByteBuffer const* packet, bool incoming ); // any log level - void outCharDump( const char * str, uint32 account_id, uint32 guid, const char * name ); - void outRALog( const char * str, ... ) ATTR_PRINTF(2,3); + void outErrorDb(const char* str, ...) ATTR_PRINTF(2,3); + // any log level + void outChar(const char* str, ...) ATTR_PRINTF(2,3); + // any log level + void outWorldPacketDump(uint32 socket, uint32 opcode, char const* opcodeName, ByteBuffer const* packet, bool incoming); + // any log level + void outCharDump(const char* str, uint32 account_id, uint32 guid, const char* name); + void outRALog(const char* str, ...) ATTR_PRINTF(2,3); uint32 GetLogLevel() const { return m_logLevel; } - void SetLogLevel(char * Level); - void SetLogFileLevel(char * Level); + void SetLogLevel(char* Level); + void SetLogFileLevel(char* Level); void SetColor(bool stdout_stream, Color color); void ResetColor(bool stdout_stream); void outTime(); @@ -239,9 +239,9 @@ class Log : public MaNGOS::Singleton 0) { + if (pid > 0) + { alarm(timeout); pause(); exit(EXIT_FAILURE); @@ -71,12 +74,14 @@ void startDaemon(uint32_t timeout) sid = setsid(); - if (sid < 0) { - exit(EXIT_FAILURE); + if (sid < 0) + { + exit(EXIT_FAILURE); } - if ((chdir("/")) < 0) { - exit(EXIT_FAILURE); + if ((chdir("/")) < 0) + { + exit(EXIT_FAILURE); } freopen("/dev/null", "rt", stdin); @@ -87,7 +92,7 @@ void startDaemon(uint32_t timeout) void stopDaemon() { std::string pidfile = sConfig.GetStringDefault("PidFile", ""); - if(!pidfile.empty()) + if (!pidfile.empty()) { std::fstream pf(pidfile.c_str(), std::ios::in); uint32_t pid = 0; diff --git a/src/shared/ProgressBar.cpp b/src/shared/ProgressBar.cpp index 50a9ec5df..74523fd9c 100644 --- a/src/shared/ProgressBar.cpp +++ b/src/shared/ProgressBar.cpp @@ -52,7 +52,7 @@ BarGoLink::~BarGoLink() if (!m_showOutput) return; - printf( "\n" ); + printf("\n"); fflush(stdout); } @@ -66,17 +66,17 @@ void BarGoLink::init(int row_count) if (!m_showOutput) return; - #ifdef _WIN32 - printf( "\x3D" ); - #else - printf( "[" ); - #endif - for ( int i = 0; i < indic_len; i++ ) printf( empty ); - #ifdef _WIN32 - printf( "\x3D 0%%\r\x3D" ); - #else - printf( "] 0%%\r[" ); - #endif +#ifdef _WIN32 + printf("\x3D"); +#else + printf("["); +#endif + for (int i = 0; i < indic_len; i++) printf(empty); +#ifdef _WIN32 + printf("\x3D 0%%\r\x3D"); +#else + printf("] 0%%\r["); +#endif fflush(stdout); } @@ -87,24 +87,24 @@ void BarGoLink::step() int i, n; - if ( num_rec == 0 ) return; + if (num_rec == 0) return; ++rec_no; n = rec_no * indic_len / num_rec; - if ( n != rec_pos ) + if (n != rec_pos) { - #ifdef _WIN32 - printf( "\r\x3D" ); - #else - printf( "\r[" ); - #endif - for ( i = 0; i < n; i++ ) printf( full ); - for ( ; i < indic_len; i++ ) printf( empty ); +#ifdef _WIN32 + printf("\r\x3D"); +#else + printf("\r["); +#endif + for (i = 0; i < n; i++) printf(full); + for (; i < indic_len; i++) printf(empty); float percent = (((float)n/(float)indic_len)*100); - #ifdef _WIN32 - printf( "\x3D %i%% \r\x3D", (int)percent); - #else - printf( "] %i%% \r[", (int)percent); - #endif +#ifdef _WIN32 + printf("\x3D %i%% \r\x3D", (int)percent); +#else + printf("] %i%% \r[", (int)percent); +#endif fflush(stdout); rec_pos = n; diff --git a/src/shared/ProgressBar.h b/src/shared/ProgressBar.h index 586c4f27c..e8f52bc56 100644 --- a/src/shared/ProgressBar.h +++ b/src/shared/ProgressBar.h @@ -36,8 +36,8 @@ class MANGOS_DLL_SPEC BarGoLink void init(int row_count); static bool m_showOutput; // not recommended change with existed active bar - static char const * const empty; - static char const * const full; + static char const* const empty; + static char const* const full; int rec_no; int rec_pos; diff --git a/src/shared/ServiceWin32.cpp b/src/shared/ServiceWin32.cpp index b88a6db26..316f9ea7d 100644 --- a/src/shared/ServiceWin32.cpp +++ b/src/shared/ServiceWin32.cpp @@ -32,7 +32,7 @@ #endif #endif -extern int main(int argc, char ** argv); +extern int main(int argc, char** argv); extern char serviceLongName[]; extern char serviceName[]; extern char serviceDescription[]; @@ -43,7 +43,7 @@ SERVICE_STATUS serviceStatus; SERVICE_STATUS_HANDLE serviceStatusHandle = 0; -typedef WINADVAPI BOOL (WINAPI *CSD_T)(SC_HANDLE, DWORD, LPCVOID); +typedef WINADVAPI BOOL (WINAPI* CSD_T)(SC_HANDLE, DWORD, LPCVOID); bool WinServiceInstall() { @@ -58,7 +58,7 @@ bool WinServiceInstall() } char path[_MAX_PATH + 10]; - if (!GetModuleFileName( 0, path, sizeof(path)/sizeof(path[0]))) + if (!GetModuleFileName(0, path, sizeof(path)/sizeof(path[0]))) { CloseServiceHandle(serviceControlManager); sLog.outError("SERVICE: Can't get service binary filename."); @@ -68,19 +68,19 @@ bool WinServiceInstall() std::strcat(path, " -s run"); SC_HANDLE service = CreateService(serviceControlManager, - serviceName, // name of service - serviceLongName, // service name to display - SERVICE_ALL_ACCESS, // desired access - // service type - SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS, - SERVICE_AUTO_START, // start type - SERVICE_ERROR_IGNORE, // error control type - path, // service's binary - 0, // no load ordering group - 0, // no tag identifier - 0, // no dependencies - 0, // LocalSystem account - 0); // no password + serviceName, // name of service + serviceLongName, // service name to display + SERVICE_ALL_ACCESS, // desired access + // service type + SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS, + SERVICE_AUTO_START, // start type + SERVICE_ERROR_IGNORE, // error control type + path, // service's binary + 0, // no load ordering group + 0, // no tag identifier + 0, // no dependencies + 0, // LocalSystem account + 0); // no password if (!service) { @@ -90,7 +90,7 @@ bool WinServiceInstall() } advapi32 = GetModuleHandle("ADVAPI32.DLL"); - if(!advapi32) + if (!advapi32) { sLog.outError("SERVICE: Can't access ADVAPI32.DLL"); CloseServiceHandle(service); @@ -143,7 +143,7 @@ bool WinServiceUninstall() } SC_HANDLE service = OpenService(serviceControlManager, - serviceName, SERVICE_QUERY_STATUS | DELETE); + serviceName, SERVICE_QUERY_STATUS | DELETE); if (!service) { @@ -192,7 +192,7 @@ void WINAPI ServiceControlHandler(DWORD controlCode) break; default: - if ( controlCode >= 128 && controlCode <= 255 ) + if (controlCode >= 128 && controlCode <= 255) // user defined control code break; else @@ -203,7 +203,7 @@ void WINAPI ServiceControlHandler(DWORD controlCode) SetServiceStatus(serviceStatusHandle, &serviceStatus); } -void WINAPI ServiceMain(DWORD argc, char *argv[]) +void WINAPI ServiceMain(DWORD argc, char* argv[]) { // initialise service status serviceStatus.dwServiceType = SERVICE_WIN32; @@ -216,7 +216,7 @@ void WINAPI ServiceMain(DWORD argc, char *argv[]) serviceStatusHandle = RegisterServiceCtrlHandler(serviceName, ServiceControlHandler); - if ( serviceStatusHandle ) + if (serviceStatusHandle) { char path[_MAX_PATH + 1]; unsigned int i, last_slash = 0; @@ -240,7 +240,7 @@ void WINAPI ServiceMain(DWORD argc, char *argv[]) // running serviceStatus.dwControlsAccepted |= (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); serviceStatus.dwCurrentState = SERVICE_RUNNING; - SetServiceStatus( serviceStatusHandle, &serviceStatus ); + SetServiceStatus(serviceStatusHandle, &serviceStatus); //////////////////////// // service main cycle // diff --git a/src/shared/Threading.cpp b/src/shared/Threading.cpp index 3adfae669..91a7eb93d 100644 --- a/src/shared/Threading.cpp +++ b/src/shared/Threading.cpp @@ -43,16 +43,16 @@ ThreadPriority::ThreadPriority() pr_iter.next(); } - MANGOS_ASSERT (!_tmp.empty()); + MANGOS_ASSERT(!_tmp.empty()); - if(_tmp.size() >= MAXPRIORITYNUM) + if (_tmp.size() >= MAXPRIORITYNUM) { const size_t max_pos = _tmp.size(); size_t min_pos = 1; size_t norm_pos = 0; for (size_t i = 0; i < max_pos; ++i) { - if(_tmp[i] == ACE_THR_PRI_OTHER_DEF) + if (_tmp[i] == ACE_THR_PRI_OTHER_DEF) { norm_pos = i + 1; break; @@ -65,7 +65,7 @@ ThreadPriority::ThreadPriority() //into ¹ piesces const size_t _divider = 4; size_t _div = (norm_pos - min_pos) / _divider; - if(_div == 0) + if (_div == 0) _div = 1; min_pos = (norm_pos - 1); @@ -74,7 +74,7 @@ ThreadPriority::ThreadPriority() m_priority[Lowest] = _tmp[min_pos -= _div ]; _div = (max_pos - norm_pos) / _divider; - if(_div == 0) + if (_div == 0) _div = 1; min_pos = norm_pos - 1; @@ -86,10 +86,10 @@ ThreadPriority::ThreadPriority() int ThreadPriority::getPriority(Priority p) const { - if(p < Idle) + if (p < Idle) p = Idle; - if(p > Realtime) + if (p > Realtime) p = Realtime; return m_priority[p]; @@ -113,7 +113,7 @@ Thread::Thread(Runnable* instance) : m_iThreadId(0), m_hThreadHandle(0), m_task( m_task->incReference(); bool _start = start(); - MANGOS_ASSERT (_start); + MANGOS_ASSERT(_start); } Thread::~Thread() @@ -181,9 +181,9 @@ void Thread::resume() ACE_Thread::resume(m_hThreadHandle); } -ACE_THR_FUNC_RETURN Thread::ThreadTask(void * param) +ACE_THR_FUNC_RETURN Thread::ThreadTask(void* param) { - Runnable * _task = (Runnable*)param; + Runnable* _task = (Runnable*)param; _task->run(); // task execution complete, free referecne added at @@ -205,17 +205,17 @@ ACE_hthread_t Thread::currentHandle() return _handle; } -Thread * Thread::current() +Thread* Thread::current() { - Thread * _thread = m_ThreadStorage.ts_object(); - if(!_thread) + Thread* _thread = m_ThreadStorage.ts_object(); + if (!_thread) { _thread = new Thread(); _thread->m_iThreadId = Thread::currentId(); _thread->m_hThreadHandle = Thread::currentHandle(); - Thread * _oldValue = m_ThreadStorage.ts_object(_thread); - if(_oldValue) + Thread* _oldValue = m_ThreadStorage.ts_object(_thread); + if (_oldValue) delete _oldValue; } @@ -228,7 +228,7 @@ void Thread::setPriority(Priority type) int _priority = m_TpEnum.getPriority(type); int _ok = ACE_Thread::setprio(m_hThreadHandle, _priority); //remove this ASSERT in case you don't want to know is thread priority change was successful or not - MANGOS_ASSERT (_ok == 0); + MANGOS_ASSERT(_ok == 0); #endif } diff --git a/src/shared/Threading.h b/src/shared/Threading.h index 14cd8ff76..84de289a3 100644 --- a/src/shared/Threading.h +++ b/src/shared/Threading.h @@ -35,7 +35,7 @@ namespace ACE_Based void incReference() { ++m_refs; } void decReference() { - if(!--m_refs) + if (!--m_refs) delete this; } private: @@ -84,17 +84,17 @@ namespace ACE_Based static void Sleep(unsigned long msecs); static ACE_thread_t currentId(); static ACE_hthread_t currentHandle(); - static Thread * current(); + static Thread* current(); private: Thread(const Thread&); Thread& operator=(const Thread&); - static ACE_THR_FUNC_RETURN ThreadTask(void * param); + static ACE_THR_FUNC_RETURN ThreadTask(void* param); ACE_thread_t m_iThreadId; ACE_hthread_t m_hThreadHandle; - Runnable * m_task; + Runnable* m_task; typedef ACE_TSS ThreadStorage; //global object - container for Thread class representation of every thread diff --git a/src/shared/Timer.h b/src/shared/Timer.h index 7f10c0611..4709acd08 100644 --- a/src/shared/Timer.h +++ b/src/shared/Timer.h @@ -52,7 +52,7 @@ class WorldTimer private: WorldTimer(); - WorldTimer(const WorldTimer& ); + WorldTimer(const WorldTimer&); //analogue to getMSTime() but it persists m_SystemTickTime static uint32 getMSTime_internal(bool savetime = false); diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp index 19a629122..6cf7a56df 100644 --- a/src/shared/Util.cpp +++ b/src/shared/Util.cpp @@ -68,47 +68,47 @@ uint32 WorldTimer::getMSTime_internal(bool savetime /*= false*/) } ////////////////////////////////////////////////////////////////////////// -int32 irand (int32 min, int32 max) +int32 irand(int32 min, int32 max) { - return int32 (mtRand->randInt (max - min)) + min; + return int32(mtRand->randInt(max - min)) + min; } -uint32 urand (uint32 min, uint32 max) +uint32 urand(uint32 min, uint32 max) { - return mtRand->randInt (max - min) + min; + return mtRand->randInt(max - min) + min; } -float frand (float min, float max) +float frand(float min, float max) { - return mtRand->randExc (max - min) + min; + return mtRand->randExc(max - min) + min; } -int32 rand32 () +int32 rand32() { - return mtRand->randInt (); + return mtRand->randInt(); } double rand_norm(void) { - return mtRand->randExc (); + return mtRand->randExc(); } float rand_norm_f(void) { - return (float)mtRand->randExc (); + return (float)mtRand->randExc(); } -double rand_chance (void) +double rand_chance(void) { - return mtRand->randExc (100.0); + return mtRand->randExc(100.0); } float rand_chance_f(void) { - return (float)mtRand->randExc (100.0); + return (float)mtRand->randExc(100.0); } -Tokens StrSplit(const std::string &src, const std::string &sep) +Tokens StrSplit(const std::string& src, const std::string& sep) { Tokens r; std::string s; @@ -130,7 +130,7 @@ Tokens StrSplit(const std::string &src, const std::string &sep) uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index) { - if(index >= data.size()) + if (index >= data.size()) return 0; return (uint32)atoi(data[index].c_str()); @@ -145,18 +145,18 @@ float GetFloatValueFromArray(Tokens const& data, uint16 index) return result; } -void stripLineInvisibleChars(std::string &str) +void stripLineInvisibleChars(std::string& str) { static std::string invChars = " \t\7\n"; size_t wpos = 0; bool space = false; - for(size_t pos = 0; pos < str.size(); ++pos) + for (size_t pos = 0; pos < str.size(); ++pos) { - if(invChars.find(str[pos])!=std::string::npos) + if (invChars.find(str[pos])!=std::string::npos) { - if(!space) + if (!space) { str[wpos++] = ' '; space = true; @@ -164,7 +164,7 @@ void stripLineInvisibleChars(std::string &str) } else { - if(wpos!=pos) + if (wpos!=pos) str[wpos++] = str[pos]; else ++wpos; @@ -172,7 +172,7 @@ void stripLineInvisibleChars(std::string &str) } } - if(wpos < str.size()) + if (wpos < str.size()) str.erase(wpos,str.size()); } @@ -184,15 +184,15 @@ std::string secsToTimeString(time_t timeInSecs, bool shortText, bool hoursOnly) time_t days = timeInSecs / DAY; std::ostringstream ss; - if(days) + if (days) ss << days << (shortText ? "d" : " Day(s) "); - if(hours || hoursOnly) + if (hours || hoursOnly) ss << hours << (shortText ? "h" : " Hour(s) "); - if(!hoursOnly) + if (!hoursOnly) { - if(minutes) + if (minutes) ss << minutes << (shortText ? "m" : " Minute(s) "); - if(secs || (!days && !hours && !minutes) ) + if (secs || (!days && !hours && !minutes)) ss << secs << (shortText ? "s" : " Second(s)."); } @@ -205,16 +205,16 @@ uint32 TimeStringToSecs(const std::string& timestring) uint32 buffer = 0; uint32 multiplier = 0; - for(std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); ++itr) + for (std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); ++itr) { - if(isdigit(*itr)) + if (isdigit(*itr)) { buffer*=10; buffer+= (*itr)-'0'; } else { - switch(*itr) + switch (*itr) { case 'd': multiplier = DAY; break; case 'h': multiplier = HOUR; break; @@ -248,7 +248,7 @@ std::string TimeToTimestampStr(time_t t) /// Check if the string is a valid ip address representation bool IsIPAddress(char const* ipaddress) { - if(!ipaddress) + if (!ipaddress) return false; // Let the big boys do it. @@ -259,7 +259,7 @@ bool IsIPAddress(char const* ipaddress) /// create PID file uint32 CreatePIDFile(const std::string& filename) { - FILE * pid_file = fopen (filename.c_str(), "w" ); + FILE* pid_file = fopen(filename.c_str(), "w"); if (pid_file == NULL) return 0; @@ -269,7 +269,7 @@ uint32 CreatePIDFile(const std::string& filename) pid_t pid = getpid(); #endif - fprintf(pid_file, "%d", pid ); + fprintf(pid_file, "%d", pid); fclose(pid_file); return (uint32)pid; @@ -281,7 +281,7 @@ size_t utf8length(std::string& utf8str) { return utf8::distance(utf8str.c_str(),utf8str.c_str()+utf8str.size()); } - catch(std::exception) + catch (std::exception) { utf8str = ""; return 0; @@ -293,7 +293,7 @@ void utf8truncate(std::string& utf8str,size_t len) try { size_t wlen = utf8::distance(utf8str.c_str(),utf8str.c_str()+utf8str.size()); - if(wlen <= len) + if (wlen <= len) return; std::wstring wstr; @@ -303,7 +303,7 @@ void utf8truncate(std::string& utf8str,size_t len) char* oend = utf8::utf16to8(wstr.c_str(),wstr.c_str()+wstr.size(),&utf8str[0]); utf8str.resize(oend-(&utf8str[0])); // remove unused tail } - catch(std::exception) + catch (std::exception) { utf8str = ""; } @@ -314,9 +314,9 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) try { size_t len = utf8::distance(utf8str,utf8str+csize); - if(len > wsize) + if (len > wsize) { - if(wsize > 0) + if (wsize > 0) wstr[0] = L'\0'; wsize = 0; return false; @@ -326,9 +326,9 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) utf8::utf8to16(utf8str,utf8str+csize,wstr); wstr[len] = L'\0'; } - catch(std::exception) + catch (std::exception) { - if(wsize > 0) + if (wsize > 0) wstr[0] = L'\0'; wsize = 0; return false; @@ -347,7 +347,7 @@ bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr) if (len) utf8::utf8to16(utf8str.c_str(),utf8str.c_str()+utf8str.size(),&wstr[0]); } - catch(std::exception) + catch (std::exception) { wstr = L""; return false; @@ -367,7 +367,7 @@ bool WStrToUtf8(wchar_t* wstr, size_t size, std::string& utf8str) utf8str2.resize(oend-(&utf8str2[0])); // remove unused tail utf8str = utf8str2; } - catch(std::exception) + catch (std::exception) { utf8str = ""; return false; @@ -387,7 +387,7 @@ bool WStrToUtf8(std::wstring wstr, std::string& utf8str) utf8str2.resize(oend-(&utf8str2[0])); // remove unused tail utf8str = utf8str2; } - catch(std::exception) + catch (std::exception) { utf8str = ""; return false; @@ -401,7 +401,7 @@ typedef wchar_t const* const* wstrlist; std::wstring GetMainPartOfName(std::wstring wname, uint32 declension) { // supported only Cyrillic cases - if(wname.size() < 1 || !isCyrillicCharacter(wname[0]) || declension > 5) + if (wname.size() < 1 || !isCyrillicCharacter(wname[0]) || declension > 5) return wname; // Important: end length must be <= MAX_INTERNAL_PLAYER_NAME-MAX_PLAYER_NAME (3 currently) @@ -423,7 +423,8 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension) static wchar_t const soft_End[] = { wchar_t(1), wchar_t(0x044C),wchar_t(0x0000)}; static wchar_t const j_End[] = { wchar_t(1), wchar_t(0x0439),wchar_t(0x0000)}; - static wchar_t const* const dropEnds[6][8] = { + static wchar_t const* const dropEnds[6][8] = + { { &a_End[1], &o_End[1], &ya_End[1], &ie_End[1], &soft_End[1], &j_End[1], NULL, NULL }, { &a_End[1], &ya_End[1], &yeru_End[1], &i_End[1], NULL, NULL, NULL, NULL }, { &ie_End[1], &u_End[1], &yu_End[1], &i_End[1], NULL, NULL, NULL, NULL }, @@ -432,11 +433,11 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension) { &ie_End[1], &i_End[1], NULL, NULL, NULL, NULL, NULL, NULL } }; - for(wchar_t const * const* itr = &dropEnds[declension][0]; *itr; ++itr) + for (wchar_t const * const* itr = &dropEnds[declension][0]; *itr; ++itr) { size_t len = size_t((*itr)[-1]); // get length from string size field - if(wname.substr(wname.size()-len,len)==*itr) + if (wname.substr(wname.size()-len,len)==*itr) return wname.substr(0,wname.size()-len); } @@ -447,7 +448,7 @@ bool utf8ToConsole(const std::string& utf8str, std::string& conStr) { #if PLATFORM == PLATFORM_WINDOWS std::wstring wstr; - if(!Utf8toWStr(utf8str,wstr)) + if (!Utf8toWStr(utf8str,wstr)) return false; conStr.resize(wstr.size()); @@ -479,19 +480,19 @@ bool Utf8FitTo(const std::string& str, std::wstring search) { std::wstring temp; - if(!Utf8toWStr(str,temp)) + if (!Utf8toWStr(str,temp)) return false; // converting to lower case - wstrToLower( temp ); + wstrToLower(temp); - if(temp.find(search) == std::wstring::npos) + if (temp.find(search) == std::wstring::npos) return false; return true; } -void utf8printf(FILE *out, const char *str, ...) +void utf8printf(FILE* out, const char* str, ...) { va_list ap; va_start(ap, str); @@ -499,7 +500,7 @@ void utf8printf(FILE *out, const char *str, ...) va_end(ap); } -void vutf8printf(FILE *out, const char *str, va_list* ap) +void vutf8printf(FILE* out, const char* str, va_list* ap) { #if PLATFORM == PLATFORM_WINDOWS char temp_buf[32*1024]; @@ -520,13 +521,13 @@ void vutf8printf(FILE *out, const char *str, va_list* ap) void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result) { std::ostringstream ss; - for(uint32 i=0; i>((1-j)*4)); char encodedNibble; - if(nibble < 0x0A) + if (nibble < 0x0A) encodedNibble = '0'+nibble; else encodedNibble = 'A'+nibble-0x0A; diff --git a/src/shared/Util.h b/src/shared/Util.h index b4476f77d..fd0a8687a 100644 --- a/src/shared/Util.h +++ b/src/shared/Util.h @@ -26,11 +26,11 @@ typedef std::vector Tokens; -Tokens StrSplit(const std::string &src, const std::string &sep); +Tokens StrSplit(const std::string& src, const std::string& sep); uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index); float GetFloatValueFromArray(Tokens const& data, uint16 index); -void stripLineInvisibleChars(std::string &src); +void stripLineInvisibleChars(std::string& src); std::string secsToTimeString(time_t timeInSecs, bool shortText = false, bool hoursOnly = false); uint32 TimeStringToSecs(const std::string& timestring); @@ -85,7 +85,7 @@ inline void ApplyModUInt32Var(uint32& var, int32 val, bool apply) { int32 cur = var; cur += (apply ? val : -val); - if(cur < 0) + if (cur < 0) cur = 0; var = cur; } @@ -93,7 +93,7 @@ inline void ApplyModUInt32Var(uint32& var, int32 val, bool apply) inline void ApplyModFloatVar(float& var, float val, bool apply) { var += (apply ? val : -val); - if(var < 0) + if (var < 0) var = 0; } @@ -121,60 +121,60 @@ void utf8truncate(std::string& utf8str,size_t len); inline bool isBasicLatinCharacter(wchar_t wchar) { - if(wchar >= L'a' && wchar <= L'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z + if (wchar >= L'a' && wchar <= L'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z return true; - if(wchar >= L'A' && wchar <= L'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z + if (wchar >= L'A' && wchar <= L'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z return true; return false; } inline bool isExtendedLatinCharacter(wchar_t wchar) { - if(isBasicLatinCharacter(wchar)) + if (isBasicLatinCharacter(wchar)) return true; - if(wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS + if (wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS return true; - if(wchar >= 0x00D8 && wchar <= 0x00DF) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN + if (wchar >= 0x00D8 && wchar <= 0x00DF) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN return true; - if(wchar == 0x00DF) // LATIN SMALL LETTER SHARP S + if (wchar == 0x00DF) // LATIN SMALL LETTER SHARP S return true; - if(wchar >= 0x00E0 && wchar <= 0x00F6) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER O WITH DIAERESIS + if (wchar >= 0x00E0 && wchar <= 0x00F6) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER O WITH DIAERESIS return true; - if(wchar >= 0x00F8 && wchar <= 0x00FE) // LATIN SMALL LETTER O WITH STROKE - LATIN SMALL LETTER THORN + if (wchar >= 0x00F8 && wchar <= 0x00FE) // LATIN SMALL LETTER O WITH STROKE - LATIN SMALL LETTER THORN return true; - if(wchar >= 0x0100 && wchar <= 0x012F) // LATIN CAPITAL LETTER A WITH MACRON - LATIN SMALL LETTER I WITH OGONEK + if (wchar >= 0x0100 && wchar <= 0x012F) // LATIN CAPITAL LETTER A WITH MACRON - LATIN SMALL LETTER I WITH OGONEK return true; - if(wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S + if (wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S return true; return false; } inline bool isCyrillicCharacter(wchar_t wchar) { - if(wchar >= 0x0410 && wchar <= 0x044F) // CYRILLIC CAPITAL LETTER A - CYRILLIC SMALL LETTER YA + if (wchar >= 0x0410 && wchar <= 0x044F) // CYRILLIC CAPITAL LETTER A - CYRILLIC SMALL LETTER YA return true; - if(wchar == 0x0401 || wchar == 0x0451) // CYRILLIC CAPITAL LETTER IO, CYRILLIC SMALL LETTER IO + if (wchar == 0x0401 || wchar == 0x0451) // CYRILLIC CAPITAL LETTER IO, CYRILLIC SMALL LETTER IO return true; return false; } inline bool isEastAsianCharacter(wchar_t wchar) { - if(wchar >= 0x1100 && wchar <= 0x11F9) // Hangul Jamo + if (wchar >= 0x1100 && wchar <= 0x11F9) // Hangul Jamo return true; - if(wchar >= 0x3041 && wchar <= 0x30FF) // Hiragana + Katakana + if (wchar >= 0x3041 && wchar <= 0x30FF) // Hiragana + Katakana return true; - if(wchar >= 0x3131 && wchar <= 0x318E) // Hangul Compatibility Jamo + if (wchar >= 0x3131 && wchar <= 0x318E) // Hangul Compatibility Jamo return true; - if(wchar >= 0x31F0 && wchar <= 0x31FF) // Katakana Phonetic Ext. + if (wchar >= 0x31F0 && wchar <= 0x31FF) // Katakana Phonetic Ext. return true; - if(wchar >= 0x3400 && wchar <= 0x4DB5) // CJK Ideographs Ext. A + if (wchar >= 0x3400 && wchar <= 0x4DB5) // CJK Ideographs Ext. A return true; - if(wchar >= 0x4E00 && wchar <= 0x9FC3) // Unified CJK Ideographs + if (wchar >= 0x4E00 && wchar <= 0x9FC3) // Unified CJK Ideographs return true; - if(wchar >= 0xAC00 && wchar <= 0xD7A3) // Hangul Syllables + if (wchar >= 0xAC00 && wchar <= 0xD7A3) // Hangul Syllables return true; - if(wchar >= 0xFF01 && wchar <= 0xFFEE) // Halfwidth forms + if (wchar >= 0xFF01 && wchar <= 0xFFEE) // Halfwidth forms return true; return false; } @@ -201,7 +201,7 @@ inline bool isNumericOrSpace(wchar_t wchar) inline bool isNumeric(char const* str) { - for(char const* c = str; *c; ++c) + for (char const* c = str; *c; ++c) if (!isNumeric(*c)) return false; @@ -210,7 +210,7 @@ inline bool isNumeric(char const* str) inline bool isNumeric(std::string const& str) { - for(std::string::const_iterator itr = str.begin(); itr != str.end(); ++itr) + for (std::string::const_iterator itr = str.begin(); itr != str.end(); ++itr) if (!isNumeric(*itr)) return false; @@ -219,7 +219,7 @@ inline bool isNumeric(std::string const& str) inline bool isNumeric(std::wstring const& str) { - for(std::wstring::const_iterator itr = str.begin(); itr != str.end(); ++itr) + for (std::wstring::const_iterator itr = str.begin(); itr != str.end(); ++itr) if (!isNumeric(*itr)) return false; @@ -228,64 +228,64 @@ inline bool isNumeric(std::wstring const& str) inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace) { - for(size_t i = 0; i < wstr.size(); ++i) - if(!isBasicLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) + for (size_t i = 0; i < wstr.size(); ++i) + if (!isBasicLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) return false; return true; } inline bool isExtendedLatinString(std::wstring wstr, bool numericOrSpace) { - for(size_t i = 0; i < wstr.size(); ++i) - if(!isExtendedLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) + for (size_t i = 0; i < wstr.size(); ++i) + if (!isExtendedLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) return false; return true; } inline bool isCyrillicString(std::wstring wstr, bool numericOrSpace) { - for(size_t i = 0; i < wstr.size(); ++i) - if(!isCyrillicCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) + for (size_t i = 0; i < wstr.size(); ++i) + if (!isCyrillicCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) return false; return true; } inline bool isEastAsianString(std::wstring wstr, bool numericOrSpace) { - for(size_t i = 0; i < wstr.size(); ++i) - if(!isEastAsianCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) + for (size_t i = 0; i < wstr.size(); ++i) + if (!isEastAsianCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) return false; return true; } inline void strToUpper(std::string& str) { - std::transform( str.begin(), str.end(), str.begin(), toupper ); + std::transform(str.begin(), str.end(), str.begin(), toupper); } inline void strToLower(std::string& str) { - std::transform( str.begin(), str.end(), str.begin(), tolower ); + std::transform(str.begin(), str.end(), str.begin(), tolower); } inline wchar_t wcharToUpper(wchar_t wchar) { - if(wchar >= L'a' && wchar <= L'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z + if (wchar >= L'a' && wchar <= L'z') // LATIN SMALL LETTER A - LATIN SMALL LETTER Z return wchar_t(uint16(wchar)-0x0020); - if(wchar == 0x00DF) // LATIN SMALL LETTER SHARP S + if (wchar == 0x00DF) // LATIN SMALL LETTER SHARP S return wchar_t(0x1E9E); - if(wchar >= 0x00E0 && wchar <= 0x00F6) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER O WITH DIAERESIS + if (wchar >= 0x00E0 && wchar <= 0x00F6) // LATIN SMALL LETTER A WITH GRAVE - LATIN SMALL LETTER O WITH DIAERESIS return wchar_t(uint16(wchar)-0x0020); - if(wchar >= 0x00F8 && wchar <= 0x00FE) // LATIN SMALL LETTER O WITH STROKE - LATIN SMALL LETTER THORN + if (wchar >= 0x00F8 && wchar <= 0x00FE) // LATIN SMALL LETTER O WITH STROKE - LATIN SMALL LETTER THORN return wchar_t(uint16(wchar)-0x0020); - if(wchar >= 0x0101 && wchar <= 0x012F) // LATIN SMALL LETTER A WITH MACRON - LATIN SMALL LETTER I WITH OGONEK (only %2=1) + if (wchar >= 0x0101 && wchar <= 0x012F) // LATIN SMALL LETTER A WITH MACRON - LATIN SMALL LETTER I WITH OGONEK (only %2=1) { - if(wchar % 2 == 1) + if (wchar % 2 == 1) return wchar_t(uint16(wchar)-0x0001); } - if(wchar >= 0x0430 && wchar <= 0x044F) // CYRILLIC SMALL LETTER A - CYRILLIC SMALL LETTER YA + if (wchar >= 0x0430 && wchar <= 0x044F) // CYRILLIC SMALL LETTER A - CYRILLIC SMALL LETTER YA return wchar_t(uint16(wchar)-0x0020); - if(wchar == 0x0451) // CYRILLIC SMALL LETTER IO + if (wchar == 0x0451) // CYRILLIC SMALL LETTER IO return wchar_t(0x0401); return wchar; @@ -298,22 +298,22 @@ inline wchar_t wcharToUpperOnlyLatin(wchar_t wchar) inline wchar_t wcharToLower(wchar_t wchar) { - if(wchar >= L'A' && wchar <= L'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z + if (wchar >= L'A' && wchar <= L'Z') // LATIN CAPITAL LETTER A - LATIN CAPITAL LETTER Z return wchar_t(uint16(wchar)+0x0020); - if(wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS + if (wchar >= 0x00C0 && wchar <= 0x00D6) // LATIN CAPITAL LETTER A WITH GRAVE - LATIN CAPITAL LETTER O WITH DIAERESIS return wchar_t(uint16(wchar)+0x0020); - if(wchar >= 0x00D8 && wchar <= 0x00DE) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN + if (wchar >= 0x00D8 && wchar <= 0x00DE) // LATIN CAPITAL LETTER O WITH STROKE - LATIN CAPITAL LETTER THORN return wchar_t(uint16(wchar)+0x0020); - if(wchar >= 0x0100 && wchar <= 0x012E) // LATIN CAPITAL LETTER A WITH MACRON - LATIN CAPITAL LETTER I WITH OGONEK (only %2=0) + if (wchar >= 0x0100 && wchar <= 0x012E) // LATIN CAPITAL LETTER A WITH MACRON - LATIN CAPITAL LETTER I WITH OGONEK (only %2=0) { - if(wchar % 2 == 0) + if (wchar % 2 == 0) return wchar_t(uint16(wchar)+0x0001); } - if(wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S + if (wchar == 0x1E9E) // LATIN CAPITAL LETTER SHARP S return wchar_t(0x00DF); - if(wchar == 0x0401) // CYRILLIC CAPITAL LETTER IO + if (wchar == 0x0401) // CYRILLIC CAPITAL LETTER IO return wchar_t(0x0451); - if(wchar >= 0x0410 && wchar <= 0x042F) // CYRILLIC CAPITAL LETTER A - CYRILLIC CAPITAL LETTER YA + if (wchar >= 0x0410 && wchar <= 0x042F) // CYRILLIC CAPITAL LETTER A - CYRILLIC CAPITAL LETTER YA return wchar_t(uint16(wchar)+0x0020); return wchar; @@ -321,12 +321,12 @@ inline wchar_t wcharToLower(wchar_t wchar) inline void wstrToUpper(std::wstring& str) { - std::transform( str.begin(), str.end(), str.begin(), wcharToUpper ); + std::transform(str.begin(), str.end(), str.begin(), wcharToUpper); } inline void wstrToLower(std::wstring& str) { - std::transform( str.begin(), str.end(), str.begin(), wcharToLower ); + std::transform(str.begin(), str.end(), str.begin(), wcharToLower); } std::wstring GetMainPartOfName(std::wstring wname, uint32 declension); @@ -334,8 +334,8 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension); bool utf8ToConsole(const std::string& utf8str, std::string& conStr); bool consoleToUtf8(const std::string& conStr,std::string& utf8str); bool Utf8FitTo(const std::string& str, std::wstring search); -void utf8printf(FILE *out, const char *str, ...); -void vutf8printf(FILE *out, const char *str, va_list* ap); +void utf8printf(FILE* out, const char* str, ...); +void vutf8printf(FILE* out, const char* str, va_list* ap); bool IsIPAddress(char const* ipaddress); uint32 CreatePIDFile(const std::string& filename); diff --git a/src/shared/WheatyExceptionReport.cpp b/src/shared/WheatyExceptionReport.cpp index d37019e08..fb259a950 100644 --- a/src/shared/WheatyExceptionReport.cpp +++ b/src/shared/WheatyExceptionReport.cpp @@ -29,7 +29,7 @@ inline LPTSTR ErrorMessage(DWORD dw) dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, - 0, NULL ); + 0, NULL); return (LPTSTR)lpMsgBuf; } @@ -48,7 +48,7 @@ WheatyExceptionReport g_WheatyExceptionReport; //============================== Class Methods ============================= -WheatyExceptionReport::WheatyExceptionReport( ) // Constructor +WheatyExceptionReport::WheatyExceptionReport() // Constructor { // Install the unhandled exception filter function m_previousFilter = SetUnhandledExceptionFilter(WheatyUnhandledExceptionFilter); @@ -58,79 +58,79 @@ WheatyExceptionReport::WheatyExceptionReport( ) // Constructor //============ // Destructor //============ -WheatyExceptionReport::~WheatyExceptionReport( ) +WheatyExceptionReport::~WheatyExceptionReport() { - if(m_previousFilter) - SetUnhandledExceptionFilter( m_previousFilter ); + if (m_previousFilter) + SetUnhandledExceptionFilter(m_previousFilter); } //=========================================================== // Entry point where control comes on an unhandled exception //=========================================================== LONG WINAPI WheatyExceptionReport::WheatyUnhandledExceptionFilter( -PEXCEPTION_POINTERS pExceptionInfo ) + PEXCEPTION_POINTERS pExceptionInfo) { TCHAR module_folder_name[MAX_PATH]; - GetModuleFileName( 0, module_folder_name, MAX_PATH ); + GetModuleFileName(0, module_folder_name, MAX_PATH); TCHAR* pos = _tcsrchr(module_folder_name, '\\'); - if(!pos) + if (!pos) return 0; pos[0] = '\0'; ++pos; TCHAR crash_folder_path[MAX_PATH]; sprintf(crash_folder_path, "%s\\%s", module_folder_name, CrashFolder); - if(!CreateDirectory(crash_folder_path, NULL)) + if (!CreateDirectory(crash_folder_path, NULL)) { - if(GetLastError() != ERROR_ALREADY_EXISTS) + if (GetLastError() != ERROR_ALREADY_EXISTS) return 0; } SYSTEMTIME systime; GetLocalTime(&systime); sprintf(m_szLogFileName, "%s\\%s_[%u-%u_%u-%u-%u].txt", - crash_folder_path, pos, systime.wDay, systime.wMonth, systime.wHour, systime.wMinute, systime.wSecond - ); + crash_folder_path, pos, systime.wDay, systime.wMonth, systime.wHour, systime.wMinute, systime.wSecond + ); - m_hReportFile = CreateFile( m_szLogFileName, - GENERIC_WRITE, - 0, - 0, - OPEN_ALWAYS, - FILE_FLAG_WRITE_THROUGH, - 0 ); + m_hReportFile = CreateFile(m_szLogFileName, + GENERIC_WRITE, + 0, + 0, + OPEN_ALWAYS, + FILE_FLAG_WRITE_THROUGH, + 0); - if ( m_hReportFile ) + if (m_hReportFile) { - SetFilePointer( m_hReportFile, 0, 0, FILE_END ); + SetFilePointer(m_hReportFile, 0, 0, FILE_END); - GenerateExceptionReport( pExceptionInfo ); + GenerateExceptionReport(pExceptionInfo); - CloseHandle( m_hReportFile ); + CloseHandle(m_hReportFile); m_hReportFile = 0; } - if ( m_previousFilter ) - return m_previousFilter( pExceptionInfo ); + if (m_previousFilter) + return m_previousFilter(pExceptionInfo); else return EXCEPTION_EXECUTE_HANDLER/*EXCEPTION_CONTINUE_SEARCH*/; } BOOL WheatyExceptionReport::_GetProcessorName(TCHAR* sProcessorName, DWORD maxcount) { - if(!sProcessorName) + if (!sProcessorName) return FALSE; HKEY hKey; LONG lRet; lRet = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"), - 0, KEY_QUERY_VALUE, &hKey); + 0, KEY_QUERY_VALUE, &hKey); if (lRet != ERROR_SUCCESS) return FALSE; TCHAR szTmp[2048]; DWORD cntBytes = sizeof(szTmp); lRet = ::RegQueryValueEx(hKey, _T("ProcessorNameString"), NULL, NULL, - (LPBYTE)szTmp, &cntBytes); + (LPBYTE)szTmp, &cntBytes); if (lRet != ERROR_SUCCESS) return FALSE; ::RegCloseKey(hKey); @@ -161,7 +161,7 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax) TCHAR wszTmp[128]; switch (osvi.dwPlatformId) { - // Windows NT product family. + // Windows NT product family. case VER_PLATFORM_WIN32_NT: // Test for the specific product family. if (osvi.dwMajorVersion == 6) @@ -172,132 +172,132 @@ BOOL WheatyExceptionReport::_GetWindowsVersion(TCHAR* szVersion, DWORD cntMax) _tcsncat(szVersion, _T("Microsoft Windows XP "), cntMax); if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) _tcsncat(szVersion, _T("Microsoft Windows 2000 "), cntMax); - if (osvi.dwMajorVersion <= 4 ) + if (osvi.dwMajorVersion <= 4) _tcsncat(szVersion, _T("Microsoft Windows NT "), cntMax); // Test for specific product on Windows NT 4.0 SP6 and later. if (bOsVersionInfoEx) { // Test for the workstation type. - #if WINVER < 0x0500 +#if WINVER < 0x0500 if (osvi.wReserved[1] == VER_NT_WORKSTATION) - #else - if (osvi.wProductType == VER_NT_WORKSTATION) - #endif // WINVER < 0x0500 - { - if (osvi.dwMajorVersion == 4) - _tcsncat(szVersion, _T("Workstation 4.0 "), cntMax); - #if WINVER < 0x0500 - else if (osvi.wReserved[0] & VER_SUITE_PERSONAL) - #else +#else + if (osvi.wProductType == VER_NT_WORKSTATION) +#endif // WINVER < 0x0500 + { + if (osvi.dwMajorVersion == 4) + _tcsncat(szVersion, _T("Workstation 4.0 "), cntMax); +#if WINVER < 0x0500 + else if (osvi.wReserved[0] & VER_SUITE_PERSONAL) +#else else if (osvi.wSuiteMask & VER_SUITE_PERSONAL) - #endif // WINVER < 0x0500 +#endif // WINVER < 0x0500 _tcsncat(szVersion, _T("Home Edition "), cntMax); - #if WINVER < 0x0500 - else if (osvi.wReserved[0] & VER_SUITE_EMBEDDEDNT) - #else +#if WINVER < 0x0500 + else if (osvi.wReserved[0] & VER_SUITE_EMBEDDEDNT) +#else else if (osvi.wSuiteMask & VER_SUITE_EMBEDDEDNT) - #endif // WINVER < 0x0500 +#endif // WINVER < 0x0500 _tcsncat(szVersion, _T("Embedded "), cntMax); - else - _tcsncat(szVersion, _T("Professional "), cntMax); - } - // Test for the server type. - #if WINVER < 0x0500 - else if (osvi.wReserved[1] == VER_NT_SERVER) - #else + else + _tcsncat(szVersion, _T("Professional "), cntMax); + } + // Test for the server type. +#if WINVER < 0x0500 + else if (osvi.wReserved[1] == VER_NT_SERVER) +#else else if (osvi.wProductType == VER_NT_SERVER) - #endif // WINVER < 0x0500 - { - if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) +#endif // WINVER < 0x0500 { - #if WINVER < 0x0500 - if (osvi.wReserved[0] & VER_SUITE_DATACENTER) - #else + if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) + { +#if WINVER < 0x0500 + if (osvi.wReserved[0] & VER_SUITE_DATACENTER) +#else if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - #endif // WINVER < 0x0500 +#endif // WINVER < 0x0500 _tcsncat(szVersion, _T("Datacenter Edition "), cntMax); - #if WINVER < 0x0500 - else if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE) - #else +#if WINVER < 0x0500 + else if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE) +#else else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - #endif // WINVER < 0x0500 +#endif // WINVER < 0x0500 _tcsncat(szVersion, _T("Enterprise Edition "), cntMax); - #if WINVER < 0x0500 - else if (osvi.wReserved[0] == VER_SUITE_BLADE) - #else +#if WINVER < 0x0500 + else if (osvi.wReserved[0] == VER_SUITE_BLADE) +#else else if (osvi.wSuiteMask == VER_SUITE_BLADE) - #endif // WINVER < 0x0500 +#endif // WINVER < 0x0500 _tcsncat(szVersion, _T("Web Edition "), cntMax); - else - _tcsncat(szVersion, _T("Standard Edition "), cntMax); - } - else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) - { - #if WINVER < 0x0500 - if (osvi.wReserved[0] & VER_SUITE_DATACENTER) - #else + else + _tcsncat(szVersion, _T("Standard Edition "), cntMax); + } + else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) + { +#if WINVER < 0x0500 + if (osvi.wReserved[0] & VER_SUITE_DATACENTER) +#else if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - #endif // WINVER < 0x0500 +#endif // WINVER < 0x0500 _tcsncat(szVersion, _T("Datacenter Server "), cntMax); - #if WINVER < 0x0500 - else if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE ) - #else - else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) - #endif // WINVER < 0x0500 +#if WINVER < 0x0500 + else if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE) +#else + else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) +#endif // WINVER < 0x0500 _tcsncat(szVersion, _T("Advanced Server "), cntMax); - else - _tcsncat(szVersion, _T("Server "), cntMax); - } - else // Windows NT 4.0 - { - #if WINVER < 0x0500 - if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE) - #else + else + _tcsncat(szVersion, _T("Server "), cntMax); + } + else // Windows NT 4.0 + { +#if WINVER < 0x0500 + if (osvi.wReserved[0] & VER_SUITE_ENTERPRISE) +#else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - #endif // WINVER < 0x0500 +#endif // WINVER < 0x0500 _tcsncat(szVersion, _T("Server 4.0, Enterprise Edition "), cntMax); - else - _tcsncat(szVersion, _T("Server 4.0 "), cntMax); + else + _tcsncat(szVersion, _T("Server 4.0 "), cntMax); + } } } - } - // Display service pack (if any) and build number. - if (osvi.dwMajorVersion == 4 && _tcsicmp(osvi.szCSDVersion, _T("Service Pack 6")) == 0) - { - HKEY hKey; - LONG lRet; + // Display service pack (if any) and build number. + if (osvi.dwMajorVersion == 4 && _tcsicmp(osvi.szCSDVersion, _T("Service Pack 6")) == 0) + { + HKEY hKey; + LONG lRet; - // Test for SP6 versus SP6a. - lRet = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"), 0, KEY_QUERY_VALUE, &hKey); - if (lRet == ERROR_SUCCESS) + // Test for SP6 versus SP6a. + lRet = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009"), 0, KEY_QUERY_VALUE, &hKey); + if (lRet == ERROR_SUCCESS) + { + _stprintf(wszTmp, _T("Service Pack 6a (Version %d.%d, Build %d)"), + osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); + _tcsncat(szVersion, wszTmp, cntMax); + } + else // Windows NT 4.0 prior to SP6a + { + _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"), + osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); + _tcsncat(szVersion, wszTmp, cntMax); + } + ::RegCloseKey(hKey); + } + else // Windows NT 3.51 and earlier or Windows 2000 and later { - _stprintf(wszTmp, _T("Service Pack 6a (Version %d.%d, Build %d)"), - osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); + if (!_tcslen(osvi.szCSDVersion)) + _stprintf(wszTmp, _T("(Version %d.%d, Build %d)"), + osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); + else + _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"), + osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); _tcsncat(szVersion, wszTmp, cntMax); } - else // Windows NT 4.0 prior to SP6a - { - _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"), - osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); - _tcsncat(szVersion, wszTmp, cntMax); - } - ::RegCloseKey(hKey); - } - else // Windows NT 3.51 and earlier or Windows 2000 and later - { - if (!_tcslen(osvi.szCSDVersion)) - _stprintf(wszTmp, _T("(Version %d.%d, Build %d)"), - osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); - else - _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"), - osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); - _tcsncat(szVersion, wszTmp, cntMax); - } - break; + break; default: _stprintf(wszTmp, _T("%s (Version %d.%d, Build %d)"), - osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); + osvi.szCSDVersion, osvi.dwMajorVersion, osvi.dwMinorVersion, osvi.dwBuildNumber & 0xFFFF); _tcsncat(szVersion, wszTmp, cntMax); break; } @@ -311,18 +311,18 @@ void WheatyExceptionReport::PrintSystemInfo() ::GetSystemInfo(&SystemInfo); MEMORYSTATUS MemoryStatus; - MemoryStatus.dwLength = sizeof (MEMORYSTATUS); + MemoryStatus.dwLength = sizeof(MEMORYSTATUS); ::GlobalMemoryStatus(&MemoryStatus); TCHAR sString[1024]; _tprintf(_T("//=====================================================\r\n")); if (_GetProcessorName(sString, countof(sString))) _tprintf(_T("*** Hardware ***\r\nProcessor: %s\r\nNumber Of Processors: %d\r\nPhysical Memory: %d KB (Available: %d KB)\r\nCommit Charge Limit: %d KB\r\n"), - sString, SystemInfo.dwNumberOfProcessors, MemoryStatus.dwTotalPhys/0x400, MemoryStatus.dwAvailPhys/0x400, MemoryStatus.dwTotalPageFile/0x400); + sString, SystemInfo.dwNumberOfProcessors, MemoryStatus.dwTotalPhys/0x400, MemoryStatus.dwAvailPhys/0x400, MemoryStatus.dwTotalPageFile/0x400); else _tprintf(_T("*** Hardware ***\r\nProcessor: \r\nNumber Of Processors: %d\r\nPhysical Memory: %d KB (Available: %d KB)\r\nCommit Charge Limit: %d KB\r\n"), - SystemInfo.dwNumberOfProcessors, MemoryStatus.dwTotalPhys/0x400, MemoryStatus.dwAvailPhys/0x400, MemoryStatus.dwTotalPageFile/0x400); + SystemInfo.dwNumberOfProcessors, MemoryStatus.dwTotalPhys/0x400, MemoryStatus.dwAvailPhys/0x400, MemoryStatus.dwTotalPageFile/0x400); - if(_GetWindowsVersion(sString, countof(sString))) + if (_GetWindowsVersion(sString, countof(sString))) _tprintf(_T("\r\n*** Operation System ***\r\n%s\r\n"), sString); else _tprintf(_T("\r\n*** Operation System:\r\n\r\n")); @@ -331,48 +331,49 @@ void WheatyExceptionReport::PrintSystemInfo() //=========================================================================== void WheatyExceptionReport::printTracesForAllThreads() { - HANDLE hThreadSnap = INVALID_HANDLE_VALUE; - THREADENTRY32 te32; + HANDLE hThreadSnap = INVALID_HANDLE_VALUE; + THREADENTRY32 te32; - DWORD dwOwnerPID = GetCurrentProcessId(); - m_hProcess = GetCurrentProcess(); - // Take a snapshot of all running threads - hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 ); - if( hThreadSnap == INVALID_HANDLE_VALUE ) - return; + DWORD dwOwnerPID = GetCurrentProcessId(); + m_hProcess = GetCurrentProcess(); + // Take a snapshot of all running threads + hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); + if (hThreadSnap == INVALID_HANDLE_VALUE) + return; - // Fill in the size of the structure before using it. - te32.dwSize = sizeof(THREADENTRY32 ); + // Fill in the size of the structure before using it. + te32.dwSize = sizeof(THREADENTRY32); - // Retrieve information about the first thread, - // and exit if unsuccessful - if( !Thread32First( hThreadSnap, &te32 ) ) - { - CloseHandle( hThreadSnap ); // Must clean up the - // snapshot object! - return; - } - - // Now walk the thread list of the system, - // and display information about each thread - // associated with the specified process - do - { - if( te32.th32OwnerProcessID == dwOwnerPID ) + // Retrieve information about the first thread, + // and exit if unsuccessful + if (!Thread32First(hThreadSnap, &te32)) { - CONTEXT context; - context.ContextFlags = 0xffffffff; - HANDLE threadHandle = OpenThread(THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION,false, te32.th32ThreadID); - if(threadHandle && GetThreadContext(threadHandle, &context)) - { - WriteStackDetails( &context, false, threadHandle ); - } - CloseHandle(threadHandle); + CloseHandle(hThreadSnap); // Must clean up the + // snapshot object! + return; } - } while( Thread32Next(hThreadSnap, &te32 ) ); + + // Now walk the thread list of the system, + // and display information about each thread + // associated with the specified process + do + { + if (te32.th32OwnerProcessID == dwOwnerPID) + { + CONTEXT context; + context.ContextFlags = 0xffffffff; + HANDLE threadHandle = OpenThread(THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION,false, te32.th32ThreadID); + if (threadHandle && GetThreadContext(threadHandle, &context)) + { + WriteStackDetails(&context, false, threadHandle); + } + CloseHandle(threadHandle); + } + } + while (Thread32Next(hThreadSnap, &te32)); // Don't forget to clean up the snapshot object. - CloseHandle( hThreadSnap ); + CloseHandle(hThreadSnap); } //=========================================================================== @@ -380,7 +381,7 @@ void WheatyExceptionReport::printTracesForAllThreads() // WheatyUnhandledExceptionFilter //=========================================================================== void WheatyExceptionReport::GenerateExceptionReport( -PEXCEPTION_POINTERS pExceptionInfo ) + PEXCEPTION_POINTERS pExceptionInfo) { SYSTEMTIME systime; GetLocalTime(&systime); @@ -393,129 +394,129 @@ PEXCEPTION_POINTERS pExceptionInfo ) PrintSystemInfo(); // First print information about the type of fault _tprintf(_T("\r\n//=====================================================\r\n")); - _tprintf( _T("Exception code: %08X %s\r\n"), - pExceptionRecord->ExceptionCode, - GetExceptionString(pExceptionRecord->ExceptionCode) ); + _tprintf(_T("Exception code: %08X %s\r\n"), + pExceptionRecord->ExceptionCode, + GetExceptionString(pExceptionRecord->ExceptionCode)); // Now print information about where the fault occured TCHAR szFaultingModule[MAX_PATH]; DWORD section; DWORD_PTR offset; - GetLogicalAddress( pExceptionRecord->ExceptionAddress, - szFaultingModule, - sizeof( szFaultingModule ), - section, offset ); + GetLogicalAddress(pExceptionRecord->ExceptionAddress, + szFaultingModule, + sizeof(szFaultingModule), + section, offset); #ifdef _M_IX86 - _tprintf( _T("Fault address: %08X %02X:%08X %s\r\n"), - pExceptionRecord->ExceptionAddress, - section, offset, szFaultingModule ); + _tprintf(_T("Fault address: %08X %02X:%08X %s\r\n"), + pExceptionRecord->ExceptionAddress, + section, offset, szFaultingModule); #endif #ifdef _M_X64 - _tprintf( _T("Fault address: %016I64X %02X:%016I64X %s\r\n"), - pExceptionRecord->ExceptionAddress, - section, offset, szFaultingModule ); + _tprintf(_T("Fault address: %016I64X %02X:%016I64X %s\r\n"), + pExceptionRecord->ExceptionAddress, + section, offset, szFaultingModule); #endif PCONTEXT pCtx = pExceptionInfo->ContextRecord; // Show the registers - #ifdef _M_IX86 // X86 Only! - _tprintf( _T("\r\nRegisters:\r\n") ); +#ifdef _M_IX86 // X86 Only! + _tprintf(_T("\r\nRegisters:\r\n")); _tprintf(_T("EAX:%08X\r\nEBX:%08X\r\nECX:%08X\r\nEDX:%08X\r\nESI:%08X\r\nEDI:%08X\r\n") - ,pCtx->Eax, pCtx->Ebx, pCtx->Ecx, pCtx->Edx, - pCtx->Esi, pCtx->Edi ); + ,pCtx->Eax, pCtx->Ebx, pCtx->Ecx, pCtx->Edx, + pCtx->Esi, pCtx->Edi); - _tprintf( _T("CS:EIP:%04X:%08X\r\n"), pCtx->SegCs, pCtx->Eip ); - _tprintf( _T("SS:ESP:%04X:%08X EBP:%08X\r\n"), - pCtx->SegSs, pCtx->Esp, pCtx->Ebp ); - _tprintf( _T("DS:%04X ES:%04X FS:%04X GS:%04X\r\n"), - pCtx->SegDs, pCtx->SegEs, pCtx->SegFs, pCtx->SegGs ); - _tprintf( _T("Flags:%08X\r\n"), pCtx->EFlags ); - #endif + _tprintf(_T("CS:EIP:%04X:%08X\r\n"), pCtx->SegCs, pCtx->Eip); + _tprintf(_T("SS:ESP:%04X:%08X EBP:%08X\r\n"), + pCtx->SegSs, pCtx->Esp, pCtx->Ebp); + _tprintf(_T("DS:%04X ES:%04X FS:%04X GS:%04X\r\n"), + pCtx->SegDs, pCtx->SegEs, pCtx->SegFs, pCtx->SegGs); + _tprintf(_T("Flags:%08X\r\n"), pCtx->EFlags); +#endif - #ifdef _M_X64 - _tprintf( _T("\r\nRegisters:\r\n") ); +#ifdef _M_X64 + _tprintf(_T("\r\nRegisters:\r\n")); _tprintf(_T("RAX:%016I64X\r\nRBX:%016I64X\r\nRCX:%016I64X\r\nRDX:%016I64X\r\nRSI:%016I64X\r\nRDI:%016I64X\r\n") - _T("R8: %016I64X\r\nR9: %016I64X\r\nR10:%016I64X\r\nR11:%016I64X\r\nR12:%016I64X\r\nR13:%016I64X\r\nR14:%016I64X\r\nR15:%016I64X\r\n") - ,pCtx->Rax, pCtx->Rbx, pCtx->Rcx, pCtx->Rdx, - pCtx->Rsi, pCtx->Rdi ,pCtx->R9,pCtx->R10,pCtx->R11,pCtx->R12,pCtx->R13,pCtx->R14,pCtx->R15); - _tprintf( _T("CS:RIP:%04X:%016I64X\r\n"), pCtx->SegCs, pCtx->Rip ); - _tprintf( _T("SS:RSP:%04X:%016X RBP:%08X\r\n"), - pCtx->SegSs, pCtx->Rsp, pCtx->Rbp ); - _tprintf( _T("DS:%04X ES:%04X FS:%04X GS:%04X\r\n"), - pCtx->SegDs, pCtx->SegEs, pCtx->SegFs, pCtx->SegGs ); - _tprintf( _T("Flags:%08X\r\n"), pCtx->EFlags ); - #endif + _T("R8: %016I64X\r\nR9: %016I64X\r\nR10:%016I64X\r\nR11:%016I64X\r\nR12:%016I64X\r\nR13:%016I64X\r\nR14:%016I64X\r\nR15:%016I64X\r\n") + ,pCtx->Rax, pCtx->Rbx, pCtx->Rcx, pCtx->Rdx, + pCtx->Rsi, pCtx->Rdi ,pCtx->R9,pCtx->R10,pCtx->R11,pCtx->R12,pCtx->R13,pCtx->R14,pCtx->R15); + _tprintf(_T("CS:RIP:%04X:%016I64X\r\n"), pCtx->SegCs, pCtx->Rip); + _tprintf(_T("SS:RSP:%04X:%016X RBP:%08X\r\n"), + pCtx->SegSs, pCtx->Rsp, pCtx->Rbp); + _tprintf(_T("DS:%04X ES:%04X FS:%04X GS:%04X\r\n"), + pCtx->SegDs, pCtx->SegEs, pCtx->SegFs, pCtx->SegGs); + _tprintf(_T("Flags:%08X\r\n"), pCtx->EFlags); +#endif - SymSetOptions( SYMOPT_DEFERRED_LOADS ); + SymSetOptions(SYMOPT_DEFERRED_LOADS); // Initialize DbgHelp - if ( !SymInitialize( GetCurrentProcess(), 0, TRUE ) ) + if (!SymInitialize(GetCurrentProcess(), 0, TRUE)) { _tprintf(_T("\n\rCRITICAL ERROR.\n\r Couldn't initialize the symbol handler for process.\n\rError [%s].\n\r\n\r"), - ErrorMessage(GetLastError())); + ErrorMessage(GetLastError())); } CONTEXT trashableContext = *pCtx; - WriteStackDetails( &trashableContext, false, NULL ); + WriteStackDetails(&trashableContext, false, NULL); printTracesForAllThreads(); // #ifdef _M_IX86 // X86 Only! - _tprintf( _T("========================\r\n") ); - _tprintf( _T("Local Variables And Parameters\r\n") ); + _tprintf(_T("========================\r\n")); + _tprintf(_T("Local Variables And Parameters\r\n")); trashableContext = *pCtx; - WriteStackDetails( &trashableContext, true, NULL ); + WriteStackDetails(&trashableContext, true, NULL); - _tprintf( _T("========================\r\n") ); - _tprintf( _T("Global Variables\r\n") ); + _tprintf(_T("========================\r\n")); + _tprintf(_T("Global Variables\r\n")); - SymEnumSymbols( GetCurrentProcess(), - (DWORD64)GetModuleHandle(szFaultingModule), - 0, EnumerateSymbolsCallback, 0 ); - // #endif // X86 Only! + SymEnumSymbols(GetCurrentProcess(), + (DWORD64)GetModuleHandle(szFaultingModule), + 0, EnumerateSymbolsCallback, 0); + // #endif // X86 Only! - SymCleanup( GetCurrentProcess() ); + SymCleanup(GetCurrentProcess()); - _tprintf( _T("\r\n") ); + _tprintf(_T("\r\n")); } //====================================================================== // Given an exception code, returns a pointer to a static string with a // description of the exception //====================================================================== -LPTSTR WheatyExceptionReport::GetExceptionString( DWORD dwCode ) +LPTSTR WheatyExceptionReport::GetExceptionString(DWORD dwCode) { - #define EXCEPTION( x ) case EXCEPTION_##x: return _T(#x); +#define EXCEPTION( x ) case EXCEPTION_##x: return _T(#x); - switch ( dwCode ) + switch (dwCode) { - EXCEPTION( ACCESS_VIOLATION ) - EXCEPTION( DATATYPE_MISALIGNMENT ) - EXCEPTION( BREAKPOINT ) - EXCEPTION( SINGLE_STEP ) - EXCEPTION( ARRAY_BOUNDS_EXCEEDED ) - EXCEPTION( FLT_DENORMAL_OPERAND ) - EXCEPTION( FLT_DIVIDE_BY_ZERO ) - EXCEPTION( FLT_INEXACT_RESULT ) - EXCEPTION( FLT_INVALID_OPERATION ) - EXCEPTION( FLT_OVERFLOW ) - EXCEPTION( FLT_STACK_CHECK ) - EXCEPTION( FLT_UNDERFLOW ) - EXCEPTION( INT_DIVIDE_BY_ZERO ) - EXCEPTION( INT_OVERFLOW ) - EXCEPTION( PRIV_INSTRUCTION ) - EXCEPTION( IN_PAGE_ERROR ) - EXCEPTION( ILLEGAL_INSTRUCTION ) - EXCEPTION( NONCONTINUABLE_EXCEPTION ) - EXCEPTION( STACK_OVERFLOW ) - EXCEPTION( INVALID_DISPOSITION ) - EXCEPTION( GUARD_PAGE ) - EXCEPTION( INVALID_HANDLE ) + EXCEPTION(ACCESS_VIOLATION) + EXCEPTION(DATATYPE_MISALIGNMENT) + EXCEPTION(BREAKPOINT) + EXCEPTION(SINGLE_STEP) + EXCEPTION(ARRAY_BOUNDS_EXCEEDED) + EXCEPTION(FLT_DENORMAL_OPERAND) + EXCEPTION(FLT_DIVIDE_BY_ZERO) + EXCEPTION(FLT_INEXACT_RESULT) + EXCEPTION(FLT_INVALID_OPERATION) + EXCEPTION(FLT_OVERFLOW) + EXCEPTION(FLT_STACK_CHECK) + EXCEPTION(FLT_UNDERFLOW) + EXCEPTION(INT_DIVIDE_BY_ZERO) + EXCEPTION(INT_OVERFLOW) + EXCEPTION(PRIV_INSTRUCTION) + EXCEPTION(IN_PAGE_ERROR) + EXCEPTION(ILLEGAL_INSTRUCTION) + EXCEPTION(NONCONTINUABLE_EXCEPTION) + EXCEPTION(STACK_OVERFLOW) + EXCEPTION(INVALID_DISPOSITION) + EXCEPTION(GUARD_PAGE) + EXCEPTION(INVALID_HANDLE) } // If not one of the "known" exceptions, try to get the string @@ -523,9 +524,9 @@ LPTSTR WheatyExceptionReport::GetExceptionString( DWORD dwCode ) static TCHAR szBuffer[512] = { 0 }; - FormatMessage( FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE, - GetModuleHandle( _T("NTDLL.DLL") ), - dwCode, 0, szBuffer, sizeof( szBuffer ), 0 ); + FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_HMODULE, + GetModuleHandle(_T("NTDLL.DLL")), + dwCode, 0, szBuffer, sizeof(szBuffer), 0); return szBuffer; } @@ -538,16 +539,16 @@ LPTSTR WheatyExceptionReport::GetExceptionString( DWORD dwCode ) // by the len parameter (in characters!) //============================================================================= BOOL WheatyExceptionReport::GetLogicalAddress( -PVOID addr, PTSTR szModule, DWORD len, DWORD& section, DWORD_PTR& offset ) + PVOID addr, PTSTR szModule, DWORD len, DWORD& section, DWORD_PTR& offset) { MEMORY_BASIC_INFORMATION mbi; - if ( !VirtualQuery( addr, &mbi, sizeof(mbi) ) ) + if (!VirtualQuery(addr, &mbi, sizeof(mbi))) return FALSE; DWORD_PTR hMod = (DWORD_PTR)mbi.AllocationBase; - if ( !GetModuleFileName( (HMODULE)hMod, szModule, len ) ) + if (!GetModuleFileName((HMODULE)hMod, szModule, len)) return FALSE; // Point to the DOS header in memory @@ -556,22 +557,22 @@ PVOID addr, PTSTR szModule, DWORD len, DWORD& section, DWORD_PTR& offset ) // From the DOS header, find the NT (PE) header PIMAGE_NT_HEADERS pNtHdr = (PIMAGE_NT_HEADERS)(hMod + DWORD_PTR(pDosHdr->e_lfanew)); - PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION( pNtHdr ); + PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pNtHdr); DWORD_PTR rva = (DWORD_PTR)addr - hMod; // RVA is offset from module load address // Iterate through the section table, looking for the one that encompasses // the linear address. - for ( unsigned i = 0; - i < pNtHdr->FileHeader.NumberOfSections; - i++, pSection++ ) + for (unsigned i = 0; + i < pNtHdr->FileHeader.NumberOfSections; + i++, pSection++) { DWORD_PTR sectionStart = pSection->VirtualAddress; DWORD_PTR sectionEnd = sectionStart - + DWORD_PTR(max(pSection->SizeOfRawData, pSection->Misc.VirtualSize)); + + DWORD_PTR(max(pSection->SizeOfRawData, pSection->Misc.VirtualSize)); // Is the address in this section??? - if ( (rva >= sectionStart) && (rva <= sectionEnd) ) + if ((rva >= sectionStart) && (rva <= sectionEnd)) { // Yes, address is in the section. Calculate section and offset, // and store in the "section" & "offset" params, which were @@ -600,20 +601,20 @@ struct CSymbolInfoPackage : public SYMBOL_INFO_PACKAGE // Walks the stack, and writes the results to the report file //============================================================ void WheatyExceptionReport::WriteStackDetails( -PCONTEXT pContext, -bool bWriteVariables, HANDLE pThreadHandle) // true if local/params should be output + PCONTEXT pContext, + bool bWriteVariables, HANDLE pThreadHandle) // true if local/params should be output { - _tprintf( _T("\r\nCall stack:\r\n") ); + _tprintf(_T("\r\nCall stack:\r\n")); - _tprintf( _T("Address Frame Function SourceFile\r\n") ); + _tprintf(_T("Address Frame Function SourceFile\r\n")); DWORD dwMachineType = 0; // Could use SymSetOptions here to add the SYMOPT_DEFERRED_LOADS flag STACKFRAME64 sf; - memset( &sf, 0, sizeof(sf) ); + memset(&sf, 0, sizeof(sf)); - #ifdef _M_IX86 +#ifdef _M_IX86 // Initialize the STACKFRAME structure for the first call. This is only // necessary for Intel CPUs, and isn't mentioned in the documentation. sf.AddrPC.Offset = pContext->Eip; @@ -624,7 +625,7 @@ bool bWriteVariables, HANDLE pThreadHandle) // true if local/par sf.AddrFrame.Mode = AddrModeFlat; dwMachineType = IMAGE_FILE_MACHINE_I386; - #endif +#endif #ifdef _M_X64 sf.AddrPC.Offset = pContext->Rip; @@ -636,26 +637,26 @@ bool bWriteVariables, HANDLE pThreadHandle) // true if local/par dwMachineType = IMAGE_FILE_MACHINE_AMD64; #endif - while ( 1 ) + while (1) { // Get the next stack frame - if ( ! StackWalk64( dwMachineType, - m_hProcess, - pThreadHandle != NULL ? pThreadHandle : GetCurrentThread(), - &sf, - pContext, - 0, - SymFunctionTableAccess64, - SymGetModuleBase64, - 0 ) ) + if (! StackWalk64(dwMachineType, + m_hProcess, + pThreadHandle != NULL ? pThreadHandle : GetCurrentThread(), + &sf, + pContext, + 0, + SymFunctionTableAccess64, + SymGetModuleBase64, + 0)) break; - if ( 0 == sf.AddrFrame.Offset ) // Basic sanity check to make sure + if (0 == sf.AddrFrame.Offset) // Basic sanity check to make sure break; // the frame is OK. Bail if not. #ifdef _M_IX86 - _tprintf( _T("%08X %08X "), sf.AddrPC.Offset, sf.AddrFrame.Offset ); + _tprintf(_T("%08X %08X "), sf.AddrPC.Offset, sf.AddrFrame.Offset); #endif #ifdef _M_X64 - _tprintf( _T("%016I64X %016I64X "), sf.AddrPC.Offset, sf.AddrFrame.Offset ); + _tprintf(_T("%016I64X %016I64X "), sf.AddrPC.Offset, sf.AddrFrame.Offset); #endif DWORD64 symDisplacement = 0; // Displacement of the input address, @@ -663,14 +664,14 @@ bool bWriteVariables, HANDLE pThreadHandle) // true if local/par // Get the name of the function for this stack frame entry CSymbolInfoPackage sip; - if ( SymFromAddr( - m_hProcess, // Process handle of the current process - sf.AddrPC.Offset, // Symbol address - &symDisplacement, // Address of the variable that will receive the displacement - &sip.si // Address of the SYMBOL_INFO structure (inside "sip" object) - )) + if (SymFromAddr( + m_hProcess, // Process handle of the current process + sf.AddrPC.Offset, // Symbol address + &symDisplacement, // Address of the variable that will receive the displacement + &sip.si // Address of the SYMBOL_INFO structure (inside "sip" object) + )) { - _tprintf( _T("%hs+%I64X"), sip.si.Name, symDisplacement ); + _tprintf(_T("%hs+%I64X"), sip.si.Name, symDisplacement); } else // No symbol found. Print out the logical address instead. @@ -679,39 +680,39 @@ bool bWriteVariables, HANDLE pThreadHandle) // true if local/par DWORD section = 0; DWORD_PTR offset = 0; - GetLogicalAddress( (PVOID)sf.AddrPC.Offset, - szModule, sizeof(szModule), section, offset ); + GetLogicalAddress((PVOID)sf.AddrPC.Offset, + szModule, sizeof(szModule), section, offset); #ifdef _M_IX86 - _tprintf( _T("%04X:%08X %s"), section, offset, szModule ); + _tprintf(_T("%04X:%08X %s"), section, offset, szModule); #endif #ifdef _M_X64 - _tprintf( _T("%04X:%016I64X %s"), section, offset, szModule ); + _tprintf(_T("%04X:%016I64X %s"), section, offset, szModule); #endif } // Get the source line for this stack frame entry IMAGEHLP_LINE64 lineInfo = { sizeof(IMAGEHLP_LINE) }; DWORD dwLineDisplacement; - if ( SymGetLineFromAddr64( m_hProcess, sf.AddrPC.Offset, - &dwLineDisplacement, &lineInfo ) ) + if (SymGetLineFromAddr64(m_hProcess, sf.AddrPC.Offset, + &dwLineDisplacement, &lineInfo)) { _tprintf(_T(" %s line %u"),lineInfo.FileName,lineInfo.LineNumber); } - _tprintf( _T("\r\n") ); + _tprintf(_T("\r\n")); // Write out the variables, if desired - if ( bWriteVariables ) + if (bWriteVariables) { // Use SymSetContext to get just the locals/params for this frame IMAGEHLP_STACK_FRAME imagehlpStackFrame; imagehlpStackFrame.InstructionOffset = sf.AddrPC.Offset; - SymSetContext( m_hProcess, &imagehlpStackFrame, 0 ); + SymSetContext(m_hProcess, &imagehlpStackFrame, 0); // Enumerate the locals/parameters - SymEnumSymbols( m_hProcess, 0, 0, EnumerateSymbolsCallback, &sf ); + SymEnumSymbols(m_hProcess, 0, 0, EnumerateSymbolsCallback, &sf); - _tprintf( _T("\r\n") ); + _tprintf(_T("\r\n")); } } @@ -723,22 +724,22 @@ bool bWriteVariables, HANDLE pThreadHandle) // true if local/par BOOL CALLBACK WheatyExceptionReport::EnumerateSymbolsCallback( -PSYMBOL_INFO pSymInfo, -ULONG SymbolSize, -PVOID UserContext ) + PSYMBOL_INFO pSymInfo, + ULONG SymbolSize, + PVOID UserContext) { char szBuffer[2048]; __try { - if ( FormatSymbolValue( pSymInfo, (STACKFRAME*)UserContext, - szBuffer, sizeof(szBuffer) ) ) - _tprintf( _T("\t%s\r\n"), szBuffer ); + if (FormatSymbolValue(pSymInfo, (STACKFRAME*)UserContext, + szBuffer, sizeof(szBuffer))) + _tprintf(_T("\t%s\r\n"), szBuffer); } - __except( 1 ) + __except (1) { - _tprintf( _T("punting on symbol %s\r\n"), pSymInfo->Name ); + _tprintf(_T("punting on symbol %s\r\n"), pSymInfo->Name); } return TRUE; @@ -750,36 +751,37 @@ PVOID UserContext ) // values. ////////////////////////////////////////////////////////////////////////////// bool WheatyExceptionReport::FormatSymbolValue( -PSYMBOL_INFO pSym, -STACKFRAME * sf, -char * pszBuffer, -unsigned cbBuffer ) + PSYMBOL_INFO pSym, + STACKFRAME* sf, + char* pszBuffer, + unsigned cbBuffer) { - char * pszCurrBuffer = pszBuffer; + char* pszCurrBuffer = pszBuffer; // Indicate if the variable is a local or parameter - if ( pSym->Flags & IMAGEHLP_SYMBOL_INFO_PARAMETER ) - pszCurrBuffer += sprintf( pszCurrBuffer, "Parameter " ); - else if ( pSym->Flags & IMAGEHLP_SYMBOL_INFO_LOCAL ) - pszCurrBuffer += sprintf( pszCurrBuffer, "Local " ); + if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_PARAMETER) + pszCurrBuffer += sprintf(pszCurrBuffer, "Parameter "); + else if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_LOCAL) + pszCurrBuffer += sprintf(pszCurrBuffer, "Local "); // If it's a function, don't do anything. - if ( pSym->Tag == 5 ) // SymTagFunction from CVCONST.H from the DIA SDK + if (pSym->Tag == 5) // SymTagFunction from CVCONST.H from the DIA SDK return false; DWORD_PTR pVariable = 0; // Will point to the variable's data in memory - if ( pSym->Flags & IMAGEHLP_SYMBOL_INFO_REGRELATIVE ) + if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_REGRELATIVE) { // if ( pSym->Register == 8 ) // EBP is the value 8 (in DBGHELP 5.1) - { // This may change!!! + { + // This may change!!! pVariable = sf->AddrFrame.Offset; pVariable += (DWORD_PTR)pSym->Address; } // else // return false; } - else if ( pSym->Flags & IMAGEHLP_SYMBOL_INFO_REGISTER ) + else if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_REGISTER) { return false; // Don't try to report register variable } @@ -792,21 +794,21 @@ unsigned cbBuffer ) // will return true. bool bHandled; pszCurrBuffer = DumpTypeIndex(pszCurrBuffer,pSym->ModBase, pSym->TypeIndex, - 0, pVariable, bHandled, pSym->Name ); + 0, pVariable, bHandled, pSym->Name); - if ( !bHandled ) + if (!bHandled) { // The symbol wasn't a UDT, so do basic, stupid formatting of the // variable. Based on the size, we're assuming it's a char, WORD, or // DWORD. - BasicType basicType = GetBasicType( pSym->TypeIndex, pSym->ModBase ); - pszCurrBuffer += sprintf( pszCurrBuffer, rgBaseType[basicType]); + BasicType basicType = GetBasicType(pSym->TypeIndex, pSym->ModBase); + pszCurrBuffer += sprintf(pszCurrBuffer, rgBaseType[basicType]); // Emit the variable name - pszCurrBuffer += sprintf( pszCurrBuffer, "\'%s\'", pSym->Name ); + pszCurrBuffer += sprintf(pszCurrBuffer, "\'%s\'", pSym->Name); pszCurrBuffer = FormatOutputValue(pszCurrBuffer, basicType, pSym->Size, - (PVOID)pVariable ); + (PVOID)pVariable); } return true; @@ -817,33 +819,33 @@ unsigned cbBuffer ) // at fundamental types. When he hit fundamental types, return // bHandled = false, so that FormatSymbolValue() will format them. ////////////////////////////////////////////////////////////////////////////// -char * WheatyExceptionReport::DumpTypeIndex( -char * pszCurrBuffer, -DWORD64 modBase, -DWORD dwTypeIndex, -unsigned nestingLevel, -DWORD_PTR offset, -bool & bHandled, -char* Name) +char* WheatyExceptionReport::DumpTypeIndex( + char* pszCurrBuffer, + DWORD64 modBase, + DWORD dwTypeIndex, + unsigned nestingLevel, + DWORD_PTR offset, + bool& bHandled, + char* Name) { bHandled = false; // Get the name of the symbol. This will either be a Type name (if a UDT), // or the structure member name. - WCHAR * pwszTypeName; - if ( SymGetTypeInfo( m_hProcess, modBase, dwTypeIndex, TI_GET_SYMNAME, - &pwszTypeName ) ) + WCHAR* pwszTypeName; + if (SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_SYMNAME, + &pwszTypeName)) { - pszCurrBuffer += sprintf( pszCurrBuffer, " %ls", pwszTypeName ); - LocalFree( pwszTypeName ); + pszCurrBuffer += sprintf(pszCurrBuffer, " %ls", pwszTypeName); + LocalFree(pwszTypeName); } // Determine how many children this type has. DWORD dwChildrenCount = 0; - SymGetTypeInfo( m_hProcess, modBase, dwTypeIndex, TI_GET_CHILDRENCOUNT, - &dwChildrenCount ); + SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_GET_CHILDRENCOUNT, + &dwChildrenCount); - if ( !dwChildrenCount ) // If no children, we're done + if (!dwChildrenCount) // If no children, we're done return pszCurrBuffer; // Prepare to get an array of "TypeIds", representing each of the children. @@ -852,51 +854,51 @@ char* Name) struct FINDCHILDREN : TI_FINDCHILDREN_PARAMS { ULONG MoreChildIds[1024]; - FINDCHILDREN(){Count = sizeof(MoreChildIds) / sizeof(MoreChildIds[0]);} + FINDCHILDREN() {Count = sizeof(MoreChildIds) / sizeof(MoreChildIds[0]);} } children; children.Count = dwChildrenCount; children.Start= 0; // Get the array of TypeIds, one for each child type - if ( !SymGetTypeInfo( m_hProcess, modBase, dwTypeIndex, TI_FINDCHILDREN, - &children ) ) + if (!SymGetTypeInfo(m_hProcess, modBase, dwTypeIndex, TI_FINDCHILDREN, + &children)) { return pszCurrBuffer; } // Append a line feed - pszCurrBuffer += sprintf( pszCurrBuffer, "\r\n" ); + pszCurrBuffer += sprintf(pszCurrBuffer, "\r\n"); // Iterate through each of the children - for ( unsigned i = 0; i < dwChildrenCount; i++ ) + for (unsigned i = 0; i < dwChildrenCount; i++) { // Add appropriate indentation level (since this routine is recursive) - for ( unsigned j = 0; j <= nestingLevel+1; j++ ) - pszCurrBuffer += sprintf( pszCurrBuffer, "\t" ); + for (unsigned j = 0; j <= nestingLevel+1; j++) + pszCurrBuffer += sprintf(pszCurrBuffer, "\t"); // Recurse for each of the child types bool bHandled2; - BasicType basicType = GetBasicType(children.ChildId[i], modBase ); - pszCurrBuffer += sprintf( pszCurrBuffer, rgBaseType[basicType]); + BasicType basicType = GetBasicType(children.ChildId[i], modBase); + pszCurrBuffer += sprintf(pszCurrBuffer, rgBaseType[basicType]); - pszCurrBuffer = DumpTypeIndex( pszCurrBuffer, modBase, - children.ChildId[i], nestingLevel+1, - offset, bHandled2, ""/*Name */); + pszCurrBuffer = DumpTypeIndex(pszCurrBuffer, modBase, + children.ChildId[i], nestingLevel+1, + offset, bHandled2, ""/*Name */); // If the child wasn't a UDT, format it appropriately - if ( !bHandled2 ) + if (!bHandled2) { // Get the offset of the child member, relative to its parent DWORD dwMemberOffset; - SymGetTypeInfo( m_hProcess, modBase, children.ChildId[i], - TI_GET_OFFSET, &dwMemberOffset ); + SymGetTypeInfo(m_hProcess, modBase, children.ChildId[i], + TI_GET_OFFSET, &dwMemberOffset); // Get the real "TypeId" of the child. We need this for the // SymGetTypeInfo( TI_GET_TYPEID ) call below. DWORD typeId; - SymGetTypeInfo( m_hProcess, modBase, children.ChildId[i], - TI_GET_TYPEID, &typeId ); + SymGetTypeInfo(m_hProcess, modBase, children.ChildId[i], + TI_GET_TYPEID, &typeId); // Get the size of the child member ULONG64 length; @@ -912,10 +914,10 @@ char* Name) // Emit the variable name // pszCurrBuffer += sprintf( pszCurrBuffer, "\'%s\'", Name ); - pszCurrBuffer = FormatOutputValue( pszCurrBuffer, basicType, - length, (PVOID)dwFinalOffset ); + pszCurrBuffer = FormatOutputValue(pszCurrBuffer, basicType, + length, (PVOID)dwFinalOffset); - pszCurrBuffer += sprintf( pszCurrBuffer, "\r\n" ); + pszCurrBuffer += sprintf(pszCurrBuffer, "\r\n"); } } @@ -923,57 +925,57 @@ char* Name) return pszCurrBuffer; } -char * WheatyExceptionReport::FormatOutputValue( char * pszCurrBuffer, -BasicType basicType, -DWORD64 length, -PVOID pAddress ) +char* WheatyExceptionReport::FormatOutputValue(char* pszCurrBuffer, + BasicType basicType, + DWORD64 length, + PVOID pAddress) { // Format appropriately (assuming it's a 1, 2, or 4 bytes (!!!) - if ( length == 1 ) - pszCurrBuffer += sprintf( pszCurrBuffer, " = %X", *(PBYTE)pAddress ); - else if ( length == 2 ) - pszCurrBuffer += sprintf( pszCurrBuffer, " = %X", *(PWORD)pAddress ); - else if ( length == 4 ) + if (length == 1) + pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PBYTE)pAddress); + else if (length == 2) + pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", *(PWORD)pAddress); + else if (length == 4) { - if ( basicType == btFloat ) + if (basicType == btFloat) { pszCurrBuffer += sprintf(pszCurrBuffer," = %f", *(PFLOAT)pAddress); } - else if ( basicType == btChar ) + else if (basicType == btChar) { - if ( !IsBadStringPtr( *(PSTR*)pAddress, 32) ) + if (!IsBadStringPtr(*(PSTR*)pAddress, 32)) { - pszCurrBuffer += sprintf( pszCurrBuffer, " = \"%.31s\"", - *(PDWORD)pAddress ); + pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%.31s\"", + *(PDWORD)pAddress); } else - pszCurrBuffer += sprintf( pszCurrBuffer, " = %X", - *(PDWORD)pAddress ); + pszCurrBuffer += sprintf(pszCurrBuffer, " = %X", + *(PDWORD)pAddress); } else pszCurrBuffer += sprintf(pszCurrBuffer," = %X", *(PDWORD)pAddress); } - else if ( length == 8 ) + else if (length == 8) { - if ( basicType == btFloat ) + if (basicType == btFloat) { - pszCurrBuffer += sprintf( pszCurrBuffer, " = %lf", - *(double *)pAddress ); + pszCurrBuffer += sprintf(pszCurrBuffer, " = %lf", + *(double*)pAddress); } else - pszCurrBuffer += sprintf( pszCurrBuffer, " = %I64X", - *(DWORD64*)pAddress ); + pszCurrBuffer += sprintf(pszCurrBuffer, " = %I64X", + *(DWORD64*)pAddress); } return pszCurrBuffer; } BasicType -WheatyExceptionReport::GetBasicType( DWORD typeIndex, DWORD64 modBase ) +WheatyExceptionReport::GetBasicType(DWORD typeIndex, DWORD64 modBase) { BasicType basicType; - if ( SymGetTypeInfo( m_hProcess, modBase, typeIndex, - TI_GET_BASETYPE, &basicType ) ) + if (SymGetTypeInfo(m_hProcess, modBase, typeIndex, + TI_GET_BASETYPE, &basicType)) { return basicType; } @@ -983,8 +985,8 @@ WheatyExceptionReport::GetBasicType( DWORD typeIndex, DWORD64 modBase ) DWORD typeId; if (SymGetTypeInfo(m_hProcess,modBase, typeIndex, TI_GET_TYPEID, &typeId)) { - if ( SymGetTypeInfo( m_hProcess, modBase, typeId, TI_GET_BASETYPE, - &basicType ) ) + if (SymGetTypeInfo(m_hProcess, modBase, typeId, TI_GET_BASETYPE, + &basicType)) { return basicType; } @@ -997,18 +999,18 @@ WheatyExceptionReport::GetBasicType( DWORD typeIndex, DWORD64 modBase ) // Helper function that writes to the report file, and allows the user to use // printf style formating //============================================================================ -int __cdecl WheatyExceptionReport::_tprintf(const TCHAR * format, ...) +int __cdecl WheatyExceptionReport::_tprintf(const TCHAR* format, ...) { TCHAR szBuff[1024]; int retValue; DWORD cbWritten; va_list argptr; - va_start( argptr, format ); - retValue = vsprintf( szBuff, format, argptr ); - va_end( argptr ); + va_start(argptr, format); + retValue = vsprintf(szBuff, format, argptr); + va_end(argptr); - WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0 ); + WriteFile(m_hReportFile, szBuff, retValue * sizeof(TCHAR), &cbWritten, 0); return retValue; } diff --git a/src/shared/WheatyExceptionReport.h b/src/shared/WheatyExceptionReport.h index 896d9c72f..060fcee3f 100644 --- a/src/shared/WheatyExceptionReport.h +++ b/src/shared/WheatyExceptionReport.h @@ -72,39 +72,39 @@ class WheatyExceptionReport { public: - WheatyExceptionReport( ); - ~WheatyExceptionReport( ); + WheatyExceptionReport(); + ~WheatyExceptionReport(); // entry point where control comes on an unhandled exception static LONG WINAPI WheatyUnhandledExceptionFilter( - PEXCEPTION_POINTERS pExceptionInfo ); + PEXCEPTION_POINTERS pExceptionInfo); static void printTracesForAllThreads(); private: // where report info is extracted and generated - static void GenerateExceptionReport( PEXCEPTION_POINTERS pExceptionInfo ); + static void GenerateExceptionReport(PEXCEPTION_POINTERS pExceptionInfo); static void PrintSystemInfo(); static BOOL _GetWindowsVersion(TCHAR* szVersion, DWORD cntMax); static BOOL _GetProcessorName(TCHAR* sProcessorName, DWORD maxcount); // Helper functions - static LPTSTR GetExceptionString( DWORD dwCode ); - static BOOL GetLogicalAddress( PVOID addr, PTSTR szModule, DWORD len, - DWORD& section, DWORD_PTR& offset ); + static LPTSTR GetExceptionString(DWORD dwCode); + static BOOL GetLogicalAddress(PVOID addr, PTSTR szModule, DWORD len, + DWORD& section, DWORD_PTR& offset); - static void WriteStackDetails( PCONTEXT pContext, bool bWriteVariables, HANDLE pThreadHandle); + static void WriteStackDetails(PCONTEXT pContext, bool bWriteVariables, HANDLE pThreadHandle); static BOOL CALLBACK EnumerateSymbolsCallback(PSYMBOL_INFO,ULONG, PVOID); - static bool FormatSymbolValue( PSYMBOL_INFO, STACKFRAME *, char * pszBuffer, unsigned cbBuffer ); + static bool FormatSymbolValue(PSYMBOL_INFO, STACKFRAME*, char* pszBuffer, unsigned cbBuffer); - static char * DumpTypeIndex( char *, DWORD64, DWORD, unsigned, DWORD_PTR, bool & , char*); + static char* DumpTypeIndex(char*, DWORD64, DWORD, unsigned, DWORD_PTR, bool& , char*); - static char * FormatOutputValue( char * pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress ); + static char* FormatOutputValue(char* pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress); - static BasicType GetBasicType( DWORD typeIndex, DWORD64 modBase ); + static BasicType GetBasicType(DWORD typeIndex, DWORD64 modBase); - static int __cdecl _tprintf(const TCHAR * format, ...); + static int __cdecl _tprintf(const TCHAR* format, ...); // Variables used by the class static TCHAR m_szLogFileName[MAX_PATH]; diff --git a/src/shared/WorldPacket.h b/src/shared/WorldPacket.h index 32c741f8d..c51adfe12 100644 --- a/src/shared/WorldPacket.h +++ b/src/shared/WorldPacket.h @@ -27,13 +27,13 @@ class WorldPacket : public ByteBuffer { public: - // just container for later use + // just container for later use WorldPacket() : ByteBuffer(0), m_opcode(0) { } explicit WorldPacket(uint16 opcode, size_t res=200) : ByteBuffer(res), m_opcode(opcode) { } - // copy constructor - WorldPacket(const WorldPacket &packet) : ByteBuffer(packet), m_opcode(packet.m_opcode) + // copy constructor + WorldPacket(const WorldPacket& packet) : ByteBuffer(packet), m_opcode(packet.m_opcode) { } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 29a78e7ec..5981ae3f4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12061" + #define REVISION_NR "12062" #endif // __REVISION_NR_H__ diff --git a/src/tools/genrevision/genrevision.cpp b/src/tools/genrevision/genrevision.cpp index 3b532b11a..eae80e0ff 100644 --- a/src/tools/genrevision/genrevision.cpp +++ b/src/tools/genrevision/genrevision.cpp @@ -49,7 +49,7 @@ void extractDataFromSvn(FILE* EntriesFile, bool url, RawData& data) fgets(buf,200,EntriesFile); fgets(buf,200,EntriesFile); sscanf(buf,"%10sT%8s",data.date_str,data.time_str); - if(url) + if (url) sprintf(data.rev_str,"%s at %s",num_str,repo_str); else strcpy(data.rev_str,num_str); @@ -64,16 +64,16 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& char url_str[200]; bool found = false; - while(fgets(buf,200,EntriesFile)) + while (fgets(buf,200,EntriesFile)) { - if(sscanf(buf,"%s\t\tbranch %s of %s",hash_str,branch_str,url_str)==3) + if (sscanf(buf,"%s\t\tbranch %s of %s",hash_str,branch_str,url_str)==3) { found = true; break; } } - if(!found) + if (!found) { strcpy(data.rev_str,"*"); strcpy(data.date_str,"*"); @@ -81,7 +81,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& return; } - if(url) + if (url) { char* host_str = NULL; char* acc_str = NULL; @@ -90,7 +90,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& // parse URL like git@github.com:mangos/mangos char url_buf[200]; int res = sscanf(url_str,"git@%s",url_buf); - if(res) + if (res) { host_str = strtok(url_buf,":"); acc_str = strtok(NULL,"/"); @@ -99,7 +99,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& else { res = sscanf(url_str,"git://%s",url_buf); - if(res) + if (res) { host_str = strtok(url_buf,"/"); acc_str = strtok(NULL,"/"); @@ -108,7 +108,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& } // can generate nice link - if(res) + if (res) sprintf(data.rev_str,"http://%s/%s/%s/commit/%s",host_str,acc_str,repo_str,hash_str); // unknonw URL format, use as-is else @@ -120,18 +120,18 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& time_t rev_time = 0; // extracting date/time FILE* LogFile = fopen((path+".git/logs/HEAD").c_str(), "r"); - if(LogFile) + if (LogFile) { - while(fgets(buf,200,LogFile)) + while (fgets(buf,200,LogFile)) { char buf2[200]; char new_hash[200]; int unix_time = 0; int res2 = sscanf(buf,"%s %s %s %s %i",buf2,new_hash,buf2,buf2,&unix_time); - if(res2!=5) + if (res2!=5) continue; - if(strcmp(hash_str,new_hash)) + if (strcmp(hash_str,new_hash)) continue; rev_time = unix_time; @@ -140,7 +140,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& fclose(LogFile); - if(rev_time) + if (rev_time) { tm* aTm = localtime(&rev_time); // YYYY year @@ -168,7 +168,7 @@ void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& bool extractDataFromSvn(std::string filename, bool url, RawData& data) { FILE* EntriesFile = fopen(filename.c_str(), "r"); - if(!EntriesFile) + if (!EntriesFile) return false; extractDataFromSvn(EntriesFile,url,data); @@ -179,7 +179,7 @@ bool extractDataFromSvn(std::string filename, bool url, RawData& data) bool extractDataFromGit(std::string filename, std::string path, bool url, RawData& data) { FILE* EntriesFile = fopen(filename.c_str(), "r"); - if(!EntriesFile) + if (!EntriesFile) return false; extractDataFromGit(EntriesFile,path,url,data); @@ -199,7 +199,7 @@ std::string generateHeader(char const* rev_str, char const* date_str, char const return newData.str(); } -int main(int argc, char **argv) +int main(int argc, char** argv) { bool use_url = false; bool svn_prefered = false; @@ -212,20 +212,20 @@ int main(int argc, char **argv) // -r use only revision (without repo URL) (default) // -u include repositire URL as commit URL or "rev at URL" // -o write header to specified target file - for(int k = 1; k <= argc; ++k) + for (int k = 1; k <= argc; ++k) { - if(!argv[k] || !*argv[k]) + if (!argv[k] || !*argv[k]) break; - if(argv[k][0]!='-') + if (argv[k][0]!='-') { path = argv[k]; - if(path.size() > 0 && (path[path.size()-1]!='/' || path[path.size()-1]!='\\')) + if (path.size() > 0 && (path[path.size()-1]!='/' || path[path.size()-1]!='\\')) path += '/'; break; } - switch(argv[k][1]) + switch (argv[k][1]) { case 'g': svn_prefered = false; @@ -259,7 +259,7 @@ int main(int argc, char **argv) bool res = false; - if(svn_prefered) + if (svn_prefered) { /// SVN data res = extractDataFromSvn(path+".svn/entries",use_url,data); @@ -280,7 +280,7 @@ int main(int argc, char **argv) res = extractDataFromSvn(path+"_svn/entries",use_url,data); } - if(res) + if (res) newData = generateHeader(data.rev_str,data.date_str,data.time_str); else newData = generateHeader("*", "*", "*"); @@ -289,12 +289,12 @@ int main(int argc, char **argv) /// get existed header data for compare std::string oldData; - if(FILE* HeaderFile = fopen(outfile.c_str(),"rb")) + if (FILE* HeaderFile = fopen(outfile.c_str(),"rb")) { - while(!feof(HeaderFile)) + while (!feof(HeaderFile)) { int c = fgetc(HeaderFile); - if(c < 0) + if (c < 0) break; oldData += (char)c; } @@ -303,9 +303,9 @@ int main(int argc, char **argv) } /// update header only if different data - if(newData != oldData) + if (newData != oldData) { - if(FILE* OutputFile = fopen(outfile.c_str(),"wb")) + if (FILE* OutputFile = fopen(outfile.c_str(),"wb")) { fprintf(OutputFile,"%s",newData.c_str()); fclose(OutputFile);