Encoding masters question

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

Moderator: Committer

Post Reply
Message
Author
Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Encoding masters question

#1 Post by Ophiuchus »

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!

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

Re: Encoding masters question

#2 Post by Geoff the Medio »

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