summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2021-02-25 10:44:18 -0800
committerHaibo Huang <hhb@google.com>2021-03-03 22:17:10 +0000
commit39f4db5ea0e87eba9ab055be299b4fa0033e2000 (patch)
tree3c9fbdab8e9e3c31f85d5d54ead10b72397c5066 /tools
parentbb57bf925ab366774736cf0c8002bfcc3a1d678d (diff)
[bit] Use new jsoncpp API
Reader / StyledWriter are deprecated upstream Bug: 170642246 Change-Id: Ia2dcd3a817209e6821ecdd7c7f8094ec74bae44a
Diffstat (limited to 'tools')
-rw-r--r--tools/bit/make.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/bit/make.cpp b/tools/bit/make.cpp
index df64a801e213..c39f49465054 100644
--- a/tools/bit/make.cpp
+++ b/tools/bit/make.cpp
@@ -89,8 +89,9 @@ BuildVars::BuildVars(const string& outDir, const string& buildProduct,
}
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 @@ BuildVars::save()
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 @@ BuildVars::save()
}
std::ofstream stream(m_filename, std::ofstream::binary);
- writer.write(stream, json);
+ writer->write(json, &stream);
}
string
@@ -212,8 +214,9 @@ read_modules(const string& buildOut, const string& device, map<string,Module>* r
}
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;
}