[thermal] Use new jsoncpp API

Reader / StyledWriter are deprecated upstream

Bug: 170642246
Change-Id: Ib46040b61ed2701ea4881a0c0a306685a15b51a4
tirimbino
Haibo Huang 4 years ago committed by Tim Zimmermann
parent a17ddacd50
commit 5a7577b20c
No known key found for this signature in database
GPG Key ID: 6DC21A63F819C5EF
  1. 12
      hidl/thermal/utils/config_parser.cpp

@ -68,9 +68,11 @@ std::map<std::string, SensorInfo> ParseSensorInfo(std::string_view config_path)
} }
Json::Value root; Json::Value root;
Json::Reader reader; Json::CharReaderBuilder builder;
std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
std::string errorMessage;
if (!reader.parse(json_doc, root)) { if (!reader->parse(&*json_doc.begin(), &*json_doc.end(), &root, &errorMessage)) {
LOG(ERROR) << "Failed to parse JSON config"; LOG(ERROR) << "Failed to parse JSON config";
return sensors_parsed; return sensors_parsed;
} }
@ -243,9 +245,11 @@ std::map<std::string, CoolingType> ParseCoolingDevice(std::string_view config_pa
} }
Json::Value root; Json::Value root;
Json::Reader reader; Json::CharReaderBuilder builder;
std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
std::string errorMessage;
if (!reader.parse(json_doc, root)) { if (!reader->parse(&*json_doc.begin(), &*json_doc.end(), &root, &errorMessage)) {
LOG(ERROR) << "Failed to parse JSON config"; LOG(ERROR) << "Failed to parse JSON config";
return cooling_devices_parsed; return cooling_devices_parsed;
} }

Loading…
Cancel
Save