]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/mysql/mysql_store.cpp
Shut up compilers
[stg.git] / projects / stargazer / plugins / store / mysql / mysql_store.cpp
index 54e13f864deaebe8eeeca50420f821b3b16d897c..859992e90eaf807b4a8b78a8edc2de245ab0fbaf 100644 (file)
@@ -12,6 +12,7 @@
 #include "stg/user_conf.h"
 #include "stg/user_stat.h"
 #include "stg/blowfish.h"
+#include "stg/plugin_creator.h"
 #include "mysql_store.h"
 
 #define adm_enc_passwd "cjeifY8m3"
@@ -95,32 +96,13 @@ int GetULongLongInt(const string & str, uint64_t * val, uint64_t defaultVal)
     return 0;
 } 
 
-class MYSQL_STORE_CREATOR
-{
-private:
-    MYSQL_STORE * ms;
-
-public:
-    MYSQL_STORE_CREATOR()
-        : ms(new MYSQL_STORE())
-        {
-        };
-    ~MYSQL_STORE_CREATOR()
-        {
-        delete ms;
-        };
-
-    MYSQL_STORE * GetStore()
-        {
-        return ms;
-        };
-} msc;
+PLUGIN_CREATOR<MYSQL_STORE> msc;
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 STORE * GetStore()
 {
-return msc.GetStore();
+return msc.GetPlugin();
 }
 //-----------------------------------------------------------------------------
 MYSQL_STORE_SETTINGS::MYSQL_STORE_SETTINGS()
@@ -1273,6 +1255,10 @@ char password[ADM_PASSWD_LEN + 1];
 char passwordE[2*ADM_PASSWD_LEN + 2];
 BLOWFISH_CTX ctx;
 
+memset(pass, 0, sizeof(pass));
+memset(password, 0, sizeof(password));
+memset(passwordE, 0, sizeof(passwordE));
+
 string p;
 MYSQL_RES *res;
 MYSQL_ROW row;
@@ -1873,8 +1859,8 @@ MYSQL_RES *res;
 MYSQL_ROW row;
 MYSQL * sock;
 
-sprintf(qbuf,"SELECT * FROM messages WHERE login='%s' AND id=%lld LIMIT 1",
-    login.c_str(), id);
+sprintf(qbuf,"SELECT * FROM messages WHERE login='%s' AND id=%llu LIMIT 1",
+        login.c_str(), static_cast<unsigned long long>(id));
     
 if(MysqlGetQuery(qbuf,sock))
 {