summaryrefslogtreecommitdiffstats
path: root/src/elem_to_json.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 04:48:35 +0000
commit207df6fc406e81bfeebdff7f404bd242ff3f099f (patch)
treea1a796b056909dd0a04ffec163db9363a8757808 /src/elem_to_json.cc
parentReleasing progress-linux version 0.11.2-1~progress7.99u1. (diff)
downloadlnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.tar.xz
lnav-207df6fc406e81bfeebdff7f404bd242ff3f099f.zip
Merging upstream version 0.12.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/elem_to_json.cc13
1 files changed, 10 insertions, 3 deletions
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 <algorithm>
-
#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