News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

using llu instead of d for the Format

Started by ollydbg, October 30, 2022, 06:45:46 AM

Previous topic - Next topic

ollydbg

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

This patch try to fix it.


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()



My question is: why the old F() function does not show the alert message box?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

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


PB

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

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.
[url="https://github.com/PBfordev/wxpbguide"]https://github.com/PBfordev/wxpbguide[/url]

Miguel Gimenez


ollydbg

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.