Skip to content

Commit 295bcef

Browse files
committed
writer-json: remove usage of boost::iostreams::filtering_ostream
... because it's redundant now.
1 parent 03b4f5f commit 295bcef

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

src/lib/writer-json.cc

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include <algorithm>
2828
#include <queue>
2929

30-
#include <boost/iostreams/filtering_stream.hpp>
31-
#include <boost/iostreams/filter/regex.hpp>
3230
#include <boost/json/src.hpp>
3331
#include <boost/lexical_cast.hpp>
3432
#include <boost/nowide/utf/convert.hpp>
@@ -656,31 +654,6 @@ void JsonWriter::handleDef(const Defect &def)
656654

657655
void JsonWriter::flush()
658656
{
659-
boost::iostreams::filtering_ostream str;
660-
661-
// create a regex-based filter to restore integral values wrapped as strings
662-
const RE reInt(": \"([0-9]+)\"(,?)$");
663-
boost::iostreams::basic_regex_filter<char> reFilter(reInt, ": \\1\\2");
664-
str.push(reFilter);
665-
666-
// create a regex-based filter to replace \/ (produced by newer boost) by /
667-
const RE reSlash("([^\\\\]*(?:\\\\\\\\)*)(?:\\\\(/))?");
668-
boost::iostreams::basic_regex_filter<char> reFilterSlash(reSlash, "\\1\\2");
669-
str.push(reFilterSlash);
670-
671-
// create a regex-based filter to replace \u0009 by \t
672-
const RE reTab("\\\\u0009");
673-
boost::iostreams::basic_regex_filter<char> reFilterTab(reTab, "\\\\t");
674-
str.push(reFilterTab);
675-
676-
// regex-based filter to replace "results": "" by "results": [] in SARIF
677-
const RE reEmptyResults("(\"results\": )\"\"$");
678-
boost::iostreams::basic_regex_filter<char>
679-
reFilterEmp(reEmptyResults, "\\1[]");
680-
str.push(reFilterEmp);
681-
682-
str.push(d->str);
683-
684657
// transfer scan properties if available
685658
d->encoder->importScanProps(d->scanProps);
686659

@@ -689,5 +662,5 @@ void JsonWriter::flush()
689662
d->encoder->appendDef(d->defQueue.front());
690663

691664
// finally encode the tree as JSON
692-
d->encoder->writeTo(str);
665+
d->encoder->writeTo(d->str);
693666
}

0 commit comments

Comments
 (0)