]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/parser_users.h
Various fixes of issues reported by static analyzers.
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / parser_users.h
index 4d03b7e8042219accd812290712125381f03ceac..cbf2591555b150b313af851a0b7e98a73824a19f 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "stg/user_conf.h"
 #include "stg/user_stat.h"
+#include "stg/common.h"
 #include "stg/resetable.h"
 
 #include <string>
@@ -47,10 +48,10 @@ class GET_USERS: public BASE_PARSER
         class FACTORY : public BASE_PARSER::FACTORY
         {
             public:
-                FACTORY(USERS & users) : m_users(users) {}
+                explicit FACTORY(USERS & users) : m_users(users) {}
                 virtual BASE_PARSER * create(const ADMIN & admin) { return new GET_USERS(admin, m_users); }
                 static void Register(REGISTRY & registry, USERS & users)
-                { registry[tag] = new FACTORY(users); }
+                { registry[ToLower(tag)] = new FACTORY(users); }
             private:
                 USERS & m_users;
         };
@@ -75,10 +76,10 @@ class GET_USER: public BASE_PARSER
         class FACTORY : public BASE_PARSER::FACTORY
         {
             public:
-                FACTORY(const USERS & users) : m_users(users) {}
+                explicit FACTORY(const USERS & users) : m_users(users) {}
                 virtual BASE_PARSER * create(const ADMIN & admin) { return new GET_USER(admin, m_users); }
                 static void Register(REGISTRY & registry, const USERS & users)
-                { registry[tag] = new FACTORY(users); }
+                { registry[ToLower(tag)] = new FACTORY(users); }
             private:
                 const USERS & m_users;
         };
@@ -102,10 +103,10 @@ class ADD_USER: public BASE_PARSER
         class FACTORY : public BASE_PARSER::FACTORY
         {
             public:
-                FACTORY(USERS & users) : m_users(users) {}
+                explicit FACTORY(USERS & users) : m_users(users) {}
                 virtual BASE_PARSER * create(const ADMIN & admin) { return new ADD_USER(admin, m_users); }
                 static void Register(REGISTRY & registry, USERS & users)
-                { registry[tag] = new FACTORY(users); }
+                { registry[ToLower(tag)] = new FACTORY(users); }
             private:
                 USERS & m_users;
         };
@@ -134,7 +135,7 @@ class CHG_USER: public BASE_PARSER
                 {}
                 virtual BASE_PARSER * create(const ADMIN & admin) { return new CHG_USER(admin, m_users, m_store, m_tariffs); }
                 static void Register(REGISTRY & registry, USERS & users, STORE & store, const TARIFFS & tariffs)
-                { registry[tag] = new FACTORY(users, store, tariffs); }
+                { registry[ToLower(tag)] = new FACTORY(users, store, tariffs); }
             private:
                 USERS & m_users;
                 STORE & m_store;
@@ -149,8 +150,7 @@ class CHG_USER: public BASE_PARSER
               m_users(users),
               m_store(store),
               m_tariffs(tariffs),
-              m_cashMustBeAdded(false),
-              m_res(0) {}
+              m_cashMustBeAdded(false) {}
 
         int Start(void * data, const char * el, const char ** attr);
 
@@ -165,7 +165,6 @@ class CHG_USER: public BASE_PARSER
         std::string m_cashMsg;
         std::string m_login;
         bool m_cashMustBeAdded;
-        int m_res;
 
         int ApplyChanges();
         void CreateAnswer();
@@ -177,10 +176,10 @@ class DEL_USER: public BASE_PARSER
         class FACTORY : public BASE_PARSER::FACTORY
         {
             public:
-                FACTORY(USERS & users) : m_users(users) {}
+                explicit FACTORY(USERS & users) : m_users(users) {}
                 virtual BASE_PARSER * create(const ADMIN & admin) { return new DEL_USER(admin, m_users); }
                 static void Register(REGISTRY & registry, USERS & users)
-                { registry[tag] = new FACTORY(users); }
+                { registry[ToLower(tag)] = new FACTORY(users); }
             private:
                 USERS & m_users;
         };
@@ -206,10 +205,10 @@ class CHECK_USER: public BASE_PARSER
         class FACTORY : public BASE_PARSER::FACTORY
         {
             public:
-                FACTORY(const USERS & users) : m_users(users) {}
+                explicit FACTORY(const USERS & users) : m_users(users) {}
                 virtual BASE_PARSER * create(const ADMIN & admin) { return new CHECK_USER(admin, m_users); }
                 static void Register(REGISTRY & registry, const USERS & users)
-                { registry[tag] = new FACTORY(users); }
+                { registry[ToLower(tag)] = new FACTORY(users); }
             private:
                 const USERS & m_users;
         };