Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

using llu instead of d for the Format

(1/2) > >>

ollydbg:
I see an alert message when C::B start in the latest rev 12996.

This patch try to fix it.


--- Code: ---From 63c1c31529667c9985c4ab96087ef1bf591f0e70 Mon Sep 17 00:00:00 2001
From: asmwarrior <a@b.com>
Date: Sun, 30 Oct 2022 13:39:30 +0800
Subject: use the %llu for unsigned long long value, otherwise, an alert will
 happen


diff --git a/src/sdk/toolsmanager.cpp b/src/sdk/toolsmanager.cpp
index 616fb2d1..ac6395bf 100644
--- a/src/sdk/toolsmanager.cpp
+++ b/src/sdk/toolsmanager.cpp
@@ -264,7 +264,7 @@ void ToolsManager::LoadTools()
 
         AddTool(&tool, false);
     }
-    Manager::Get()->GetLogManager()->Log(wxString::Format(_("Configured %d tools"), m_Tools.GetCount()));
+    Manager::Get()->GetLogManager()->Log(wxString::Format(_("Configured %llu tools"), m_Tools.GetCount()));
 }
 
 void ToolsManager::SaveTools()


--- End code ---

My question is: why the old F() function does not show the alert message box?

Miguel Gimenez:
This a diagnostic from the compiler (or wxWidgets), it knows how printf() works but nothing about F().

I did not see this because I am working with 32 bits, I will fix it in trunk.

Miguel Gimenez:
Fixed in r12997.

PB:

--- Quote from: Miguel Gimenez on October 30, 2022, 09:51:40 am ---Fixed in r12997.

--- End quote ---

Just a nitpick, sorry. IMO, the correct solution would be to use "%zu". %zu is the natural formatter for size_t returned by GetCount() / size() methods of std(-like) containers,  hence no cast is required and the formatter works regardless of 32/64-bit builds. It has been supported by wxWidgets since a long time.

Miguel Gimenez:
Corrected in r12998, thank you.

Navigation

[0] Message Index

[#] Next page

Go to full version