]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/firebird/firebird_store_admins.cpp
Merge remote-tracking branch 'github/master'
[stg.git] / projects / stargazer / plugins / store / firebird / firebird_store_admins.cpp
index a6369acca8480ce424d1ae89898b957b74114c2c..fd00a7e91064704714baa2794cf9e749638823d1 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "firebird_store.h"
 
-#include "stg/ibpp.h"
 #include "stg/admin_conf.h"
 #include "stg/blowfish.h"
 #include "stg/common.h"
@@ -41,7 +40,7 @@
 //-----------------------------------------------------------------------------
 int FIREBIRD_STORE::GetAdminsList(std::vector<std::string> * adminsList) const
 {
-STG_LOCKER lock(&mutex);
+std::lock_guard lock(m_mutex);
 
 IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr);
 IBPP::Statement st = IBPP::StatementFactory(db, tr);
@@ -72,7 +71,7 @@ return 0;
 //-----------------------------------------------------------------------------
 int FIREBIRD_STORE::SaveAdmin(const STG::AdminConf & ac) const
 {
-STG_LOCKER lock(&mutex);
+std::lock_guard lock(m_mutex);
 
 IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr);
 IBPP::Statement st = IBPP::StatementFactory(db, tr);
@@ -130,7 +129,7 @@ return 0;
 //-----------------------------------------------------------------------------
 int FIREBIRD_STORE::RestoreAdmin(STG::AdminConf * ac, const std::string & login) const
 {
-STG_LOCKER lock(&mutex);
+std::lock_guard lock(m_mutex);
 
 IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr);
 IBPP::Statement st = IBPP::StatementFactory(db, tr);
@@ -149,13 +148,13 @@ try
         {
         st->Get(2, ac->login);
         st->Get(3, ac->password);
-        st->Get(4, (int16_t &)ac->priv.userConf);
-        st->Get(5, (int16_t &)ac->priv.userPasswd);
-        st->Get(6, (int16_t &)ac->priv.userStat);
-        st->Get(7, (int16_t &)ac->priv.userCash);
-        st->Get(8, (int16_t &)ac->priv.userAddDel);
-        st->Get(9, (int16_t &)ac->priv.tariffChg);
-        st->Get(10, (int16_t &)ac->priv.adminChg);
+        st->Get(4, reinterpret_cast<int16_t &>(ac->priv.userConf));
+        st->Get(5, reinterpret_cast<int16_t &>(ac->priv.userPasswd));
+        st->Get(6, reinterpret_cast<int16_t &>(ac->priv.userStat));
+        st->Get(7, reinterpret_cast<int16_t &>(ac->priv.userCash));
+        st->Get(8, reinterpret_cast<int16_t &>(ac->priv.userAddDel));
+        st->Get(9, reinterpret_cast<int16_t &>(ac->priv.tariffChg));
+        st->Get(10, reinterpret_cast<int16_t &>(ac->priv.adminChg));
         }
     else
         {
@@ -193,7 +192,7 @@ return 0;
 //-----------------------------------------------------------------------------
 int FIREBIRD_STORE::AddAdmin(const std::string & login) const
 {
-STG_LOCKER lock(&mutex);
+std::lock_guard lock(m_mutex);
 
 IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr);
 IBPP::Statement st = IBPP::StatementFactory(db, tr);
@@ -231,7 +230,7 @@ return 0;
 //-----------------------------------------------------------------------------
 int FIREBIRD_STORE::DelAdmin(const std::string & login) const
 {
-STG_LOCKER lock(&mutex);
+std::lock_guard lock(m_mutex);
 
 IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amWrite, til, tlr);
 IBPP::Statement st = IBPP::StatementFactory(db, tr);