mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 13:37:02 +00:00
[10432] Rename ASSERT -> MANGOS_ASSERT and related fixes
ASSERT hard use in predictable way because diff. 3rd party libs code redefine it inf different ways and hard make sure that used in end of mangos define version. This is real detected problem make some expected assert checks ignored and so bugs not detected as expected from code. In addition made related changes: * Common.h header expected to be first include in any src/game/header except most simple cases. * Related FILE.h header expected to be first include in FILE.cpp * Fixed some absent includes and type forwards for safe build without PCH enabled. * Avoid using MANGOS_ASSERT in src/framework code
This commit is contained in:
parent
32e3e252fb
commit
acd0716297
77 changed files with 309 additions and 260 deletions
|
|
@ -49,7 +49,7 @@ void HMACSHA1::Finalize()
|
|||
{
|
||||
uint32 length = 0;
|
||||
HMAC_Final(&m_ctx, (uint8*)m_digest, &length);
|
||||
ASSERT(length == SHA_DIGEST_LENGTH);
|
||||
MANGOS_ASSERT(length == SHA_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
uint8 *HMACSHA1::ComputeHash(BigNumber *bn)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#define _BYTEBUFFER_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
#include "Utilities/ByteConverter.h"
|
||||
|
||||
|
|
@ -359,7 +358,7 @@ class ByteBuffer
|
|||
if (!cnt)
|
||||
return;
|
||||
|
||||
ASSERT(size() < 10000000);
|
||||
MANGOS_ASSERT(size() < 10000000);
|
||||
|
||||
if (_storage.size() < _wpos + cnt)
|
||||
_storage.resize(_wpos + cnt);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@
|
|||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Errors.h"
|
||||
#include "LockedQueue.h"
|
||||
#include "Threading.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
#if !defined(QUERYRESULT_H)
|
||||
#define QUERYRESULT_H
|
||||
|
||||
#include "Errors.h"
|
||||
|
||||
class MANGOS_DLL_SPEC QueryResult
|
||||
{
|
||||
public:
|
||||
|
|
@ -68,7 +70,7 @@ class MANGOS_DLL_SPEC QueryNamedResult
|
|||
if(mFieldNames[idx] == name)
|
||||
return idx;
|
||||
}
|
||||
ASSERT(false && "unknown field name");
|
||||
MANGOS_ASSERT(false && "unknown field name");
|
||||
return uint32(-1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,13 +19,14 @@
|
|||
#ifndef DO_POSTGRESQL
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Errors.h"
|
||||
|
||||
QueryResultMysql::QueryResultMysql(MYSQL_RES *result, MYSQL_FIELD *fields, uint64 rowCount, uint32 fieldCount) :
|
||||
QueryResult(rowCount, fieldCount), mResult(result)
|
||||
{
|
||||
|
||||
mCurrentRow = new Field[mFieldCount];
|
||||
ASSERT(mCurrentRow);
|
||||
MANGOS_ASSERT(mCurrentRow);
|
||||
|
||||
for (uint32 i = 0; i < mFieldCount; i++)
|
||||
mCurrentRow[i].SetType(ConvertNativeType(fields[i].type));
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ if (!(CONDITION)) \
|
|||
#endif
|
||||
|
||||
#ifdef MANGOS_DEBUG
|
||||
# define ASSERT WPError
|
||||
# define MANGOS_ASSERT WPError
|
||||
#else
|
||||
# define ASSERT WPError // Error even if in release mode.
|
||||
# define MANGOS_ASSERT WPError // Error even if in release mode.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ ThreadPriority::ThreadPriority()
|
|||
pr_iter.next();
|
||||
}
|
||||
|
||||
ASSERT (!_tmp.empty());
|
||||
MANGOS_ASSERT (!_tmp.empty());
|
||||
|
||||
if(_tmp.size() >= MAXPRIORITYNUM)
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ Thread::Thread(Runnable* instance) : m_task(instance), m_iThreadId(0), m_hThread
|
|||
m_task->incReference();
|
||||
|
||||
bool _start = start();
|
||||
ASSERT (_start);
|
||||
MANGOS_ASSERT (_start);
|
||||
}
|
||||
|
||||
Thread::~Thread()
|
||||
|
|
@ -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
|
||||
ASSERT (_ok == 0);
|
||||
MANGOS_ASSERT (_ok == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10431"
|
||||
#define REVISION_NR "10432"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace VMAP
|
|||
{
|
||||
float maxDist = (pos2 - pos1).magnitude();
|
||||
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too:
|
||||
ASSERT(maxDist < std::numeric_limits<float>::max());
|
||||
MANGOS_ASSERT(maxDist < std::numeric_limits<float>::max());
|
||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||
if (maxDist < 1e-10f)
|
||||
return true;
|
||||
|
|
@ -177,7 +177,7 @@ namespace VMAP
|
|||
bool result=false;
|
||||
float maxDist = (pPos2 - pPos1).magnitude();
|
||||
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too:
|
||||
ASSERT(maxDist < std::numeric_limits<float>::max());
|
||||
MANGOS_ASSERT(maxDist < std::numeric_limits<float>::max());
|
||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||
if (maxDist < 1e-10f)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace VMAP
|
|||
#define ERROR_LOG(...) sLog.outError(__VA_ARGS__);
|
||||
#else
|
||||
#include <assert.h>
|
||||
#define ASSERT(x) assert(x)
|
||||
#define MANGOS_ASSERT(x) assert(x)
|
||||
#define DEBUG_LOG(...) do{ printf(__VA_ARGS__); printf("\n"); } while(0)
|
||||
#define DETAIL_LOG(...) do{ printf(__VA_ARGS__); printf("\n"); } while(0)
|
||||
#define ERROR_LOG(...) do{ printf("ERROR:"); printf(__VA_ARGS__); printf("\n"); } while(0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue