diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/encryption.cpp | 4 | ||||
-rw-r--r-- | src/utils/logger.cpp | 6 | ||||
-rw-r--r-- | src/utils/sha256.cpp | 2 | ||||
-rw-r--r-- | src/utils/stringfilter.cpp | 10 |
4 files changed, 10 insertions, 12 deletions
diff --git a/src/utils/encryption.cpp b/src/utils/encryption.cpp index 1a7cfb41..9062248f 100644 --- a/src/utils/encryption.cpp +++ b/src/utils/encryption.cpp @@ -46,7 +46,7 @@ static char getRandomCharacter() */ std::string createRandomPassword() { - std::string result = ""; + std::string result; // Ititializing random seed. srand(time(NULL)); @@ -55,9 +55,7 @@ std::string createRandomPassword() int characterNumber = (rand() % 10) + 20; for (int a = 1; a < characterNumber; a++) - { result += getRandomCharacter(); - } return result; } diff --git a/src/utils/logger.cpp b/src/utils/logger.cpp index d3f82418..e5ceb9bc 100644 --- a/src/utils/logger.cpp +++ b/src/utils/logger.cpp @@ -36,7 +36,7 @@ namespace utils /** Log file. */ static std::ofstream mLogFile; /** current log filename */ -std::string Logger::mFilename = ""; +std::string Logger::mFilename; /** Timestamp flag. */ bool Logger::mHasTimestamp = true; /** Tee mode flag. */ @@ -50,13 +50,13 @@ long Logger::mMaxFileSize = 1024; // 1 Mb /** Switch log file each day. */ bool Logger::mSwitchLogEachDay = false; /** Last call date */ -static std::string mLastCallDate = ""; +static std::string mLastCallDate; /** * Old date * For code simplificatiion, the old Date is kept separate * from the last call date. */ -static std::string mOldDate = ""; +static std::string mOldDate; /** * Check whether the day has changed since the last call. diff --git a/src/utils/sha256.cpp b/src/utils/sha256.cpp index ba6a5078..102171e9 100644 --- a/src/utils/sha256.cpp +++ b/src/utils/sha256.cpp @@ -263,7 +263,7 @@ std::string SHA256Hash(const char *src, int len) SHA256Final(&ctx, bytehash); // Convert it to hex const char* hxc = "0123456789abcdef"; - std::string hash = ""; + std::string hash; for (int i = 0; i < SHA256_DIGEST_SIZE; i++) { hash += hxc[bytehash[i] / 16]; diff --git a/src/utils/stringfilter.cpp b/src/utils/stringfilter.cpp index 617da90d..b48d267f 100644 --- a/src/utils/stringfilter.cpp +++ b/src/utils/stringfilter.cpp @@ -43,13 +43,13 @@ bool StringFilter::loadSlangFilterList() { mInitialized = false; - std::string slangsList = Configuration::getValue("SlangsList", ""); - if (slangsList != "") { + const std::string slangsList = Configuration::getValue("SlangsList", + std::string()); + if (!slangsList.empty()) { std::istringstream iss(slangsList); std::string tmp; - while (getline(iss, tmp, ',')) { + while (getline(iss, tmp, ',')) mSlangs.push_back(tmp); - } mInitialized = true; } @@ -59,7 +59,7 @@ bool StringFilter::loadSlangFilterList() void StringFilter::writeSlangFilterList() { // Write the list to config - std::string slangsList = ""; + std::string slangsList; for (SlangIterator i = mSlangs.begin(); i != mSlangs.end(); ) { slangsList += *i; |