diff --git a/src/test/scriptflags.h b/src/test/scriptflags.h --- a/src/test/scriptflags.h +++ b/src/test/scriptflags.h @@ -7,7 +7,7 @@ #include -unsigned int ParseScriptFlags(std::string strFlags); -std::string FormatScriptFlags(unsigned int flags); +uint32_t ParseScriptFlags(std::string strFlags); +std::string FormatScriptFlags(uint32_t flags); #endif // BITCOIN_TEST_SCRIPTFLAGS_H diff --git a/src/test/scriptflags.cpp b/src/test/scriptflags.cpp --- a/src/test/scriptflags.cpp +++ b/src/test/scriptflags.cpp @@ -13,7 +13,7 @@ #include #include -static std::map mapFlagNames = { +static std::map mapFlagNames = { {"NONE", SCRIPT_VERIFY_NONE}, {"P2SH", SCRIPT_VERIFY_P2SH}, {"STRICTENC", SCRIPT_VERIFY_STRICTENC}, @@ -34,11 +34,12 @@ {"SIGHASH_FORKID", SCRIPT_ENABLE_SIGHASH_FORKID}, }; -unsigned int ParseScriptFlags(std::string strFlags) { +uint32_t ParseScriptFlags(std::string strFlags) { if (strFlags.empty()) { return 0; } - unsigned int flags = 0; + + uint32_t flags = 0; std::vector words; boost::algorithm::split(words, strFlags, boost::algorithm::is_any_of(",")); @@ -51,18 +52,19 @@ return flags; } -std::string FormatScriptFlags(unsigned int flags) { +std::string FormatScriptFlags(uint32_t flags) { if (flags == 0) { return ""; } + std::string ret; - std::map::const_iterator it = - mapFlagNames.begin(); + std::map::const_iterator it = mapFlagNames.begin(); while (it != mapFlagNames.end()) { if (flags & it->second) { ret += it->first + ","; } it++; } + return ret.substr(0, ret.size() - 1); }