Skip to content

Commit f67337a

Browse files
Fix wrong use of ret code enumeration in logs (#145)
* Fix wrong use of ret code enumeration in logs Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com> * Fix comment Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com> --------- Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
1 parent ecfc750 commit f67337a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

cpp_utils/include/cpp_utils/ReturnCode.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ class ReturnCode
8181

8282
protected:
8383

84-
//! Link every ReturnCode available with a string to deserialize
85-
static const std::map<ReturnCode, std::string> to_string_conversion_;
84+
//! Link every ReturnCodeValue available with a string to deserialize
85+
static const std::map<ReturnCodeValue, std::string> to_string_conversion_;
8686

8787
//! \c ReturnCode value
8888
std::uint32_t value_;

cpp_utils/src/cpp/ReturnCode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ bool ReturnCode::operator !() const noexcept
8989
return value_ != ReturnCode::RETCODE_OK;
9090
}
9191

92-
const std::map<ReturnCode, std::string> ReturnCode::to_string_conversion_ =
92+
const std::map<ReturnCode::ReturnCodeValue, std::string> ReturnCode::to_string_conversion_ =
9393
{
9494
{ReturnCode::RETCODE_OK, "Ok"},
9595
{ReturnCode::RETCODE_ERROR, "Error"},
@@ -103,7 +103,7 @@ std::ostream& operator <<(
103103
std::ostream& os,
104104
const ReturnCode& code)
105105
{
106-
auto it = ReturnCode::to_string_conversion_.find(code);
106+
auto it = ReturnCode::to_string_conversion_.find(static_cast<ReturnCode::ReturnCodeValue>((code())));
107107
assert(it != ReturnCode::to_string_conversion_.end());
108108
os << "{" << it->second << "}";
109109
return os;

0 commit comments

Comments
 (0)