Actually fixed pointer conversion bug

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

View file

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

View file

@ -189,6 +189,13 @@ namespace ostd
return *this; return *this;
} }
String& String::addPtr(const void* p, const String& prefix)
{
std::stringstream stream;
stream << prefix << std::hex << std::uppercase << reinterpret_cast<uintptr_t>(p);
return add(stream.str());
}
String& String::add(const String& se) String& String::add(const String& se)
{ {
m_data += se.cpp_str(); m_data += se.cpp_str();
@ -265,13 +272,6 @@ namespace ostd
return add(s); 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 //New String
@ -372,6 +372,12 @@ namespace ostd
return __str.addChar(c); return __str.addChar(c);
} }
String String::new_addPtr(const void* p, const String& prefix)
{
String __str = m_data;
return __str.addPtr(p, prefix);
}
String String::new_add(const String& se) const String String::new_add(const String& se) const
{ {
String __str = m_data; String __str = m_data;
@ -438,12 +444,6 @@ namespace ostd
return __str.add(f, precision); 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 //Utility

View file

@ -111,6 +111,7 @@ namespace ostd
String& fixedLength(u32 length, char fill_character = ' ', const String& truncate_indicator = "... "); String& fixedLength(u32 length, char fill_character = ' ', const String& truncate_indicator = "... ");
String& addChar(char c); String& addChar(char c);
String& addPtr(const void* p, const String& prefix = "0x");
String& add(const String& se); String& add(const String& se);
String& add(u8 i); String& add(u8 i);
String& add(i8 i); String& add(i8 i);
@ -122,7 +123,6 @@ namespace ostd
String& add(i64 i); String& add(i64 i);
String& add(f32 f, u8 precision = 0); String& add(f32 f, u8 precision = 0);
String& add(f64 f, u8 precision = 0); String& add(f64 f, u8 precision = 0);
String& add(const void* p, const String& prefix = "0x");
//New String //New String
String new_ltrim(void) const; String new_ltrim(void) const;
@ -142,6 +142,7 @@ namespace ostd
String new_fixedLength(u32 length, char fill_character = ' ', const String& truncate_indicator = "... ") const; String new_fixedLength(u32 length, char fill_character = ' ', const String& truncate_indicator = "... ") const;
String new_addChar(char c) const; String new_addChar(char c) const;
String new_addPtr(const void* p, const String& prefix = "0x");
String new_add(const String& se) const; String new_add(const String& se) const;
String new_add(u8 i) const; String new_add(u8 i) const;
String new_add(i8 i) const; String new_add(i8 i) const;
@ -153,7 +154,6 @@ namespace ostd
String new_add(i64 i) const; String new_add(i64 i) const;
String new_add(f32 f, u8 precision = 0) const; String new_add(f32 f, u8 precision = 0) const;
String new_add(f64 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 //Utility
i64 toInt(void) const; i64 toInt(void) const;