Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structure padding cause many bugs in saving and loading #9

Closed
GoogleCodeExporter opened this issue Aug 14, 2015 · 3 comments
Closed

Comments

@GoogleCodeExporter
Copy link

Saving and loading files uses direct read/write of struct to file. This causes 
problem because there are 
gaps between members wich should not be written to the file.

Replace the direct read/write of structs by read/write of each members one 
after each other.


Original issue reported on code.google.com by pulkoma...@gmail.com on 2 Aug 2008 at 4:02

@GoogleCodeExporter
Copy link
Author

If you are using a gcc compiler, you can use "__attribute__ ((__packed__))" in 
the
structure definitions you need to be packed in memory, as they were in the DOS 
version.

Original comment by yrizoud on 4 Sep 2008 at 7:17

@GoogleCodeExporter
Copy link
Author

Yes, but writing a structure to a file is not clean and packing the struct does 
not 
solve the endianness problem. So we're going to write the members of the struc 
one 
after each other to the file, in a more portable way.

Original comment by pulkoma...@gmail.com on 8 Sep 2008 at 9:06

@GoogleCodeExporter
Copy link
Author

As of r154, all the structs used in file format are __packed__.
When I solve the endianness issue for all formats I am certainly going to read 
and 
write member by member anyway, but in either way the packing problem is solved.

Original comment by yrizoud on 17 Sep 2008 at 7:42

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant