From 5fb6ed4ae608c6f7ef589f1069b5dd5c7bdbd60b Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Sat, 22 Jan 2005 17:36:17 +0000 Subject: Use binary mode for reading/writing bytecode files git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19751 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bytecode/Archive/ArchiveWriter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/Bytecode') diff --git a/lib/Bytecode/Archive/ArchiveWriter.cpp b/lib/Bytecode/Archive/ArchiveWriter.cpp index 5c7b126320..f16376725d 100644 --- a/lib/Bytecode/Archive/ArchiveWriter.cpp +++ b/lib/Bytecode/Archive/ArchiveWriter.cpp @@ -375,7 +375,9 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){ // Ensure we can remove the temporary even in the face of an exception try { // Create archive file for output. - std::ofstream ArchiveFile(TmpArchive.c_str()); + std::ios::openmode io_mode = std::ios::out | std::ios::trunc | + std::ios::binary; + std::ofstream ArchiveFile(TmpArchive.c_str(), io_mode); // Check for errors opening or creating archive file. if ( !ArchiveFile.is_open() || ArchiveFile.bad() ) { @@ -413,7 +415,7 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){ const char* base = (const char*) arch.map(); // Open the final file to write and check it. - std::ofstream FinalFile(archPath.c_str()); + std::ofstream FinalFile(archPath.c_str(), io_mode); if ( !FinalFile.is_open() || FinalFile.bad() ) { throw std::string("Error opening archive file: ") + archPath.toString(); } -- cgit v1.2.3-70-g09d2