diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-16 03:29:14 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-16 03:29:14 +0000 |
commit | 3ff9563c3e391954b2e224afcf8b2b0fcc3888aa (patch) | |
tree | cccde9111a73ba5895f6cefbfb280290fa6c469d /lib/Archive/ArchiveWriter.cpp | |
parent | b29b20e7deb7297f6a10b2d6922feeca8c6df055 (diff) |
MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> via an out parm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Archive/ArchiveWriter.cpp')
-rw-r--r-- | lib/Archive/ArchiveWriter.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp index e9222c5e09..07516c6aa4 100644 --- a/lib/Archive/ArchiveWriter.cpp +++ b/lib/Archive/ArchiveWriter.cpp @@ -213,13 +213,13 @@ Archive::writeMember( const char *data = (const char*)member.getData(); MemoryBuffer *mFile = 0; if (!data) { - error_code ec; - mFile = MemoryBuffer::getFile(member.getPath().c_str(), ec); - if (mFile == 0) { + OwningPtr<MemoryBuffer> File; + if (error_code ec = MemoryBuffer::getFile(member.getPath().c_str(), File)) { if (ErrMsg) *ErrMsg = ec.message(); return true; } + mFile = File.take(); data = mFile->getBufferStart(); fSize = mFile->getBufferSize(); } @@ -411,9 +411,8 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress, // Map in the archive we just wrote. { - error_code ec; - OwningPtr<MemoryBuffer> arch(MemoryBuffer::getFile(TmpArchive.c_str(), ec)); - if (arch == 0) { + OwningPtr<MemoryBuffer> arch; + if (error_code ec = MemoryBuffer::getFile(TmpArchive.c_str(), arch)) { if (ErrMsg) *ErrMsg = ec.message(); return true; |