SFML/SOURCES/SFML-strict-aliasing.patch

27 lines
849 B
Diff

--- src/SFML/Graphics/Font.cpp~ 2017-02-17 22:38:42.144725860 +0530
+++ src/SFML/Graphics/Font.cpp 2017-02-17 22:37:41.094344692 +0530
@@ -61,6 +61,14 @@
void close(FT_Stream)
{
}
+
+ template <typename T, typename U>
+ inline T reinterpret(const U& input)
+ {
+ T output;
+ std::memcpy(&output, &input, sizeof(U));
+ return output;
+ }
}
@@ -325,7 +333,7 @@
GlyphTable& glyphs = m_pages[characterSize].glyphs;
// Build the key by combining the code point, bold flag, and outline thickness
- Uint64 key = (static_cast<Uint64>(*reinterpret_cast<Uint32*>(&outlineThickness)) << 32)
+ Uint64 key = (static_cast<Uint64>(reinterpret<Uint32>(outlineThickness)) << 32)
| (static_cast<Uint64>(bold ? 1 : 0) << 31)
| static_cast<Uint64>(codePoint);