[12062] Cleanup MaNGOS sources

This commit is contained in:
Schmoozerd 2012-07-19 22:03:32 +02:00
parent a4cbed3199
commit aeff8f9d1a
46 changed files with 1982 additions and 1864 deletions

View file

@ -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<Item *> &updateQueue = player->GetItemUpdateQueue();
for(size_t i = 0; i < updateQueue.size(); ++i)
std::vector<Item*>& 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<Item *> &updateQueue = player->GetItemUpdateQueue();
std::vector<Item*>& 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);

View file

@ -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() ? "<nonexistent>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "<nonexistent>" : 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() ? "<nonexistent>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "<nonexistent>" : 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;

View file

@ -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 }
};

View file

@ -49,29 +49,29 @@ class MaNGOSsoapRunnable: public ACE_Based::Runnable
class SOAPWorkingThread : public ACE_Task<ACE_MT_SYNCH>
{
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);
};

View file

@ -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 [<options>]\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( "<Ctrl-C> to stop." );
sLog.outString("%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID));
sLog.outString("<Ctrl-C> 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]");

View file

@ -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
}

View file

@ -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)
{
/// <ul> <li> If the input is '<username>'
/// <ul> <li> If the input is '<username>'
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)
}
///<li> If the input is '<password>' (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;
///</ul>
///</ul>
};
}
@ -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;

View file

@ -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

View file

@ -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();

File diff suppressed because it is too large Load diff

View file

@ -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

View file

@ -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);
}

View file

@ -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);
/******************************************************************************\
* *

View file

@ -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;

View file

@ -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; }

View file

@ -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);
}

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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);

View file

@ -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;
};

View file

@ -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);
}

View file

@ -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:

View file

@ -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 */

View file

@ -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 <typename T> 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<uint8>(value);
return *this;
}
ByteBuffer &operator<<(uint16 value)
ByteBuffer& operator<<(uint16 value)
{
append<uint16>(value);
return *this;
}
ByteBuffer &operator<<(uint32 value)
ByteBuffer& operator<<(uint32 value)
{
append<uint32>(value);
return *this;
}
ByteBuffer &operator<<(uint64 value)
ByteBuffer& operator<<(uint64 value)
{
append<uint64>(value);
return *this;
}
// signed as in 2e complement
ByteBuffer &operator<<(int8 value)
ByteBuffer& operator<<(int8 value)
{
append<int8>(value);
return *this;
}
ByteBuffer &operator<<(int16 value)
ByteBuffer& operator<<(int16 value)
{
append<int16>(value);
return *this;
}
ByteBuffer &operator<<(int32 value)
ByteBuffer& operator<<(int32 value)
{
append<int32>(value);
return *this;
}
ByteBuffer &operator<<(int64 value)
ByteBuffer& operator<<(int64 value)
{
append<int64>(value);
return *this;
}
// floating points
ByteBuffer &operator<<(float value)
ByteBuffer& operator<<(float value)
{
append<float>(value);
return *this;
}
ByteBuffer &operator<<(double value)
ByteBuffer& operator<<(double value)
{
append<double>(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<char>() > 0 ? true : false;
return *this;
}
ByteBuffer &operator>>(uint8 &value)
ByteBuffer& operator>>(uint8& value)
{
value = read<uint8>();
return *this;
}
ByteBuffer &operator>>(uint16 &value)
ByteBuffer& operator>>(uint16& value)
{
value = read<uint16>();
return *this;
}
ByteBuffer &operator>>(uint32 &value)
ByteBuffer& operator>>(uint32& value)
{
value = read<uint32>();
return *this;
}
ByteBuffer &operator>>(uint64 &value)
ByteBuffer& operator>>(uint64& value)
{
value = read<uint64>();
return *this;
}
//signed as in 2e complement
ByteBuffer &operator>>(int8 &value)
ByteBuffer& operator>>(int8& value)
{
value = read<int8>();
return *this;
}
ByteBuffer &operator>>(int16 &value)
ByteBuffer& operator>>(int16& value)
{
value = read<int16>();
return *this;
}
ByteBuffer &operator>>(int32 &value)
ByteBuffer& operator>>(int32& value)
{
value = read<int32>();
return *this;
}
ByteBuffer &operator>>(int64 &value)
ByteBuffer& operator>>(int64& value)
{
value = read<int64>();
return *this;
}
ByteBuffer &operator>>(float &value)
ByteBuffer& operator>>(float& value)
{
value = read<float>();
return *this;
}
ByteBuffer &operator>>(double &value)
ByteBuffer& operator>>(double& value)
{
value = read<double>();
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<class T>
ByteBuffer &operator>>(Unused<T> const&)
ByteBuffer& operator>>(Unused<T> const&)
{
read_skip<T>();
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 <typename T> 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<class T> void append(const T *src, size_t cnt)
template<class T> 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 <typename T> void append(T value)
{
EndianConvert(value);
append((uint8 *)&value, sizeof(value));
append((uint8*)&value, sizeof(value));
}
protected:
@ -496,7 +496,7 @@ class ByteBuffer
};
template <typename T>
inline ByteBuffer &operator<<(ByteBuffer &b, std::vector<T> const& v)
inline ByteBuffer& operator<<(ByteBuffer& b, std::vector<T> const& v)
{
b << (uint32)v.size();
for (typename std::vector<T>::iterator i = v.begin(); i != v.end(); ++i)
@ -507,12 +507,12 @@ inline ByteBuffer &operator<<(ByteBuffer &b, std::vector<T> const& v)
}
template <typename T>
inline ByteBuffer &operator>>(ByteBuffer &b, std::vector<T> &v)
inline ByteBuffer& operator>>(ByteBuffer& b, std::vector<T>& 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<T> &v)
}
template <typename T>
inline ByteBuffer &operator<<(ByteBuffer &b, std::list<T> const& v)
inline ByteBuffer& operator<<(ByteBuffer& b, std::list<T> const& v)
{
b << (uint32)v.size();
for (typename std::list<T>::iterator i = v.begin(); i != v.end(); ++i)
@ -533,12 +533,12 @@ inline ByteBuffer &operator<<(ByteBuffer &b, std::list<T> const& v)
}
template <typename T>
inline ByteBuffer &operator>>(ByteBuffer &b, std::list<T> &v)
inline ByteBuffer& operator>>(ByteBuffer& b, std::list<T>& 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<T> &v)
}
template <typename K, typename V>
inline ByteBuffer &operator<<(ByteBuffer &b, std::map<K, V> &m)
inline ByteBuffer& operator<<(ByteBuffer& b, std::map<K, V>& m)
{
b << (uint32)m.size();
for (typename std::map<K, V>::iterator i = m.begin(); i != m.end(); ++i)
@ -559,12 +559,12 @@ inline ByteBuffer &operator<<(ByteBuffer &b, std::map<K, V> &m)
}
template <typename K, typename V>
inline ByteBuffer &operator>>(ByteBuffer &b, std::map<K, V> &m)
inline ByteBuffer& operator>>(ByteBuffer& b, std::map<K, V>& m)
{
uint32 msize;
b >> msize;
m.clear();
while(msize--)
while (msize--)
{
K k;
V v;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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<Config>::Instance()

View file

@ -28,16 +28,16 @@
namespace ACE_Based
{
template <class T, class LockType, typename StorageType=std::deque<T> >
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<class Checker>
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();

View file

@ -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<Color_count ?";1":""));
#endif
#endif
}
void Log::ResetColor(bool stdout_stream)
{
#if PLATFORM == PLATFORM_WINDOWS
HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE );
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED );
#else
fprintf(( stdout_stream ? stdout : stderr ), "\x1b[0m");
#endif
#if PLATFORM == PLATFORM_WINDOWS
HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
#else
fprintf((stdout_stream ? stdout : stderr), "\x1b[0m");
#endif
}
void Log::SetLogLevel(char* level)
@ -271,7 +271,7 @@ void Log::Initialize()
InitColors(sConfig.GetStringDefault("LogColors", ""));
m_logFilter = 0;
for(int i = 0; i < LOG_FILTER_COUNT; ++i)
for (int i = 0; i < LOG_FILTER_COUNT; ++i)
if (*logFilterData[i].name)
if (sConfig.GetBoolDefault(logFilterData[i].configName, logFilterData[i].defaultState))
m_logFilter |= (1 << i);
@ -353,18 +353,18 @@ void Log::outString()
{
if (m_includeTime)
outTime();
printf( "\n" );
printf("\n");
if (logfile)
{
outTimestamp(logfile);
fprintf(logfile, "\n" );
fprintf(logfile, "\n");
fflush(logfile);
}
fflush(stdout);
}
void Log::outString( const char * str, ... )
void Log::outString(const char* str, ...)
{
if (!str)
return;
@ -384,7 +384,7 @@ void Log::outString( const char * str, ... )
if (m_colored)
ResetColor(true);
printf( "\n" );
printf("\n");
if (logfile)
{
@ -392,7 +392,7 @@ void Log::outString( const char * str, ... )
va_start(ap, str);
vfprintf(logfile, str, ap);
fprintf(logfile, "\n" );
fprintf(logfile, "\n");
va_end(ap);
fflush(logfile);
@ -401,7 +401,7 @@ void Log::outString( const char * str, ... )
fflush(stdout);
}
void Log::outError( const char * err, ... )
void Log::outError(const char* err, ...)
{
if (!err)
return;
@ -421,17 +421,17 @@ void Log::outError( const char * err, ... )
if (m_colored)
ResetColor(false);
fprintf( stderr, "\n" );
fprintf(stderr, "\n");
if (logfile)
{
outTimestamp(logfile);
fprintf(logfile, "ERROR:" );
fprintf(logfile, "ERROR:");
va_start(ap, err);
vfprintf(logfile, err, ap);
va_end(ap);
fprintf(logfile, "\n" );
fprintf(logfile, "\n");
fflush(logfile);
}
@ -443,26 +443,26 @@ void Log::outErrorDb()
if (m_includeTime)
outTime();
fprintf( stderr, "\n" );
fprintf(stderr, "\n");
if (logfile)
{
outTimestamp(logfile);
fprintf(logfile, "ERROR:\n" );
fprintf(logfile, "ERROR:\n");
fflush(logfile);
}
if (dberLogfile)
{
outTimestamp(dberLogfile);
fprintf(dberLogfile, "\n" );
fprintf(dberLogfile, "\n");
fflush(dberLogfile);
}
fflush(stderr);
}
void Log::outErrorDb( const char * err, ... )
void Log::outErrorDb(const char* err, ...)
{
if (!err)
return;
@ -482,18 +482,18 @@ void Log::outErrorDb( const char * err, ... )
if (m_colored)
ResetColor(false);
fprintf( stderr, "\n" );
fprintf(stderr, "\n");
if (logfile)
{
outTimestamp(logfile);
fprintf(logfile, "ERROR:" );
fprintf(logfile, "ERROR:");
va_start(ap, err);
vfprintf(logfile, err, ap);
va_end(ap);
fprintf(logfile, "\n" );
fprintf(logfile, "\n");
fflush(logfile);
}
@ -506,14 +506,14 @@ void Log::outErrorDb( const char * err, ... )
vfprintf(dberLogfile, err, ap);
va_end(ap);
fprintf(dberLogfile, "\n" );
fprintf(dberLogfile, "\n");
fflush(dberLogfile);
}
fflush(stderr);
}
void Log::outBasic( const char * str, ... )
void Log::outBasic(const char* str, ...)
{
if (!str)
return;
@ -534,7 +534,7 @@ void Log::outBasic( const char * str, ... )
if (m_colored)
ResetColor(true);
printf( "\n" );
printf("\n");
}
if (logfile && m_logFileLevel >= 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 <Enter> 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;

View file

@ -89,65 +89,65 @@ const int Color_count = int(WHITE)+1;
class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Thread_Mutex> >
{
friend class MaNGOS::OperatorNew<Log>;
Log();
friend class MaNGOS::OperatorNew<Log>;
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<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
ERROR_DB_FILTER_LOG(LOG_FILTER_DB_STRICTED_CHECK, __VA_ARGS__)
// primary for script library
void MANGOS_DLL_SPEC outstring_log(const char * str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC detail_log(const char * str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC debug_log(const char * str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC error_log(const char * str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC error_db_log(const char * str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC outstring_log(const char* str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC detail_log(const char* str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC debug_log(const char* str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC error_log(const char* str, ...) ATTR_PRINTF(1,2);
void MANGOS_DLL_SPEC error_db_log(const char* str, ...) ATTR_PRINTF(1,2);
#endif

View file

@ -37,7 +37,8 @@ void daemonSignal(int s)
exit(EXIT_SUCCESS);
}
if (sid) {
if (sid)
{
kill(sid, s);
}
@ -57,11 +58,13 @@ void startDaemon(uint32_t timeout)
sid = pid = fork();
if (pid < 0) {
exit(EXIT_FAILURE);
if (pid < 0)
{
exit(EXIT_FAILURE);
}
if (pid > 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;

View file

@ -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;

View file

@ -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;

View file

@ -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 //

View file

@ -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
}

View file

@ -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<Thread> ThreadStorage;
//global object - container for Thread class representation of every thread

View file

@ -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);

View file

@ -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<arrayLen; ++i)
for (uint32 i=0; i<arrayLen; ++i)
{
for(uint8 j=0; j<2; ++j)
for (uint8 j=0; j<2; ++j)
{
unsigned char nibble = 0x0F & (bytes[i]>>((1-j)*4));
char encodedNibble;
if(nibble < 0x0A)
if (nibble < 0x0A)
encodedNibble = '0'+nibble;
else
encodedNibble = 'A'+nibble-0x0A;

View file

@ -26,11 +26,11 @@
typedef std::vector<std::string> 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);

File diff suppressed because it is too large Load diff

View file

@ -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];

View file

@ -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)
{
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12061"
#define REVISION_NR "12062"
#endif // __REVISION_NR_H__

View file

@ -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 <file> 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);