This repository has been archived on 2023-08-12. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2016-10-15 09:12:01 -04:00
|
|
|
#include <cstring>
|
2017-10-17 10:29:56 -04:00
|
|
|
#include <nntpchan/buffer.hpp>
|
2016-10-15 09:12:01 -04:00
|
|
|
|
|
|
|
|
namespace nntpchan
|
|
|
|
|
{
|
2017-10-17 10:29:56 -04:00
|
|
|
WriteBuffer::WriteBuffer(const char *b, const size_t s)
|
|
|
|
|
{
|
|
|
|
|
char *buf = new char[s];
|
|
|
|
|
std::memcpy(buf, b, s);
|
|
|
|
|
this->b = uv_buf_init(buf, s);
|
|
|
|
|
w.data = this;
|
2016-10-15 09:12:01 -04:00
|
|
|
}
|
|
|
|
|
|
2017-10-17 10:29:56 -04:00
|
|
|
WriteBuffer::WriteBuffer(const std::string &s) : WriteBuffer(s.c_str(), s.size()) {}
|
|
|
|
|
|
|
|
|
|
WriteBuffer::~WriteBuffer() { delete[] b.base; }
|
|
|
|
|
}
|