open ifstream in zstr as binary always #793
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sorry that things come in small pieces.
I had problems reading compressed input on Windows with zstr. (There was an exception from
std::string
thrown.)Turned out that this is due to mateidavid/zstr#15, i.e., not opening the input stream as binary. On Windows, there are some conversions of carriage-return (
\r
) happening in that case that cause trouble.This PR changes the zstr library to always open the input stream in binary form.
As far as I understand zstr/issues#15, this means that
\r
in the input are not converted away.Fortunately, your LP and MPS readers seem to handle this case:
\r
, becauseisspace('\r')
is true: https://github.com/ERGO-Code/HiGHS/blob/master/src/io/HMPSIO.cpp#L474-L484trim()
function to remove white-space, which includes\r
: https://github.com/ERGO-Code/HiGHS/blob/master/src/util/stringutil.h#L27\r
: https://github.com/ERGO-Code/HiGHS/blob/master/extern/filereaderlp/reader.cpp#L898-L900