194 Commits

Author SHA1 Message Date
Takatoshi Kondo
5ece2ef2c7 Fixed #637.
<<< Breaking change >>>
In the functions unpack() and parse(),
Old behavior: If any parse error is happend, offset is NOT updated.
New behavior: If any parse error is happend, offset is updated to the
position the error happened.

It helps MessagePack format error analysis.

If you want to old behavior, copy the original value of offset and then call unpack()
and/or parse().
2017-10-22 18:22:41 +09:00
Stefan Herbrechtsmeier
004939e732 Pass wildcard precision of snprintf as int
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
2017-03-22 13:05:47 +01:00
Takatoshi Kondo
a933fa5892 Merge pull request #557 from obache/neatsrc/fix-char-subscripts-warnings
Make sure to pass `unsigned char` to `isprint()`
2017-01-13 14:15:15 +09:00
OBATA Akio
c955727d8c Make sure to pass unsigned char to isprint()
This change make safe for `char = signed char`.

As the spec, argment of `isprintf()` must be representabe as an
`unsigned char` (or equal to EOF, not expected here).
Additionally, some implementation define it as a macro using array,
then it cause warning "array subscript has type `char` [-Wchar-subscripts]"
with `char` argments.
2017-01-12 15:01:04 +09:00
OBATA Akio
094b70213a Strip unwanted CR before EOL 2017-01-12 14:35:51 +09:00
Takatoshi Kondo
364fc0daf6 Fixed redundant caluclation. 2016-12-14 10:02:49 +09:00
Takatoshi Kondo
9a113bb0ca Fixed C unpack return code. 2016-12-14 00:07:43 +09:00
Takatoshi Kondo
c5c3de8f61 Fixed integer overflow and EXT size problem. 2016-12-13 15:47:20 +09:00
Takatoshi Kondo
ccc9ac5538 Fixed #521.
Introduced new object type `FLOAT32` and `FLOAT64`.
`FLOAT64` is equivalent to `FLOAT`.
The both internal expressions are f64(double).
2016-10-11 23:23:06 +09:00
Eduardo Silva
b90bcf3c11 unpack: unpacker_next_with_size() update parsed bytes on success or continue
This patch makes unpacker_next_with_size(...), update p_bytes when
unpacker_next() returns MSGPACK_UNPACK_SUCCESS or MSGPACK_UNPACK_CONTINUE.

Signed-off-by: Eduardo Silva <eduardo@treasure-data.com>
2016-09-06 10:46:30 -06:00
Eduardo Silva
d9a77e220a unpack: new msgpack_unpacker_next_with_size() function
This new function is an extension of the original msgpack_unpacker_next()
where it now adds third argument to store the number of parsed bytes for
the returned buffer upon a MSGPACK_UNPACK_SUCCESS case.

This is useful for cases where the caller needs to optimize memory usage
in the original buffer,s so upon success retrieval of the object, it can
later deprecate the already 'parsed' bytes.

For more details about the origins of this function please refer to the
following issue on github:

  https://github.com/msgpack/msgpack-c/issues/514

Signed-off-by: Eduardo Silva <eduardo@treasure-data.com>
2016-08-31 16:49:14 -06:00
Stefan Mititelu
c73d9a9dab Print unprintable characters in memory buffer 2016-07-19 12:17:38 +00:00
Takatoshi Kondo
48abfe7aa1 Adusted coding style. 2016-07-16 10:25:38 +09:00
Takatoshi Kondo
8105c33f9d Merge branch 'bin-printer' of https://github.com/iphydf/msgpack-c into iphydf-bin-printer 2016-07-16 10:19:40 +09:00
Takatoshi Kondo
b9bc9d4195 Replaced uint32_t with size_t.
User buffer size is not limited by msgpack-c so size_t is the
appropriate type.
2016-07-16 09:32:19 +09:00
iphydf
1da0539a00
Improve bin/ext printer for unprintable characters.
msgpack_object_print used fwrite to write binary data to a stream. The intention
of the function is to produce a human-readable representation of the object for
debugging purposes. Having arbitrary data dumped as is can cause issues with
terminals that interpret it as control sequences.

This change prints printable characters as is and unprintable characters as
hex-escapes ("\xNN"). Note that UTF-8 encoded characters will now be printed as
escaped sequence of UTF-8 bytes. This is an acceptable compromise, as doing
otherwise would require a light form of UTF-8 decoding and BIN-typed objects
should not be used to transport UTF-8 strings anyway (STR should be used
instead).
2016-07-12 13:31:05 +02:00
Stefan Mititelu
4fa661a63d Add msgpack_object_print_buffer() function
In order to print the msgpack object in a memory buffer.
2016-07-07 22:43:48 +03:00
Takatoshi Kondo
4ee616bbde Removed autotools and msvc files.
Please use cmake.
2016-06-05 21:54:59 +09:00
Takatoshi Kondo
89faf6ee9f Updated boost predef and preprocessor from 1.58.0 to 1.61.0 2016-05-30 13:20:58 +09:00
Takatoshi Kondo
b68c073d1b Moved gcc_atomic.hpp location. 2016-05-30 09:55:16 +09:00
Takatoshi Kondo
7094e0872e Added msgpack-c library file generation.
When you add or remove .h .hpp .c files in the msgpack-c library, run
make_file_list.sh. It generates (overwrites) Files.cmake for cmake and
src/files.mk for autotools. They are a part of repository managed
files. Files.cmake is included by CMakeLists.txt and src/files.mk is
included by src/Makefile.am.
2016-05-29 21:09:03 +09:00
Takatoshi Kondo
cc02da0ccf Fixed #465
Added C-Style array support.

Existing mapping:
  convert:
  pack:
    char[N]       => STR
    const char[N] => STR
  object:
    char[N]       => STR (v1 only)
    const char[N] => STR (v1 only)
  object_with_zone:
    char[N]       => STR
    const char[N] => STR

Additional mapping:

  convert:
    STR        => char[N]
    ARRAY      => T[N]
  pack:
    T[N]       => ARRAY
    const T[N] => ARRAY
  object:
  object_with_zone:
    T[N]       => ARRAY
    const T[N] => ARRAY
2016-05-16 23:00:30 +09:00
Takatoshi Kondo
db90ee4283 Removed obsolete unpack() API. 2016-03-26 11:46:45 +09:00
Takatoshi Kondo
31a06a0682 Removed obsolete APIs form v2.
Removed MSGPACK_DISABLE_LEGACY_CONVERT from v2. Those APIs are removed
from v2.
2016-03-25 09:16:27 +09:00
Takatoshi Kondo
f88e621dca Fixed zone expansion algorithm.
See:
https://github.com/msgpack/msgpack-c/pull/160#commitcomment-16087596
2016-02-16 12:18:38 +09:00
Takatoshi Kondo
54cb4350b3 Re-organized tree to prepare for version 2.0.0.
See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_versioning
2016-01-31 19:28:31 +09:00
Takatoshi Kondo
c06d4d70ef Fixed #395
libmsgpack.[a|so] is the library file for C++.
libmsgpackc.[a|so] is the library file for C.
Since version 1.0.0, the C++ parts of msgpack-c is a header only
library. So libmsgpack.* shouldn't be generated.

On the autotools building environment, removed libmsgpack.*
generation. On the cmake building environment, replaced libmsgpack.*
with libmsgpackc.* and set so-version to 2.0.0.
2016-01-14 07:59:37 +09:00
Takatoshi Kondo
ba15089d86 Version 1.3.0.
Updated the license from the license from the Apache License Version 2.0
to the Boost Software License, Version 1.0.
Removed unused files.
2015-11-21 12:41:46 +09:00
Takatoshi Kondo
428780db53 Added std::reference_wrapper packing and making object and object_with_zone support.
Fixed #370.
2015-10-09 15:45:29 +09:00
Nobuyuki Kubota
2b38389f68 Add missing files to Makefile.am 2015-09-04 19:18:23 +09:00
Nobuyuki Kubota
93142323f0 Merge pull request #349 from redboltz/variant
Variant
2015-09-04 18:42:47 +09:00
Nobuyuki Kubota
3352b2f029 Merge pull request #359 from redboltz/fix_243
Fixed #243.
2015-09-04 18:34:19 +09:00
Takatoshi Kondo
d640395765 Fixed 'make dist'. 2015-09-04 15:42:13 +09:00
Takatoshi Kondo
96f145812f Fixed #243.
std::vector<unsigned char> and std::array<unsigned char> are mapped to BIN.
std::vector<uint8_t> and std::array<uint8_t> are mapped to BIN if uint8_t is the same type of unsigned char, otherwise mapped to ARRAY.

Added array_ref. When client wraps BIN mapped types above with array_ref as msgpack::type::array_ref<std::vector<char> >, the type is mapped to ARRAY.
2015-08-31 14:06:39 +09:00
Takatoshi Kondo
92822996e2 Fixed #348.
The parameter 'offset' of unpack() function family, not unpacker family, updates only when the function successfully finished.

The parameter 'offset' used to update even if a caller passes insufficient bytes to the unpack() function family.
2015-08-19 10:52:08 +09:00
Takatoshi Kondo
cd9d6c5940 Added msgpack::type::variant and msgpack::type::variant_ref that is based on boost::variant.
You can convert to those types from any msgpack objects.
2015-08-18 17:47:27 +09:00
Takatoshi Kondo
5adea26044 Added install files. 2015-08-11 19:58:54 +09:00
Nobuyuki Kubota
41bff7b96d Merge branch 'add_boost_predef' 2015-08-10 11:30:29 -07:00
Takatoshi Kondo
db588909b9 Added std::shared_ptr and std::unique_ptr adaptors. 2015-07-31 12:39:11 +09:00
Takatoshi Kondo
a746afa7cc Added 'as' support for containers. 2015-07-30 16:18:20 +09:00
Takatoshi Kondo
756d02f8c0 Added Boost.Predef to check environment such as endian.
https://github.com/boostorg/predef.git has been added as a submodule on
external/boost/predef.

In order to avoid macro name conflicts, replaced "BOOST_" with "MSGPACK_"
and "boost/" with "msgpack/" then copy replaced files to include/msgpack.
This process is described in CMakeLists.txt.
Replaced files are included as a part of msgpack-c. So you don't need to
do the converting process each time.

Fixed endian checking logic.
2015-07-08 16:38:12 +09:00
Takatoshi Kondo
188c0a9a6b Merge branch 'add_define_map' of https://github.com/redboltz/msgpack-c into redboltz-add_define_map 2015-07-06 14:18:21 +09:00
Takatoshi Kondo
9b655faa64 Merge branch 'add_ext_ref' of https://github.com/redboltz/msgpack-c into redboltz-add_ext_ref 2015-07-05 20:04:30 +09:00
Takatoshi Kondo
a37e7232c7 Merge pull request #305 from redboltz/add_boost_fusion
Added Boost.Fusion support.
2015-07-05 10:34:06 +09:00
Takatoshi Kondo
777e5f13f3 Added map-based class pack/convert support. 2015-07-05 09:23:43 +09:00
Takatoshi Kondo
57ba93a2b2 Added Boost.Fusion support.
Fusion sequences can be serialized.
2015-07-01 15:07:45 +09:00
Takatoshi Kondo
34a42415be Added v4(old) raw packing support. 2015-06-30 15:11:51 +09:00
Takatoshi Kondo
ff14be8fdb Added EXT type supporting classes. 2015-05-27 13:12:26 +09:00
Takatoshi Kondo
70fbae3c5f Added Boost.StringRef support. 2015-05-02 11:02:57 +09:00
Nobuyuki Kubota
cb9114e31c Merge pull request #268 from redboltz/support_boost
Added the Boost.Optional adaptor.
2015-04-19 18:45:08 -07:00