282 Commits

Author SHA1 Message Date
Takatoshi Kondo
309e96087a - Added unpack limit.
- Added new exceptions to explain limit over errors.

- Fixed ext maximum size problem.
Problem:
The type of m_trail was uint32_t but when parsing ext, it could be 0xffffffff + 1. +1 means type. See https://github.com/msgpack/msgpack/blob/master/spec.md#ext-format-family

Solution:
Modified the type of m_trail as std::size_t. If sizeof(std::size_t) == 4, 0xffffffff size of ext is an error. If sizeof(std::size_t) == 8, 0xffffffff size of ext is not an error. m_trail is 0xffffffff + 1.

Design cohice:
I chose std::size_t as the m_trail's type instead of uint64_t intentionally. On 64 addressing bit environment, there is no problem. On 32 bit environment, there is no problem except ext with maximum size. There is only one exception in the all msgpack format. Using uint64_t to support that, it's very expensive. On 32 addressing bit environment, allocating 0xffffffff + 1 bytes of memory couldn't succeed, so I believe that throwing an exception is a reasonable design choice in the case.
2014-12-14 19:10:46 +09:00
Takatoshi Kondo
8b796dc788 Added zone alignment tests. 2014-12-05 22:08:31 +09:00
Takatoshi Kondo
38a380684e Fixed typos.
The typos have been pointed out by https://github.com/msgpack/msgpack-c/pull/130
Thank you @jpetso !
2014-12-05 17:18:24 +09:00
Takatoshi Kondo
9162610682 Added adaptors for the C++11 version of unordered containers.
(Fixed https://github.com/msgpack/msgpack-c/issues/168)
2014-12-05 15:40:33 +09:00
Takatoshi Kondo
037b1c22dc Fixed https://github.com/msgpack/msgpack-c/issues/144
This fix is ogirinally from https://github.com/msgpack/msgpack-c/pull/133

I removed raw support and added str, bin, and ext support.
2014-11-17 12:51:34 +09:00
Takatoshi Kondo
bcdbf78542 Updated infinity test better way.
Added NaN tests.
2014-11-03 10:03:05 +09:00
Takatoshi Kondo
a4af97b32c Supported dll export for msvc.
Supported tests for msvc.
2014-11-02 20:16:20 +09:00
Takatoshi Kondo
11a2a1b8ec Fixed https://github.com/msgpack/msgpack-c/pull/95 on poc/0.6 branch. 2014-10-21 22:13:53 +09:00
Takatoshi Kondo
1e7fbc0349 Removed wrong tr1:: from unordered containers. 2014-10-12 00:20:54 +09:00
Nobuyuki Kubota
cd03ab62f8 Merge pull request #128 from redboltz/cpp11_unpacked_return
Added additional unpack() APIs to support C++11 style programming.
2014-09-16 10:06:31 -07:00
Takatoshi Kondo
4fcb4777f3 Added additional unpack() APIs to support C++11 style programming. 2014-09-15 22:33:23 +09:00
Takatoshi Kondo
6e810df2a4 Added zero size tuple support. 2014-09-14 20:50:57 +09:00
Takatoshi Kondo
dd4043a616 Removed unused variables. 2014-09-09 14:29:10 +09:00
Takatoshi Kondo
6a8412d6de Separated msgpack_test.cpp.
Renamed test files.
Decreased test's loop counter to avoid travis-ci no output timeout.
The number of loops is not so meaningful.
2014-09-09 14:15:21 +09:00
Thiago de Arruda
896dead7cc Adapt msgpack_test.cpp EXT cases to msgpackc_test.cpp 2014-09-08 12:11:39 -03:00
Takatoshi Kondo
11f1d5fbbd Fixed https://github.com/msgpack/msgpack-c/pull/113
When the original PR was applied, the resource leak had been fixed, but a dual free problem had been happened.

When msgpack_unpacker_next returns MSGPACK_UNPACK_CONTINUE, msgpack_unpacked::zone is not replaced. Then mespack_zone_free is called twice with the same object. msgpack_unpacked_destroy frees msgpack::zone when it is not NULL and set it to NULL.

Also, fixed memory leak (msgpack_sbuffer) on the test code.
2014-09-07 13:56:07 +09:00
Takatoshi Kondo
86ad026f11 Renamed the last digit of version string from RELEASE to REVISION.
Added REVISION macro and getting API.
2014-09-03 13:26:34 +09:00
Takatoshi Kondo
5896ff3746 Fixed -Wextra warnings on gcc. 2014-09-02 18:15:58 +09:00
Takatoshi Kondo
2103c12e05 Added char* packing support. char* is packed to STR similar as std::string.
See https://github.com/msgpack/msgpack-c/issues/110
2014-09-01 22:42:08 +09:00
Takatoshi Kondo
2c2df64427 Fixed C++03 and C++11 conditional tests building problem on cmake. 2014-08-29 00:38:44 +09:00
Takatoshi Kondo
4d6e9d6c05 Removed referenced member from msgpack::unpacked.
Added a referenced parameter to msgpack::unpack() and msgpack::unpacker::next().

msgpack::unpacked is a kind of handler that holds msgpack::object and msgpack::zone, so the size of msgpack::unpacked should be small. There is no reason to have referenced in msgpack::unpacked. msgpack user can get the same information using msgpack::unpack() and msgpack::unpacker::next().
2014-08-11 15:50:51 +09:00
Takatoshi Kondo
f969f6f39c Replaced zone* member variable in object with zone&.
Added msgpack::object::with_zone tests.
Added tuples operator<<'s parameter to const.
Fixed array object::with_zone pointer and size unset problem.
Fixed forward_list object::with_zone pointer and size unset problem.
2014-08-11 13:23:27 +09:00
Takatoshi Kondo
8920c49597 Unified test files extension as cpp. 2014-08-11 09:01:17 +09:00
Takatoshi Kondo
ea23bf843e Added std::forward_list support.
Fixed cmake filename typo.
2014-08-10 23:45:50 +09:00
Takatoshi Kondo
0bc4b3f599 Added the C++11 std::array support.
std::array<char, N> is mapped to BIN. That is the same mannar as std::vector.
2014-08-10 23:06:30 +09:00
Takatoshi Kondo
9a1ccaf155 Merge pull request #100 from redboltz/add_vector_char_as_bin
vector<char> is mapped to BIN
2014-08-10 21:52:02 +09:00
Takatoshi Kondo
0201c21b9a Added minimum copy/reference threshold.
Even if ref_size is given on vrefbuffer's constructor, the minimum size of vrefbuffer::ref_buffer is 10.
Because int64, uint64, and double's msgpack expression size equals 9, and those buffer is allocated on the stack internally.
2014-08-08 14:28:03 +09:00
Takatoshi Kondo
0a99b9f933 Fixed the problem that reference function doesn't pass correctly.
Fixed referenced flag writing timing on next(). It should place before flush.
Added msgpack_tuple test for CMakeLists.txt
Untabified CMakeLists.txt
Added reference function test.
2014-08-07 23:26:09 +09:00
Takatoshi Kondo
1f5d6b9cac Added EXT support.
Removed obsolete unpack functions.
Updated examples that no longer use obsolete functions.
Added reference checking function to unpacked. ( unpacked::referenced() )
Added std:: namespace.
Added reference or copy choice function and default behavior:
  When you use unpacker, default behavior is:
    STR, BIN, EXT types are always held by reference.
  When you don't use unpacker, default behavior is:
    STR, BIN, EXT types are always held by copy.
    The memory is allocated from zone.
  You can customize the behavior passing your custom judging function to unpack() or unpacker's constructor.
2014-08-06 16:18:37 +09:00
Takatoshi Kondo
15a0d61a64 Added the new mapping:
std::vector<char> is mapped to BIN.

So, currently BIN, STR, and ARRAY mappings are as follows:
  std::vector<char> is mapped to BIN
  std::string       is mapped to STR
  std::vector<T>    is mapped to ARRAY // T is not char
2014-08-04 15:14:39 +09:00
Takatoshi Kondo
66014eebc0 Updated test codes using recommended interface.
They used to use obsolete interfaces.
2014-08-04 01:08:05 +09:00
Takatoshi Kondo
fd566afeb4 Added reference version of unpacker::next(). 2014-08-04 00:52:04 +09:00
Takatoshi Kondo
55bf279a7c Removed obsolete unpack interface from test codes. 2014-08-03 08:08:08 +09:00
Takatoshi Kondo
78e8cbdfb5 Cleaned up pointer and reference versions of unpack(). 2014-08-03 07:09:03 +09:00
Takatoshi Kondo
f11a811114 Added a move constructor and a move assign operator for unpacker and context.
https://github.com/msgpack/msgpack-c/issues/96
2014-07-23 21:32:45 +09:00
Takatoshi Kondo
0380215982 Fixed https://github.com/msgpack/msgpack-c/issues/88
Added examples for the following updated functions:

msgpack_unpack_return msgpack_unpacker_next(msgpack_unpacker* mpac, msgpack_unpacked* result);

msgpack_unpack_return
msgpack_unpack_next(msgpack_unpacked* result,
        const char* data, size_t len, size_t* off);
2014-07-13 09:35:58 +09:00
Takatoshi Kondo
b0df21295c Untabified.
Adjust line break positions.
2014-07-12 00:17:31 +09:00
Takatoshi Kondo
212f025f00 Supported the C++11's enum class. 2014-07-08 19:31:02 +09:00
Takatoshi Kondo
f6a5402194 Supported the C++11 tuple. 2014-07-08 19:18:43 +09:00
Takatoshi Kondo
bc33317b7e Reorganized tree. 2014-07-07 16:31:29 +09:00
Takatoshi Kondo
3b7a2f8f32 Updated test codes using reference version of unpack functions. 2014-07-07 16:19:31 +09:00
Takatoshi Kondo
ed51d23335 Refined tuple implementation. 2014-07-07 16:19:31 +09:00
Takatoshi Kondo
beebccd323 Renamed zone::malloc familiy functions. 2014-07-07 16:17:59 +09:00
Takatoshi Kondo
d70c44b723 Added bin and str families support. 2014-07-07 16:17:59 +09:00
Takatoshi Kondo
b6b2ef5e57 Removed the last comma at enum definitions to support C++03 strictly. 2014-07-07 16:17:58 +09:00
Takatoshi Kondo
4ef69da25d Restored the test cases using pointer based interfaces.
It assures that we can use the same interfaces as the original version(0.5.6).
To support both C++03 and C++11, I introduced msgpack::unique_ptr and msgpack::move() in test codes.
2014-07-07 16:17:58 +09:00
Takatoshi Kondo
415b14335f Modified the parameter of object::convert() from pointer to reference. 2014-07-07 16:17:58 +09:00
Takatoshi Kondo
27629a8dd6 Modified 'unpacked' interface using references instead of pointers.
Added speed test for 'unpacked' based unpack() function.
2014-07-07 16:17:58 +09:00
Takatoshi Kondo
bad3801eae Modified zone* to zone&. 2014-07-07 16:17:58 +09:00
Takatoshi Kondo
56b0ad6809 Modified passed by value of object to const reference of object.
Modified object pointers to object references.
This modification has increased unpack speed.
2014-07-07 16:17:58 +09:00