Skip to content

Commit

Permalink
ZYZL-12 #comment fix issues scanned by coverity (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
marklion authored May 6, 2021
1 parent 78db903 commit 52ba4c6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions pa_rpc/company_management_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class company_management_handler : virtual public company_managementIf
{
if (opt_user->buyer)
{
statistics_plan = opt_user->get_all_children<pa_sql_plan>("created_by", "create_time >= %d AND create_time <= %d AND status = 4", begin_date, end_date);
statistics_plan = opt_user->get_all_children<pa_sql_plan>("created_by", "create_time >= %ld AND create_time <= %ld AND status = 4", begin_date, end_date);
}
else
{
Expand All @@ -263,7 +263,7 @@ class company_management_handler : virtual public company_managementIf
auto stuffs = company->get_all_children<pa_sql_stuff_info>("belong_company");
for (auto &itr : stuffs)
{
auto plans = itr.get_all_children<pa_sql_plan>("belong_stuff", "create_time >= %d AND create_time <= %d AND status = 4", begin_date, end_date);
auto plans = itr.get_all_children<pa_sql_plan>("belong_stuff", "create_time >= %ld AND create_time <= %ld AND status = 4", begin_date, end_date);
statistics_plan.insert(statistics_plan.begin(), plans.begin(), plans.end());
}
}
Expand Down Expand Up @@ -398,7 +398,7 @@ class company_management_handler : virtual public company_managementIf
{
PA_RETURN_NOCOMPANY_MSG();
}
auto user_need_remove = company->get_children<pa_sql_userinfo>("belong_company", "PRI_ID = %d", user_id);
auto user_need_remove = company->get_children<pa_sql_userinfo>("belong_company", "PRI_ID = %ld", user_id);
if (!user_need_remove)
{
PA_RETURN_MSG("用户不存在");
Expand Down Expand Up @@ -564,7 +564,7 @@ class company_management_handler : virtual public company_managementIf
virtual void del_attachment(const std::string &ssid, const int64_t id)
{
auto company = get_belong_company(ssid);
auto attach = company->get_children<pa_sql_company_attachment>("belong_company", "PRI_ID = %d", id);
auto attach = company->get_children<pa_sql_company_attachment>("belong_company", "PRI_ID = %ld", id);
if (attach)
{
attach->remove_record();
Expand Down
2 changes: 1 addition & 1 deletion pa_rpc/stuff_plan_management_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ class stuff_plan_management_handler : virtual public stuff_plan_managementIf

std::string get_vichele_verify_result(pa_sql_vichele &single_vichele, std::string plan_time_day, int64_t self_plan_id) {
std::string ret;
auto all_related_plan = sqlite_orm::search_record_all<pa_sql_plan>("plan_time LIKE '%s%%' AND status != 5 AND PRI_ID != %d", plan_time_day.c_str(), self_plan_id);
auto all_related_plan = sqlite_orm::search_record_all<pa_sql_plan>("plan_time LIKE '%s%%' AND status != 5 AND PRI_ID != %ld", plan_time_day.c_str(), self_plan_id);
for (auto &itr:all_related_plan)
{
auto all_related_vichele_info = itr.get_all_children<pa_sql_single_vichele>("belong_plan");
Expand Down
8 changes: 4 additions & 4 deletions pa_rpc/user_management_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class user_management_handler : virtual public user_managementIf

if (oJson.KeyExist("errcode"))
{
m_log.err("failed to get openid: %s", oJson("errmsg"));
m_log.err("failed to get openid: %s", oJson("errmsg").c_str());
PA_RETURN_MSG("微信登陆失败");
}
else
Expand Down Expand Up @@ -259,7 +259,7 @@ class user_management_handler : virtual public user_managementIf
}
if (main_vichele)
{
auto vichele = company->get_children<pa_sql_vichele>("belong_company", "PRI_ID = %d", id);
auto vichele = company->get_children<pa_sql_vichele>("belong_company", "PRI_ID = %ld", id);
if (vichele)
{
vichele->is_drop = 1;
Expand All @@ -268,7 +268,7 @@ class user_management_handler : virtual public user_managementIf
}
else
{
auto vichele = company->get_children<pa_sql_vichele_behind>("belong_company", "PRI_ID = %d", id);
auto vichele = company->get_children<pa_sql_vichele_behind>("belong_company", "PRI_ID = %ld", id);
if (vichele)
{
vichele->is_drop = 1;
Expand Down Expand Up @@ -405,7 +405,7 @@ class user_management_handler : virtual public user_managementIf
{
PA_RETURN_NOCOMPANY_MSG();
}
auto driver = company->get_children<pa_sql_driver>("belong_company", "PRI_ID = %d", id);
auto driver = company->get_children<pa_sql_driver>("belong_company", "PRI_ID = %ld", id);
if (driver)
{
driver->is_drop = 1;
Expand Down
6 changes: 3 additions & 3 deletions pa_rpc/wechat_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct acc_tok_from_wx:content_from_wx {

if (oJson.KeyExist("errcode"))
{
g_log.err("failed when req acc_tok:%s", oJson("errmsg"));
g_log.err("failed when req acc_tok:%s", oJson("errmsg").c_str());
}
else
{
Expand All @@ -62,7 +62,7 @@ struct acc_tok_pub_from_wx:content_from_wx {

if (oJson.KeyExist("errcode"))
{
g_log.err("failed when req acc_tok:%s", oJson("errmsg"));
g_log.err("failed when req acc_tok:%s", oJson("errmsg").c_str());
}
else
{
Expand All @@ -82,7 +82,7 @@ struct jsapi_ticket_from_wx:content_from_wx {

if ("0" != oJson("errcode"))
{
g_log.err("failed when req js_ticket:%s", oJson("errmsg"));
g_log.err("failed when req js_ticket:%s", oJson("errmsg").c_str());
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions sqlite_orm/sqlite_orm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ extern bool execute_sql_cmd(const std::string& _sql_cmd, const std::string& _sql
usleep(10000);
if (_count>20)
{
g_log.err("max retry times arrived: %s", _priv);
g_log.err("max retry times arrived: %s", (char *)_priv);
return 0;
}
g_log.log("retry sql :%s for %d times", _priv, _count);
g_log.log("retry sql :%s for %d times", (char *)_priv, _count);
return 1;
}, (void*)(_sql_cmd.c_str()));
char *errmsg = nullptr;
Expand Down
4 changes: 4 additions & 0 deletions tcp_framework/tdf_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ class tdf_listen :public Itdf_io_channel{
ret = true;
}
}
if (ret == false)
{
close(fd);
}
}

return ret;
Expand Down

0 comments on commit 52ba4c6

Please sign in to comment.