X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0907aa4037b12b6b88ee24495d4577a064d4f8db..HEAD:/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp diff --git a/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp b/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp index 6a675989..085675c3 100644 --- a/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp +++ b/projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp @@ -30,7 +30,6 @@ #include "stg/tariff_conf.h" #include "stg/common.h" -#include "stg/locker.h" #include #include @@ -49,7 +48,7 @@ const int pt_mega = 1024 * 1024; //----------------------------------------------------------------------------- int POSTGRESQL_STORE::GetTariffsList(std::vector * tariffsList) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -105,7 +104,7 @@ return 0; //----------------------------------------------------------------------------- int POSTGRESQL_STORE::AddTariff(const std::string & name) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -168,7 +167,7 @@ return 0; //----------------------------------------------------------------------------- int POSTGRESQL_STORE::DelTariff(const std::string & name) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -232,7 +231,7 @@ return 0; int POSTGRESQL_STORE::SaveTariff(const STG::TariffData & td, const std::string & tariffName) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -417,7 +416,7 @@ return 0; int POSTGRESQL_STORE::RestoreTariff(STG::TariffData * td, const std::string & tariffName) const { -STG_LOCKER lock(&mutex); +std::lock_guard lock(m_mutex); if (PQstatus(connection) != CONNECTION_OK) { @@ -603,7 +602,7 @@ for (int i = 0; i < std::min(tuples, DIR_NUM); ++i) { td->dirPrice[dir].singlePrice = false; } - if (td->dirPrice[dir].threshold == (int)0xffFFffFF) + if (td->dirPrice[dir].threshold == static_cast(0xffFFffFF)) { td->dirPrice[dir].noDiscount = true; }