Fixed pointer conversion bug

This commit is contained in:
OmniaX-Dev 2026-05-08 00:53:00 +02:00
parent ede7db738c
commit 3ca1c3314d
3 changed files with 16 additions and 1 deletions

View file

@ -248,7 +248,7 @@ namespace ogfx
if (!font) font = m_font;
auto l_buildCacheKey = [&](void) -> String {
return String("").add(message).add(fontSize).add(reinterpret_cast<uintptr_t>(font));
return String("").add(message).add(fontSize).add(font);
};
String cacheKey = l_buildCacheKey();

View file

@ -265,6 +265,13 @@ namespace ostd
return add(s);
}
String& String::add(const void* p, const String& prefix)
{
std::stringstream stream;
stream << prefix << std::hex << std::uppercase << reinterpret_cast<uintptr_t>(p);
return add(stream.str());
}
//New String
@ -431,6 +438,12 @@ namespace ostd
return __str.add(f, precision);
}
String String::new_add(const void* p, const String& prefix)
{
String __str = m_data;
return __str.add(p, prefix);
}
//Utility

View file

@ -122,6 +122,7 @@ namespace ostd
String& add(i64 i);
String& add(f32 f, u8 precision = 0);
String& add(f64 f, u8 precision = 0);
String& add(const void* p, const String& prefix = "0x");
//New String
String new_ltrim(void) const;
@ -152,6 +153,7 @@ namespace ostd
String new_add(i64 i) const;
String new_add(f32 f, u8 precision = 0) const;
String new_add(f64 f, u8 precision = 0) const;
String new_add(const void* p, const String& prefix = "0x");
//Utility
i64 toInt(void) const;