Skip to content

Commit 94cef49

Browse files
committed
json-writer: fix encoding of int values in the JSON output
The original fix worked only for lines ending with ','.
1 parent fda9523 commit 94cef49

26 files changed

+8619
-8619
lines changed

src/json-writer.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ void JsonWriter::flush()
168168
boost::iostreams::filtering_ostream str;
169169

170170
// create a regex-based filter to restore integral values wrapped as strings
171-
const RE reInt(": \"([0-9]+)\",$");
172-
boost::iostreams::basic_regex_filter<char> reFilter(reInt, ": \\1,");
171+
const RE reInt(": \"([0-9]+)\"(,?)$");
172+
boost::iostreams::basic_regex_filter<char> reFilter(reInt, ": \\1\\2");
173173
str.push(reFilter);
174174

175175
// create a regex-based filter to replace \/ (produced by newer boost) by /

tests/csgrep/10-err-file-comments-stdout.txt

Lines changed: 137 additions & 137 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)