Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.
Moderator: Committer
Ophiuchus
Programmer
Posts: 3433 Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV
#1
Post
by Ophiuchus » Sat Oct 06, 2018 9:30 pm
I trying to figure out what the right way to fix a certain memory leak is
issue-2297
So I need a feedback if the following actually is possible (else i will prune the use case as dead code):
I encounter a savefile, read the first five bytes
as they are not "<?xml" i try to deserialize the save game as binary
as binary deserialization fails I try to deserialize xml-based and succeed
If that is not a real use case the code would definitely become more nice.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Geoff the Medio
Programming, Design, Admin
Posts: 13587 Joined: Wed Oct 08, 2003 1:33 am
Location: Munich
#2
Post
by Geoff the Medio » Sun Oct 07, 2018 8:12 am
If a save file doesn't start with "<?xml" then it isn't a valid XML save file and it (probably?) wouldn't parse, and so it is not necessary to attempt to load it as one.