aboutsummaryrefslogtreecommitdiffstats
path: root/src/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/platforms')
-rw-r--r--src/platforms/posix/posixChildProcess.cpp19
-rw-r--r--src/platforms/posix/posixFile.cpp34
-rw-r--r--src/platforms/posix/posixHandler.cpp16
-rw-r--r--src/platforms/posix/posixSocket.cpp12
-rw-r--r--src/platforms/windows/windowsFile.cpp32
-rw-r--r--src/platforms/windows/windowsHandler.cpp14
-rw-r--r--src/platforms/windows/windowsSocket.cpp12
7 files changed, 68 insertions, 71 deletions
diff --git a/src/platforms/posix/posixChildProcess.cpp b/src/platforms/posix/posixChildProcess.cpp
index 09119996..c4761624 100644
--- a/src/platforms/posix/posixChildProcess.cpp
+++ b/src/platforms/posix/posixChildProcess.cpp
@@ -32,8 +32,6 @@
#include "vmime/exception.hpp"
-#include "vmime/utility/smartPtr.hpp"
-
#include <unistd.h>
#include <string.h>
#include <errno.h>
@@ -49,9 +47,9 @@ namespace posix {
// posixChildProcessFactory
-ref <utility::childProcess> posixChildProcessFactory::create(const utility::file::path& path) const
+shared_ptr <utility::childProcess> posixChildProcessFactory::create(const utility::file::path& path) const
{
- return vmime::create <posixChildProcess>(path);
+ return make_shared <posixChildProcess>(path);
}
@@ -215,7 +213,7 @@ private:
posixChildProcess::posixChildProcess(const utility::file::path& path)
: m_processPath(path), m_started(false),
- m_stdIn(NULL), m_stdOut(NULL), m_pid(0), m_argArray(NULL)
+ m_stdIn(null), m_stdOut(null), m_pid(0), m_argArray(NULL)
{
m_pipe[0] = 0;
m_pipe[1] = 0;
@@ -319,7 +317,7 @@ void posixChildProcess::start(const std::vector <string> args, const int flags)
if (flags & FLAG_REDIRECT_STDIN)
{
- m_stdIn = vmime::create <outputStreamPosixPipeAdapter>(m_pipe[1]);
+ m_stdIn = make_shared <outputStreamPosixPipeAdapter>(m_pipe[1]);
}
else
{
@@ -329,7 +327,7 @@ void posixChildProcess::start(const std::vector <string> args, const int flags)
if (flags & FLAG_REDIRECT_STDOUT)
{
- m_stdOut = vmime::create <inputStreamPosixPipeAdapter>(m_pipe[0]);
+ m_stdOut = make_shared <inputStreamPosixPipeAdapter>(m_pipe[0]);
}
else
{
@@ -342,13 +340,13 @@ void posixChildProcess::start(const std::vector <string> args, const int flags)
}
-ref <utility::outputStream> posixChildProcess::getStdIn()
+shared_ptr <utility::outputStream> posixChildProcess::getStdIn()
{
return (m_stdIn);
}
-ref <utility::inputStream> posixChildProcess::getStdOut()
+shared_ptr <utility::inputStream> posixChildProcess::getStdOut()
{
return (m_stdOut);
}
@@ -377,8 +375,7 @@ void posixChildProcess::waitForFinish()
{
if (WEXITSTATUS(wstat) == 255)
{
- vmime::utility::auto_ptr <posixFileSystemFactory> pfsf
- = new posixFileSystemFactory();
+ std::auto_ptr <posixFileSystemFactory> pfsf(new posixFileSystemFactory());
throw exceptions::system_error("Could not execute '"
+ pfsf->pathToString(m_processPath) + "'");
diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
index 744f01ff..1e4dd070 100644
--- a/src/platforms/posix/posixFile.cpp
+++ b/src/platforms/posix/posixFile.cpp
@@ -79,9 +79,9 @@ bool posixFileIterator::hasMoreElements() const
}
-ref <vmime::utility::file> posixFileIterator::nextElement()
+shared_ptr <vmime::utility::file> posixFileIterator::nextElement()
{
- ref <posixFile> file = vmime::create <posixFile>
+ shared_ptr <posixFile> file = make_shared <posixFile>
(m_path / vmime::utility::file::path::component(m_dirEntry->d_name));
getNextElement();
@@ -258,14 +258,14 @@ posixFileWriter::posixFileWriter(const vmime::utility::file::path& path, const v
}
-ref <vmime::utility::outputStream> posixFileWriter::getOutputStream()
+shared_ptr <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 vmime::create <posixFileWriterOutputStream>(m_path, fd);
+ return make_shared <posixFileWriterOutputStream>(m_path, fd);
}
@@ -280,14 +280,14 @@ posixFileReader::posixFileReader(const vmime::utility::file::path& path, const v
}
-ref <vmime::utility::inputStream> posixFileReader::getInputStream()
+shared_ptr <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 vmime::create <posixFileReaderInputStream>(m_path, fd);
+ return make_shared <posixFileReaderInputStream>(m_path, fd);
}
@@ -417,12 +417,12 @@ bool posixFile::exists() const
}
-ref <vmime::utility::file> posixFile::getParent() const
+shared_ptr <vmime::utility::file> posixFile::getParent() const
{
if (m_path.isEmpty())
- return NULL;
+ return null;
else
- return vmime::create <posixFile>(m_path.getParent());
+ return make_shared <posixFile>(m_path.getParent());
}
@@ -465,24 +465,24 @@ void posixFile::remove()
}
-ref <vmime::utility::fileWriter> posixFile::getFileWriter()
+shared_ptr <vmime::utility::fileWriter> posixFile::getFileWriter()
{
- return vmime::create <posixFileWriter>(m_path, m_nativePath);
+ return make_shared <posixFileWriter>(m_path, m_nativePath);
}
-ref <vmime::utility::fileReader> posixFile::getFileReader()
+shared_ptr <vmime::utility::fileReader> posixFile::getFileReader()
{
- return vmime::create <posixFileReader>(m_path, m_nativePath);
+ return make_shared <posixFileReader>(m_path, m_nativePath);
}
-ref <vmime::utility::fileIterator> posixFile::getFiles() const
+shared_ptr <vmime::utility::fileIterator> posixFile::getFiles() const
{
if (!isDirectory())
throw vmime::exceptions::not_a_directory(m_path);
- return vmime::create <posixFileIterator>(m_path, m_nativePath);
+ return make_shared <posixFileIterator>(m_path, m_nativePath);
}
@@ -508,9 +508,9 @@ void posixFile::createDirectoryImpl(const vmime::utility::file::path& fullPath,
// posixFileSystemFactory
//
-ref <vmime::utility::file> posixFileSystemFactory::create(const vmime::utility::file::path& path) const
+shared_ptr <vmime::utility::file> posixFileSystemFactory::create(const vmime::utility::file::path& path) const
{
- return vmime::create <posixFile>(path);
+ return make_shared <posixFile>(path);
}
diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp
index 73005d7e..b5d08ce6 100644
--- a/src/platforms/posix/posixHandler.cpp
+++ b/src/platforms/posix/posixHandler.cpp
@@ -109,11 +109,11 @@ namespace posix {
posixHandler::posixHandler()
{
#if VMIME_HAVE_MESSAGING_FEATURES
- m_socketFactory = vmime::create <posixSocketFactory>();
+ m_socketFactory = make_shared <posixSocketFactory>();
#endif
#if VMIME_HAVE_FILESYSTEM_FEATURES
- m_fileSysFactory = vmime::create <posixFileSystemFactory>();
- m_childProcFactory = vmime::create <posixChildProcessFactory>();
+ m_fileSysFactory = make_shared <posixFileSystemFactory>();
+ m_childProcFactory = make_shared <posixChildProcessFactory>();
#endif
}
@@ -249,7 +249,7 @@ unsigned int posixHandler::getThreadId() const
#if VMIME_HAVE_MESSAGING_FEATURES
-ref <vmime::net::socketFactory> posixHandler::getSocketFactory()
+shared_ptr <vmime::net::socketFactory> posixHandler::getSocketFactory()
{
return m_socketFactory;
}
@@ -259,13 +259,13 @@ ref <vmime::net::socketFactory> posixHandler::getSocketFactory()
#if VMIME_HAVE_FILESYSTEM_FEATURES
-ref <vmime::utility::fileSystemFactory> posixHandler::getFileSystemFactory()
+shared_ptr <vmime::utility::fileSystemFactory> posixHandler::getFileSystemFactory()
{
return m_fileSysFactory;
}
-ref <vmime::utility::childProcessFactory> posixHandler::getChildProcessFactory()
+shared_ptr <vmime::utility::childProcessFactory> posixHandler::getChildProcessFactory()
{
return m_childProcFactory;
}
@@ -308,9 +308,9 @@ void posixHandler::generateRandomBytes(unsigned char* buffer, const unsigned int
}
-ref <utility::sync::criticalSection> posixHandler::createCriticalSection()
+shared_ptr <utility::sync::criticalSection> posixHandler::createCriticalSection()
{
- return vmime::create <posixCriticalSection>();
+ return make_shared <posixCriticalSection>();
}
diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
index bee9f89e..e0bcf03a 100644
--- a/src/platforms/posix/posixSocket.cpp
+++ b/src/platforms/posix/posixSocket.cpp
@@ -59,7 +59,7 @@ namespace posix {
// posixSocket
//
-posixSocket::posixSocket(ref <vmime::net::timeoutHandler> th)
+posixSocket::posixSocket(shared_ptr <vmime::net::timeoutHandler> th)
: m_timeoutHandler(th), m_desc(-1), m_status(0)
{
}
@@ -631,16 +631,16 @@ unsigned int posixSocket::getStatus() const
// posixSocketFactory
//
-ref <vmime::net::socket> posixSocketFactory::create()
+shared_ptr <vmime::net::socket> posixSocketFactory::create()
{
- ref <vmime::net::timeoutHandler> th = NULL;
- return vmime::create <posixSocket>(th);
+ shared_ptr <vmime::net::timeoutHandler> th;
+ return make_shared <posixSocket>(th);
}
-ref <vmime::net::socket> posixSocketFactory::create(ref <vmime::net::timeoutHandler> th)
+shared_ptr <vmime::net::socket> posixSocketFactory::create(shared_ptr <vmime::net::timeoutHandler> th)
{
- return vmime::create <posixSocket>(th);
+ return make_shared <posixSocket>(th);
}
diff --git a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/windowsFile.cpp
index fd8a9651..8d2a19da 100644
--- a/src/platforms/windows/windowsFile.cpp
+++ b/src/platforms/windows/windowsFile.cpp
@@ -41,9 +41,9 @@ namespace platforms {
namespace windows {
-ref <vmime::utility::file> windowsFileSystemFactory::create(const vmime::utility::file::path& path) const
+shared_ptr <vmime::utility::file> windowsFileSystemFactory::create(const vmime::utility::file::path& path) const
{
- return vmime::create <windowsFile>(path);
+ return make_shared <windowsFile>(path);
}
@@ -307,12 +307,12 @@ bool windowsFile::exists() const
return false;
}
-ref <vmime::utility::file> windowsFile::getParent() const
+shared_ptr <vmime::utility::file> windowsFile::getParent() const
{
if (m_path.isEmpty())
return NULL;
else
- return vmime::create <windowsFile>(m_path.getParent());
+ return make_shared <windowsFile>(m_path.getParent());
}
void windowsFile::rename(const path& newName)
@@ -333,19 +333,19 @@ void windowsFile::remove()
windowsFileSystemFactory::reportError(m_path, GetLastError());
}
-ref <vmime::utility::fileWriter> windowsFile::getFileWriter()
+shared_ptr <vmime::utility::fileWriter> windowsFile::getFileWriter()
{
- return vmime::create <windowsFileWriter>(m_path, m_nativePath);
+ return make_shared <windowsFileWriter>(m_path, m_nativePath);
}
-ref <vmime::utility::fileReader> windowsFile::getFileReader()
+shared_ptr <vmime::utility::fileReader> windowsFile::getFileReader()
{
- return vmime::create <windowsFileReader>(m_path, m_nativePath);
+ return make_shared <windowsFileReader>(m_path, m_nativePath);
}
-ref <vmime::utility::fileIterator> windowsFile::getFiles() const
+shared_ptr <vmime::utility::fileIterator> windowsFile::getFiles() const
{
- return vmime::create <windowsFileIterator>(m_path, m_nativePath);
+ return make_shared <windowsFileIterator>(m_path, m_nativePath);
}
void windowsFile::createDirectoryImpl(const vmime::utility::file::path& fullPath, const vmime::utility::file::path& path, const bool recursive)
@@ -380,9 +380,9 @@ bool windowsFileIterator::hasMoreElements() const
return m_moreElements;
}
-ref <vmime::utility::file> windowsFileIterator::nextElement()
+shared_ptr <vmime::utility::file> windowsFileIterator::nextElement()
{
- ref <vmime::utility::file> pFile = vmime::create <windowsFile>
+ shared_ptr <vmime::utility::file> pFile = make_shared <windowsFile>
(m_path / vmime::utility::file::path::component(m_findData.cFileName));
findNext();
@@ -430,7 +430,7 @@ windowsFileReader::windowsFileReader(const vmime::utility::file::path& path, con
{
}
-ref <vmime::utility::inputStream> windowsFileReader::getInputStream()
+shared_ptr <vmime::utility::inputStream> windowsFileReader::getInputStream()
{
HANDLE hFile = CreateFile(
m_nativePath.c_str(),
@@ -442,7 +442,7 @@ ref <vmime::utility::inputStream> windowsFileReader::getInputStream()
NULL);
if (hFile == INVALID_HANDLE_VALUE)
windowsFileSystemFactory::reportError(m_path, GetLastError());
- return vmime::create <windowsFileReaderInputStream>(m_path, hFile);
+ return make_shared <windowsFileReaderInputStream>(m_path, hFile);
}
windowsFileReaderInputStream::windowsFileReaderInputStream(const vmime::utility::file::path& path, HANDLE hFile)
@@ -505,7 +505,7 @@ windowsFileWriter::windowsFileWriter(const vmime::utility::file::path& path, con
{
}
-ref <vmime::utility::outputStream> windowsFileWriter::getOutputStream()
+shared_ptr <vmime::utility::outputStream> windowsFileWriter::getOutputStream()
{
HANDLE hFile = CreateFile(
m_nativePath.c_str(),
@@ -517,7 +517,7 @@ ref <vmime::utility::outputStream> windowsFileWriter::getOutputStream()
NULL);
if (hFile == INVALID_HANDLE_VALUE)
windowsFileSystemFactory::reportError(m_path, GetLastError());
- return vmime::create <windowsFileWriterOutputStream>(m_path, hFile);
+ return make_shared <windowsFileWriterOutputStream>(m_path, hFile);
}
windowsFileWriterOutputStream::windowsFileWriterOutputStream(const vmime::utility::file::path& path, HANDLE hFile)
diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp
index d4027801..5b9c37ce 100644
--- a/src/platforms/windows/windowsHandler.cpp
+++ b/src/platforms/windows/windowsHandler.cpp
@@ -57,10 +57,10 @@ windowsHandler::windowsHandler()
WSAStartup(MAKEWORD(1, 1), &wsaData);
#if VMIME_HAVE_MESSAGING_FEATURES
- m_socketFactory = vmime::create <windowsSocketFactory>();
+ m_socketFactory = make_shared <windowsSocketFactory>();
#endif
#if VMIME_HAVE_FILESYSTEM_FEATURES
- m_fileSysFactory = vmime::create <windowsFileSystemFactory>();
+ m_fileSysFactory = make_shared <windowsFileSystemFactory>();
#endif
}
@@ -274,7 +274,7 @@ unsigned int windowsHandler::getThreadId() const
#if VMIME_HAVE_MESSAGING_FEATURES
-ref <vmime::net::socketFactory> windowsHandler::getSocketFactory()
+shared_ptr <vmime::net::socketFactory> windowsHandler::getSocketFactory()
{
return m_socketFactory;
}
@@ -284,13 +284,13 @@ ref <vmime::net::socketFactory> windowsHandler::getSocketFactory()
#if VMIME_HAVE_FILESYSTEM_FEATURES
-ref <vmime::utility::fileSystemFactory> windowsHandler::getFileSystemFactory()
+shared_ptr <vmime::utility::fileSystemFactory> windowsHandler::getFileSystemFactory()
{
return m_fileSysFactory;
}
-ref <vmime::utility::childProcessFactory> windowsHandler::getChildProcessFactory()
+shared_ptr <vmime::utility::childProcessFactory> windowsHandler::getChildProcessFactory()
{
// TODO: Not implemented
return (NULL);
@@ -314,9 +314,9 @@ void windowsHandler::generateRandomBytes(unsigned char* buffer, const unsigned i
}
-ref <utility::sync::criticalSection> windowsHandler::createCriticalSection()
+shared_ptr <utility::sync::criticalSection> windowsHandler::createCriticalSection()
{
- return vmime::create <windowsCriticalSection>();
+ return make_shared <windowsCriticalSection>();
}
diff --git a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/windowsSocket.cpp
index dc932965..502d1067 100644
--- a/src/platforms/windows/windowsSocket.cpp
+++ b/src/platforms/windows/windowsSocket.cpp
@@ -45,7 +45,7 @@ namespace windows {
// windowsSocket
//
-windowsSocket::windowsSocket(ref <vmime::net::timeoutHandler> th)
+windowsSocket::windowsSocket(shared_ptr <vmime::net::timeoutHandler> th)
: m_timeoutHandler(th), m_desc(INVALID_SOCKET), m_status(0)
{
WSAData wsaData;
@@ -438,15 +438,15 @@ void windowsSocket::waitForData(const WaitOpType t, bool& timedOut)
// posixSocketFactory
//
-ref <vmime::net::socket> windowsSocketFactory::create()
+shared_ptr <vmime::net::socket> windowsSocketFactory::create()
{
- ref <vmime::net::timeoutHandler> th = NULL;
- return vmime::create <windowsSocket>(th);
+ shared_ptr <vmime::net::timeoutHandler> th = NULL;
+ return make_shared <windowsSocket>(th);
}
-ref <vmime::net::socket> windowsSocketFactory::create(ref <vmime::net::timeoutHandler> th)
+shared_ptr <vmime::net::socket> windowsSocketFactory::create(shared_ptr <vmime::net::timeoutHandler> th)
{
- return vmime::create <windowsSocket>(th);
+ return make_shared <windowsSocket>(th);
}
} // posix