mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[12086] Fix some unintended custom literals.
This commit is contained in:
parent
f2578c0e74
commit
a2f442fc73
5 changed files with 91 additions and 64 deletions
|
|
@ -2579,7 +2579,7 @@ bool ChatHandler::HandlePInfoCommand(char* args)
|
|||
AccountTypes security = SEC_PLAYER;
|
||||
std::string last_login = GetMangosString(LANG_ERROR);
|
||||
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT a.username,aa.gmlevel,a.last_ip,a.last_login FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.id = '%u'", accId);
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT username,gmlevel,last_ip,last_login FROM account WHERE id = '%u'", accId);
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
|
@ -4442,7 +4442,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args)
|
|||
HandleLearnSkillRecipesHelper(target, targetSkillInfo->id);
|
||||
|
||||
uint16 maxLevel = target->GetPureMaxSkillValue(targetSkillInfo->id);
|
||||
target->SetSkill(targetSkillInfo->id, maxLevel, maxLevel, target->GetSkillStep(targetSkillInfo->id));
|
||||
target->SetSkill(targetSkillInfo->id, maxLevel, maxLevel);
|
||||
PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str());
|
||||
return true;
|
||||
}
|
||||
|
|
@ -4460,7 +4460,7 @@ bool ChatHandler::HandleLookupAccountEmailCommand(char* args)
|
|||
std::string email = emailStr;
|
||||
LoginDatabase.escape_string(email);
|
||||
// 0 1 2 3 4
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT a.id, a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE email " _LIKE_ " " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), email.c_str());
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE email " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), email.c_str());
|
||||
|
||||
return ShowAccountListHelper(result, &limit);
|
||||
}
|
||||
|
|
@ -4479,7 +4479,7 @@ bool ChatHandler::HandleLookupAccountIpCommand(char* args)
|
|||
LoginDatabase.escape_string(ip);
|
||||
|
||||
// 0 1 2 3 4
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT a.id, a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE last_ip " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), ip.c_str());
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE last_ip " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), ip.c_str());
|
||||
|
||||
return ShowAccountListHelper(result, &limit);
|
||||
}
|
||||
|
|
@ -4500,7 +4500,7 @@ bool ChatHandler::HandleLookupAccountNameCommand(char* args)
|
|||
|
||||
LoginDatabase.escape_string(account);
|
||||
// 0 1 2 3 4
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT a.id, a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), account.c_str());
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE username " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), account.c_str());
|
||||
|
||||
return ShowAccountListHelper(result, &limit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
|
||||
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -17,68 +17,95 @@
|
|||
*/
|
||||
|
||||
#include "ByteBuffer.h"
|
||||
#include "Log.h"
|
||||
|
||||
void BitStream::Clear()
|
||||
void ByteBufferException::PrintPosError() const
|
||||
{
|
||||
_data.clear();
|
||||
_rpos = _wpos = 0;
|
||||
char const* traceStr;
|
||||
|
||||
#ifdef HAVE_ACE_STACK_TRACE_H
|
||||
ACE_Stack_Trace trace;
|
||||
traceStr = trace.c_str();
|
||||
#else
|
||||
traceStr = NULL;
|
||||
#endif
|
||||
|
||||
sLog.outError(
|
||||
"Attempted to %s in ByteBuffer (pos: " SIZEFMTD " size: " SIZEFMTD ") "
|
||||
"value with size: " SIZEFMTD "%s%s",
|
||||
(add ? "put" : "get"), pos, size, esize,
|
||||
traceStr ? "\n" : "", traceStr ? traceStr : "");
|
||||
}
|
||||
|
||||
uint8 BitStream::GetBit(uint32 bit)
|
||||
void ByteBuffer::print_storage() const
|
||||
{
|
||||
MANGOS_ASSERT(_data.size() > bit);
|
||||
return _data[bit];
|
||||
}
|
||||
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
|
||||
return;
|
||||
|
||||
uint8 BitStream::ReadBit()
|
||||
{
|
||||
MANGOS_ASSERT(_data.size() < _rpos);
|
||||
uint8 b = _data[_rpos];
|
||||
++_rpos;
|
||||
return b;
|
||||
}
|
||||
std::ostringstream ss;
|
||||
ss << "STORAGE_SIZE: " << size() << "\n";
|
||||
|
||||
void BitStream::WriteBit(uint32 bit)
|
||||
{
|
||||
_data.push_back(bit ? uint8(1) : uint8(0));
|
||||
++_wpos;
|
||||
}
|
||||
if (sLog.IsIncludeTime())
|
||||
ss << " ";
|
||||
|
||||
template <typename T> void BitStream::WriteBits(T value, size_t bits)
|
||||
{
|
||||
for (int32 i = bits-1; i >= 0; --i)
|
||||
WriteBit((value >> i) & 1);
|
||||
}
|
||||
|
||||
bool BitStream::Empty()
|
||||
{
|
||||
return _data.empty();
|
||||
}
|
||||
|
||||
void BitStream::Reverse()
|
||||
{
|
||||
uint32 len = GetLength();
|
||||
std::vector<uint8> b = _data;
|
||||
Clear();
|
||||
|
||||
for(uint32 i = len; i > 0; --i)
|
||||
WriteBit(b[i-1]);
|
||||
}
|
||||
|
||||
void BitStream::Print()
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "BitStream: ";
|
||||
for (uint32 i = 0; i < GetLength(); ++i)
|
||||
ss << uint32(GetBit(i)) << " ";
|
||||
for (size_t i = 0; i < size(); ++i)
|
||||
ss << uint32(read<uint8>(i)) << " - ";
|
||||
|
||||
sLog.outDebug(ss.str().c_str());
|
||||
}
|
||||
|
||||
ByteBuffer::ByteBuffer(size_t res, bool init): _rpos(0), _wpos(0), _bitpos(8), _curbitval(0)
|
||||
void ByteBuffer::textlike() const
|
||||
{
|
||||
if (init)
|
||||
_storage.resize(res, 0);
|
||||
else
|
||||
_storage.reserve(res);
|
||||
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
|
||||
return;
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << "STORAGE_SIZE: " << size() << "\n";
|
||||
|
||||
if (sLog.IsIncludeTime())
|
||||
ss << " ";
|
||||
|
||||
for (size_t i = 0; i < size(); ++i)
|
||||
ss << read<uint8>(i);
|
||||
|
||||
sLog.outDebug(ss.str().c_str());
|
||||
}
|
||||
|
||||
void ByteBuffer::hexlike() const
|
||||
{
|
||||
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
|
||||
return;
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << "STORAGE_SIZE: " << size() << "\n";
|
||||
|
||||
if (sLog.IsIncludeTime())
|
||||
ss << " ";
|
||||
|
||||
size_t j = 1, k = 1;
|
||||
|
||||
for (size_t i = 0; i < size(); ++i)
|
||||
{
|
||||
if ((i == (j * 8)) && ((i != (k * 16))))
|
||||
{
|
||||
ss << "| ";
|
||||
++j;
|
||||
}
|
||||
else if (i == (k * 16))
|
||||
{
|
||||
ss << "\n";
|
||||
|
||||
if (sLog.IsIncludeTime())
|
||||
ss << " ";
|
||||
|
||||
++k;
|
||||
++j;
|
||||
}
|
||||
|
||||
char buf[4];
|
||||
snprintf(buf, 4, "%02X", read<uint8>(i));
|
||||
ss << buf << " ";
|
||||
}
|
||||
|
||||
sLog.outDebug(ss.str().c_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "12085"
|
||||
#define REVISION_NR "12086"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue