X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2Finternal%2Fio%2FTcpSocket_p.cpp;h=d3909326dbd238823cb4bcaa9bf699cbbbc104c2;hb=153d8f44a0ae6aebd0323289d961e5c00ea2b212;hp=619571051b2eb2707d591d63c0b2f83fc7f522c4;hpb=61f4f02a6f27510e96de59dda110f6e5de3236ba;p=bamtools.git diff --git a/src/api/internal/io/TcpSocket_p.cpp b/src/api/internal/io/TcpSocket_p.cpp index 6195710..d390932 100644 --- a/src/api/internal/io/TcpSocket_p.cpp +++ b/src/api/internal/io/TcpSocket_p.cpp @@ -2,7 +2,7 @@ // TcpSocket_p.cpp (c) 2011 Derek Barnett // Marth Lab, Department of Biology, Boston College // --------------------------------------------------------------------------- -// Last modified: 8 December 2011 (DB) +// Last modified: 5 January 2012 (DB) // --------------------------------------------------------------------------- // Provides basic TCP I/O interface // *************************************************************************** @@ -14,6 +14,7 @@ using namespace BamTools; using namespace BamTools::Internal; #include +#include #include #include using namespace std; @@ -26,7 +27,7 @@ namespace BamTools { namespace Internal { // constants -static const size_t DEFAULT_BUFFER_SIZE = 0x4000; +static const size_t DEFAULT_BUFFER_SIZE = 0x10000; } // namespace Internal } // namespace BamTools @@ -42,7 +43,7 @@ TcpSocket::TcpSocket(void) , m_engine(0) , m_cachedSocketDescriptor(-1) , m_readBuffer(DEFAULT_BUFFER_SIZE) - , m_error(TcpSocket::UnknownSocketError) + , m_error(TcpSocket::NoError) , m_state(TcpSocket::UnconnectedState) { } @@ -78,7 +79,7 @@ bool TcpSocket::ConnectImpl(const HostInfo& hostInfo, m_hostName = hostInfo.HostName(); m_mode = mode; m_state = TcpSocket::UnconnectedState; - m_error = TcpSocket::UnknownSocketError; + m_error = TcpSocket::NoError; // m_localPort = 0; m_remotePort = 0; // m_localAddress.Clear(); @@ -313,8 +314,8 @@ string TcpSocket::ReadLine(int64_t max) { // prep result byte buffer ByteArray result; - - size_t bufferMax = ((max > static_cast(string::npos)) ? string::npos : static_cast(max)); + size_t bufferMax = ((max > static_cast(UINT_MAX)) + ? UINT_MAX : static_cast(max)); result.Resize(bufferMax); // read data @@ -322,7 +323,7 @@ string TcpSocket::ReadLine(int64_t max) { if ( result.Size() == 0 ) { if ( bufferMax == 0 ) - bufferMax = string::npos; + bufferMax = UINT_MAX; result.Resize(1);