mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-26 17:52:13 +01:00
pcp: make NAT-PMP error codes uint16_t
They are defined as being 16 bits in the RFC and correctly parsed in the code which may result in an implicit conversion from uint16_t to uint8_t.
This commit is contained in:
parent
01906ce912
commit
6fe1c35c05
@ -84,7 +84,7 @@ constexpr uint8_t NATPMP_RESULT_UNSUPP_VERSION = 1;
|
||||
constexpr uint8_t NATPMP_RESULT_NO_RESOURCES = 4;
|
||||
|
||||
//! Mapping of NATPMP result code to string (RFC6886 3.5). Result codes <=2 match PCP.
|
||||
const std::map<uint8_t, std::string> NATPMP_RESULT_STR{
|
||||
const std::map<uint16_t, std::string> NATPMP_RESULT_STR{
|
||||
{0, "SUCCESS"},
|
||||
{1, "UNSUPP_VERSION"},
|
||||
{2, "NOT_AUTHORIZED"},
|
||||
@ -165,7 +165,7 @@ const std::map<uint8_t, std::string> PCP_RESULT_STR{
|
||||
};
|
||||
|
||||
//! Return human-readable string from NATPMP result code.
|
||||
std::string NATPMPResultString(uint8_t result_code)
|
||||
std::string NATPMPResultString(uint16_t result_code)
|
||||
{
|
||||
auto result_i = NATPMP_RESULT_STR.find(result_code);
|
||||
return strprintf("%s (code %d)", result_i == NATPMP_RESULT_STR.end() ? "(unknown)" : result_i->second, result_code);
|
||||
|
Loading…
x
Reference in New Issue
Block a user