From 3a647345a15b1aa54277c0e644eb925656869c04 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 28 Mar 2011 17:32:49 +0200 Subject: [PATCH] Changed: Replaced display of pointers using %d or %X by %p --- code/nel/src/3d/coarse_mesh_build.cpp | 4 ++-- code/nel/src/3d/particle_system.cpp | 4 ++-- code/nel/src/3d/render_trav.cpp | 4 ++-- code/nel/src/georges/form.cpp | 8 +++---- code/nel/src/georges/form_dfn.cpp | 34 +++++++++++++-------------- code/nel/src/georges/form_elm.cpp | 12 +++++----- code/nel/src/georges/header.cpp | 8 +++---- code/nel/src/georges/type.cpp | 20 ++++++++-------- code/nel/src/ligo/ligo_config.cpp | 2 +- code/nel/src/ligo/primitive.cpp | 2 +- code/nel/src/misc/debug.cpp | 6 ++--- code/nel/src/misc/mem_displayer.cpp | 2 +- 12 files changed, 53 insertions(+), 53 deletions(-) diff --git a/code/nel/src/3d/coarse_mesh_build.cpp b/code/nel/src/3d/coarse_mesh_build.cpp index 14c2da789..e196b3f99 100644 --- a/code/nel/src/3d/coarse_mesh_build.cpp +++ b/code/nel/src/3d/coarse_mesh_build.cpp @@ -117,7 +117,7 @@ bool CCoarseMeshBuild::buildBitmap (const std::vector& coarseMe else { // Build a name - name+=toString ("%d",(ptrdiff_t)texture); + name+=toString ("%p", texture); } } @@ -477,7 +477,7 @@ void CCoarseMeshBuild::remapCoordinates (const std::vector& coa else { // Build a name - name+=toString ("%d",(ptrdiff_t)texture); + name+=toString ("%p", texture); } } diff --git a/code/nel/src/3d/particle_system.cpp b/code/nel/src/3d/particle_system.cpp index 0e22f5c94..a26a2c307 100644 --- a/code/nel/src/3d/particle_system.cpp +++ b/code/nel/src/3d/particle_system.cpp @@ -2305,13 +2305,13 @@ void CParticleSystem::dumpHierarchy() CPSLocated *loc = dynamic_cast(_ProcessVect[k]); if (loc) { - nlinfo("Located k : %s @%x", loc->getName().c_str(), (ptrdiff_t) loc); + nlinfo("Located k : %s @%p", loc->getName().c_str(), loc); for(uint l = 0; l < loc->getNbBoundObjects(); ++l) { CPSEmitter *emitter = dynamic_cast(loc->getBoundObject(l)); if (emitter) { - nlinfo(" emitter %s : emit %s @%x", emitter->getName().c_str(), emitter->getEmittedType() ? emitter->getEmittedType()->getName().c_str() : "none", (ptrdiff_t) emitter->getEmittedType()); + nlinfo(" emitter %s : emit %s @%p", emitter->getName().c_str(), emitter->getEmittedType() ? emitter->getEmittedType()->getName().c_str() : "none", emitter->getEmittedType()); } } } diff --git a/code/nel/src/3d/render_trav.cpp b/code/nel/src/3d/render_trav.cpp index 33ca5f499..c509ca945 100644 --- a/code/nel/src/3d/render_trav.cpp +++ b/code/nel/src/3d/render_trav.cpp @@ -1300,12 +1300,12 @@ void CRenderTrav::debugWaterModelMemory(const char *tag, bool dumpList) { // Before crash, do some log nlwarning("******* WaterModelList crash after %s", tag); - nlwarning("Current: Ptr:%x. List:%x/%x", (ptrdiff_t)dmp.Address, (ptrdiff_t)dmp.ClippedPolyBegin, (ptrdiff_t)dmp.ClippedPolyEnd); + nlwarning("Current: Ptr:%p. List:%p/%p", dmp.Address, dmp.ClippedPolyBegin, dmp.ClippedPolyEnd); // Log also the list bkuped (to do comparisons) for(uint i=0;i<_DebugWaterModelList.size();i++) { CWaterModelDump &bkup= _DebugWaterModelList[i]; - nlwarning("List%02d: Ptr:%x. Array:%x/%x", i, (ptrdiff_t)bkup.Address, (ptrdiff_t)bkup.ClippedPolyBegin, (ptrdiff_t)bkup.ClippedPolyEnd); + nlwarning("List%02d: Ptr:%p. Array:%p/%p", i, bkup.Address, bkup.ClippedPolyBegin, bkup.ClippedPolyEnd); } // crash (assert not stop for clearness) diff --git a/code/nel/src/georges/form.cpp b/code/nel/src/georges/form.cpp index 29a4b04dd..ebadc1d13 100644 --- a/code/nel/src/georges/form.cpp +++ b/code/nel/src/georges/form.cpp @@ -188,8 +188,8 @@ void CForm::read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const cha if ( ((const char*)node->name == NULL) || (strcmp ((const char*)node->name, "FORM") != 0) ) { // Make an error message - warning (true, "read", "XML Syntax error in block line %d, node (%s) should be FORM.", - (ptrdiff_t)node->content, node->name); + warning (true, "read", "XML Syntax error in block line %p, node (%s) should be FORM.", + node->content, node->name); } // Get first struct node @@ -197,8 +197,8 @@ void CForm::read (xmlNodePtr node, CFormLoader &loader, CFormDfn *dfn, const cha if (child == NULL) { // Throw exception - warning (true, "read", "Syntax error in block line %d, node (%s) should have a STRUCT child node.", - (ptrdiff_t)node->content, node->name); + warning (true, "read", "Syntax error in block line %p, node (%s) should have a STRUCT child node.", + node->content, node->name); } // Read the struct diff --git a/code/nel/src/georges/form_dfn.cpp b/code/nel/src/georges/form_dfn.cpp index 316a7b403..ee7bbcb0d 100644 --- a/code/nel/src/georges/form_dfn.cpp +++ b/code/nel/src/georges/form_dfn.cpp @@ -115,7 +115,7 @@ void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const if ( ((const char*)root->name == NULL) || (strcmp ((const char*)root->name, "DFN") != 0) ) { // Throw exception - warning (true, "read", "XML Syntax error in block line %d, node (%s) should be DFN.", (ptrdiff_t)root->content, root->name); + warning (true, "read", "XML Syntax error in block line %p, node (%s) should be DFN.", root->content, root->name); } // Count the parent @@ -147,8 +147,8 @@ void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const else { // Throw exception - warning (true, "read", "XML Syntax error in block (%s) line %d, aguments Name not found.", - parent->name, (ptrdiff_t)parent->content); + warning (true, "read", "XML Syntax error in block (%s) line %p, aguments Name not found.", + parent->name, parent->content); } // Next parent @@ -230,8 +230,8 @@ void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const if ((Entries[childNumber].Type == NULL) && !forceLoad) { // Throw exception - warning (true, "read", "In XML block (%s) line %d, file not found %s.", - child->name, (ptrdiff_t)child->content, Entries[childNumber].Filename.c_str ()); + warning (true, "read", "In XML block (%s) line %p, file not found %s.", + child->name, child->content, Entries[childNumber].Filename.c_str ()); } // Read the default value @@ -247,8 +247,8 @@ void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const else { // Throw exception - warning (true, "read", "XML In block (%s) line %d, no filename found for the .typ file.", - child->name, (ptrdiff_t)child->content, Entries[childNumber].Filename.c_str ()); + warning (true, "read", "XML In block (%s) line %p, no filename found for the .typ file.", + child->name, child->content); } } else if (stricmp (typeName, "Dfn") == 0) @@ -264,15 +264,15 @@ void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const if ((Entries[childNumber].Dfn == NULL) && !forceLoad) { // Throw exception - warning (true, "read", "XML In block (%s) line %d, file not found %s.", - child->name, (ptrdiff_t)child->content, Entries[childNumber].Filename.c_str ()); + warning (true, "read", "XML In block (%s) line %p, file not found %s.", + child->name, child->content, Entries[childNumber].Filename.c_str ()); } } else { // Throw exception - warning (true, "read", "XML In block (%s) line %d, no filename found for the .typ file.", - child->name, (ptrdiff_t)child->content, Entries[childNumber].Filename.c_str ()); + warning (true, "read", "XML In block (%s) line %p, no filename found for the .typ file.", + child->name, child->content); } } else if (stricmp (typeName, "DfnPointer") == 0) @@ -282,8 +282,8 @@ void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const else { // Throw exception - warning (true, "read", "XML Syntax error in block (%s) line %d, element has not a valid type name attribut \"Type = %s\".", - child->name, (ptrdiff_t)child->content, typeName); + warning (true, "read", "XML Syntax error in block (%s) line %p, element has not a valid type name attribut \"Type = %s\".", + child->name, child->content, typeName); } // Delete the value @@ -292,8 +292,8 @@ void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const else { // Throw exception - warning (true, "read", "XML Syntax error in block (%s) line %d, element has no type name attribut \"Type = [Type][Dfn][DfnPointer]\".", - child->name, (ptrdiff_t)child->content); + warning (true, "read", "XML Syntax error in block (%s) line %p, element has no type name attribut \"Type = [Type][Dfn][DfnPointer]\".", + child->name, child->content); } // Get the array attrib @@ -310,8 +310,8 @@ void CFormDfn::read (xmlNodePtr root, CFormLoader &loader, bool forceLoad, const else { // Throw exception - warning (true, "read", "XML Syntax error in block (%s) line %d, aguments Name not found.", - root->name, (ptrdiff_t)root->content); + warning (true, "read", "XML Syntax error in block (%s) line %p, aguments Name not found.", + root->name, root->content); } // Next child diff --git a/code/nel/src/georges/form_elm.cpp b/code/nel/src/georges/form_elm.cpp index a0ca4b505..528f6eec9 100644 --- a/code/nel/src/georges/form_elm.cpp +++ b/code/nel/src/georges/form_elm.cpp @@ -1904,8 +1904,8 @@ void CFormElmStruct::read (xmlNodePtr node, CFormLoader &loader, const CFormDfn else { // Make a warning message - warning (false, "read", "In block line %d, node (%s) type in DFN have changed.", - (ptrdiff_t)child->content, child->name); + warning (false, "read", "In block line %p, node (%s) type in DFN have changed.", + child->content, child->name); } } else @@ -1917,8 +1917,8 @@ void CFormElmStruct::read (xmlNodePtr node, CFormLoader &loader, const CFormDfn } // Throw exception - warning (true, "read", "XML Syntax error in block line %d, node (%s) name should be STRUCT, ATOM or ARRAY.", - (ptrdiff_t)child->content, child->name); + warning (true, "read", "XML Syntax error in block line %p, node (%s) name should be STRUCT, ATOM or ARRAY.", + child->content, child->name); } } @@ -2199,8 +2199,8 @@ void CFormElmVirtualStruct::read (xmlNodePtr node, CFormLoader &loader, CForm *f else { // Throw exception - warning (true, "read", "XML Syntax error in virtual struct in block line %d, should have a DfnName property.", - (ptrdiff_t)node->content, node->name); + warning (true, "read", "XML Syntax error in virtual struct in block line %p, should have a DfnName property.", + node->content); } // Read the parent diff --git a/code/nel/src/georges/header.cpp b/code/nel/src/georges/header.cpp index 8b2fa2c14..6a881d8b4 100644 --- a/code/nel/src/georges/header.cpp +++ b/code/nel/src/georges/header.cpp @@ -123,8 +123,8 @@ void CFileHeader::read (xmlNodePtr root) xmlFree ((void*)value); // Throw exception - warning (true, "read", "XML Syntax error in TYPE block line %d, the Version argument is invalid.", - (ptrdiff_t)root->content); + warning (true, "read", "XML Syntax error in TYPE block line %p, the Version argument is invalid.", + root->content); } // Delete the value @@ -173,8 +173,8 @@ void CFileHeader::read (xmlNodePtr root) xmlFree ((void*)value); // Throw exception - warning (true, "read", "XML Syntax error in TYPE block line %d, the State argument is invalid.", - (ptrdiff_t)root->content); + warning (true, "read", "XML Syntax error in TYPE block line %p, the State argument is invalid.", + root->content); } // Delete the value diff --git a/code/nel/src/georges/type.cpp b/code/nel/src/georges/type.cpp index 6b4a20c3a..3075efc79 100644 --- a/code/nel/src/georges/type.cpp +++ b/code/nel/src/georges/type.cpp @@ -110,8 +110,8 @@ void CType::read (xmlNodePtr root) if ( ((const char*)root->name == NULL) || (strcmp ((const char*)root->name, "TYPE") != 0) ) { // Throw exception - warning2 (true, "read", "XML Syntax error in block line %d, node (%s) should be TYPE.", - (ptrdiff_t)root->content, root->name); + warning2 (true, "read", "XML Syntax error in block line %p, node (%s) should be TYPE.", + root->content, root->name); } // Read the type @@ -138,8 +138,8 @@ void CType::read (xmlNodePtr root) xmlFree ((void*)value); // Throw exception - warning2 (true, "read", "XML Syntax error in TYPE block line %d, the Type value is unknown (%s).", - (ptrdiff_t)root->content, valueStr.c_str ()); + warning2 (true, "read", "XML Syntax error in TYPE block line %p, the Type value is unknown (%s).", + root->content, valueStr.c_str ()); } // Delete the value @@ -148,8 +148,8 @@ void CType::read (xmlNodePtr root) else { // Throw exception - warning2 (true, "read", "XML Syntax error in TYPE block line %d, the Type argument was not found.", - (ptrdiff_t)root->content); + warning2 (true, "read", "XML Syntax error in TYPE block line %p, the Type argument was not found.", + root->content); } // Read the UI @@ -256,8 +256,8 @@ void CType::read (xmlNodePtr root) xmlFree ((void*)label); // Throw exception - warning2 (true, "read", "XML Syntax error in DEFINITION block line %d, the Value argument was not found.", - (ptrdiff_t)childPtr->content); + warning2 (true, "read", "XML Syntax error in DEFINITION block line %p, the Value argument was not found.", + childPtr->content); } // Delete the value @@ -266,8 +266,8 @@ void CType::read (xmlNodePtr root) else { // Throw exception - warning2 (true, "read", "XML Syntax error in DEFINITION block line %d, the Label argument was not found.", - (ptrdiff_t)childPtr->content); + warning2 (true, "read", "XML Syntax error in DEFINITION block line %p, the Label argument was not found.", + childPtr->content); } // One more diff --git a/code/nel/src/ligo/ligo_config.cpp b/code/nel/src/ligo/ligo_config.cpp index 8d4b730f0..c61b03d03 100644 --- a/code/nel/src/ligo/ligo_config.cpp +++ b/code/nel/src/ligo/ligo_config.cpp @@ -530,7 +530,7 @@ void CLigoConfig::syntaxError (const char *filename, xmlNodePtr xmlNode, const c vsnprintf( buffer, 1024, format, args ); va_end( args ); - errorMessage ("(%s), node (%s), line (%d) :\n%s", filename, xmlNode->name, (ptrdiff_t)xmlNode->content, buffer); + errorMessage ("(%s), node (%s), line (%p) :\n%s", filename, xmlNode->name, xmlNode->content, buffer); } // *************************************************************************** diff --git a/code/nel/src/ligo/primitive.cpp b/code/nel/src/ligo/primitive.cpp index 4c1b3f9dd..ff8c71c18 100644 --- a/code/nel/src/ligo/primitive.cpp +++ b/code/nel/src/ligo/primitive.cpp @@ -59,7 +59,7 @@ void XMLError (xmlNodePtr xmlNode, const char *filename, const char *format, ... vsnprintf( buffer, 1024, format, args ); va_end( args ); - Error (filename, "node (%s), line (%d) : %s", xmlNode->name, (ptrdiff_t)xmlNode->content, buffer); + Error (filename, "node (%s), line (%p) : %s", xmlNode->name, xmlNode->content, buffer); } diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index 9284217d6..472e2cd35 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -734,10 +734,10 @@ public: str = ""; } char tmp[32]; - sprintf (tmp, "!0x%X", addr); + sprintf (tmp, "!0x%p", addr); str += tmp; //} - str +=" DEBUG:"+toString("0x%08X", addr); + str +=" DEBUG:"+toString("0x%p", addr); // @@ -925,7 +925,7 @@ public: if(*addr == NULL) sprintf (tmp, ""); else - sprintf (tmp, "0x%X", *addr); + sprintf (tmp, "0x%p", *addr); } } diff --git a/code/nel/src/misc/mem_displayer.cpp b/code/nel/src/misc/mem_displayer.cpp index f7220cb2a..f97da783c 100644 --- a/code/nel/src/misc/mem_displayer.cpp +++ b/code/nel/src/misc/mem_displayer.cpp @@ -97,7 +97,7 @@ static string getFuncInfo (DWORD_TYPE funcAddr, DWORD_TYPE stackAddr) if (stop==0 && (parse[i] == ',' || parse[i] == ')')) { char tmp[32]; - sprintf (tmp, "=0x%X", *((ULONG*)(stackAddr) + 2 + pos++)); + sprintf (tmp, "=0x%p", *((ULONG*)(stackAddr) + 2 + pos++)); str += tmp; } str += parse[i];