// Write an integer using variable bit rate encoding. This saves a few bytes
// per entry in the symbol table.
-inline void writeInteger(unsigned num, std::ofstream& ARFile) {
+static inline void writeInteger(unsigned num, std::ofstream& ARFile) {
while (1) {
if (num < 0x80) { // done?
ARFile << (unsigned char)num;
// Compute how many bytes are taken by a given VBR encoded value. This is needed
// to pre-compute the size of the symbol table.
-inline unsigned numVbrBytes(unsigned num) {
+static inline unsigned numVbrBytes(unsigned num) {
// Note that the following nested ifs are somewhat equivalent to a binary
// search. We split it in half by comparing against 2^14 first. This allows
const char *data = (const char*)member.getData();
MemoryBuffer *mFile = 0;
if (!data) {
- mFile = MemoryBuffer::getFile(member.getPath().c_str(),
- member.getPath().size(), ErrMsg);
+ mFile = MemoryBuffer::getFile(member.getPath().c_str(), ErrMsg);
if (mFile == 0)
return true;
data = mFile->getBufferStart();
// Map in the archive we just wrote.
{
- OwningPtr<MemoryBuffer> arch(MemoryBuffer::getFile(TmpArchive.c_str(),
- TmpArchive.size()));
+ OwningPtr<MemoryBuffer> arch(MemoryBuffer::getFile(TmpArchive.c_str()));
if (arch == 0) return true;
const char* base = arch->getBufferStart();
if (TmpArchive.renamePathOnDisk(archPath, ErrMsg))
return true;
+ // Set correct read and write permissions after temporary file is moved
+ // to final destination path.
+ if (archPath.makeReadableOnDisk(ErrMsg))
+ return true;
+ if (archPath.makeWriteableOnDisk(ErrMsg))
+ return true;
+
return false;
}