summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2016-06-20 16:12:26 -0400
committerJackLivio <jack@livio.io>2016-06-20 16:12:26 -0400
commit0a0d488e62cf76064ea970af6cf7ee2c93a03b7a (patch)
tree024f0f3ee78c601526ef376c9f3170e294861154
parentac1bce0ae273ad189b0e48efcf62a46b17369a6e (diff)
downloadsdl_core-0a0d488e62cf76064ea970af6cf7ee2c93a03b7a.tar.gz
ParsePTString to Modify string, instead of returning a copyhotfix/add_escape_characters_during_ptu_header_construction
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h2
-rw-r--r--src/components/application_manager/src/commands/mobile/on_system_request_notification.cc12
2 files changed, 7 insertions, 7 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h b/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h
index 9d4584adf9..0763e680a8 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/on_system_request_notification.h
@@ -72,7 +72,7 @@ class OnSystemRequestNotification : public CommandNotificationImpl {
* @param message Message
*/
void AddHeader(BinaryMessage& message) const;
- std::string ParsePTString(std::string& pt_string) const;
+ void ParsePTString(std::string& pt_string) const;
#endif
DISALLOW_COPY_AND_ASSIGN(OnSystemRequestNotification);
diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
index 7de1700fe8..fbcbaede81 100644
--- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
@@ -116,8 +116,8 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
if (0 > sprintf(timeout_str, "%d", timeout)) {
memset(timeout_str, 0, sizeof(timeout_str));
}
- std::string temp_string = std::string(message.begin(), message.end());
- std::string policy_table_string = ParsePTString(temp_string);
+ std::string policy_table_string = std::string(message.begin(), message.end());
+ ParsePTString(policy_table_string);
const std::string header =
"{"
@@ -145,11 +145,11 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
logger_, "Header added: " << std::string(message.begin(), message.end()));
}
-std::string OnSystemRequestNotification::ParsePTString(std::string& pt_string) const{
+void OnSystemRequestNotification::ParsePTString(std::string& pt_string) const{
std::string result;
- int length = pt_string.length();
+ size_t length = pt_string.length();
result.reserve(length*2);
- for(int i=0;i<length;++i){
+ for(size_t i=0;i<length;++i){
if(pt_string[i]=='\"' || pt_string[i]=='\\'){
result += '\\';
} else if(pt_string[i] == '\n') {
@@ -157,7 +157,7 @@ std::string OnSystemRequestNotification::ParsePTString(std::string& pt_string) c
}
result += pt_string[i];
}
- return result;
+ pt_string = result;
}
#endif