102 Commits

Author SHA1 Message Date
Nobuyuki Kubota
cc2ded6338 Merge pull request #236 from redboltz/add_depth_limit2
Added depth limit on unpack.
2015-03-10 21:08:01 +09:00
Takatoshi Kondo
081ee0e99a Added depth limit on unpack. 2015-03-10 20:30:22 +09:00
Nobuyuki Kubota
8eaa2e9e74 Merge pull request #199 from redboltz/fix_issue_198
Fix issue 198
2015-03-10 19:31:09 +09:00
Takatoshi Kondo
eb765d21f2 Fixed MSVC++ warning about int to bool conversion. 2015-03-10 19:04:51 +09:00
Nobuyuki Kubota
c1e9f92d7f Merge branch 'fix_issue_226_author_fixed'
Conflicts:
	include/msgpack/unpack.hpp
2015-03-10 17:21:58 +09:00
Nobuyuki Kubota
582fe38e78 Merge branch 'fix_issue_167' 2015-03-10 16:55:46 +09:00
Nobuyuki Kubota
6443738f66 Add serialization test of non-const char* 2015-03-10 16:54:45 +09:00
Takatoshi Kondo
8ad9ce059b Fixed #226.
Suppressed warnings on MSVC++ 64bit environment.
Added container size limit check.
2015-03-05 07:36:56 +09:00
Takatoshi Kondo
ff86d61799 Replaced auto& with auto const& for msgpack::object.
Replaced auto with auto const& for msgpack::object.
Avoided msgpack::object conversion in EXPECT_EQ.
2015-02-02 15:27:15 +09:00
Mizuki Hirata
97886c50e7 Fixed iterator test case. 2015-02-02 15:27:15 +09:00
Mizuki Hirata
327b0db626 Added versioning namespace and test case to iterator. 2015-02-02 15:27:15 +09:00
Takatoshi Kondo
fa231139d7 Merge pull request #205 from redboltz/fix_issue_204
Fixed #204, #202.
2015-02-01 21:20:31 +09:00
Takatoshi Kondo
c4fb47c00d Fixed #204, #202.
enum support had been incomplete.
This fix made enum support complete.

Replaced int with auto on c++11 scoped enum.
Replaced template specializations with function overloads on operator<< and operator>> for enum.

enum can convert to object with and without zone.

When you want to adapt enum, you need to write as follows:

// NOT msgpack.hpp

enum yourenum {
    elem
};

MSGPACK_ADD_ENUM(yourenum);

// msgpack.hpp should be included after MSGPACK_ADD_ENUM(...)

int main() {
    msgpack::object obj(yourenum::elem);
}
2015-01-31 22:19:31 +09:00
Takatoshi Kondo
70e50d9679 Added unpack function using existing zone.
Removed redundant inline keyword form declarations.
2015-01-30 22:57:27 +09:00
Takatoshi Kondo
64ac09c492 Fixed #198.
Added a conversion support from msgpack::object to std::vector<bool>.
2015-01-25 21:59:39 +09:00
Nobuyuki Kubota
6c59e5195a Merge branch 'fix_issue_191'
Conflicts:
	test/streaming_c.cpp
2015-01-16 21:47:13 +09:00
Takatoshi Kondo
737e6703df Fixed #191.
The names of float format family are changed.

old                      new
dec                   -> f64
MSGPACK_OBJECT_DOUBLE -> MSGPACK_OBJECT_FLOAT
msgpack::type::DOUBLE -> msgpack::type::FLOAT

Client codes could have compile errors when it use dec, MSGPACK_OBJECT_DOUBLE or msgpack::type::DOUBLE.
The best way to fix such errors, update client code. If it can't, set MSGPACK_USE_LEGACY_NAME_AS_FLOAT macro.
Then both old names and new names are available.
2015-01-16 00:20:43 +09:00
Takatoshi Kondo
7f48ddc85e Fixed #190.
Supressed warnings on MSVC.
2015-01-15 20:42:33 +09:00
Nobuyuki Kubota
ce96ca8bfc Merge pull request #175 from redboltz/add_limit
- Added unpack limit.
2015-01-02 12:22:03 -08:00
Nobuyuki Kubota
57732f0c1b Merge pull request #171 from redboltz/fixed_zone_alignment
Fixed zone alignment
2015-01-02 11:37:01 -08:00
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