It seems that boost_property has issues with reinterpret_cast. Not sure if boost breaks some standard rules in this section. Anyways, I use memcpy which just transfers the addresses of the pointers. Since Commander Genius needs that for savegames and configs, this fix is required.

This commit is contained in:
Gerhard Stein
2014-10-11 08:46:30 +02:00
parent 82c2f4e0e9
commit ed973d4f7b
5 changed files with 16 additions and 6 deletions

View File

@@ -599,7 +599,11 @@ namespace boost { namespace property_tree { namespace detail {namespace rapidxml
// Setup new pool in allocated memory
char *pool = align(raw_memory);
header *new_header = reinterpret_cast<header *>(pool);
header *new_header;
memcpy( (void*) new_header, (void*)pool,sizeof(header*));
//header *new_header = reinterpret_cast<header *>(pool);
new_header->previous_begin = m_begin;
m_begin = raw_memory;
m_ptr = pool + sizeof(header);

View File

@@ -36,8 +36,14 @@ template<class T> struct addressof_impl
{
static inline T * f( T & v, long )
{
return reinterpret_cast<T*>(
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
T* address;
memcpy( (void*) address, (void*)&v,sizeof(T*));
/*return reinterpret_cast<T*>(
&const_cast<char&>( reinterpret_cast<const volatile char &>(v) )
);*/
return address;
}
static inline T * f( T * v, int )