This commit is contained in:
vl 2010-05-13 19:03:03 +02:00
commit 4ddd501f1d
33 changed files with 68 additions and 63 deletions

View file

@ -298,7 +298,7 @@ void nlSleep( uint32 ms );
#endif
/// Returns Thread Id (note: on Linux, Process Id is the same as the Thread Id)
uint getThreadId();
size_t getThreadId();
/// Returns a readable string from a vector of bytes. unprintable char are replaced by '?'
std::string stringFromVector( const std::vector<uint8>& v, bool limited = true );

View file

@ -374,19 +374,19 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
// Linux set of asserts is reduced due to that there is no message box displayer
#define nlassert(exp) \
{ \
do { \
if (!(exp)) { \
NLMISC::createDebug (); \
NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \
NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \
NLMISC_BREAKPOINT; \
} \
}
} while(0)
#define nlassertonce(exp) nlassert(exp)
#define nlassertex(exp, str) \
{ \
do { \
if (!(exp)) { \
NLMISC::createDebug (); \
NLMISC::INelContext::getInstance().getAssertLog()->setPosition (__LINE__, __FILE__, __FUNCTION__); \
@ -394,7 +394,7 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
NLMISC::INelContext::getInstance().getAssertLog()->displayRawNL str; \
NLMISC_BREAKPOINT; \
} \
}
} while(0)
#define nlverify(exp) nlassert(exp)
#define nlverifyonce(exp) nlassert(exp)
@ -403,7 +403,7 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
# else // NL_OS_UNIX
#define nlassert(exp) \
{ \
do { \
static bool ignoreNextTime = false; \
bool _expResult_ = (exp) ? true : false; \
if (!ignoreNextTime && !_expResult_) { \
@ -411,20 +411,20 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
NLMISC_BREAKPOINT; \
} \
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
}
} while(0)
#define nlassertonce(exp) \
{ \
do { \
static bool ignoreNextTime = false; \
if (!ignoreNextTime && !(exp)) { \
ignoreNextTime = true; \
if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \
NLMISC_BREAKPOINT; \
} \
}
} while(0)
#define nlassertex(exp, str) \
{ \
do { \
static bool ignoreNextTime = false; \
bool _expResult_ = (exp) ? true : false; \
if (!ignoreNextTime && !_expResult_) { \
@ -434,10 +434,10 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
NLMISC_BREAKPOINT; \
} \
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
}
} while(0)
#define nlverify(exp) \
{ \
do { \
static bool ignoreNextTime = false; \
bool _expResult_ = (exp) ? true : false; \
if (!_expResult_ && !ignoreNextTime) { \
@ -445,10 +445,10 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
NLMISC_BREAKPOINT; \
} \
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
}
} while(0)
#define nlverifyonce(exp) \
{ \
do { \
static bool ignoreNextTime = false; \
bool _expResult_ = (exp) ? true : false; \
if (!_expResult_ && !ignoreNextTime) { \
@ -456,10 +456,10 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, #exp)) \
NLMISC_BREAKPOINT; \
} \
}
} while(0)
#define nlverifyex(exp, str) \
{ \
do { \
static bool ignoreNextTime = false; \
bool _expResult_ = (exp) ? true : false; \
if (!_expResult_ && !ignoreNextTime) { \
@ -469,7 +469,7 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
NLMISC_BREAKPOINT; \
} \
ASSERT_THROW_EXCEPTION_CODE_EX(_expResult_, #exp) \
}
} while(0)
# endif // NL_OS_UNIX
@ -478,28 +478,28 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
#define nlunreferenced(identifier) (identifier)
#define nlstop \
{ \
do { \
static bool ignoreNextTime = false; \
if (!ignoreNextTime) { \
if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, NULL)) \
NLMISC_BREAKPOINT; \
} \
ASSERT_THROW_EXCEPTION_CODE(false) \
}
} while(0)
#define nlstoponce \
{ \
do { \
static bool ignoreNextTime = false; \
if (!ignoreNextTime) { \
ignoreNextTime = true; \
if(NLMISC::_assert_stop(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, NULL)) \
NLMISC_BREAKPOINT; \
} \
}
} while(0)
#define nlstopex(str) \
{ \
do { \
static bool ignoreNextTime = false; \
if (!ignoreNextTime) { \
NLMISC::_assertex_stop_0(ignoreNextTime, __LINE__, __FILE__, __FUNCTION__, NULL); \
@ -507,7 +507,7 @@ extern bool _assertex_stop_1(bool &ignoreNextTime);
if(NLMISC::_assertex_stop_1(ignoreNextTime)) \
NLMISC_BREAKPOINT; \
} \
}
} while(0)
struct EFatalError : public Exception

View file

@ -3187,7 +3187,7 @@ IOcclusionQuery::TOcclusionType COcclusionQueryD3D::getOcclusionType()
H_AUTO_D3D(COcclusionQueryD3D_getOcclusionType);
nlassert(Driver);
nlassert(Query);
nlassert(Driver->_CurrentOcclusionQuery != this) // can't query result between a begin/end pair!
nlassert(Driver->_CurrentOcclusionQuery != this); // can't query result between a begin/end pair!
if (OcclusionType == NotAvailable)
{
DWORD numPix;
@ -3207,7 +3207,7 @@ uint COcclusionQueryD3D::getVisibleCount()
H_AUTO_D3D(COcclusionQueryD3D_getVisibleCount);
nlassert(Driver);
nlassert(Query);
nlassert(Driver->_CurrentOcclusionQuery != this) // can't query result between a begin/end pair!
nlassert(Driver->_CurrentOcclusionQuery != this); // can't query result between a begin/end pair!
if (getOcclusionType() == NotAvailable) return 0;
return VisibleCount;
}

View file

@ -4231,7 +4231,7 @@ IOcclusionQuery::TOcclusionType COcclusionQueryGL::getOcclusionType()
H_AUTO_OGL(COcclusionQueryGL_getOcclusionType)
nlassert(Driver);
nlassert(ID);
nlassert(Driver->_CurrentOcclusionQuery != this) // can't query result between a begin/end pair!
nlassert(Driver->_CurrentOcclusionQuery != this); // can't query result between a begin/end pair!
if (OcclusionType == NotAvailable)
{
GLuint result;
@ -4254,7 +4254,7 @@ uint COcclusionQueryGL::getVisibleCount()
H_AUTO_OGL(COcclusionQueryGL_getVisibleCount)
nlassert(Driver);
nlassert(ID);
nlassert(Driver->_CurrentOcclusionQuery != this) // can't query result between a begin/end pair!
nlassert(Driver->_CurrentOcclusionQuery != this); // can't query result between a begin/end pair!
if (getOcclusionType() == NotAvailable) return 0;
return VisibleCount;
}

View file

@ -923,7 +923,7 @@ void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bo
nglDisableVariantClientStateEXT(variants[CDriverGL::EVSPaletteSkinVariant]);
break;
case 7: // empty
nlstop
nlstop;
break;
case 8:
case 9:

View file

@ -1413,7 +1413,7 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
}
break;
case CVertexBuffer::Empty: // empty
nlstop
nlstop;
break;
case CVertexBuffer::TexCoord0:
case CVertexBuffer::TexCoord1:
@ -1483,7 +1483,7 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb)
}
break;
case CVertexBuffer::Empty: // empty
nlstop
nlstop;
break;
case CVertexBuffer::TexCoord0:
case CVertexBuffer::TexCoord1:

View file

@ -1400,7 +1400,7 @@ bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgra
{
GLint position;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &position);
nlassert(position != -1) // there was an error..
nlassert(position != -1); // there was an error..
nlassert(position < (GLint) code.size());
uint line = 0;
const char *lineStart = code.c_str();

View file

@ -34,7 +34,7 @@ void CPackedWorld::build(std::vector<TPackedZoneBaseSPtr> &packedZones)
_Zones.clear();
if (packedZones.empty()) return;
CAABBox box;
nlassert(packedZones[0])
nlassert(packedZones[0]);
box = packedZones[0]->Box;
for(uint k = 1; k < packedZones.size(); ++k)
{

View file

@ -2127,7 +2127,7 @@ void CParticleSystem::addRefForUserSysCoordInfo(uint numRefs)
{
_UserCoordSystemInfo = new CUserCoordSystemInfo;
}
nlassert(_UserCoordSystemInfo)
nlassert(_UserCoordSystemInfo);
_UserCoordSystemInfo->NumRef += numRefs;
}
@ -2138,7 +2138,7 @@ void CParticleSystem::releaseRefForUserSysCoordInfo(uint numRefs)
NL_PS_FUNC_MAIN(CParticleSystem_releaseRefForUserSysCoordInfo)
if (!numRefs) return;
nlassert(_UserCoordSystemInfo);
nlassert(numRefs <= _UserCoordSystemInfo->NumRef)
nlassert(numRefs <= _UserCoordSystemInfo->NumRef);
_UserCoordSystemInfo->NumRef -= numRefs;
if (_UserCoordSystemInfo->NumRef == 0)
{

View file

@ -107,12 +107,12 @@ void nlSleep( uint32 ms )
/*
* Returns Thread Id (note: on Linux, Process Id is the same as the Thread Id)
*/
uint getThreadId()
size_t getThreadId()
{
#ifdef NL_OS_WINDOWS
return GetCurrentThreadId();
#elif defined NL_OS_UNIX
return uint(pthread_self());
return size_t(pthread_self());
// doesnt work on linux kernel 2.6 return getpid();
#endif

View file

@ -2161,7 +2161,7 @@ CPolygon2D::CPolygon2D(const CTriangle &tri, const CMatrix &projMat)
// *******************************************************************************
void CPolygon2D::getBoundingRect(CVector2f &minCorner, CVector2f &maxCorner) const
{
nlassert(!Vertices.empty())
nlassert(!Vertices.empty());
minCorner = maxCorner = Vertices[0];
uint numVertices = Vertices.size();
for(uint k = 0; k < numVertices; ++k)

View file

@ -34,7 +34,7 @@ using namespace NLMISC;
namespace NLNET {
static uint ThreadCreator = 0;
static size_t ThreadCreator = 0;
static const uint64 AppIdDeadConnection = 0xDEAD;

View file

@ -35,8 +35,13 @@
#include <algorithm>
#include <limits>
#ifdef NL_OS_MAC
# include <al.h>
# include <alc.h>
#else
# include <AL/al.h>
# include <AL/alc.h>
#endif
#include <nel/misc/common.h>
#include <nel/misc/debug.h>

View file

@ -132,7 +132,7 @@ void CFogMap::getFogParams(float startDist, float endDist, float x, float y, flo
NLMISC::CRGBAF CFogMap::getMapValue(TMapType type, float x, float y, NLMISC::CRGBAF defaultValue) const
{
H_AUTO_USE(RZ_FogMap)
nlassert(type < CFogMapBuild::NumMap)
nlassert(type < CFogMapBuild::NumMap);
if (_Map[type].getWidth() == 0) return defaultValue;
float mx, my;
worldPosToMapPos(x, y, mx, my);
@ -143,7 +143,7 @@ NLMISC::CRGBAF CFogMap::getMapValue(TMapType type, float x, float y, NLMISC::CRG
NLMISC::CRGBAF CFogMap::getMapValueFromMapCoord(TMapType type, float x, float y, NLMISC::CRGBAF defaultValue) const
{
H_AUTO_USE(RZ_FogMap)
nlassert(type < CFogMapBuild::NumMap)
nlassert(type < CFogMapBuild::NumMap);
if (_Map[type].getWidth() == 0) return defaultValue;
return _Map[type].getColor(x, y);
}

View file

@ -900,7 +900,7 @@ bool CGroupList::addChildAtIndex(CViewBase *child, uint index, bool deleteOn
addView (pVB, (sint) index);
return true;
}
nlstop
nlstop;
return false;
}
return false;

View file

@ -1074,7 +1074,7 @@ bool CGroupParagraph::addChildAtIndex(CViewBase *child, uint index, bool deleteO
addView (pVB, (sint) index);
return true;
}
nlstop
nlstop;
return false;
}
return false;

View file

@ -626,7 +626,7 @@ CXDeltaPatch::TApplyResult CXDeltaPatch::apply(const std::string &sFileToPatch,
if (_Ctrl.SourceInfo.size() == 2)
{
// _Ctrl.SourceInfo[0].IsData must be true
nlassert(_Ctrl.SourceInfo[0].IsData)
nlassert(_Ctrl.SourceInfo[0].IsData);
// index 0 == Data from patch file
if (!XDFR[0].init(_FileName, _HeaderOffset, _CtrlOffset, isPatchCompressed()))
{

View file

@ -1762,7 +1762,7 @@ uint32 CClientEditionModule::getCurrentMaxId()
return 1000;
std::string eid = getEid();
sint32 currentId = _Factory->getMaxId(eid);
nlassert(currentId >= -1)
nlassert(currentId >= -1);
return static_cast<uint32>(currentId + 1);
}

View file

@ -5599,7 +5599,7 @@ void CEditor::onAttrModified(const CObject *value)
{
CInstance *parentInstance = getInstanceFromObject(parent);
sint32 indexInParent = parent->findIndex(son);
nlassert(indexInParent != -1)
nlassert(indexInParent != -1);
if (parentInstance)
{
// we are in an instance (a CObjectTable with an instance id)

View file

@ -55,7 +55,7 @@ CToolChoosePosLua::CToolChoosePosLua(uint ghostSlot,
void CToolChoosePosLua::commit(const NLMISC::CVector &createPosition, float /* createAngle */)
{
//H_AUTO(R2_CToolChoosePosLua_commit)
nlassert(!_Commited)
nlassert(!_Commited);
if (_ValidFunc.isFunction())
{
CLuaState &lua = *_ValidFunc.getLuaState();

View file

@ -1168,7 +1168,7 @@ void CServerEditionModule::init(NLNET::IModuleSocket* gateway, CDynamicMapServic
void CServerEditionModule::updateRSMGR()
{
nlassert(!_SessionManager.isNull())
nlassert(!_SessionManager.isNull());
nlassert(!_WaitingForBS);
RSMGR::CRingSessionManagerProxy rsm(_SessionManager);
@ -5131,7 +5131,7 @@ void CServerEditionModule::wakeUpSessionImpl(CEditionSession* session)
{
CEditionSession* previous = found->second ;
nlassert( session != previous)
nlassert( session != previous);
sessionPtr->swap( *previous);
session = previous;
}

View file

@ -418,7 +418,7 @@ void CAIS::update()
// send agglomerated hp changes
if (!_CreatureChangeHPList.Entities.empty())
{
nlassert(_CreatureChangeHPList.Entities.size()==_CreatureChangeHPList.DeltaHp.size())
nlassert(_CreatureChangeHPList.Entities.size()==_CreatureChangeHPList.DeltaHp.size());
_CreatureChangeHPList.send("EGS");
_CreatureChangeHPList.Entities.clear();
_CreatureChangeHPList.DeltaHp.clear();

View file

@ -58,7 +58,7 @@ public:
{}
// attach a group family to the action if it supports it (assert otherwise)
virtual void addGroupFamily(CGroupFamily *gf) { nlassert(0) }
virtual void addGroupFamily(CGroupFamily *gf) { nlassert(0); }
};
// Code use by native functions and LogicAction

View file

@ -74,7 +74,7 @@ void CGrpProfileDynFollowPath::calcPath()
_FollowRoute.setAIProfile(new CGrpProfileFollowRoute(_Grp, _CurrentRoad->coords(), _CurrentRoad->verticalPos(), true));
CGrpProfileFollowRoute*const fr = static_cast<CGrpProfileFollowRoute*>(_FollowRoute.getAIProfile());
nlassert(_CurrentZone==_CurrentRoad->startZone() || _CurrentZone==_CurrentRoad->endZone())
nlassert(_CurrentZone==_CurrentRoad->startZone() || _CurrentZone==_CurrentRoad->endZone());
fr->setDirection(_CurrentRoad->startZone()==_CurrentZone);
}

View file

@ -1146,7 +1146,7 @@ void CCompiler::dumpByteCode (const string &sourceCode, const string &fullName,
fclose (file);
}
else
nlstop ("can't open %s for writing", tmp.c_str ());
nlstopex(("can't open %s for writing", tmp.c_str ()));
}
CSmartPtr<const AIVM::CByteCode> CCompiler::compileCodeOld (const string &sourceCode, const string &fullName, bool debug) const

View file

@ -864,7 +864,7 @@ class CMissionStepKillByName : public IMissionStepTemplate
retParams[0].Type = STRING_MANAGER::bot_name;
retParams[0].Identifier = TargetName;
retParams[1].Type = STRING_MANAGER::integer;
nlassert( subStepStates.size() == 1 )
nlassert( subStepStates.size() == 1 );
retParams[1].Int = subStepStates[0];
if ( Place != 0xFFFF )
{

View file

@ -278,7 +278,7 @@ void CCombatAttackerAI::initFromRowId( const TDataSetRow &rowId )
return;
#if !FINAL_VERSION
nlassert(entity->getId().getType() == RYZOMID::creature)
nlassert(entity->getId().getType() == RYZOMID::creature);
#endif
const CStaticCreatures * form = entity->getForm();
@ -400,7 +400,7 @@ void CCombatAttackerNpc::initFromRowId( const TDataSetRow &rowId )
return;
#if !FINAL_VERSION
nlassert(entity->getId().getType() == RYZOMID::npc)
nlassert(entity->getId().getType() == RYZOMID::npc);
#endif
const CStaticCreatures * form = entity->getForm();

View file

@ -212,7 +212,7 @@ public:
}
#if !FINAL_VERSION
nlassert(character->getId().getType() == RYZOMID::player)
nlassert(character->getId().getType() == RYZOMID::player);
#endif
_Character = character;

View file

@ -95,7 +95,7 @@ public:
if ( !TheDataset.isAccessible(rowId))
{
nlwarning("<CCombatDefender> ERROR Get an invalid row id as param for the constructor, should never happens");
nlstop("");
nlstop;
return;
}

View file

@ -212,7 +212,7 @@ void CPVPFactionRewardManager::init()
}
else
{
nlstop("Pointer null in map of totem base found !!!!");
nlstopex(("Pointer null in map of totem base found !!!!"));
}
}

View file

@ -846,7 +846,7 @@ struct TPredicateNode : public TQueryNode
}
}
else
nlstop
nlstop;
}
else
{

View file

@ -653,7 +653,7 @@ struct COutpostCreateSquadMsg
static uint32 const s_version = 1;
uint32 version = s_version;
s.serial(version);
nlassert(version==s_version)
nlassert(version==s_version);
s.serial(Outpost);
s.serial(Group);
s.serial(Zone);

View file

@ -3910,7 +3910,7 @@ endOfWelcomeUserResult:
{
nldebug("RSM : setScenarioInfo char %u set scenario info for session %u", charId, sessionId.asInt());
nlstop("Deprecated");
nlstopex(("Deprecated"));
// // load the user
// CCharacterPtr character = CCharacter::load(_RingDb, charId, __FILE__, __LINE__);