From 207df6fc406e81bfeebdff7f404bd242ff3f099f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 7 May 2024 06:48:35 +0200 Subject: Merging upstream version 0.12.2. Signed-off-by: Daniel Baumann --- src/elem_to_json.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/elem_to_json.cc') diff --git a/src/elem_to_json.cc b/src/elem_to_json.cc index 4b04dfb..fc05424 100644 --- a/src/elem_to_json.cc +++ b/src/elem_to_json.cc @@ -27,8 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - #include "elem_to_json.hh" #include "base/itertools.hh" @@ -43,7 +41,11 @@ element_to_json(yajl_gen gen, data_parser& dp, const data_parser::element& elem) switch (elem.value_token()) { case DT_NUMBER: { - yajl_gen_number(gen, value_str, value_len); + auto leading_plus = value_str[0] == '+'; + + yajl_gen_number(gen, + leading_plus ? value_str + 1 : value_str, + leading_plus ? value_len - 1 : value_len); break; } case DNT_GROUP: { @@ -51,6 +53,11 @@ element_to_json(yajl_gen gen, data_parser& dp, const data_parser::element& elem) gen, dp, elem.get_value_elem().e_sub_elements, false); break; } + case DNT_MEASUREMENT: { + elements_to_json( + gen, dp, elem.get_value_elem().e_sub_elements, false); + break; + } case DNT_PAIR: { const data_parser::element& pair_elem = elem.get_pair_elem(); const auto key_str -- cgit v1.2.3