Don't look up '0-serialized' pointers in TQGDict. This replaces PR #263

It makes no logical sense to serialize a pointer value and in fact 0 is written. So the call to look_ptr is never executed when deserializing a pointer.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/266/head
Michele Calgaro 2 months ago
parent b6ba99e65a
commit ec615dc3b5
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -945,12 +945,8 @@ TQDataStream &TQGDict::read( TQDataStream &s )
TQ_UINT32 k;
s >> k;
read( s, d );
// ### cannot insert 0 - this renders the thing
// useless since all pointers are written as 0,
// but hey, serializing pointers? can it be done
// at all, ever?
if ( k )
look_ptr( (void *)k, d, op_insert );
// Pointer real values are not serialized, so it doesn't make sense
// to insert null values back into the dictionary by calling 'look_ptr' here
}
break;
}
@ -980,7 +976,7 @@ TQDataStream& TQGDict::write( TQDataStream &s ) const
s << (TQ_UINT32)((TQIntBucket*)n)->getKey();
break;
case PtrKey:
s << (TQ_UINT32)0; // ### cannot serialize a pointer
s << (TQ_UINT32)0; // ### it doesn't make sense to serialize a pointer's value
break;
}
write( s, n->getData() ); // write data

Loading…
Cancel
Save