From 9c74b349ca5f30c8c005d28379b04682332b9d4d Mon Sep 17 00:00:00 2001 From: jonathan-r-thorpe <64410119+jonathan-r-thorpe@users.noreply.github.com> Date: Mon, 14 Oct 2024 14:04:43 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Simon Lo --- Development/nmos/control_protocol_methods.cpp | 38 +++++++++---------- Development/nmos/control_protocol_utils.cpp | 1 - 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Development/nmos/control_protocol_methods.cpp b/Development/nmos/control_protocol_methods.cpp index 99a2fd9f..4f50a6a3 100644 --- a/Development/nmos/control_protocol_methods.cpp +++ b/Development/nmos/control_protocol_methods.cpp @@ -30,7 +30,7 @@ namespace nmos // unknown property utility::stringstream_t ss; ss << U("unknown property: ") << property_id.serialize() << U(" to do Get"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::property_not_implemented }, ss.str()); } @@ -85,7 +85,7 @@ namespace nmos { utility::stringstream_t ss; ss << "Set property: " << property_id.serialize() << " value: " << val.serialize() << " error: " << e.what(); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::parameter_error }, ss.str()); } } @@ -93,7 +93,7 @@ namespace nmos // unknown property utility::stringstream_t ss; ss << U("unknown property: ") << property_id.serialize() << " to do Set"; - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::property_not_implemented }, ss.str()); } @@ -129,14 +129,14 @@ namespace nmos // out of bound utility::stringstream_t ss; ss << U("property: ") << property_id.serialize() << U(" is outside the available range to do GetSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::index_out_of_bounds }, ss.str()); } // unknown property utility::stringstream_t ss; ss << U("unknown property: ") << property_id.serialize() << U(" to do GetSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::property_not_implemented }, ss.str()); } @@ -168,7 +168,7 @@ namespace nmos // property is not a sequence utility::stringstream_t ss; ss << U("property: ") << property_id.serialize() << U(" is not a sequence to do SetSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::invalid_request }, ss.str()); } @@ -198,7 +198,7 @@ namespace nmos { utility::stringstream_t ss; ss << "Set sequence item: " << property_id.serialize() << " index: " << index << " value: " << val.serialize() << " error: " << e.what(); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::parameter_error }, ss.str()); } } @@ -206,14 +206,14 @@ namespace nmos // out of bound utility::stringstream_t ss; ss << U("property: ") << property_id.serialize() << U(" is outside the available range to do SetSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::index_out_of_bounds }, ss.str()); } // unknown property utility::stringstream_t ss; ss << U("unknown property: ") << property_id.serialize() << U(" to do SetSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::property_not_implemented }, ss.str()); } @@ -277,7 +277,7 @@ namespace nmos { utility::stringstream_t ss; ss << "Add sequence item: " << property_id.serialize() << " value: " << val.serialize() << " error: " << e.what(); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result({ nc_method_status::parameter_error }); } } @@ -285,7 +285,7 @@ namespace nmos // unknown property utility::stringstream_t ss; ss << U("unknown property: ") << property_id.serialize() << U(" to do AddSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::property_not_implemented }, ss.str()); } @@ -310,7 +310,7 @@ namespace nmos // property is not a sequence utility::stringstream_t ss; ss << U("property: ") << property_id.serialize() << U(" is not a sequence to do RemoveSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::invalid_request }, ss.str()); } @@ -329,14 +329,14 @@ namespace nmos // out of bound utility::stringstream_t ss; ss << U("property: ") << property_id.serialize() << U(" is outside the available range to do RemoveSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::index_out_of_bounds }, ss.str()); } // unknown property utility::stringstream_t ss; ss << U("unknown property: ") << property_id.serialize() << U(" to do RemoveSequenceItem"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::property_not_implemented }, ss.str()); } @@ -360,7 +360,7 @@ namespace nmos // property is not a sequence utility::stringstream_t ss; ss << U("property: ") << property_id.serialize() << U(" is not a sequence to do GetSequenceLength"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::invalid_request }, ss.str()); } @@ -383,7 +383,7 @@ namespace nmos // null utility::stringstream_t ss; ss << U("property: ") << property_id.serialize() << " is a null sequence to do GetSequenceLength"; - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::invalid_request }, ss.str()); } } @@ -393,7 +393,7 @@ namespace nmos // unknown property utility::stringstream_t ss; ss << U("unknown property: ") << property_id.serialize() << " to do GetSequenceLength"; - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::property_not_implemented }, ss.str()); } @@ -461,7 +461,7 @@ namespace nmos // no role utility::stringstream_t ss; ss << U("role: ") << role.as_string() << U(" not found to do FindMembersByPath"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::parameter_error }, ss.str()); } } @@ -470,7 +470,7 @@ namespace nmos // no members utility::stringstream_t ss; ss << U("role: ") << role.as_string() << U(" has no members to do FindMembersByPath"); - slog::log(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str()); + slog::log(gate, SLOG_FLF) << ss.str(); return details::make_nc_method_result_error({ nc_method_status::parameter_error }, ss.str()); } } diff --git a/Development/nmos/control_protocol_utils.cpp b/Development/nmos/control_protocol_utils.cpp index 2dc142d2..46478f41 100644 --- a/Development/nmos/control_protocol_utils.cpp +++ b/Development/nmos/control_protocol_utils.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include "bst/regex.h" #include "cpprest/json_utils.h"