On Mingw, ftell() and ftello() are unreliable when used on text files with
plain LF line endings:
http://article.gmane.org/gmane.comp.gnu.m4.bugs/2224
This made the get-data-txt-importcases.sh test fail, because
dfm_get_percent_read() that it depends upon to determine the percentage of
the file that has been read uses ftello(). The solution is to always open
the text file as a binary file. According to my audit of the ways that
the text file is read, this should not cause other problems. In
particular, ds_read_line() handles both LF and CR-LF line endings. But it
cannot handle negative effects on Unix platforms anyway, since they do not
distinguish text and binary modes.
struct stat s;
r->where.file_name = CONST_CAST (char *, fh_get_file_name (fh));
r->where.line_number = 0;
- r->file = fn_open (fh_get_file_name (fh),
- fh_get_mode (fh) == FH_MODE_TEXT ? "r" : "rb");
+ r->file = fn_open (fh_get_file_name (fh), "rb");
if (r->file == NULL)
{
msg (ME, _("Could not open \"%s\" for reading as a data file: %s."),