From: Haibo Huang Date: Thu, 25 Feb 2021 19:10:04 +0000 (-0800) Subject: [thermal] Use new jsoncpp API X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5a7577b20cc4a1550650d48afa5763fccd89a4e2;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung.git [thermal] Use new jsoncpp API Reader / StyledWriter are deprecated upstream Bug: 170642246 Change-Id: Ib46040b61ed2701ea4881a0c0a306685a15b51a4 --- diff --git a/hidl/thermal/utils/config_parser.cpp b/hidl/thermal/utils/config_parser.cpp index d74fd49..3933d9f 100644 --- a/hidl/thermal/utils/config_parser.cpp +++ b/hidl/thermal/utils/config_parser.cpp @@ -68,9 +68,11 @@ std::map ParseSensorInfo(std::string_view config_path) } Json::Value root; - Json::Reader reader; + Json::CharReaderBuilder builder; + std::unique_ptr 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"; return sensors_parsed; } @@ -243,9 +245,11 @@ std::map ParseCoolingDevice(std::string_view config_pa } Json::Value root; - Json::Reader reader; + Json::CharReaderBuilder builder; + std::unique_ptr 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"; return cooling_devices_parsed; }