unsigned long sum(FileName const & file)
{
- LYXERR(Debug::FILES) << "lyx::sum() using mmap (lightning fast)"
- << endl;
+ LYXERR(Debug::FILES, "lyx::sum() using mmap (lightning fast)");
int fd = open(file.toFilesystemEncoding().c_str(), O_RDONLY);
if (!fd)
unsigned long sum(FileName const & file)
{
- LYXERR(Debug::FILES) << "lyx::sum() using istreambuf_iterator (fast)"
- << endl;
+ LYXERR(Debug::FILES, "lyx::sum() using istreambuf_iterator (fast)");
// a directory may be passed here so we need to test it. (bug 3622)
if (file.isDirectory())
return 0;
string filename = file.toFilesystemEncoding();
- ifstream ifs(filename.c_str());
+ ifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary);
if (!ifs)
return 0;
unsigned long sum(FileName const & file)
{
- LYXERR(Debug::FILES)
- << "lyx::sum() using istream_iterator (slow as a snail)"
- << endl;
+ LYXERR(Debug::FILES, "lyx::sum() using istream_iterator (slow as a snail)");
// a directory may be passed here so we need to test it. (bug 3622)
if (file.isDirectory())
return 0;
string filename = file.toFilesystemEncoding();
- ifstream ifs(filename.c_str());
+ ifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary);
if (!ifs)
return 0;