From 7e265b05f440ed81b80f2de496c9d13221a69fe0 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 10 Dec 2013 08:52:51 +0100 Subject: Simplified types for better readability. Use appropriate types (size_t, byte_t...). Minor warning fixes. --- src/platforms/windows/windowsSocket.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/platforms/windows/windowsSocket.cpp') 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 (buffer.data()), buffer.length()); } -void windowsSocket::sendRaw(const char* buffer, const size_type count) +void windowsSocket::send(const char* str) +{ + sendRaw(reinterpret_cast (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; -- cgit v1.2.3