diff options
Diffstat (limited to 'src/platforms/posix')
-rw-r--r-- | src/platforms/posix/posixChildProcess.cpp | 15 | ||||
-rw-r--r-- | src/platforms/posix/posixFile.cpp | 33 | ||||
-rw-r--r-- | src/platforms/posix/posixSocket.cpp | 4 |
3 files changed, 25 insertions, 27 deletions
diff --git a/src/platforms/posix/posixChildProcess.cpp b/src/platforms/posix/posixChildProcess.cpp index 54410bf6..cd3aafb3 100644 --- a/src/platforms/posix/posixChildProcess.cpp +++ b/src/platforms/posix/posixChildProcess.cpp @@ -39,9 +39,9 @@ namespace posix { // posixChildProcessFactory -utility::childProcess* posixChildProcessFactory::create(const utility::file::path& path) const +ref <utility::childProcess> posixChildProcessFactory::create(const utility::file::path& path) const { - return new posixChildProcess(path); + return vmime::create <posixChildProcess>(path); } @@ -220,9 +220,6 @@ posixChildProcess::~posixChildProcess() if (m_pipe[1] != 0) close(m_pipe[1]); - delete (m_stdIn); - delete (m_stdOut); - delete [] (m_argArray); } @@ -307,7 +304,7 @@ void posixChildProcess::start(const std::vector <string> args, const int flags) if (flags & FLAG_REDIRECT_STDIN) { - m_stdIn = new outputStreamPosixPipeAdapter(m_pipe[1]); + m_stdIn = vmime::create <outputStreamPosixPipeAdapter>(m_pipe[1]); } else { @@ -317,7 +314,7 @@ void posixChildProcess::start(const std::vector <string> args, const int flags) if (flags & FLAG_REDIRECT_STDOUT) { - m_stdOut = new inputStreamPosixPipeAdapter(m_pipe[0]); + m_stdOut = vmime::create <inputStreamPosixPipeAdapter>(m_pipe[0]); } else { @@ -330,13 +327,13 @@ void posixChildProcess::start(const std::vector <string> args, const int flags) } -utility::outputStream* posixChildProcess::getStdIn() +ref <utility::outputStream> posixChildProcess::getStdIn() { return (m_stdIn); } -utility::inputStream* posixChildProcess::getStdOut() +ref <utility::inputStream> posixChildProcess::getStdOut() { return (m_stdOut); } diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp index 83ea0f1b..2f2ef39f 100644 --- a/src/platforms/posix/posixFile.cpp +++ b/src/platforms/posix/posixFile.cpp @@ -68,9 +68,10 @@ const bool posixFileIterator::hasMoreElements() const } -vmime::utility::file* posixFileIterator::nextElement() +ref <vmime::utility::file> posixFileIterator::nextElement() { - posixFile* file = new posixFile(m_path / vmime::utility::file::path::component(m_dirEntry->d_name)); + ref <posixFile> file = vmime::create <posixFile> + (m_path / vmime::utility::file::path::component(m_dirEntry->d_name)); getNextElement(); @@ -182,14 +183,14 @@ posixFileWriter::posixFileWriter(const vmime::utility::file::path& path, const v } -vmime::utility::outputStream* posixFileWriter::getOutputStream() +ref <vmime::utility::outputStream> posixFileWriter::getOutputStream() { int fd = 0; if ((fd = ::open(m_nativePath.c_str(), O_WRONLY, 0660)) == -1) posixFileSystemFactory::reportError(m_path, errno); - return new posixFileWriterOutputStream(m_path, fd); + return vmime::create <posixFileWriterOutputStream>(m_path, fd); } @@ -204,14 +205,14 @@ posixFileReader::posixFileReader(const vmime::utility::file::path& path, const v } -vmime::utility::inputStream* posixFileReader::getInputStream() +ref <vmime::utility::inputStream> posixFileReader::getInputStream() { int fd = 0; if ((fd = ::open(m_nativePath.c_str(), O_RDONLY, 0640)) == -1) posixFileSystemFactory::reportError(m_path, errno); - return new posixFileReaderInputStream(m_path, fd); + return vmime::create <posixFileReaderInputStream>(m_path, fd); } @@ -299,12 +300,12 @@ const bool posixFile::exists() const } -const vmime::utility::file* posixFile::getParent() const +ref <vmime::utility::file> posixFile::getParent() const { if (m_path.isEmpty()) return NULL; else - return new posixFile(m_path.getParent()); + return vmime::create <posixFile>(m_path.getParent()); } @@ -340,24 +341,24 @@ void posixFile::remove() } -vmime::utility::fileWriter* posixFile::getFileWriter() +ref <vmime::utility::fileWriter> posixFile::getFileWriter() { - return new posixFileWriter(m_path, m_nativePath); + return vmime::create <posixFileWriter>(m_path, m_nativePath); } -vmime::utility::fileReader* posixFile::getFileReader() +ref <vmime::utility::fileReader> posixFile::getFileReader() { - return new posixFileReader(m_path, m_nativePath); + return vmime::create <posixFileReader>(m_path, m_nativePath); } -vmime::utility::fileIterator* posixFile::getFiles() const +ref <vmime::utility::fileIterator> posixFile::getFiles() const { if (!isDirectory()) throw vmime::exceptions::not_a_directory(m_path); - return new posixFileIterator(m_path, m_nativePath); + return vmime::create <posixFileIterator>(m_path, m_nativePath); } @@ -383,9 +384,9 @@ void posixFile::createDirectoryImpl(const vmime::utility::file::path& fullPath, // posixFileSystemFactory // -vmime::utility::file* posixFileSystemFactory::create(const vmime::utility::file::path& path) const +ref <vmime::utility::file> posixFileSystemFactory::create(const vmime::utility::file::path& path) const { - return new posixFile(path); + return vmime::create <posixFile>(path); } diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp index a958680f..be346b2a 100644 --- a/src/platforms/posix/posixSocket.cpp +++ b/src/platforms/posix/posixSocket.cpp @@ -172,9 +172,9 @@ void posixSocket::sendRaw(const char* buffer, const int count) // posixSocketFactory // -vmime::messaging::socket* posixSocketFactory::create() +ref <vmime::messaging::socket> posixSocketFactory::create() { - return new posixSocket(); + return vmime::create <posixSocket>(); } |