From b2c7484255db2743cf0add2dc38de171d6efeff6 Mon Sep 17 00:00:00 2001 From: dimxy Date: Mon, 22 Apr 2019 13:47:35 +0500 Subject: [PATCH] param to lower case --- src/cc/CCinclude.h | 1 + src/wallet/rpcwallet.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index db1ee7475..21c987248 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -298,6 +298,7 @@ UniValue ValueFromAmount(const CAmount& amount); int64_t TotalPubkeyNormalInputs(const CTransaction &tx, const CPubKey &pubkey); int64_t TotalPubkeyCCInputs(const CTransaction &tx, const CPubKey &pubkey); +inline std::string STR_TOLOWER(const std::string &str) { std::string out; for (std::string::const_iterator i = str.begin(); i != str.end(); i++) out += std::tolower(*i); return out; } // bitcoin LogPrintStr with category "-debug" cmdarg support for C++ ostringstream: #define CCLOG_INFO 0 diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 01b3d72fb..4ac8c5f4e 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -6922,11 +6922,11 @@ UniValue faucetget(const UniValue& params, bool fHelp) uint32_t pricesGetParam(UniValue param) { uint32_t filter = 0; - if (strcmpi(param.get_str().c_str(), "all") == 0) + if (STR_TOLOWER(param.get_str()) == "all") filter = 0; - if (strcmpi(param.get_str().c_str(), "open") == 0) + if (STR_TOLOWER(param.get_str()) == "open") filter = 1; - if (strcmpi(param.get_str().c_str(), "closed") == 0) + if (STR_TOLOWER(param.get_str()) == "closed") filter = 2; else throw runtime_error("incorrect parameter\n");