Skip to content

Commit d403c8a

Browse files
committed
lib: replace Json::Reader by CharReader
In commit gromox-3.1-45-ga15d0275d, rfbl.cpp was switched away from streambuf, but in doing so, started using a deprecated jsoncpp API accidentally. There was a __attribute__((deprecated)) warning, but only until jsoncpp 1.9.5^2~1.
1 parent e4bbdef commit d403c8a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/rfbl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,9 @@ errno_t gx_compress_tofile(std::string_view inbuf, const char *outfile,
14681468

14691469
bool str_to_json(std::string_view sv, Json::Value &jv)
14701470
{
1471-
return Json::Reader().parse(sv.data(), sv.data() + sv.size(), jv);
1471+
using reader_t = decltype(Json::CharReaderBuilder().newCharReader());
1472+
std::unique_ptr<std::remove_pointer_t<reader_t>> rd(Json::CharReaderBuilder().newCharReader());
1473+
return rd->parse(sv.data(), sv.data() + sv.size(), &jv, nullptr);
14721474
}
14731475

14741476
std::string json_to_str(const Json::Value &jv)

0 commit comments

Comments
 (0)