Stupid winsock needs special way to close sockets.
[dftpd.git] / DataBufferListing.cpp
blob9adfbcfa25200dfbd9c500393722bc391c6e7a91
1 #include <string.h>
2 #include "DataBufferListing.hpp"
4 static const char CRLF[] = { 13, 10, 0 };
6 DataBufferListing::DataBufferListing( const std::list<std::string>& list )
7 : m_offset( 0 )
9 for( std::list<std::string>::const_iterator it = list.begin(); it != list.end(); ++it )
11 m_buf += *it + CRLF;
15 DataBufferListing::~DataBufferListing()
19 int DataBufferListing::Read( void* ptr, int size )
21 std::string data = m_buf.substr( m_offset, size );
22 size = data.size();
24 if( size != 0 )
26 strncpy( (char*)ptr, data.c_str(), size );
27 m_offset += size;
30 return size;