aboutsummaryrefslogtreecommitdiffstats
path: root/src/platforms/windows/windowsSocket.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2013-12-10 07:52:51 +0000
committerVincent Richard <[email protected]>2013-12-10 07:52:51 +0000
commit7e265b05f440ed81b80f2de496c9d13221a69fe0 (patch)
treed4dad210715ea9d60b2136bd416647d4bc02166a /src/platforms/windows/windowsSocket.cpp
parentEnforce strict aliasing rule and avoid alignment issues. (diff)
downloadvmime-7e265b05f440ed81b80f2de496c9d13221a69fe0.tar.gz
vmime-7e265b05f440ed81b80f2de496c9d13221a69fe0.zip
Simplified types for better readability. Use appropriate types (size_t, byte_t...). Minor warning fixes.
Diffstat (limited to 'src/platforms/windows/windowsSocket.cpp')
-rw-r--r--src/platforms/windows/windowsSocket.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/windowsSocket.cpp
index 502d1067..2cad21c0 100644
--- a/src/platforms/windows/windowsSocket.cpp
+++ b/src/platforms/windows/windowsSocket.cpp
@@ -230,7 +230,7 @@ const string windowsSocket::getPeerName() const
}
-windowsSocket::size_type windowsSocket::getBlockSize() const
+size_t windowsSocket::getBlockSize() const
{
return 16384; // 16 KB
}
@@ -238,12 +238,12 @@ windowsSocket::size_type windowsSocket::getBlockSize() const
void windowsSocket::receive(vmime::string& buffer)
{
- const size_type size = receiveRaw(m_buffer, sizeof(m_buffer));
+ const size_t size = receiveRaw(m_buffer, sizeof(m_buffer));
buffer = vmime::string(m_buffer, size);
}
-windowsSocket::size_type windowsSocket::receiveRaw(char* buffer, const size_type count)
+size_t windowsSocket::receiveRaw(char* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
@@ -307,15 +307,21 @@ windowsSocket::size_type windowsSocket::receiveRaw(char* buffer, const size_type
void windowsSocket::send(const vmime::string& buffer)
{
- sendRaw(buffer.data(), buffer.length());
+ sendRaw(reinterpret_cast <const byte_t*>(buffer.data()), buffer.length());
}
-void windowsSocket::sendRaw(const char* buffer, const size_type count)
+void windowsSocket::send(const char* str)
+{
+ sendRaw(reinterpret_cast <const byte_t*>(str), strlen(str));
+}
+
+
+void windowsSocket::sendRaw(const char* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
- size_type size = count;
+ size_t size = count;
while (size > 0)
{
@@ -344,7 +350,7 @@ void windowsSocket::sendRaw(const char* buffer, const size_type count)
}
-windowsSocket::size_type windowsSocket::sendRawNonBlocking(const char* buffer, const size_type count)
+size_t windowsSocket::sendRawNonBlocking(const char* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;