summaryrefslogtreecommitdiff
path: root/src/SocketBuffer.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-05-22 20:57:33 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-05-22 20:57:33 +0900
commit9d40c47799bbec12bb02f7579736fbc1fcc35c08 (patch)
tree0ef02a9f17d6550667aa745829ff5146b1ccf6a6 /src/SocketBuffer.h
parent9727b5b256bb12cff42e6aa230ba2020a933562f (diff)
parent0b906f40f1204e79cb43af3867468ab02a371075 (diff)
Merge branch 'master' into dynamic-select-file
Diffstat (limited to 'src/SocketBuffer.h')
-rw-r--r--src/SocketBuffer.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/SocketBuffer.h b/src/SocketBuffer.h
index 8d9f3198..5858078f 100644
--- a/src/SocketBuffer.h
+++ b/src/SocketBuffer.h
@@ -40,6 +40,7 @@
#include <string>
#include <deque>
#include <memory>
+#include <vector>
namespace aria2 {
@@ -77,7 +78,7 @@ private:
class ByteArrayBufEntry : public BufEntry {
public:
- ByteArrayBufEntry(unsigned char* bytes, size_t length,
+ ByteArrayBufEntry(std::vector<unsigned char> bytes,
std::unique_ptr<ProgressUpdate> progressUpdate);
virtual ~ByteArrayBufEntry();
virtual ssize_t send(const std::shared_ptr<SocketCore>& socket,
@@ -87,8 +88,7 @@ private:
virtual const unsigned char* getData() const CXX11_OVERRIDE;
private:
- unsigned char* bytes_;
- size_t length_;
+ std::vector<unsigned char> bytes_;
};
class StringBufEntry : public BufEntry {
@@ -123,13 +123,11 @@ public:
SocketBuffer(const SocketBuffer&) = delete;
SocketBuffer& operator=(const SocketBuffer&) = delete;
- // Feeds data pointed by bytes with length len into queue. This
- // object gets ownership of bytes, so caller must not delete or
- // later bytes after this call. This function doesn't send data. If
+ // Feeds |bytes| into queue. This function doesn't send data. If
// progressUpdate is not null, its update() function will be called
// each time the data is sent. It will be deleted by this object. It
// can be null.
- void pushBytes(unsigned char* bytes, size_t len,
+ void pushBytes(std::vector<unsigned char> bytes,
std::unique_ptr<ProgressUpdate> progressUpdate = nullptr);
// Feeds data into queue. This function doesn't send data. If