From: Maxim Mamontov Date: Fri, 3 Oct 2014 09:46:35 +0000 (+0300) Subject: Removed "using namespace std;" from sgauth. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/154bc708621a9073b7b434fb0591f5795542f843?ds=inline;hp=86927db89773681c7dae5823c03ba9ba23873c41 Removed "using namespace std;" from sgauth. --- diff --git a/projects/sgauth/main.cpp b/projects/sgauth/main.cpp index d0ab3c35..3256ae52 100644 --- a/projects/sgauth/main.cpp +++ b/projects/sgauth/main.cpp @@ -49,8 +49,6 @@ const int winKOI = 0; IA_CLIENT_PROT * clnp; WEB * web = NULL; -using namespace std; - time_t stgTime; //----------------------------------------------------------------------------- @@ -61,13 +59,13 @@ void Usage() printf("sgauth \n"); } //----------------------------------------------------------------------------- -void SetDirName(const vector & dn, void *) +void SetDirName(const std::vector & dn, void *) { for (int j = 0; j < DIR_NUM; j++) { if (winKOI) { - string dir; + std::string dir; KOIToWin(dn[j], &dir); if (web) web->SetDirName(dir, j); @@ -90,13 +88,13 @@ void StatusChanged(int, void *) { } //----------------------------------------------------------------------------- -void ShowMessage(const string & message, int i, int, int, void *) +void ShowMessage(const std::string & message, int i, int, int, void *) { if (web) web->AddMessage(message, i); } //----------------------------------------------------------------------------- -void ShowError(const string & message, int, void *) +void ShowError(const std::string & message, int, void *) { if (web) web->AddMessage(message, 0); @@ -106,20 +104,20 @@ void CatchUSR1(int) { if (clnp->GetAuthorized()) { - cout << "Connect" << endl; + std::cout << "Connect" << std::endl; clnp->Connect(); } } //----------------------------------------------------------------------------- void CatchUSR2(int) { -cout << "Disconnect" << endl; +std::cout << "Disconnect" << std::endl; clnp->Disconnect(); } //----------------------------------------------------------------------------- void CatchTERM(int) { -cout << "Terminated" << endl; +std::cout << "Terminated" << std::endl; clnp->Disconnect(); sleep(2); exit(0); diff --git a/projects/sgauth/web.cpp b/projects/sgauth/web.cpp index 61cd2b58..01660b61 100644 --- a/projects/sgauth/web.cpp +++ b/projects/sgauth/web.cpp @@ -294,7 +294,7 @@ for (j = 0; j < DIR_NUM; j++) { if (dirName[j][0] == 0) continue; - string s; + std::string s; KOIToWin(dirName[j], &s);// +++++++++ sigsegv ========== TODO too long dir name crashes sgauth sprintf(str, " %s\n", rowNum++, s.c_str()); send(outerSocket, str, strlen(str), 0); @@ -388,7 +388,7 @@ if (!messages.empty()) sprintf(str," \n"); send(outerSocket, str, strlen(str), 0); - list::reverse_iterator it; + std::list::reverse_iterator it; it = messages.rbegin(); while (it != messages.rend()) { @@ -433,12 +433,12 @@ send(outerSocket, replyFooter, strlen(replyFooter), 0); return 0; } //--------------------------------------------------------------------------- -void WEB::SetDirName(const string & dn, int n) +void WEB::SetDirName(const std::string & dn, int n) { web->dirName[n] = dn; } //--------------------------------------------------------------------------- -void WEB::AddMessage(const string & message, int type) +void WEB::AddMessage(const std::string & message, int type) { time_t t = time(NULL); STG_MESSAGE m; diff --git a/projects/sgauth/web.h b/projects/sgauth/web.h index aa2227ee..a933230a 100644 --- a/projects/sgauth/web.h +++ b/projects/sgauth/web.h @@ -42,14 +42,12 @@ #include "stg/const.h" #include "stg/ia_packets.h" -using namespace std; - #define MAX_MESSAGES (10) //----------------------------------------------------------------------------- struct STG_MESSAGE { -string msg; -string recvTime; +std::string msg; +std::string recvTime; int type; }; //----------------------------------------------------------------------------- @@ -58,10 +56,10 @@ class WEB public: WEB(); void Run(); - void SetDirName(const string & dn, int n); + void SetDirName(const std::string & dn, int n); void SetRefreshPagePeriod(int p); void SetListenAddr(uint32_t ip); - void AddMessage(const string & message, int type); + void AddMessage(const std::string & message, int type); void UpdateStat(const LOADSTAT & ls); void Start(); private: @@ -76,7 +74,7 @@ private: pthread_t thread; #endif - string dirName[DIR_NUM]; + std::string dirName[DIR_NUM]; int res; int listenSocket; int outerSocket; @@ -85,6 +83,6 @@ private: uint32_t listenWebAddr; LOADSTAT ls; - list messages; + std::list messages; }; //-----------------------------------------------------------------------------