瀏覽代碼

UI: Use binary mode for QuickReadFile

When not using binary mode (i.e. text mode) CRLF will be converted to
LF, which means that the size provided by tellg() is no longer correct,
and reading prematurely hits an EOF and sets the fail bit.
derrod 2 年之前
父節點
當前提交
c55fcbbb12
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      UI/update/shared-update.cpp

+ 1 - 1
UI/update/shared-update.cpp

@@ -68,7 +68,7 @@ try {
 
 static bool QuickReadFile(const char *file, std::string &data)
 try {
-	std::ifstream fileStream(file);
+	std::ifstream fileStream(file, std::ifstream::binary);
 	if (!fileStream.is_open() || fileStream.fail())
 		throw strprintf("Failed to open file '%s': %s", file,
 				strerror(errno));