summaryrefslogtreecommitdiff
path: root/cpp/unpack.hpp
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731>2009-02-15 09:09:59 +0000
committerfrsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731>2009-02-15 09:09:59 +0000
commit8be25a7f3216007dd3e9561076bd2e7cf3945b90 (patch)
tree71d341a5e1e7c3b5fb9292fa7e56b8a6e9fccee6 /cpp/unpack.hpp
parent33986868162e0c312fd9547e7c05199d684bd07a (diff)
downloadmsgpack-python-8be25a7f3216007dd3e9561076bd2e7cf3945b90.tar.gz
unpacker::unpacker() accepts initial buffer size
git-svn-id: file:///Users/frsyuki/project/msgpack-git/svn/x@82 5a5092ae-2292-43ba-b2d5-dcab9c1a2731
Diffstat (limited to 'cpp/unpack.hpp')
-rw-r--r--cpp/unpack.hpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/cpp/unpack.hpp b/cpp/unpack.hpp
index ffee60d..ac20de3 100644
--- a/cpp/unpack.hpp
+++ b/cpp/unpack.hpp
@@ -23,16 +23,13 @@
#include <memory>
#include <stdexcept>
-#ifndef MSGPACK_UNPACKER_INITIAL_BUFFER_SIZE
-#define MSGPACK_UNPACKER_INITIAL_BUFFER_SIZE 8*1024
+#ifndef MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE
+#define MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE 8*1024
#endif
namespace msgpack {
-static const size_t UNPACKER_INITIAL_BUFFER_SIZE = MSGPACK_UNPACKER_INITIAL_BUFFER_SIZE;
-
-
struct unpack_error : public std::runtime_error {
unpack_error(const std::string& msg) :
std::runtime_error(msg) { }
@@ -41,7 +38,7 @@ struct unpack_error : public std::runtime_error {
class unpacker {
public:
- unpacker();
+ unpacker(size_t initial_buffer_size = MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE);
~unpacker();
public:
@@ -139,6 +136,8 @@ private:
struct context;
context* m_ctx;
+ const size_t m_initial_buffer_size;
+
private:
void expand_buffer(size_t len);