[bit] Use new jsoncpp API
Reader / StyledWriter are deprecated upstream
Bug: 170642246
Change-Id: Ia2dcd3a817209e6821ecdd7c7f8094ec74bae44a
diff --git a/tools/bit/make.cpp b/tools/bit/make.cpp
index df64a80..c39f494 100644
--- a/tools/bit/make.cpp
+++ b/tools/bit/make.cpp
@@ -89,8 +89,9 @@
}
Json::Value json;
- Json::Reader reader;
- if (!reader.parse(stream, json)) {
+ Json::CharReaderBuilder builder;
+ std::string errorMessage;
+ if (!Json::parseFromStream(builder, stream, &json, &errorMessage)) {
return;
}
@@ -132,8 +133,9 @@
return;
}
- Json::StyledStreamWriter writer(" ");
-
+ Json::StreamWriterBuilder factory;
+ factory["indentation"] = " ";
+ std::unique_ptr<Json::StreamWriter> const writer(factory.newStreamWriter());
Json::Value json(Json::objectValue);
for (map<string,string>::const_iterator it = m_cache.begin(); it != m_cache.end(); it++) {
@@ -141,7 +143,7 @@
}
std::ofstream stream(m_filename, std::ofstream::binary);
- writer.write(stream, json);
+ writer->write(json, &stream);
}
string
@@ -212,8 +214,9 @@
}
Json::Value json;
- Json::Reader reader;
- if (!reader.parse(stream, json)) {
+ Json::CharReaderBuilder builder;
+ std::string errorMessage;
+ if (!Json::parseFromStream(builder, stream, &json, &errorMessage)) {
json_error(filename, "can't parse json format", quiet);
return;
}