Skip to content

Commit

Permalink
use Json::Value::nullSingleton() instead of Json::Value::null
Browse files Browse the repository at this point in the history
  • Loading branch information
lkpworkspace committed Oct 24, 2023
1 parent a3399cc commit 7fa40b2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion myframe/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class MYFRAME_EXPORT Actor {
std::string mod_name_;
std::string actor_name_;
std::string instance_name_;
Json::Value config_{ Json::Value::null };
Json::Value config_;
std::weak_ptr<ActorContext> ctx_;

DISALLOW_COPY_AND_ASSIGN(Actor)
Expand Down
6 changes: 3 additions & 3 deletions myframe/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ class MYFRAME_EXPORT App final : public std::enable_shared_from_this<App> {
const std::string& inst_name,
const std::string& params,
std::shared_ptr<Actor> actor,
const Json::Value& config = Json::Value::null);
const Json::Value& config = Json::Value::nullSingleton());

bool AddWorker(
const std::string& inst_name,
std::shared_ptr<Worker> worker,
const Json::Value& config = Json::Value::null);
const Json::Value& config = Json::Value::nullSingleton());

int Send(
const std::string& dst,
Expand All @@ -88,7 +88,7 @@ class MYFRAME_EXPORT App final : public std::enable_shared_from_this<App> {
const std::string& actor_name,
const std::string& inst_name,
const std::string& params,
const Json::Value& config = Json::Value::null);
const Json::Value& config);
bool CreateActorContext(
std::shared_ptr<Actor> inst,
const std::string& params);
Expand Down
4 changes: 2 additions & 2 deletions myframe/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ std::vector<stdfs::path> Common::GetDirFiles(const std::string& conf_path) {
Json::Value Common::LoadJsonFromFile(const std::string& json_file) {
std::ifstream ifs(json_file);
if (!ifs.is_open()) {
return Json::Value::null;
return Json::Value::nullSingleton();
}
Json::Value root;
Json::Reader reader(Json::Features::strictMode());
if (!reader.parse(ifs, root)) {
ifs.close();
return Json::Value::null;
return Json::Value::nullSingleton();
}
ifs.close();
return root;
Expand Down
2 changes: 1 addition & 1 deletion myframe/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class MYFRAME_EXPORT Worker {
std::string mod_name_;
std::string worker_name_;
std::string inst_name_;
Json::Value config_{ Json::Value::null };
Json::Value config_;

std::weak_ptr<WorkerContext> ctx_;

Expand Down

0 comments on commit 7fa40b2

Please sign in to comment.