diff options
| author | Gordon Sim <gsim@apache.org> | 2013-04-30 15:46:53 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-04-30 15:46:53 +0000 |
| commit | 37323eb6adbf634039f955504a9a4842fe39d9c2 (patch) | |
| tree | 9a1f24b21731a83e9c8735e7f133477470a18721 /cpp/src/qpid/sys/posix/MemoryMappedFile.cpp | |
| parent | 1eaa4da4c71e37c51277f6db5b7d1ce2cd264d17 (diff) | |
| download | qpid-python-37323eb6adbf634039f955504a9a4842fe39d9c2.tar.gz | |
QPID-4339: fix for older compilers/c++ libraries
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1477698 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/posix/MemoryMappedFile.cpp')
| -rw-r--r-- | cpp/src/qpid/sys/posix/MemoryMappedFile.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp b/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp index eae23cc6a9..147a1970ee 100644 --- a/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp +++ b/cpp/src/qpid/sys/posix/MemoryMappedFile.cpp @@ -54,10 +54,11 @@ std::string getFileName(const std::string& name, const std::string& dir) class MemoryMappedFilePrivate { friend class MemoryMappedFile; - const int fd; - MemoryMappedFilePrivate(int fd_) : fd(fd_) {} + int fd; + MemoryMappedFilePrivate() : fd(0) {} }; -MemoryMappedFile::MemoryMappedFile() {} +MemoryMappedFile::MemoryMappedFile() : state(new MemoryMappedFilePrivate) {} +MemoryMappedFile::~MemoryMappedFile() { delete state; } std::string MemoryMappedFile::open(const std::string& name, const std::string& directory) { @@ -66,7 +67,7 @@ std::string MemoryMappedFile::open(const std::string& name, const std::string& d int flags = O_CREAT | O_TRUNC | O_RDWR; int fd = ::open(path.c_str(), flags, S_IRWXU); if (fd == -1) throw qpid::Exception(QPID_MSG("Failed to open memory mapped file " << path << ": " << qpid::sys::strError(errno) << " [flags=" << flags << "]")); - state = std::auto_ptr<MemoryMappedFilePrivate>(new MemoryMappedFilePrivate(fd)); + state->fd = fd; return path; } size_t MemoryMappedFile::getPageSize() |
