Mercurial > octave
diff libinterp/corefcn/load-save.cc @ 28993:cc287e633588 stable
Always open files in binary mode for saving variables (bug #59238).
* load-save.cc (load_save_system::save): Open ofstream in binary mode for all
save file formats. This means that line endings are stored as-is and are no
longer converted dependent on the platform.
* ls-ascii-helper.cc: Add comment as a reminder to keep these functions even
though we no longer save variables in files in text mode.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 23 Oct 2020 18:59:29 +0200 |
parents | dc80e087df4b |
children | c3970f97f9b8 139df373c107 |
line wrap: on
line diff
--- a/libinterp/corefcn/load-save.cc Sat Oct 24 11:17:46 2020 -0400 +++ b/libinterp/corefcn/load-save.cc Fri Oct 23 18:59:29 2020 +0200 @@ -1471,14 +1471,8 @@ std::ios::openmode mode = (append ? (std::ios::app | std::ios::ate) : std::ios::out); - if (format.type () == BINARY -#if defined (HAVE_HDF5) - || format.type () == HDF5 -#endif - || format.type () == MAT_BINARY - || format.type () == MAT5_BINARY - || format.type () == MAT7_BINARY) - mode |= std::ios::binary; + // Always open in binary mode to save line endings as is. + mode |= std::ios::binary; #if defined (HAVE_HDF5) if (format.type () == HDF5)