@@ -903,13 +903,13 @@ std::string get_payload_value(attribute_store::attribute updated_node_cpp,
903903 // Credential data are encoded in different way that's why we store them as raw byte array and interpret their value
904904
905905 std::string output;
906- auto data = updated_node_cpp.reported <std::vector<uint8_t >>();
906+ auto raw_data = updated_node_cpp.reported <std::vector<uint8_t >>();
907907
908908 // Check if we need to convert the value to UTF-8
909909 if (need_utf8_conversion) {
910910 std::u16string utf16_str;
911- for (size_t i = 0 ; i < data .size (); i += 2 ) {
912- char16_t char16 = (data [i] << 8 ) | data [i + 1 ];
911+ for (size_t i = 0 ; i < raw_data .size (); i += 2 ) {
912+ char16_t char16 = (raw_data [i] << 8 ) | raw_data [i + 1 ];
913913 utf16_str.push_back (char16);
914914 }
915915 std::wstring_convert<std::codecvt_utf8_utf16<char16_t >, char16_t > cnv;
@@ -918,8 +918,8 @@ std::string get_payload_value(attribute_store::attribute updated_node_cpp,
918918 sl_log_error (LOG_TAG, " Error converting UTF-16 to UTF-8" );
919919 }
920920 } else {
921- output.reserve (data .size ());
922- for (auto c: data ) {
921+ output.reserve (raw_data .size ());
922+ for (auto c: raw_data ) {
923923 output.push_back (static_cast <char >(c));
924924 }
925925 }
@@ -1005,7 +1005,7 @@ void publish_mqtt_topic(const std::string &base_topic,
10051005void on_attribute_update (
10061006 attribute_store_node_t updated_node,
10071007 attribute_store_change_t change,
1008- std::function<std::string(attribute_store::attribute)> get_base_mqtt_topic,
1008+ const std::function<std::string(attribute_store::attribute)>& get_base_mqtt_topic,
10091009 const user_attributes_mqtt_map_t &attributes)
10101010{
10111011 try {
@@ -1087,7 +1087,7 @@ void on_uuic_slot_update(
10871087 old_credential_slot.credential_type );
10881088 // Simulate deletion of the old slot
10891089 // First simulate deletion of all attributes
1090- for (auto [attribute_store_type, mqtt_data]: credential_attributes) {
1090+ for (const auto & [attribute_store_type, mqtt_data]: credential_attributes) {
10911091 std::string mqtt_topic
10921092 = mqtt_topic_add_attribute (old_credential_topic, mqtt_data.topic );
10931093 uic_mqtt_publish (mqtt_topic.c_str (), " " , 0 , true );
@@ -1102,7 +1102,7 @@ void on_uuic_slot_update(
11021102}
11031103
11041104void on_user_credential_message (sl_log_level_t log_level,
1105- const std::string message)
1105+ const std::string& message)
11061106{
11071107 nlohmann::json payload;
11081108 payload[" level" ] = log_level;
0 commit comments