Encoding masters question

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderators: Committer, Committer

Post Reply
Posts: 1452
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Encoding masters question

#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.

Furthermore, I propse... we should default to four combat rounds instead of three ...for the good of playerkind.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12631
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Encoding masters question

#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.

Post Reply