summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2005-01-22 17:36:17 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2005-01-22 17:36:17 +0000
commitc8f1f4bc8e569a71f0067b8825f3bdb77dcd56fd (patch)
tree55b1d008e1cf3c87f4bd6accbe2299dacdb7e907 /llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
parente90b0c546976065cb6e09b29081e27e263159fef (diff)
downloadbcm5719-llvm-c8f1f4bc8e569a71f0067b8825f3bdb77dcd56fd.tar.gz
bcm5719-llvm-c8f1f4bc8e569a71f0067b8825f3bdb77dcd56fd.zip
Use binary mode for reading/writing bytecode files
llvm-svn: 19751
Diffstat (limited to 'llvm/lib/Bytecode/Archive/ArchiveWriter.cpp')
-rw-r--r--llvm/lib/Bytecode/Archive/ArchiveWriter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp b/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
index 5c7b1263204..f16376725d0 100644
--- a/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
+++ b/llvm/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();
}
OpenPOWER on IntegriCloud