Skip to content

Commit

Permalink
Cleanup API for JSON, map() --> asObject() etc
Browse files Browse the repository at this point in the history
- .map() --> .asObject()
- .array() --> .asArray()

Required by changes in JSON API

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
  • Loading branch information
cvigue committed Jan 23, 2024
1 parent 1824aae commit b06252b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions openvpn/options/servpush.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ServerPushList : public std::vector<std::string>
void parse(const std::string &title, const Json::Value &push_list) // push_list is JSON array
{
reserve(16); // arbitrary, just a guess
const auto &ja = json::cast_array(push_list, false, title).array();
const auto &ja = json::cast_array(push_list, false, title).asArray();
for (size_t i = 0; i < ja.size(); ++i)
{
const Json::Value &jv = ja[i];
Expand All @@ -77,7 +77,7 @@ class ServerPushList : public std::vector<std::string>
push_back(ji.asStringRef());
else if (ji.isArray())
{
const auto &ia = ji.array();
const auto &ia = ji.asArray();
for (size_t j = 0; j < ia.size(); ++j)
{
const Json::Value &iv = ia[j];
Expand Down
2 changes: 1 addition & 1 deletion openvpn/ssl/peerinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct Set : public std::vector<KeyValue>, public RCCopyable<thread_unsafe_refco
{
if (!src.isObject())
OPENVPN_THROW(peer_info_error, title << ": top level JSON object must be a dictionary");
auto m = src.map();
auto m = src.asObject();
for (auto &e : m)
{
if (e.second.isString())
Expand Down

0 comments on commit b06252b

Please sign in to comment.