mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-25 07:37:39 -05:00
A better fix for gcc ptr->int casting pickiness.
This commit is contained in:
1 parent
2f94d1611b
commit
b028f50fa3
1 file changed
+2
-18
@@ -368,24 +368,8 @@ GncSqlColumnTableEntry::get_row_value_from_object(QofIdTypeConst obj_name,
|
||||
QofAccessFunc getter = get_getter(obj_name);
|
||||
if (getter != nullptr)
|
||||
{
|
||||
if constexpr (sizeof(T) >= sizeof(void*))
|
||||
result = reinterpret_cast<T>((getter)(const_cast<void*>(pObject),
|
||||
nullptr));
|
||||
else
|
||||
{
|
||||
union converter
|
||||
{
|
||||
intptr_t whole;
|
||||
uint32_t upper;
|
||||
uint32_t lower;
|
||||
};
|
||||
converter conv;
|
||||
conv.whole = reinterpret_cast<intptr_t>((getter)(const_cast<void*>(pObject),
|
||||
nullptr));
|
||||
if (conv.upper)
|
||||
throw std::runtime_error("Bits left over when converting pointer"); //crash out
|
||||
result = conv.lower;
|
||||
}
|
||||
result = static_cast<T>(reinterpret_cast<intptr_t>((getter)(const_cast<void*>(pObject),
|
||||
nullptr)));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user