Merge commit '999a5ffa642c27dc3566664cf0e5b44dffafb1b7' into 4.3.4

Conflicts:
	sql/updates/world/2015_03_01_00_world.sql
	src/server/game/Server/WorldSocket.cpp
	src/server/scripts/Northrend/Nexus/Nexus/boss_commander_stoutbeard.cpp
This commit is contained in:
Carbenium
2015-07-21 23:20:40 +02:00
26 changed files with 219 additions and 246 deletions

View File

@@ -171,19 +171,20 @@ bool BigNumber::isZero() const
std::unique_ptr<uint8[]> BigNumber::AsByteArray(int32 minSize, bool littleEndian)
{
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
int numBytes = GetNumBytes();
int length = (minSize >= numBytes) ? minSize : numBytes;
uint8* array = new uint8[length];
// If we need more bytes than length of BigNumber set the rest to 0
if (length > GetNumBytes())
if (length > numBytes)
memset((void*)array, 0, length);
BN_bn2bin(_bn, (unsigned char *)array);
// openssl's BN stores data internally in big endian format, reverse if little endian desired
if (littleEndian)
std::reverse(array, array + length);
std::reverse(array, array + numBytes);
std::unique_ptr<uint8[]> ret(array);
return ret;

View File

@@ -1068,7 +1068,7 @@ bool logChildren)
{
case btChar:
case btStdString:
FormatOutputValue(buffer, basicType, length, (PVOID)offset, sizeof(buffer));
FormatOutputValue(buffer, basicType, length, (PVOID)offset, sizeof(buffer), elementsCount);
symbolDetails.top().Value = buffer;
break;
default:
@@ -1196,7 +1196,8 @@ void WheatyExceptionReport::FormatOutputValue(char * pszCurrBuffer,
BasicType basicType,
DWORD64 length,
PVOID pAddress,
size_t bufferSize)
size_t bufferSize,
size_t countOverride)
{
__try
{
@@ -1204,10 +1205,15 @@ size_t bufferSize)
{
case btChar:
{
if (strlen((char*)pAddress) > bufferSize - 6)
// Special case handling for char[] type
if (countOverride != 0)
length = countOverride;
else
length = strlen((char*)pAddress);
if (length > bufferSize - 6)
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", bufferSize - 6, (char*)pAddress);
else
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%s\"", (char*)pAddress);
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s\"", length, (char*)pAddress);
break;
}
case btStdString:

View File

@@ -172,7 +172,7 @@ class WheatyExceptionReport
static char * DumpTypeIndex(char *, DWORD64, DWORD, unsigned, DWORD_PTR, bool &, const char*, char*, bool, bool);
static void FormatOutputValue(char * pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, size_t bufferSize);
static void FormatOutputValue(char * pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, size_t bufferSize, size_t countOverride = 0);
static BasicType GetBasicType(DWORD typeIndex, DWORD64 modBase);
static DWORD_PTR DereferenceUnsafePointer(DWORD_PTR address);

View File

@@ -199,6 +199,9 @@ void Log::CreateLoggerFromConfig(std::string const& appenderName)
return;
}
if (level < lowestLogLevel)
lowestLogLevel = level;
logger.Create(name, level);
//fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Level %u\n", name.c_str(), level);
@@ -321,6 +324,9 @@ bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLog
return false;
it->second.setLogLevel(newLevel);
if (newLevel != LOG_LEVEL_DISABLED && newLevel < lowestLogLevel)
lowestLogLevel = newLevel;
}
else
{
@@ -394,6 +400,7 @@ void Log::LoadFromConfig()
{
Close();
lowestLogLevel = LOG_LEVEL_FATAL;
AppenderId = 0;
m_logsDir = sConfigMgr->GetStringDefault("LogsDir", "");
if (!m_logsDir.empty())

View File

@@ -82,6 +82,7 @@ class Log
AppenderMap appenders;
LoggerMap loggers;
uint8 AppenderId;
LogLevel lowestLogLevel;
std::string m_logsDir;
std::string m_logsTimestamp;
@@ -113,6 +114,10 @@ inline bool Log::ShouldLog(std::string const& type, LogLevel level) const
// Speed up in cases where requesting "Type.sub1.sub2" but only configured
// Logger "Type"
// Don't even look for a logger if the LogLevel is lower than lowest log levels across all loggers
if (level < lowestLogLevel)
return false;
Logger const* logger = GetLoggerByType(type);
if (!logger)
return false;

View File

@@ -34,7 +34,9 @@
using boost::asio::ip::tcp;
#define READ_BLOCK_SIZE 4096
#define TC_SOCKET_USE_IOCP BOOST_ASIO_HAS_IOCP
#ifdef BOOST_ASIO_HAS_IOCP
#define TC_SOCKET_USE_IOCP
#endif
template<class T>
class Socket : public std::enable_shared_from_this<T>