From 8d101c98a9594ba8db0d3727cf0e29ca695e5c86 Mon Sep 17 00:00:00 2001 From: Dmitriy Klimenko Date: Thu, 3 Apr 2014 04:58:21 -0700 Subject: [PATCH] APPLINK-6506: Remove fakes params in request Signed-off-by: Justin Dickow Conflicts: src/components/protocol_handler/src/protocol_payload.cc src/components/utils/src/bitstream.cc --- CMakeLists.txt | 2 +- src/components/application_manager/src/message_helper.cc | 4 ++++ src/components/policy | 2 +- src/components/protocol_handler/src/protocol_payload.cc | 2 +- src/components/smart_objects/src/object_schema_item.cc | 10 ++++++++++ src/components/utils/src/bitstream.cc | 6 ++---- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fd5897..456b78d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ #dont modify this section if you dont know details about integration with Jenkins!!! set (HMI "web" CACHE STRING "HMI type") option(HMI2 "Use Qt HMI" OFF) -option(EXTENDED_MEDIA_MODE "Turn on and off extended Madia Manager features relates to PulseAudio A2DP and GSteamer" OFF) +option(EXTENDED_MEDIA_MODE "Turn on and off extended Madia Manager features relates to PulseAudio A2DP and GStreamer" OFF) option(BUILD_SHARED_LIBS "Build all libraries as shared (if ON) or static (if OFF)" OFF) option(BUILD_BT_SUPPORT "Bluetooth support" ON) option(BUILD_USB_SUPPORT "libusb support" ON) diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc index 7fec88b..2ef722c 100644 --- a/src/components/application_manager/src/message_helper.cc +++ b/src/components/application_manager/src/message_helper.cc @@ -951,6 +951,10 @@ smart_objects::SmartObject* MessageHelper::CreateChangeRegistration( } void MessageHelper::SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app) { + if (!app.valid()) { + return; + } + hmi_apis::Common_Language::eType app_common_language = ToCommonLanguage(app->language()); const HMICapabilities& hmi_capabilities = diff --git a/src/components/policy b/src/components/policy index 6ac1ed2..c2ad2f6 160000 --- a/src/components/policy +++ b/src/components/policy @@ -1 +1 @@ -Subproject commit 6ac1ed235958280c706db98b773757505f17e610 +Subproject commit c2ad2f65576e200d8977acbcc046606c0dcb1360 diff --git a/src/components/protocol_handler/src/protocol_payload.cc b/src/components/protocol_handler/src/protocol_payload.cc index 3fff217..eefd428 100644 --- a/src/components/protocol_handler/src/protocol_payload.cc +++ b/src/components/protocol_handler/src/protocol_payload.cc @@ -72,7 +72,7 @@ void Extract(utils::BitStream* bs, ProtocolPayloadV2* payload, utils::Extract(bs, &payload->json, payload->header.json_size); size_t data_size = payload_size - payload->header.json_size - PayloadHeaderBits / CHAR_BIT; - DCHECK(data_size < payload_size); // Make sure data_size didn't underflow + DCHECK(data_size < payload_size); utils::Extract(bs, &payload->data, data_size); } } diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc index 90591a4..8bdef53 100644 --- a/src/components/smart_objects/src/object_schema_item.cc +++ b/src/components/smart_objects/src/object_schema_item.cc @@ -94,6 +94,7 @@ Errors::eType CObjectSchemaItem::validate(const SmartObject& Object) { void CObjectSchemaItem::applySchema(SmartObject& Object) { if (SmartType_Map == Object.getType()) { + for (std::map::const_iterator i = mMembers.begin(); i != mMembers.end(); ++i) { if (Object.keyExists(i->first)) { @@ -105,6 +106,15 @@ void CObjectSchemaItem::applySchema(SmartObject& Object) { void CObjectSchemaItem::unapplySchema(SmartObject& Object) { if (SmartType_Map == Object.getType()) { + const std::set objectKeys = Object.enumerate(); + for (std::set::const_iterator k = objectKeys.begin(); + k != objectKeys.end(); ++k) { + if (mMembers.end() == mMembers.find(*k)) { + // remove fake params + Object.erase(*k); + } + } + for (std::map::const_iterator i = mMembers.begin(); i != mMembers.end(); ++i) { if (Object.keyExists(i->first)) { diff --git a/src/components/utils/src/bitstream.cc b/src/components/utils/src/bitstream.cc index faa94fb..c616b1a 100644 --- a/src/components/utils/src/bitstream.cc +++ b/src/components/utils/src/bitstream.cc @@ -120,10 +120,8 @@ void Extract(BitStream* bs, std::vector* data, size_t length) { return; } data->resize(length); - - // Don't call vector::front() on an empty vector (it's undefined) - if (length != 0) - { + + if (0 != length) { void* dataptr = &data->front(); bs->ExtractBytes(dataptr, length); } -- 2.7.4