diff options
author | Haibo Huang <hhb@google.com> | 2021-02-25 11:10:04 -0800 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2021-03-01 23:08:49 +0000 |
commit | 684b53807dc9bc2d4778788e55ee91d248123607 (patch) | |
tree | 378641ea890b86625ee878eb8cef9326575fcf8c /thermal | |
parent | 32f3a338abb0dfe42b4f299e45fc363e7eb0cb3b (diff) | |
download | pixel-684b53807dc9bc2d4778788e55ee91d248123607.tar.gz |
[thermal] Use new jsoncpp API
Reader / StyledWriter are deprecated upstream
Bug: 170642246
Change-Id: Ib46040b61ed2701ea4881a0c0a306685a15b51a4
Diffstat (limited to 'thermal')
-rw-r--r-- | thermal/utils/config_parser.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/thermal/utils/config_parser.cpp b/thermal/utils/config_parser.cpp index daba0ee3..79997f79 100644 --- a/thermal/utils/config_parser.cpp +++ b/thermal/utils/config_parser.cpp @@ -68,9 +68,11 @@ std::map<std::string, SensorInfo> ParseSensorInfo(std::string_view config_path) } 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"; return sensors_parsed; } @@ -253,9 +255,11 @@ std::map<std::string, CoolingType> ParseCoolingDevice(std::string_view config_pa } 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"; return cooling_devices_parsed; } |