From cfecf5622657aab4646b66fad28f081fe62cb8ac Mon Sep 17 00:00:00 2001 From: ma-shaoyin Date: Thu, 29 Sep 2022 15:39:37 +0800 Subject: [PATCH] Signed-off-by: ma-shaoyin Changes to be committed: --- services/include/input_method_setting.h | 3 -- services/src/input_method_property.cpp | 30 ++--------------- services/src/input_method_setting.cpp | 43 ------------------------- 3 files changed, 2 insertions(+), 74 deletions(-) diff --git a/services/include/input_method_setting.h b/services/include/input_method_setting.h index 060968a2..cb247f16 100644 --- a/services/include/input_method_setting.h +++ b/services/include/input_method_setting.h @@ -55,9 +55,6 @@ namespace MiscServices { void ClearData(); bool FindKey(const std::u16string& key) const; - bool Marshalling(Parcel &parcel) const override; - static InputMethodSetting *Unmarshalling(Parcel &parcel); - private: std::map setting; const char16_t DELIM_IME = ':'; diff --git a/services/src/input_method_property.cpp b/services/src/input_method_property.cpp index 2ae6f412..59c28379 100644 --- a/services/src/input_method_property.cpp +++ b/services/src/input_method_property.cpp @@ -90,7 +90,7 @@ namespace MiscServices { */ bool InputMethodProperty::Marshalling(Parcel &parcel) const { - if (!(parcel.WriteString16(mImeId) + return parcel.WriteString16(mImeId) && parcel.WriteString16(mPackageName) && parcel.WriteString16(mAbilityName) && parcel.WriteString16(mConfigurationPage) @@ -99,17 +99,7 @@ namespace MiscServices { && parcel.WriteInt32(labelId) && parcel.WriteInt32(descriptionId) && parcel.WriteString16(label) - && parcel.WriteString16(description))) - return false; - int32_t size = (int32_t)mTypes.size(); - parcel.WriteInt32(size); - if (!size) { - return true; - } - for (int i = 0; i < size; i++) { - parcel.WriteParcelable(mTypes[i]); - } - return true; + && parcel.WriteString16(description); } /*! Get InputMethodProperty from parcel @@ -131,22 +121,6 @@ namespace MiscServices { info->label = parcel.ReadString16(); info->description = parcel.ReadString16(); - int32_t size = parcel.ReadInt32(); - if (size < 0) { - return info; - } - - size_t readAbleSize = parcel.GetReadableBytes() / sizeof(KeyboardType); - size_t len = static_cast(size); - if(len > readAbleSize) { - return info; - } - - if (!size) - return info; - for (int i = 0; i < size; i++) { - info->mTypes.push_back(parcel.ReadParcelable()); - } return info; } } // namespace MiscServices diff --git a/services/src/input_method_setting.cpp b/services/src/input_method_setting.cpp index 5bda5c75..23fb0323 100644 --- a/services/src/input_method_setting.cpp +++ b/services/src/input_method_setting.cpp @@ -58,49 +58,6 @@ namespace MiscServices { return *this; } - /*! Write setting data to parcel - \param[out] parcel the setting data is written to parcel returned to caller. - \return ErrorCode::NO_ERROR - */ - bool InputMethodSetting::Marshalling(OHOS::Parcel &parcel) const - { - int32_t size = setting.size(); - parcel.WriteInt32(size); - std::map::const_iterator it; - for (it = setting.cbegin(); it != setting.cend(); ++it) { - parcel.WriteString16(it->first); - parcel.WriteString16(it->second); - } - return ErrorCode::NO_ERROR; - } - - /*! Read setting data from parcel - \param parcel read the setting data from the given parcel - \return ErrorCode::NO_ERROR - */ - InputMethodSetting *InputMethodSetting::Unmarshalling(OHOS::Parcel &parcel) - { - auto ims = new InputMethodSetting(); - int32_t size = parcel.ReadInt32(); - - if (size < 0) { - return ims; - } - - size_t readAbleSize = parcel.GetReadableBytes() / (sizeof(std::u16string) * 2); - size_t len = static_cast(size); - if(len > readAbleSize) { - return ims; - } - - for (int i = 0; i < size; i++) { - std::u16string key = parcel.ReadString16(); - std::u16string value = parcel.ReadString16(); - ims->setting.insert(std::pair(key, value)); - } - return ims; - } - /*! Set setting data for an item \param key the name of setting item \param value the value of setting item