From f33ee855662b43f1be410325ce096abf4551d7de Mon Sep 17 00:00:00 2001 From: iwbnwif Date: Wed, 6 Mar 2019 21:55:36 +0000 Subject: [PATCH] Fix printing 64 bit pointers in wxMemStruct code Don't truncate addresses under Win64 when printing debug messages using wxMemStruct. This avoids build errors if wxUSE_DEBUG_CONTEXT = 1 when building on Win64. Closes https://github.com/wxWidgets/wxWidgets/pull/1249 --- src/common/memory.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/memory.cpp b/src/common/memory.cpp index f14989ad3b..2795070054 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -321,7 +321,7 @@ void wxMemStruct::PrintNode () msg += wxT("object"); wxString msg2; - msg2.Printf(wxT(" at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize()); + msg2.Printf(wxT(" at %#zx, size %d"), wxPtrToUInt(GetActualData()), (int)RequestSize()); msg += msg2; wxLogMessage(msg); @@ -334,7 +334,7 @@ void wxMemStruct::PrintNode () msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); msg += wxT("non-object data"); wxString msg2; - msg2.Printf(wxT(" at 0x%lX, size %d\n"), (long)GetActualData(), (int)RequestSize()); + msg2.Printf(wxT(" at %#zx, size %d\n"), wxPtrToUInt(GetActualData()), (int)RequestSize()); msg += msg2; wxLogMessage(msg); @@ -367,7 +367,7 @@ void wxMemStruct::Dump () msg += wxT("unknown object class"); wxString msg2; - msg2.Printf(wxT(" at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize()); + msg2.Printf(wxT(" at %#zx, size %d"), wxPtrToUInt(GetActualData()), (int)RequestSize()); msg += msg2; wxDebugContext::OutputDumpLine(msg.c_str()); @@ -379,7 +379,7 @@ void wxMemStruct::Dump () msg.Printf(wxT("%s(%d): "), m_fileName, (int)m_lineNum); wxString msg2; - msg2.Printf(wxT("non-object data at 0x%lX, size %d"), (long)GetActualData(), (int)RequestSize() ); + msg2.Printf(wxT("non-object data at %#zx, size %d"), wxPtrToUInt(GetActualData()), (int)RequestSize() ); msg += msg2; wxDebugContext::OutputDumpLine(msg.c_str()); }