project-gemmi / gemmi

macromolecular crystallography library and utilities
https://project-gemmi.github.io/
Mozilla Public License 2.0
223 stars 45 forks source link

Loading ccp4 map from memory #41

Closed ghost closed 4 years ago

ghost commented 4 years ago

https://github.com/project-gemmi/gemmi/blob/f8048836778d1528e0a6c3486ef9a6806288f0e7/include/gemmi/ccp4.hpp#L172

When loading ccp4 map from MemoryStream, the position of the stream is not advanced, since the Stream is passed by value. This breaks the loader since the header bytes are read again as grid data later. Passing the Stream f by reference fixes this issue.

wojdyr commented 4 years ago

Thanks spotting this problem and for finding out how to fix it.