diff --git a/vpr/src/server/convertutils.cpp b/vpr/src/server/convertutils.cpp index 1cb38388194..f176e7ffee9 100644 --- a/vpr/src/server/convertutils.cpp +++ b/vpr/src/server/convertutils.cpp @@ -53,7 +53,7 @@ std::string get_truncated_middle_str(const std::string& src, std::size_t num) { if (num < minimal_string_size_to_truncate) { num = minimal_string_size_to_truncate; } - constexpr char middle_place_holder[] = "..."; + constexpr const char middle_place_holder[] = "..."; const std::size_t src_size = src.size(); if (src_size > num) { int prefix_num = num / 2; diff --git a/vpr/src/server/telegramparser.cpp b/vpr/src/server/telegramparser.cpp index 9ea8e784256..ed691841097 100644 --- a/vpr/src/server/telegramparser.cpp +++ b/vpr/src/server/telegramparser.cpp @@ -4,10 +4,12 @@ #include "convertutils.h" #include "commconstants.h" +#include + namespace comm { std::optional TelegramParser::try_extract_json_value_str(const std::string& json_string, const std::string& key) { - static const std::string end_key_pattern{"\":\""}; + constexpr const char end_key_pattern[] = {"\":\""}; // Find the position of the key size_t key_pos = json_string.find('\"' + key + end_key_pattern); @@ -18,7 +20,7 @@ std::optional TelegramParser::try_extract_json_value_str(const std: } // Find the position of the value after the key - size_t value_pos_start = json_string.find('\"', key_pos + key.length() + end_key_pattern.size()); + size_t value_pos_start = json_string.find('\"', key_pos + key.length() + std::strlen(end_key_pattern)); if (value_pos_start == std::string::npos) { // Value not found