X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/ede91934442fd804d7b818971a44e3ad795cb01f..ae21e8d6ad32d0bf3517127aef5cd8129b7507aa:/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp?ds=sidebyside diff --git a/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp b/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp index e2daa336..7be1af96 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig/parser_tariff.cpp @@ -1,8 +1,8 @@ #include // snprintf #include +#include "stg/tariffs.h" #include "parser.h" -#include "tariffs.h" const int pt_mega = 1024 * 1024; //----------------------------------------------------------------------------- @@ -29,7 +29,7 @@ return -1; //----------------------------------------------------------------------------- void PARSER_GET_TARIFFS::CreateAnswer() { -string s; +std::string s; char vs[100]; int hd, hn, md, mn; @@ -180,13 +180,13 @@ void PARSER_ADD_TARIFF::CreateAnswer() //answerList->clear(); answerList->erase(answerList->begin(), answerList->end()); -if (tariffs->Add(tariffToAdd, *currAdmin) == 0) +if (tariffs->Add(tariffToAdd, currAdmin) == 0) { answerList->push_back(""); } else { - string s; + std::string s; strprintf(&s, "", tariffs->GetStrError().c_str()); answerList->push_back(s); } @@ -222,19 +222,19 @@ answerList->erase(answerList->begin(), answerList->end()); if (users->TariffInUse(tariffToDel)) { - string s; + std::string s; strprintf(&s, "", tariffToDel.c_str()); answerList->push_back(s); return; } -if (tariffs->Del(tariffToDel, *currAdmin) == 0) +if (tariffs->Del(tariffToDel, currAdmin) == 0) { answerList->push_back(""); } else { - string s; + std::string s; strprintf(&s, "", tariffs->GetStrError().c_str()); answerList->push_back(s); } @@ -244,7 +244,7 @@ else // CHG TARIFF //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int PARSER_CHG_TARIFF::ParseSlashedIntParams(int paramsNum, const string & s, int * params) +int PARSER_CHG_TARIFF::ParseSlashedIntParams(int paramsNum, const std::string & s, int * params) { char * str = new char[s.size() + 1]; char * p; @@ -272,7 +272,7 @@ delete[] str; return 0; } //----------------------------------------------------------------------------- -int PARSER_CHG_TARIFF::ParseSlashedDoubleParams(int paramsNum, const string & s, double * params) +int PARSER_CHG_TARIFF::ParseSlashedDoubleParams(int paramsNum, const std::string & s, double * params) { char * str = new char[s.size() + 1]; char * p; @@ -317,7 +317,7 @@ if (depth == 1) } else { - string s; + std::string s; if (strcasecmp(el, "PriceDayA") == 0) { @@ -388,7 +388,10 @@ else snprintf(st, 50, "Time%d", j); if (strcasecmp(el, st) == 0) { - int h1, m1, h2, m2; + int h1 = 0; + int m1 = 0; + int h2 = 0; + int m2 = 0; if (ParseTariffTimeStr(attr[1], h1, m1, h2, m2) == 0) { td.dirPrice[j].hDay = h1; @@ -475,14 +478,14 @@ answerList->erase(answerList->begin(), answerList->end()); if (!td.tariffConf.name.data().empty()) { TARIFF_DATA tariffData = td.GetData(); - if (tariffs->Chg(tariffData, *currAdmin) == 0) + if (tariffs->Chg(tariffData, currAdmin) == 0) { answerList->push_back(""); return; } else { - string s; + std::string s; strprintf(&s, "", tariffs->GetStrError().c_str()); answerList->push_back(s); return;