diff --git a/etc/para/include/para_handle.h b/etc/para/include/para_handle.h index 183e91b..d45fd3d 100644 --- a/etc/para/include/para_handle.h +++ b/etc/para/include/para_handle.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_INPUTMETHOD_PARA_HANDLE_H -#define OHOS_MISCSERVICES_INPUTMETHOD_PARA_HANDLE_H +#ifndef ETC_PARA_INCLUDE_PARA_HANDLE_H +#define ETC_PARA_INCLUDE_PARA_HANDLE_H #include namespace OHOS { namespace MiscServices { diff --git a/etc/para/src/para_handle.cpp b/etc/para/src/para_handle.cpp index 70812ff..5d4ec40 100644 --- a/etc/para/src/para_handle.cpp +++ b/etc/para/src/para_handle.cpp @@ -22,9 +22,9 @@ namespace OHOS { bool ParaHandle::SetDefaultIme(int32_t userId, const std::string &imeName) { if (userId != main_userId) { - return SetParameter(DEFAULT_IME_KEY + userId, imeName.data()) == 0; + return !SetParameter(DEFAULT_IME_KEY + userId, imeName.data()); } else { - return SetParameter(DEFAULT_IME_KEY, imeName.data()) == 0; + return !SetParameter(DEFAULT_IME_KEY, imeName.data()); } } diff --git a/frameworks/inputmethod_ability/include/i_input_method_agent.h b/frameworks/inputmethod_ability/include/i_input_method_agent.h index 8307a90..8af4173 100644 --- a/frameworks/inputmethod_ability/include/i_input_method_agent.h +++ b/frameworks/inputmethod_ability/include/i_input_method_agent.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IINPUTMETHODAGENT_H -#define FM_IMMS_PROJECT_IINPUTMETHODAGENT_H +#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_I_INPUT_METHOD_AGENT_H +#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_I_INPUT_METHOD_AGENT_H #include "iremote_broker.h" #include "global.h" diff --git a/frameworks/inputmethod_ability/include/i_input_method_core.h b/frameworks/inputmethod_ability/include/i_input_method_core.h index 2d0c8c9..a9b2bc6 100644 --- a/frameworks/inputmethod_ability/include/i_input_method_core.h +++ b/frameworks/inputmethod_ability/include/i_input_method_core.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IINPUTMETHODCORE_H -#define FM_IMMS_PROJECT_IINPUTMETHODCORE_H +#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_I_INPUT_METHOD_CORE_H +#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_I_INPUT_METHOD_CORE_H #include "iremote_broker.h" #include "i_input_data_channel.h" #include "i_input_control_channel.h" diff --git a/frameworks/inputmethod_ability/include/input_method_ability.h b/frameworks/inputmethod_ability/include/input_method_ability.h index 748ada6..026990d 100644 --- a/frameworks/inputmethod_ability/include/input_method_ability.h +++ b/frameworks/inputmethod_ability/include/input_method_ability.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTMETHODABILITY_H -#define FM_IMMS_PROJECT_INPUTMETHODABILITY_H +#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_ABILITY_H +#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_ABILITY_H #include #include "js_input_method_engine_listener.h" diff --git a/frameworks/inputmethod_ability/include/input_method_agent_proxy.h b/frameworks/inputmethod_ability/include/input_method_agent_proxy.h index 80452ad..425b729 100644 --- a/frameworks/inputmethod_ability/include/input_method_agent_proxy.h +++ b/frameworks/inputmethod_ability/include/input_method_agent_proxy.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMC_PROJECT_INPUTMETHODAGENTPROXY_H -#define FM_IMC_PROJECT_INPUTMETHODAGENTPROXY_H +#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_AGENT_PROXY_H +#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_AGENT_PROXY_H #include "iremote_proxy.h" #include "i_input_method_agent.h" diff --git a/frameworks/inputmethod_ability/include/input_method_agent_stub.h b/frameworks/inputmethod_ability/include/input_method_agent_stub.h index e49c88e..b247aab 100644 --- a/frameworks/inputmethod_ability/include/input_method_agent_stub.h +++ b/frameworks/inputmethod_ability/include/input_method_agent_stub.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMC_PROJECT_INPUTMETHODAGENTSTUB_H -#define FM_IMC_PROJECT_INPUTMETHODAGENTSTUB_H +#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_AGENT_STUB_H +#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_AGENT_STUB_H #include "iremote_stub.h" #include "message_parcel.h" diff --git a/frameworks/inputmethod_ability/include/input_method_core_proxy.h b/frameworks/inputmethod_ability/include/input_method_core_proxy.h index 2afe62b..7f1f09b 100644 --- a/frameworks/inputmethod_ability/include/input_method_core_proxy.h +++ b/frameworks/inputmethod_ability/include/input_method_core_proxy.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMC_PROJECT_INPUTMETHODCOREPROXY_H -#define FM_IMC_PROJECT_INPUTMETHODCOREPROXY_H +#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H +#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H #include "iremote_proxy.h" #include "iremote_object.h" diff --git a/frameworks/inputmethod_ability/include/input_method_core_stub.h b/frameworks/inputmethod_ability/include/input_method_core_stub.h index eddec19..5d10014 100644 --- a/frameworks/inputmethod_ability/include/input_method_core_stub.h +++ b/frameworks/inputmethod_ability/include/input_method_core_stub.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTCONTROLCHANNEL_SK_H -#define FM_IMMS_PROJECT_INPUTCONTROLCHANNEL_SK_H +#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_STUB_H +#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_STUB_H #include #include diff --git a/frameworks/inputmethod_ability/src/input_method_ability.cpp b/frameworks/inputmethod_ability/src/input_method_ability.cpp index 546660a..32fad04 100644 --- a/frameworks/inputmethod_ability/src/input_method_ability.cpp +++ b/frameworks/inputmethod_ability/src/input_method_ability.cpp @@ -41,7 +41,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodAbility::~InputMethodAbility"); instance_ = nullptr; - if (msgHandler != nullptr) { + if (msgHandler) { delete msgHandler; msgHandler = nullptr; } @@ -51,9 +51,9 @@ namespace MiscServices { sptr InputMethodAbility::GetInstance() { IMSA_HILOGI("InputMethodAbility::GetInstance"); - if (instance_ == nullptr) { + if (!instance_) { std::lock_guard autoLock(instanceLock_); - if (instance_ == nullptr) { + if (!instance_) { IMSA_HILOGI("InputMethodAbility::GetInstance need new IMA"); instance_ = new InputMethodAbility(); } @@ -66,13 +66,13 @@ namespace MiscServices { IMSA_HILOGI("InputMethodAbility::GetImsaProxy"); sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - if (systemAbilityManager == nullptr) { + if (!systemAbilityManager) { IMSA_HILOGI("InputMethodAbility::GetImsaProxy systemAbilityManager is nullptr"); return nullptr; } auto systemAbility = systemAbilityManager->GetSystemAbility(INPUT_METHOD_SYSTEM_ABILITY_ID, ""); - if (systemAbility == nullptr) { + if (!systemAbility) { IMSA_HILOGI("InputMethodAbility::GetImsaProxy systemAbility is nullptr"); return nullptr; } @@ -85,7 +85,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodAbility::SetCoreAndAgent"); mImms = GetImsaProxy(); - if (mImms == nullptr) { + if (!mImms) { IMSA_HILOGI("InputMethodAbility::SetCoreAndAgent() mImms is nullptr"); return; } @@ -120,7 +120,7 @@ namespace MiscServices { void InputMethodAbility::setImeListener(sptr &imeListener) { IMSA_HILOGI("InputMethodAbility::setImeListener"); - if (imeListener_ == nullptr) { + if (!imeListener_) { imeListener_ = imeListener; } } @@ -128,7 +128,7 @@ namespace MiscServices { void InputMethodAbility::setKdListener(sptr &kdListener) { IMSA_HILOGI("InputMethodAbility::setKdListener"); - if (kdListener_ == nullptr) { + if (!kdListener_) { kdListener_ = kdListener; } } @@ -178,7 +178,7 @@ namespace MiscServices { case MSG_ID_STOP_INPUT_SERVICE:{ MessageParcel *data = msg->msgContent_; std::string imeId = Str16ToStr8(data->ReadString16()); - if (imeListener_ != nullptr) { + if (imeListener_) { imeListener_->OnInputStop(imeId); } break; @@ -198,13 +198,13 @@ namespace MiscServices { MessageParcel *data = msg->msgContent_; displyId = data->ReadInt32(); sptr channelObject = data->ReadRemoteObject(); - if (channelObject == nullptr) { + if (!channelObject) { IMSA_HILOGI("InputMethodAbility::OnInitialInput channelObject is nullptr"); return; } sptr channelProxy = new InputControlChannelProxy(channelObject); inputControlChannel = channelProxy; - if (inputControlChannel == nullptr) { + if (!inputControlChannel) { IMSA_HILOGI("InputMethodAbility::OnInitialInput inputControlChannel is nullptr"); return; } @@ -215,13 +215,13 @@ namespace MiscServices { IMSA_HILOGI("InputMethodAbility::OnInitInputControlChannel"); MessageParcel *data = msg->msgContent_; sptr channelObject = data->ReadRemoteObject(); - if (channelObject == nullptr) { + if (!channelObject) { IMSA_HILOGI("InputMethodAbility::OnInitInputControlChannel channelObject is nullptr"); return; } sptr channelProxy = new InputControlChannelProxy(channelObject); inputControlChannel = channelProxy; - if (inputControlChannel == nullptr) { + if (!inputControlChannel) { IMSA_HILOGI("InputMethodAbility::OnInitInputControlChannel inputControlChannel is nullptr"); } } @@ -232,11 +232,12 @@ namespace MiscServices { MessageParcel *data = msg->msgContent_; sptr channalProxy = new InputDataChannelProxy(data->ReadRemoteObject()); inputDataChannel = channalProxy; - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::OnStartInput inputDataChannel is nullptr"); + return; } editorAttribute = data->ReadParcelable(); - if (editorAttribute == nullptr) { + if (!editorAttribute) { IMSA_HILOGI("InputMethodAbility::OnStartInput editorAttribute is nullptr"); } mSupportPhysicalKbd = data->ReadBool(); @@ -248,7 +249,7 @@ namespace MiscServices { MessageParcel *data = msg->msgContent_; sptr channalProxy = new InputDataChannelProxy(data->ReadRemoteObject()); inputDataChannel = channalProxy; - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::OnShowKeyboard inputDataChannel is nullptr"); } ShowInputWindow(); @@ -263,7 +264,7 @@ namespace MiscServices { void InputMethodAbility::OnStopInput(Message *msg) { IMSA_HILOGI("InputMethodAbility::OnStopInput"); - if (writeInputChannel != nullptr) { + if (writeInputChannel) { delete writeInputChannel; writeInputChannel = nullptr; } @@ -277,7 +278,7 @@ namespace MiscServices { IMSA_HILOGI("InputMethodAbility::DispatchKeyEvent abort. no client"); return false; } - if (kdListener_ == nullptr) { + if (!kdListener_) { IMSA_HILOGI("InputMethodAbility::DispatchKeyEvent kdListener_ is nullptr"); return false; } @@ -291,7 +292,7 @@ namespace MiscServices { int32_t positionX = data->ReadInt32(); int32_t positionY = data->ReadInt32(); int32_t height = data->ReadInt32(); - if (kdListener_ == nullptr) { + if (!kdListener_) { IMSA_HILOGI("InputMethodAbility::OnCursorUpdate kdListener_ is nullptr"); return; } @@ -308,7 +309,7 @@ namespace MiscServices { int32_t newBegin = data->ReadInt32(); int32_t newEnd = data->ReadInt32(); - if (kdListener_ == nullptr) { + if (!kdListener_) { IMSA_HILOGI("InputMethodAbility::OnSelectionChange kdListener_ is nullptr"); return; } @@ -320,13 +321,13 @@ namespace MiscServices { void InputMethodAbility::ShowInputWindow() { IMSA_HILOGI("InputMethodAbility::ShowInputWindow"); - if (imeListener_ == nullptr) { + if (!imeListener_) { IMSA_HILOGI("InputMethodAbility::ShowInputWindow imeListener_ is nullptr"); return; } imeListener_->OnInputStart(); imeListener_->OnKeyboardStatus(true); - if (inputDataChannel != nullptr) { + if (inputDataChannel) { inputDataChannel->SendKeyboardStatus(KEYBOARD_SHOW); } } @@ -334,12 +335,12 @@ namespace MiscServices { void InputMethodAbility::DissmissInputWindow() { IMSA_HILOGI("InputMethodAbility::DissmissInputWindow"); - if (imeListener_ == nullptr) { + if (!imeListener_) { IMSA_HILOGI("InputMethodAbility::DissmissInputWindow imeListener_ is nullptr"); return; } imeListener_->OnKeyboardStatus(false); - if (inputDataChannel != nullptr) { + if (inputDataChannel) { inputDataChannel->SendKeyboardStatus(KEYBOARD_HIDE); } } @@ -347,7 +348,7 @@ namespace MiscServices { bool InputMethodAbility::InsertText(const std::string text) { IMSA_HILOGI("InputMethodAbility::InsertText"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::InsertText inputDataChanel is nullptr"); return false; } @@ -358,7 +359,7 @@ namespace MiscServices { void InputMethodAbility::DeleteForward(int32_t length) { IMSA_HILOGI("InputMethodAbility::DeleteForward"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::DeleteForward inputDataChanel is nullptr"); return; } @@ -368,7 +369,7 @@ namespace MiscServices { void InputMethodAbility::DeleteBackward(int32_t length) { IMSA_HILOGI("InputMethodAbility::DeleteBackward"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::DeleteBackward inputDataChanel is nullptr"); return; } @@ -378,7 +379,7 @@ namespace MiscServices { void InputMethodAbility::SendFunctionKey(int32_t funcKey) { IMSA_HILOGI("InputMethodAbility::SendFunctionKey"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::SendFunctionKey inputDataChanel is nullptr"); return; } @@ -395,7 +396,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodAbility::GetTextBeforeCursor"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::GetTextBeforeCursor inputDataChanel is nullptr"); return u""; } @@ -406,7 +407,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodAbility::GetTextAfterCursor"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::GetTextAfterCursor inputDataChanel is nullptr"); return u""; } @@ -417,7 +418,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodAbility::MoveCursor"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::MoveCursor inputDataChanel is nullptr"); return; } @@ -430,7 +431,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodAbility::GetEnterKeyType"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::GetEnterKeyType inputDataChanel is nullptr"); return 0; } @@ -441,7 +442,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodAbility::GetInputPattern"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::GetInputPattern inputDataChanel is nullptr"); return 0; } @@ -452,7 +453,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodAbility::StopInput"); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodAbility::StopInput inputDataChanel is nullptr"); return; } diff --git a/frameworks/inputmethod_ability/src/input_method_agent_stub.cpp b/frameworks/inputmethod_ability/src/input_method_agent_stub.cpp index ee02c32..099ae66 100644 --- a/frameworks/inputmethod_ability/src/input_method_agent_stub.cpp +++ b/frameworks/inputmethod_ability/src/input_method_agent_stub.cpp @@ -75,7 +75,7 @@ namespace MiscServices { bool InputMethodAgentStub::DispatchKeyEvent(MessageParcel& data) { IMSA_HILOGI("InputMethodAgentStub::DispatchKeyEvent"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return false; } return InputMethodAbility::GetInstance()->DispatchKeyEvent(data.ReadInt32(), data.ReadInt32()); @@ -84,7 +84,7 @@ namespace MiscServices { void InputMethodAgentStub::OnCursorUpdate(int32_t positionX, int32_t positionY, int height) { IMSA_HILOGI("InputMethodAgentStub::OnCursorUpdate"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return; } MessageParcel *data = new MessageParcel(); @@ -99,7 +99,7 @@ namespace MiscServices { int32_t newBegin, int32_t newEnd) { IMSA_HILOGI("InputMethodAgentStub::OnSelectionChange"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return; } MessageParcel *data = new MessageParcel(); diff --git a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp index 9af050f..28e333f 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp @@ -33,15 +33,15 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::initializeInput"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("remote is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } - if (startInputToken == nullptr) { + if (!startInputToken) { IMSA_HILOGI("InputMethodCoreProxy::initializeInput startInputToken is nullptr"); } - if (inputControlChannel == nullptr) { + if (!inputControlChannel) { IMSA_HILOGI("InputMethodCoreProxy::initializeInput inputControlChannel is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } @@ -50,7 +50,7 @@ namespace MiscServices { data.WriteInterfaceToken(GetDescriptor()); data.WriteInt32(displayId); sptr channelObject = inputControlChannel->AsObject(); - if (channelObject == nullptr) { + if (!channelObject) { IMSA_HILOGI("InputMethodCoreProxy::initializeInput channelObject is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } @@ -76,18 +76,18 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("remote is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } - if (inputControlChannel == nullptr) { + if (!inputControlChannel) { IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel inputControlChannel is nullptr"); return ErrorCode::ERROR_EX_NULL_POINTER; } MessageParcel data, reply; data.WriteInterfaceToken(GetDescriptor()); sptr channelObject = inputControlChannel->AsObject(); - if (channelObject == nullptr) { + if (!channelObject) { IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel channelObject is nullptr"); return ErrorCode::ERROR_EX_NULL_POINTER; } @@ -108,7 +108,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::SetClientState"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("remote is nullptr"); return; } @@ -133,11 +133,11 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::startInput"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("remote is nullptr"); return false; } - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodCoreProxy::startInput inputDataChannel is nullptr"); return false; } @@ -169,7 +169,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::stopInput"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("remote is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } @@ -195,7 +195,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::showKeyboard"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("InputMethodCoreProxy::showKeyboard remote is nullptr"); return false; } @@ -221,7 +221,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::StopInputService"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("InputMethodCoreProxy::StopInputService remote is nullptr"); return; } @@ -245,7 +245,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::hideKeyboard"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { return false; } @@ -269,7 +269,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::setKeyboardType"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("remote is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } @@ -291,7 +291,7 @@ namespace MiscServices { { IMSA_HILOGI("InputMethodCoreProxy::getKeyboardWindowHeight"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { IMSA_HILOGI("remote is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } @@ -305,7 +305,7 @@ namespace MiscServices { return status; } int32_t code = reply.ReadException(); - if (code != 0) { + if (code) { return code; } retHeight = reply.ReadInt32(); diff --git a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp b/frameworks/inputmethod_ability/src/input_method_core_stub.cpp index 6e1eeb6..8c0484d 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_stub.cpp @@ -57,11 +57,11 @@ namespace MiscServices { int32_t displayId = data.ReadInt32(); IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest displayId = %{public}d", displayId); sptr channelObject = data.ReadRemoteObject(); - if (channelObject == nullptr) { + if (!channelObject) { IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest channelObject is nullptr"); } sptr inputControlChannel = new InputControlChannelProxy(channelObject); - if (inputControlChannel == nullptr) { + if (!inputControlChannel) { IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest inputControlChannel is nullptr"); } @@ -71,11 +71,11 @@ namespace MiscServices { } case INIT_INPUT_CONTROL_CHANNEL: { sptr channelObject = data.ReadRemoteObject(); - if (channelObject == nullptr) { + if (!channelObject) { IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest channelObject is nullptr"); } sptr inputControlChannel = new InputControlChannelProxy(channelObject); - if (inputControlChannel == nullptr) { + if (!inputControlChannel) { IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest inputControlChannel is nullptr"); } @@ -88,7 +88,7 @@ namespace MiscServices { InputAttribute *editorAttribute = data.ReadParcelable(); bool supportPhysicalKbd = data.ReadBool(); - if (inputDataChannel == nullptr) { + if (!inputDataChannel) { IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest START_INPUT inputDataChannel is nulltpr"); } startInput(inputDataChannel, *editorAttribute, supportPhysicalKbd); @@ -148,17 +148,17 @@ namespace MiscServices { sptr& inputControlChannel) { IMSA_HILOGI("InputMethodCoreStub::initializeInput"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return ErrorCode::ERROR_NULL_POINTER; } - if (startInputToken == nullptr) { + if (!startInputToken) { IMSA_HILOGI("InputMethodCoreStub::initializeInput startInputToken is nullptr"); } MessageParcel *data = new MessageParcel(); data->WriteInt32(displayId); - if (inputControlChannel != nullptr) { + if (inputControlChannel) { IMSA_HILOGI("InputMethodCoreStub::initializeInput. inputControlChannel is not nullptr"); data->WriteRemoteObject(inputControlChannel->AsObject()); } @@ -170,12 +170,12 @@ namespace MiscServices { int32_t InputMethodCoreStub::InitInputControlChannel(sptr& inputControlChannel) { IMSA_HILOGI("InputMethodCoreStub::initializeInput"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return ErrorCode::ERROR_NULL_POINTER; } MessageParcel *data = new MessageParcel(); - if (inputControlChannel != nullptr) { + if (inputControlChannel) { IMSA_HILOGI("InputMethodCoreStub::initializeInput. inputControlChannel is not nullptr"); data->WriteRemoteObject(inputControlChannel->AsObject()); } @@ -188,11 +188,11 @@ namespace MiscServices { const InputAttribute& editorAttribute, bool supportPhysicalKbd) { IMSA_HILOGI("InputMethodCoreStub::startInput"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return ErrorCode::ERROR_NULL_POINTER; } MessageParcel *data = new MessageParcel(); - if (inputDataChannel != nullptr) { + if (inputDataChannel) { IMSA_HILOGI("InputMethodCoreStub::startInput inputDataChannel is not nullptr"); data->WriteRemoteObject(inputDataChannel->AsObject()); } @@ -206,7 +206,7 @@ namespace MiscServices { int32_t InputMethodCoreStub::stopInput() { IMSA_HILOGI("InputMethodCoreStub::stopInput"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return ErrorCode::ERROR_NULL_POINTER; } MessageParcel *data = new MessageParcel(); @@ -218,7 +218,7 @@ namespace MiscServices { void InputMethodCoreStub::SetClientState(bool state) { IMSA_HILOGI("InputMethodCoreStub::SetClientState"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return; } MessageParcel *data = new MessageParcel(); @@ -231,11 +231,11 @@ namespace MiscServices { bool InputMethodCoreStub::showKeyboard(const sptr& inputDataChannel) { IMSA_HILOGI("InputMethodCoreStub::showKeyboard"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return false; } MessageParcel *data = new MessageParcel(); - if (inputDataChannel != nullptr) { + if (inputDataChannel) { IMSA_HILOGI("InputMethodCoreStub::showKeyboard inputDataChannel is not nullptr"); data->WriteRemoteObject(inputDataChannel->AsObject()); } @@ -248,7 +248,7 @@ namespace MiscServices { bool InputMethodCoreStub::hideKeyboard(int32_t flags) { IMSA_HILOGI("InputMethodCoreStub::hideKeyboard"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return ErrorCode::ERROR_NULL_POINTER; } MessageParcel *data = new MessageParcel(); @@ -263,7 +263,7 @@ namespace MiscServices { int32_t InputMethodCoreStub::setKeyboardType(const KeyboardType& type) { IMSA_HILOGI("InputMethodCoreStub::setKeyboardType"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return ErrorCode::ERROR_NULL_POINTER; } MessageParcel *data = new MessageParcel(); @@ -277,7 +277,7 @@ namespace MiscServices { void InputMethodCoreStub::StopInputService(std::string imeId) { IMSA_HILOGI("InputMethodCoreStub::StopInputService"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return; } MessageParcel *data = new MessageParcel(); @@ -290,7 +290,7 @@ namespace MiscServices { int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t retHeight) { IMSA_HILOGI("InputMethodCoreStub::getKeyboardWindowHeight"); - if (msgHandler_ == nullptr) { + if (!msgHandler_) { return ErrorCode::ERROR_NULL_POINTER; } MessageParcel *data = new MessageParcel(); diff --git a/frameworks/inputmethod_controller/include/i_input_client.h b/frameworks/inputmethod_controller/include/i_input_client.h index 009c304..48e6c29 100644 --- a/frameworks/inputmethod_controller/include/i_input_client.h +++ b/frameworks/inputmethod_controller/include/i_input_client.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IINPUTCLIENT_H -#define FM_IMMS_PROJECT_IINPUTCLIENT_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_CLIENT_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_CLIENT_H #include "iremote_broker.h" #include "i_input_method_agent.h" diff --git a/frameworks/inputmethod_controller/include/i_input_data_channel.h b/frameworks/inputmethod_controller/include/i_input_data_channel.h index 4916a9b..8f6d45b 100644 --- a/frameworks/inputmethod_controller/include/i_input_data_channel.h +++ b/frameworks/inputmethod_controller/include/i_input_data_channel.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IINPUTDATACHANNEL_H -#define FM_IMMS_PROJECT_IINPUTDATACHANNEL_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H #include #include "iremote_broker.h" #include "global.h" diff --git a/frameworks/inputmethod_controller/include/input_client_proxy.h b/frameworks/inputmethod_controller/include/input_client_proxy.h index 4ac5603..fc1fcc4 100644 --- a/frameworks/inputmethod_controller/include/input_client_proxy.h +++ b/frameworks/inputmethod_controller/include/input_client_proxy.h @@ -14,8 +14,8 @@ */ -#ifndef FM_IMC_PROJECT_INPUTCLIENTPROXY_H -#define FM_IMC_PROJECT_INPUTCLIENTPROXY_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_CLIENT_PROXY_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_CLIENT_PROXY_H #include "iremote_proxy.h" #include "i_input_client.h" diff --git a/frameworks/inputmethod_controller/include/input_client_stub.h b/frameworks/inputmethod_controller/include/input_client_stub.h index d18e716..5ccc71e 100644 --- a/frameworks/inputmethod_controller/include/input_client_stub.h +++ b/frameworks/inputmethod_controller/include/input_client_stub.h @@ -14,8 +14,8 @@ */ -#ifndef FM_IMC_PROJECT_INPUTCLIENTSTUB_H -#define FM_IMC_PROJECT_INPUTCLIENTSTUB_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_CLIENT_STUB_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_CLIENT_STUB_H #include "iremote_stub.h" #include "i_input_client.h" diff --git a/frameworks/inputmethod_controller/include/input_data_channel_proxy.h b/frameworks/inputmethod_controller/include/input_data_channel_proxy.h index 78a43e5..5d26ae6 100644 --- a/frameworks/inputmethod_controller/include/input_data_channel_proxy.h +++ b/frameworks/inputmethod_controller/include/input_data_channel_proxy.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMC_PROJECT_INPUTDATACHANNELPROXY_H -#define FM_IMC_PROJECT_INPUTDATACHANNELPROXY_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_DATA_CHANNEL_PROXY_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_DATA_CHANNEL_PROXY_H #include "iremote_proxy.h" #include "i_input_data_channel.h" diff --git a/frameworks/inputmethod_controller/include/input_data_channel_stub.h b/frameworks/inputmethod_controller/include/input_data_channel_stub.h index 3bf4999..68e1bba 100644 --- a/frameworks/inputmethod_controller/include/input_data_channel_stub.h +++ b/frameworks/inputmethod_controller/include/input_data_channel_stub.h @@ -14,8 +14,8 @@ */ -#ifndef FM_IMC_PROJECT_INPUTDATACHANNELSTUB_H -#define FM_IMC_PROJECT_INPUTDATACHANNELSTUB_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_DATA_CHANNEL_STUB_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_DATA_CHANNEL_STUB_H #include "i_input_data_channel.h" #include "iremote_stub.h" diff --git a/frameworks/inputmethod_controller/include/input_method_controller.h b/frameworks/inputmethod_controller/include/input_method_controller.h index 0cc6e2e..3744a5b 100644 --- a/frameworks/inputmethod_controller/include/input_method_controller.h +++ b/frameworks/inputmethod_controller/include/input_method_controller.h @@ -14,8 +14,8 @@ */ -#ifndef FM_IMC_PROJECT_INPUTMETHODCONTROLLER_H -#define FM_IMC_PROJECT_INPUTMETHODCONTROLLER_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H #include #include diff --git a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h b/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h index 9f091ff..531cfc3 100644 --- a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h +++ b/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMC_PROJECT_INPUTMETHODSYSTEMABILITYPROXY_H -#define FM_IMC_PROJECT_INPUTMETHODSYSTEMABILITYPROXY_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_PROXY_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_PROXY_H #include #include "iremote_proxy.h" diff --git a/frameworks/inputmethod_controller/include/input_method_utils.h b/frameworks/inputmethod_controller/include/input_method_utils.h index 24be150..8002421 100644 --- a/frameworks/inputmethod_controller/include/input_method_utils.h +++ b/frameworks/inputmethod_controller/include/input_method_utils.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMC_PROJECT_INPUT_METHOD_UTILS_H -#define FM_IMC_PROJECT_INPUT_METHOD_UTILS_H +#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_UTILS_H +#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_UTILS_H #include diff --git a/frameworks/inputmethod_controller/src/input_client_stub.cpp b/frameworks/inputmethod_controller/src/input_client_stub.cpp index 7c8ff3a..3db66b9 100644 --- a/frameworks/inputmethod_controller/src/input_client_stub.cpp +++ b/frameworks/inputmethod_controller/src/input_client_stub.cpp @@ -36,7 +36,7 @@ namespace MiscServices { } switch (code) { case ON_INPUT_READY: { - if (msgHandler == nullptr) { + if (!msgHandler) { break; } MessageParcel *parcel = new MessageParcel(); @@ -47,7 +47,7 @@ namespace MiscServices { break; } case ON_INPUT_RELEASED: { - if (msgHandler == nullptr) { + if (!msgHandler) { break; } MessageParcel *parcel = new MessageParcel(); @@ -57,7 +57,7 @@ namespace MiscServices { break; } case SET_DISPLAY_MODE: { - if (msgHandler == nullptr) { + if (!msgHandler) { break; } MessageParcel *parcel = new MessageParcel(); diff --git a/frameworks/inputmethod_controller/src/input_data_channel_stub.cpp b/frameworks/inputmethod_controller/src/input_data_channel_stub.cpp index 74b37af..577a121 100644 --- a/frameworks/inputmethod_controller/src/input_data_channel_stub.cpp +++ b/frameworks/inputmethod_controller/src/input_data_channel_stub.cpp @@ -24,7 +24,7 @@ namespace MiscServices { InputDataChannelStub::~InputDataChannelStub() { - if (msgHandler != nullptr) { + if (msgHandler) { delete msgHandler; msgHandler = nullptr; } @@ -103,7 +103,7 @@ namespace MiscServices { bool InputDataChannelStub::InsertText(const std::u16string& text) { IMSA_HILOGI("InputDataChannelStub::InsertText"); - if (msgHandler != nullptr) { + if (msgHandler) { MessageParcel *parcel = new MessageParcel; parcel->WriteString16(text); Message *msg = new Message(MessageID::MSG_ID_INSERT_CHAR, parcel); @@ -117,7 +117,7 @@ namespace MiscServices { bool InputDataChannelStub::DeleteForward(int32_t length) { IMSA_HILOGI("InputDataChannelStub::DeleteForward"); - if (msgHandler == nullptr) { + if (!msgHandler) { return false; } MessageParcel *parcel = new MessageParcel; @@ -131,7 +131,7 @@ namespace MiscServices { bool InputDataChannelStub::DeleteBackward(int32_t length) { IMSA_HILOGI("InputDataChannelStub::DeleteBackward"); - if (msgHandler != nullptr) { + if (msgHandler) { MessageParcel *parcel = new MessageParcel; parcel->WriteInt32(length); Message *msg = new Message(MessageID::MSG_ID_DELETE_BACKWARD, parcel); @@ -178,7 +178,7 @@ namespace MiscServices { void InputDataChannelStub::SendKeyboardStatus(int32_t status) { IMSA_HILOGI("InputDataChannelStub::SendKeyboardStatus"); - if (msgHandler != nullptr) { + if (msgHandler) { MessageParcel *parcel = new MessageParcel; parcel->WriteInt32(status); Message *msg = new Message(MessageID::MSG_ID_SEND_KEYBOARD_STATUS, parcel); @@ -189,7 +189,7 @@ namespace MiscServices { void InputDataChannelStub::SendFunctionKey(int32_t funcKey) { IMSA_HILOGI("InputDataChannelStub::SendFunctionKey"); - if (msgHandler != nullptr) { + if (msgHandler) { MessageParcel *parcel = new MessageParcel; parcel->WriteInt32(funcKey); Message *msg = new Message(MessageID::MSG_ID_SEND_FUNCTION_KEY, parcel); @@ -200,7 +200,7 @@ namespace MiscServices { void InputDataChannelStub::MoveCursor(int32_t keyCode) { IMSA_HILOGI("InputDataChannelStub::MoveCursor"); - if (msgHandler != nullptr) { + if (msgHandler) { MessageParcel *parcel = new MessageParcel; parcel->WriteInt32(keyCode); Message *msg = new Message(MessageID::MSG_ID_MOVE_CURSOR, parcel); diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index 8fba7ad..eab6588 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -32,7 +32,7 @@ using namespace MessageID; InputMethodController::~InputMethodController() { - if (msgHandler != nullptr) { + if (msgHandler) { delete msgHandler; msgHandler = nullptr; stop_ = false; @@ -41,9 +41,9 @@ using namespace MessageID; sptr InputMethodController::GetInstance() { - if (instance_ == nullptr) { + if (!instance_) { std::lock_guard autoLock(instanceLock_); - if (instance_ == nullptr) { + if (!instance_) { IMSA_HILOGI("InputMethodController::GetInstance instance_ is nullptr"); instance_ = new InputMethodController(); } @@ -77,18 +77,18 @@ using namespace MessageID; IMSA_HILOGI("InputMethodController::GetImsaProxy"); sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - if (systemAbilityManager == nullptr) { + if (!systemAbilityManager) { IMSA_HILOGI("InputMethodController::GetImsaProxy systemAbilityManager is nullptr"); return nullptr; } auto systemAbility = systemAbilityManager->GetSystemAbility(INPUT_METHOD_SYSTEM_ABILITY_ID, ""); - if (systemAbility == nullptr) { + if (!systemAbility) { IMSA_HILOGI("InputMethodController::GetImsaProxy systemAbility is nullptr"); return nullptr; } - if (deathRecipient_ == nullptr) { + if (!deathRecipient_) { deathRecipient_ = new ImsaDeathRecipient(); } systemAbility->AddDeathRecipient(deathRecipient_); @@ -106,7 +106,7 @@ using namespace MessageID; MessageParcel *data = msg->msgContent_; std::u16string text = data->ReadString16(); IMSA_HILOGI("InputMethodController::WorkThread InsertText"); - if (textListener != nullptr) { + if (textListener) { textListener->InsertText(text); } break; @@ -116,7 +116,7 @@ using namespace MessageID; MessageParcel *data = msg->msgContent_; int32_t length = data->ReadInt32(); IMSA_HILOGI("InputMethodController::WorkThread DeleteForward"); - if (textListener != nullptr) { + if (textListener) { textListener->DeleteForward(length); } break; @@ -125,7 +125,7 @@ using namespace MessageID; MessageParcel *data = msg->msgContent_; int32_t length = data->ReadInt32(); IMSA_HILOGI("InputMethodController::WorkThread DeleteBackward"); - if (textListener != nullptr) { + if (textListener) { textListener->DeleteBackward(length); } break; @@ -139,7 +139,7 @@ using namespace MessageID; case MSG_ID_ON_INPUT_READY: { MessageParcel *data = msg->msgContent_; sptr object = data->ReadRemoteObject(); - if (object != nullptr) { + if (object) { mAgent = new InputMethodAgentProxy(object); } break; @@ -157,7 +157,7 @@ using namespace MessageID; KeyboardInfo *info = new KeyboardInfo(); info->SetKeyboardStatus(ret); IMSA_HILOGI("InputMethodController::WorkThread SendKeyboardInfo"); - if (textListener != nullptr) { + if (textListener) { textListener->SendKeyboardInfo(*info); } delete info; @@ -169,7 +169,7 @@ using namespace MessageID; KeyboardInfo *info = new KeyboardInfo(); info->SetFunctionKey(ret); IMSA_HILOGI("InputMethodController::WorkThread SendKeyboardInfo"); - if (textListener != nullptr) { + if (textListener) { textListener->SendKeyboardInfo(*info); } delete info; @@ -179,7 +179,7 @@ using namespace MessageID; MessageParcel *data = msg->msgContent_; int32_t ret = data->ReadInt32(); IMSA_HILOGI("InputMethodController::WorkThread MoveCursor"); - if (textListener != nullptr) { + if (textListener) { Direction direction = static_cast(ret); textListener->MoveCursor(direction); } @@ -217,7 +217,7 @@ using namespace MessageID; void InputMethodController::HideCurrentInput() { IMSA_HILOGI("InputMethodController::HideCurrentInput"); - if (mImms == nullptr) { + if (!mImms) { return; } MessageParcel data; @@ -238,7 +238,7 @@ using namespace MessageID; sptr &channel, InputAttribute &attribute) { IMSA_HILOGI("InputMethodController::PrepareInput"); - if (mImms == nullptr) { + if (!mImms) { return; } MessageParcel data; @@ -255,7 +255,7 @@ using namespace MessageID; void InputMethodController::DisplayOptionalInputMethod() { IMSA_HILOGI("InputMethodController::DisplayOptionalInputMethod"); - if (mImms == nullptr) { + if (!mImms) { return; } MessageParcel data; @@ -269,7 +269,7 @@ using namespace MessageID; { IMSA_HILOGI("InputMethodController::listInputMethod"); std::vector properties; - if (mImms == nullptr) { + if (!mImms) { return properties; } mImms->listInputMethod(&properties); @@ -279,7 +279,7 @@ using namespace MessageID; void InputMethodController::StartInput(sptr &client) { IMSA_HILOGI("InputMethodController::StartInput"); - if (mImms == nullptr) { + if (!mImms) { return; } MessageParcel data; @@ -293,7 +293,7 @@ using namespace MessageID; void InputMethodController::ReleaseInput(sptr &client) { IMSA_HILOGI("InputMethodController::ReleaseInput"); - if (mImms == nullptr) { + if (!mImms) { return; } MessageParcel data; @@ -307,7 +307,7 @@ using namespace MessageID; void InputMethodController::StopInput(sptr &client) { IMSA_HILOGI("InputMethodController::StopInput"); - if (mImms == nullptr) { + if (!mImms) { return; } MessageParcel data; @@ -334,7 +334,7 @@ using namespace MessageID; void InputMethodController::OnCursorUpdate(CursorInfo cursorInfo) { - if (mAgent == nullptr) { + if (!mAgent) { IMSA_HILOGI("InputMethodController::OnCursorUpdate mAgent is nullptr"); return; } @@ -358,7 +358,7 @@ using namespace MessageID; mSelectOldEnd = mSelectNewEnd; mSelectNewBegin = start; mSelectNewEnd = end; - if (mAgent == nullptr) { + if (!mAgent) { IMSA_HILOGI("InputMethodController::OnSelectionChange mAgent is nullptr"); return; } @@ -395,7 +395,7 @@ using namespace MessageID; bool InputMethodController::dispatchKeyEvent(std::shared_ptr keyEvent) { IMSA_HILOGI("InputMethodController::dispatchKeyEvent"); - if (mAgent == nullptr) { + if (!mAgent) { IMSA_HILOGI("InputMethodController::dispatchKeyEvent mAgent is nullptr"); return false; } diff --git a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp index b61194b..540861f 100644 --- a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp +++ b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp @@ -120,7 +120,7 @@ namespace MiscServices { IMSA_HILOGI("InputMethodSystemAbilityProxy::SetCoreAndAgent"); auto remote = Remote(); - if (remote == nullptr) { + if (!remote) { return; } MessageParcel reply; @@ -307,7 +307,7 @@ namespace MiscServices { int32_t InputMethodSystemAbilityProxy::getCurrentKeyboardType(KeyboardType *retType) { - if (retType == nullptr) { + if (!retType) { return ERROR_NULL_POINTER; } @@ -329,7 +329,7 @@ namespace MiscServices { } KeyboardType *keyType = reply.ReadParcelable(); - if (keyType == nullptr) { + if (!keyType) { return ERROR_NULL_POINTER; } *retType = *keyType; @@ -340,7 +340,7 @@ namespace MiscServices { int32_t InputMethodSystemAbilityProxy::listInputMethodEnabled(std::vector *properties) { - if (properties == nullptr) { + if (!properties) { return ERROR_NULL_POINTER; } @@ -373,7 +373,7 @@ namespace MiscServices { int32_t InputMethodSystemAbilityProxy::listInputMethod(std::vector *properties) { - if (properties == nullptr) { + if (!properties) { return ERROR_NULL_POINTER; } @@ -408,7 +408,7 @@ namespace MiscServices { int32_t InputMethodSystemAbilityProxy::listKeyboardType(const std::u16string& imeId, std::vector *types) { - if (types == nullptr) { + if (!types) { return ERROR_NULL_POINTER; } diff --git a/interfaces/kits/js/napi/inputmethod/include/js_input_method_controller.h b/interfaces/kits/js/napi/inputmethod/include/js_input_method_controller.h index e2229f6..3e27e23 100644 --- a/interfaces/kits/js/napi/inputmethod/include/js_input_method_controller.h +++ b/interfaces/kits/js/napi/inputmethod/include/js_input_method_controller.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_CONTROLLER_H -#define OHOS_MISCSERVICES_JS_INPUT_METHOD_CONTROLLER_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_CONTROLLER_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_CONTROLLER_H #include "native_engine/native_engine.h" #include "native_engine/native_value.h" #include "global.h" diff --git a/interfaces/kits/js/napi/inputmethod/include/js_input_method_registry.h b/interfaces/kits/js/napi/inputmethod/include/js_input_method_registry.h index 43fdc2b..e4aa6f8 100644 --- a/interfaces/kits/js/napi/inputmethod/include/js_input_method_registry.h +++ b/interfaces/kits/js/napi/inputmethod/include/js_input_method_registry.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_REGISTRY_H -#define OHOS_MISCSERVICES_JS_INPUT_METHOD_REGISTRY_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_REGISTRY_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_REGISTRY_H #include "native_engine/native_engine.h" #include "native_engine/native_value.h" diff --git a/interfaces/kits/js/napi/inputmethod/include/js_input_method_setting.h b/interfaces/kits/js/napi/inputmethod/include/js_input_method_setting.h index 14a3ac0..700f2e1 100644 --- a/interfaces/kits/js/napi/inputmethod/include/js_input_method_setting.h +++ b/interfaces/kits/js/napi/inputmethod/include/js_input_method_setting.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_SETTING_H -#define OHOS_MISCSERVICES_JS_INPUT_METHOD_SETTING_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_SETTING_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_SETTING_H #include "native_engine/native_engine.h" #include "native_engine/native_value.h" #include "global.h" diff --git a/interfaces/kits/js/napi/inputmethod/include/js_input_method_utils.h b/interfaces/kits/js/napi/inputmethod/include/js_input_method_utils.h index 76f3b67..071ab03 100644 --- a/interfaces/kits/js/napi/inputmethod/include/js_input_method_utils.h +++ b/interfaces/kits/js/napi/inputmethod/include/js_input_method_utils.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_UTILS_H -#define OHOS_MISCSERVICES_JS_INPUT_METHOD_UTILS_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_UTILS_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_UTILS_H #include "native_engine/native_engine.h" #include "native_engine/native_value.h" #include "global.h" diff --git a/interfaces/kits/js/napi/inputmethod/src/js_input_method_registry.cpp b/interfaces/kits/js/napi/inputmethod/src/js_input_method_registry.cpp index e6c5d4a..a0219b1 100644 --- a/interfaces/kits/js/napi/inputmethod/src/js_input_method_registry.cpp +++ b/interfaces/kits/js/napi/inputmethod/src/js_input_method_registry.cpp @@ -86,13 +86,13 @@ namespace MiscServices { { IMSA_HILOGI("JsInputMethodRegistryInit() is called!"); - if (engine == nullptr || exportObj == nullptr) { + if (!engine || !exportObj) { IMSA_HILOGI("engine or exportObj null"); return nullptr; } NativeObject* object = ConvertNativeValueTo(exportObj); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("object null"); return nullptr; } diff --git a/interfaces/kits/js/napi/inputmethod/src/js_input_method_setting.cpp b/interfaces/kits/js/napi/inputmethod/src/js_input_method_setting.cpp index 71c41eb..4f11f93 100644 --- a/interfaces/kits/js/napi/inputmethod/src/js_input_method_setting.cpp +++ b/interfaces/kits/js/napi/inputmethod/src/js_input_method_setting.cpp @@ -64,7 +64,7 @@ namespace MiscServices { } std::vector properties = InputMethodController::GetInstance()->ListInputMethod(); - if (properties.size() == 0) { + if (!properties.size()) { IMSA_HILOGI("JsInputMethodSetting::ListInputMethod has no ime"); return engine.CreateUndefined(); } diff --git a/interfaces/kits/js/napi/inputmethod/src/js_input_method_utils.cpp b/interfaces/kits/js/napi/inputmethod/src/js_input_method_utils.cpp index 5e641f4..c8ad6bd 100644 --- a/interfaces/kits/js/napi/inputmethod/src/js_input_method_utils.cpp +++ b/interfaces/kits/js/napi/inputmethod/src/js_input_method_utils.cpp @@ -28,7 +28,7 @@ namespace OHOS { IMSA_HILOGI("JsInputMethodUtils::CreateInputMethodSetting is called"); NativeValue *objValue = engine.CreateObject(); NativeObject *object = ConvertNativeValueTo(objValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("JsInputMethodUtils::CreateInputMethodSetting Failed to get object"); return nullptr; } @@ -46,7 +46,7 @@ namespace OHOS { IMSA_HILOGI("JsInputMethodUtils::CreateInputMethodController is called"); NativeValue *objValue = engine.CreateObject(); NativeObject *object = ConvertNativeValueTo(objValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("JsInputMethodUtils::CreateInputMethodController Failed to get object"); return nullptr; } diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_editor_attribute.h b/interfaces/kits/js/napi/inputmethodengine/include/js_editor_attribute.h index 123aa40..9cc73a0 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_editor_attribute.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_editor_attribute.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_EDITOR_ATTRIBUTE_H -#define OHOS_MISCSERVICES_JS_EDITOR_ATTRIBUTE_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_EDITOR_ATTRIBUTE_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_EDITOR_ATTRIBUTE_H #include "native_engine/native_engine.h" #include "native_engine/native_value.h" #include "js_runtime_utils.h" diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine.h b/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine.h index 7aa29fc..716c809 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_H -#define OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_H #include "js_runtime_utils.h" #include "native_engine/native_engine.h" diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_listener.h b/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_listener.h index c4bdc37..d942b4c 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_listener.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_listener.h @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_JS_INPUT_METHOD_ENGINE_LISTENER_H -#define FM_IMMS_PROJECT_JS_INPUT_METHOD_ENGINE_LISTENER_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_LISTENER_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_LISTENER_H #include #include diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_registry.h b/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_registry.h index 5fa1cad..bf393bc 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_registry.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_registry.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_REGISTRY_H -#define OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_REGISTRY_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_REGISTRY_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_REGISTRY_H #include "native_engine/native_engine.h" #include "native_engine/native_value.h" diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_utils.h b/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_utils.h index bfb7c0e..4cce377 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_utils.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_input_method_engine_utils.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_UTILS_H -#define OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_UTILS_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_UTILS_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_UTILS_H #include "js_runtime_utils.h" #include "native_engine/native_engine.h" diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_controller.h b/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_controller.h index 7ad9dc8..4a59cca 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_controller.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_controller.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_KEYBOARD_CONTROLLER_H -#define OHOS_MISCSERVICES_JS_KEYBOARD_CONTROLLER_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_CONTROLLER_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_CONTROLLER_H #include "native_engine/native_engine.h" #include "native_engine/native_value.h" #include "js_runtime_utils.h" diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_delegate.h b/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_delegate.h index 3305b06..5605ad3 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_delegate.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_delegate.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_KEYBOARD_DELEGATE_H -#define OHOS_MISCSERVICES_JS_KEYBOARD_DELEGATE_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_DELEGATE_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_DELEGATE_H #include "js_runtime_utils.h" #include "native_engine/native_engine.h" diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_delegate_listener.h b/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_delegate_listener.h index dc07ceb..38e4a62 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_delegate_listener.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_keyboard_delegate_listener.h @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_JS_KEYBOARD_DELEGATE_LISTENER_H -#define FM_IMMS_PROJECT_JS_KEYBOARD_DELEGATE_LISTENER_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_DELEGATE_LISTENER_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_DELEGATE_LISTENER_H #include #include diff --git a/interfaces/kits/js/napi/inputmethodengine/include/js_text_input_client.h b/interfaces/kits/js/napi/inputmethodengine/include/js_text_input_client.h index d52fa78..9caac29 100644 --- a/interfaces/kits/js/napi/inputmethodengine/include/js_text_input_client.h +++ b/interfaces/kits/js/napi/inputmethodengine/include/js_text_input_client.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_MISCSERVICES_JS_TEXT_INPUT_CLIENT_H -#define OHOS_MISCSERVICES_JS_TEXT_INPUT_CLIENT_H +#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_TEXT_INPUT_CLIENT_H +#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_TEXT_INPUT_CLIENT_H #include "native_engine/native_engine.h" #include "native_engine/native_value.h" #include "js_runtime_utils.h" diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine.cpp index 759e30a..236073e 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine.cpp @@ -52,13 +52,13 @@ namespace MiscServices { NativeValue* JsInputMethodEngine::RegisterCallback(NativeEngine* engine, NativeCallbackInfo* info) { JsInputMethodEngine* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnRegisterCallback(*engine, *info) : nullptr; + return (me) ? me->OnRegisterCallback(*engine, *info) : nullptr; } NativeValue* JsInputMethodEngine::UnRegisterCallback(NativeEngine* engine, NativeCallbackInfo* info) { JsInputMethodEngine* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnUnRegisterCallback(*engine, *info) : nullptr; + return (me) ? me->OnUnRegisterCallback(*engine, *info) : nullptr; } NativeValue* JsInputMethodEngine::OnRegisterCallback(NativeEngine& engine, NativeCallbackInfo& info) @@ -83,7 +83,7 @@ namespace MiscServices { NativeValue* JsInputMethodEngine::OnUnRegisterCallback(NativeEngine& engine, NativeCallbackInfo& info) { IMSA_HILOGI("JsInputMethodEngine::OnUnRegisterCallback is called!"); - if (info.argc == 0) { + if (!info.argc) { IMSA_HILOGI("JsInputMethodEngine::OnUnRegisterCallback Params not match"); return engine.CreateUndefined(); } diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_listener.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_listener.cpp index 09887c0..b3f66fd 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_listener.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_listener.cpp @@ -106,7 +106,7 @@ namespace MiscServices { void JsInputMethodEngineListener::CallJsMethod(std::string methodName, NativeValue* const* argv, size_t argc) { IMSA_HILOGI("JsInputMethodEngineListener::CallJsMethod"); - if (engine_ == nullptr) { + if (!engine_) { IMSA_HILOGI("engine_ nullptr"); return; } @@ -125,7 +125,7 @@ namespace MiscServices { NativeValue* const* argv, size_t argc) { IMSA_HILOGI("JsInputMethodEngineListener::CallJsMethodReturnBool"); - if (engine_ == nullptr) { + if (!engine_) { IMSA_HILOGI("engine_ nullptr"); return false; } @@ -154,7 +154,7 @@ namespace MiscServices { auto task = [this, isShow] () { NativeValue* nativeValue = engine_->CreateObject(); NativeObject* object = ConvertNativeValueTo < NativeObject >(nativeValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("Failed to convert rect to jsObject"); return; } diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_registry.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_registry.cpp index 207e3a9..d671378 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_registry.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_registry.cpp @@ -48,19 +48,19 @@ namespace MiscServices { static NativeValue* GetInputMethodEngine(NativeEngine* engine, NativeCallbackInfo* info) { JsInputMethodEngineRegistry* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnGetInputMethodEngine(*engine, *info) : nullptr; + return (me) ? me->OnGetInputMethodEngine(*engine, *info) : nullptr; } static NativeValue* GetKeyboardDelegate(NativeEngine* engine, NativeCallbackInfo* info) { JsInputMethodEngineRegistry* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnGetKeyboardDelegate(*engine, *info) : nullptr; + return (me) ? me->OnGetKeyboardDelegate(*engine, *info) : nullptr; } static NativeValue* MoveCursor(NativeEngine* engine, NativeCallbackInfo* info) { JsInputMethodEngineRegistry* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnMoveCursor(*engine, *info) : nullptr; + return (me) ? me->OnMoveCursor(*engine, *info) : nullptr; } private: NativeValue* OnGetInputMethodEngine(NativeEngine& engine, NativeCallbackInfo& info) @@ -114,13 +114,13 @@ namespace MiscServices { { IMSA_HILOGI("JsInputMethodEngineRegistryInit() is called!"); - if (engine == nullptr || exportObj == nullptr) { + if (!engine || !exportObj) { IMSA_HILOGI("engine or exportObj null"); return nullptr; } NativeObject* object = ConvertNativeValueTo(exportObj); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("object null"); return nullptr; } diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_utils.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_utils.cpp index a97b2ad..92d5c54 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_utils.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_input_method_engine_utils.cpp @@ -32,7 +32,7 @@ namespace OHOS { IMSA_HILOGI("JsInputMethodEngineUtils::CreateInputMethodEngine is called"); NativeValue *objValue = engine.CreateObject(); NativeObject *object = ConvertNativeValueTo(objValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("JsInputMethodEngineUtils::CreateInputMethodEngine Failed to get object"); return nullptr; } @@ -50,7 +50,7 @@ namespace OHOS { IMSA_HILOGI("JsInputMethodEngineUtils::CreateKeyboardController is called"); NativeValue *objValue = engine.CreateObject(); NativeObject *object = ConvertNativeValueTo(objValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("CreateKeyboardController Failed to get object"); return nullptr; } @@ -68,7 +68,7 @@ namespace OHOS { IMSA_HILOGI("JsInputMethodEngineUtils::CreateTextInputClient is called"); NativeValue *objValue = engine.CreateObject(); NativeObject *object = ConvertNativeValueTo(objValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("CreateTextInputClient Failed to get object"); return nullptr; } @@ -91,7 +91,7 @@ namespace OHOS { IMSA_HILOGI("JsInputMethodEngineUtils::CreateKeyboardDelegate is called"); NativeValue *objValue = engine.CreateObject(); NativeObject *object = ConvertNativeValueTo(objValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("CreateKeyboardDelegate Failed to get object"); return nullptr; } @@ -109,7 +109,7 @@ namespace OHOS { IMSA_HILOGI("JsInputMethodEngineUtils::CreateEditorAttribute is called"); NativeValue *objValue = engine.CreateObject(); NativeObject *object = ConvertNativeValueTo(objValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("CreateEditorAttribute Failed to get object"); return nullptr; } diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_controller.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_controller.cpp index 4f2c7e9..70bdca9 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_controller.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_controller.cpp @@ -33,7 +33,7 @@ namespace MiscServices { NativeValue* JsKeyboardController::HideKeyboardSelf(NativeEngine* engine, NativeCallbackInfo* info) { JsKeyboardController* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnHideKeyboardSelf(*engine, *info) : nullptr; + return (me) ? me->OnHideKeyboardSelf(*engine, *info) : nullptr; } NativeValue* JsKeyboardController::OnHideKeyboardSelf(NativeEngine& engine, NativeCallbackInfo& info) diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_delegate.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_delegate.cpp index 74f4640..666b40f 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_delegate.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_delegate.cpp @@ -52,13 +52,13 @@ namespace MiscServices { NativeValue* JsKeyboardDelegate::RegisterCallback(NativeEngine* engine, NativeCallbackInfo* info) { JsKeyboardDelegate* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnRegisterCallback(*engine, *info) : nullptr; + return (me) ? me->OnRegisterCallback(*engine, *info) : nullptr; } NativeValue* JsKeyboardDelegate::UnRegisterCallback(NativeEngine* engine, NativeCallbackInfo* info) { JsKeyboardDelegate* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnUnRegisterCallback(*engine, *info) : nullptr; + return (me) ? me->OnUnRegisterCallback(*engine, *info) : nullptr; } NativeValue* JsKeyboardDelegate::OnRegisterCallback(NativeEngine& engine, NativeCallbackInfo& info) @@ -83,7 +83,7 @@ namespace MiscServices { NativeValue* JsKeyboardDelegate::OnUnRegisterCallback(NativeEngine& engine, NativeCallbackInfo& info) { IMSA_HILOGI("JsKeyboardDelegate::OnUnRegisterCallback is called!"); - if (info.argc == 0) { + if (!info.argc) { IMSA_HILOGI("JsKeyboardDelegate::OnUnRegisterCallback Params not match"); return engine.CreateUndefined(); } diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_delegate_listener.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_delegate_listener.cpp index 0d6985f..decd009 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_delegate_listener.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_keyboard_delegate_listener.cpp @@ -104,7 +104,7 @@ namespace MiscServices { void JsKeyboardDelegateListener::CallJsMethod(std::string methodName, NativeValue* const* argv, size_t argc) { IMSA_HILOGI("JsKeyboardDelegateListener::CallJsMethod"); - if (engine_ == nullptr) { + if (!engine_) { IMSA_HILOGI("engine_ nullptr"); return; } @@ -123,7 +123,7 @@ namespace MiscServices { NativeValue* const* argv, size_t argc) { IMSA_HILOGI("JsKeyboardDelegateListener::CallJsMethodReturnBool"); - if (engine_ == nullptr) { + if (!engine_) { IMSA_HILOGI("engine_ nullptr"); return false; } @@ -153,7 +153,7 @@ namespace MiscServices { auto task = [this, keyCode, keyStatus, &result] () { NativeValue* nativeValue = engine_->CreateObject(); NativeObject* object = ConvertNativeValueTo(nativeValue); - if (object == nullptr) { + if (!object) { IMSA_HILOGI("Failed to convert rect to jsObject"); return; } diff --git a/interfaces/kits/js/napi/inputmethodengine/src/js_text_input_client.cpp b/interfaces/kits/js/napi/inputmethodengine/src/js_text_input_client.cpp index 5bd9bef..0f89bfb 100644 --- a/interfaces/kits/js/napi/inputmethodengine/src/js_text_input_client.cpp +++ b/interfaces/kits/js/napi/inputmethodengine/src/js_text_input_client.cpp @@ -36,43 +36,43 @@ namespace MiscServices { NativeValue* JsTextInputClient::InsertText(NativeEngine* engine, NativeCallbackInfo* info) { JsTextInputClient* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnInsertText(*engine, *info) : nullptr; + return (me) ? me->OnInsertText(*engine, *info) : nullptr; } NativeValue* JsTextInputClient::DeleteForward(NativeEngine* engine, NativeCallbackInfo* info) { JsTextInputClient* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnDeleteForward(*engine, *info) : nullptr; + return (me) ? me->OnDeleteForward(*engine, *info) : nullptr; } NativeValue* JsTextInputClient::DeleteBackward(NativeEngine* engine, NativeCallbackInfo* info) { JsTextInputClient* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnDeleteBackward(*engine, *info) : nullptr; + return (me) ? me->OnDeleteBackward(*engine, *info) : nullptr; } NativeValue* JsTextInputClient::SendFunctionKey(NativeEngine* engine, NativeCallbackInfo* info) { JsTextInputClient* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnSendFunctionKey(*engine, *info) : nullptr; + return (me) ? me->OnSendFunctionKey(*engine, *info) : nullptr; } NativeValue* JsTextInputClient::GetForward(NativeEngine* engine, NativeCallbackInfo* info) { JsTextInputClient* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnGetForward(*engine, *info) : nullptr; + return (me) ? me->OnGetForward(*engine, *info) : nullptr; } NativeValue* JsTextInputClient::GetBackward(NativeEngine* engine, NativeCallbackInfo* info) { JsTextInputClient* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnGetBackward(*engine, *info) : nullptr; + return (me) ? me->OnGetBackward(*engine, *info) : nullptr; } NativeValue* JsTextInputClient::GetEditorAttribute(NativeEngine* engine, NativeCallbackInfo* info) { JsTextInputClient* me = CheckParamsAndGetThis(engine, info); - return (me != nullptr) ? me->OnGetEditorAttribute(*engine, *info) : nullptr; + return (me) ? me->OnGetEditorAttribute(*engine, *info) : nullptr; } NativeValue* JsTextInputClient::OnInsertText(NativeEngine& engine, NativeCallbackInfo& info) diff --git a/services/dialog/js/pages/index/index.css b/services/dialog/js/pages/index/index.css index 31db677..5ec55c0 100644 --- a/services/dialog/js/pages/index/index.css +++ b/services/dialog/js/pages/index/index.css @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + .container { display: flex; flex-direction: column; diff --git a/services/dialog/js/pages/index/index.hml b/services/dialog/js/pages/index/index.hml index 797f5c2..69f546f 100644 --- a/services/dialog/js/pages/index/index.hml +++ b/services/dialog/js/pages/index/index.hml @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +
{{ dialogTitle }} @@ -8,7 +23,7 @@
{{ $item.label }} - {{ $item.discription }} + {{ $item.description }}
diff --git a/services/dialog/js/pages/index/index.js b/services/dialog/js/pages/index/index.js index bce8ed6..181ae48 100644 --- a/services/dialog/js/pages/index/index.js +++ b/services/dialog/js/pages/index/index.js @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import router from '@ohos.router' export default { diff --git a/services/include/global.h b/services/include/global.h index 9b45a63..dc2db6e 100644 --- a/services/include/global.h +++ b/services/include/global.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_GLOBAL_H -#define FM_IMMS_PROJECT_GLOBAL_H +#ifndef SERVICES_INCLUDE_GLOBAL_H +#define SERVICES_INCLUDE_GLOBAL_H #include #include @@ -31,8 +31,6 @@ namespace MiscServices { using BRemoteObject = IPCObjectStub; -#define INPUTMETHOD_DEBUG 0 - #define LOG_INFO(fmt, args...) \ LogTimeStamp(); printf("I %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args) diff --git a/services/include/i_input_control_channel.h b/services/include/i_input_control_channel.h index 653ff5b..b82b65e 100644 --- a/services/include/i_input_control_channel.h +++ b/services/include/i_input_control_channel.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IINPUTCONTROLCHANNEL_H -#define FM_IMMS_PROJECT_IINPUTCONTROLCHANNEL_H +#ifndef SERVICES_INCLUDE_I_INPUT_CONTROL_CHANNEL_H +#define SERVICES_INCLUDE_I_INPUT_CONTROL_CHANNEL_H #include "iremote_broker.h" #include "input_channel.h" diff --git a/services/include/i_input_method_system_ability.h b/services/include/i_input_method_system_ability.h index 9511baf..8319cd3 100644 --- a/services/include/i_input_method_system_ability.h +++ b/services/include/i_input_method_system_ability.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IINPUTMETHODSYSTEMABILITY_H -#define FM_IMMS_PROJECT_IINPUTMETHODSYSTEMABILITY_H +#ifndef SERVICES_INCLUDE_I_INPUT_METHOD_SYSTEM_ABILITY_H +#define SERVICES_INCLUDE_I_INPUT_METHOD_SYSTEM_ABILITY_H #include #include diff --git a/services/include/i_platform_api.h b/services/include/i_platform_api.h index b9ab913..b701fc7 100644 --- a/services/include/i_platform_api.h +++ b/services/include/i_platform_api.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IPLATFORMAPI_H -#define FM_IMMS_PROJECT_IPLATFORMAPI_H +#ifndef SERVICES_INCLUDE_I_PLATFORM_API_H +#define SERVICES_INCLUDE_I_PLATFORM_API_H #include #include diff --git a/services/include/i_platform_callback.h b/services/include/i_platform_callback.h index 4b79db7..970cecc 100644 --- a/services/include/i_platform_callback.h +++ b/services/include/i_platform_callback.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IPLATFORMCALLBACK_H -#define FM_IMMS_PROJECT_IPLATFORMCALLBACK_H +#ifndef SERVICES_INCLUDE_I_PLATFORM_CALLBACK_H +#define SERVICES_INCLUDE_I_PLATFORM_CALLBACK_H #include #include diff --git a/services/include/im_common_event_manager.h b/services/include/im_common_event_manager.h index 14e7741..ec9d425 100644 --- a/services/include/im_common_event_manager.h +++ b/services/include/im_common_event_manager.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_IMCOMMONEVENTMANAGER_H -#define FM_IMMS_PROJECT_IMCOMMONEVENTMANAGER_H +#ifndef SERVICES_INCLUDE_IM_COMMON_EVENT_MANAGER_H +#define SERVICES_INCLUDE_IM_COMMON_EVENT_MANAGER_H #include #include "common_event_subscriber.h" diff --git a/services/include/input_attribute.h b/services/include/input_attribute.h index 36f4f29..b6b39b4 100644 --- a/services/include/input_attribute.h +++ b/services/include/input_attribute.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTATTRIBUTE_H -#define FM_IMMS_PROJECT_INPUTATTRIBUTE_H +#ifndef SERVICES_INCLUDE_INPUT_ATTRIBUTE_H +#define SERVICES_INCLUDE_INPUT_ATTRIBUTE_H #include "parcel.h" namespace OHOS { diff --git a/services/include/input_channel.h b/services/include/input_channel.h index 43f15c5..254ae4a 100644 --- a/services/include/input_channel.h +++ b/services/include/input_channel.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT__INPUTCHANNEL_H -#define FM_IMMS_PROJECT__INPUTCHANNEL_H +#ifndef SERVICES_INCLUDE_INPUT_CHANNEL_H +#define SERVICES_INCLUDE_INPUT_CHANNEL_H #include #include "parcel.h" #include "global.h" diff --git a/services/include/input_control_channel_proxy.h b/services/include/input_control_channel_proxy.h index aa85bda..27e7f81 100644 --- a/services/include/input_control_channel_proxy.h +++ b/services/include/input_control_channel_proxy.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTCONTROLCHANNELPROXY_H -#define FM_IMMS_PROJECT_INPUTCONTROLCHANNELPROXY_H +#ifndef SERVICES_INCLUDE_INPUT_CONTROL_CHANNEL_PROXY_H +#define SERVICES_INCLUDE_INPUT_CONTROL_CHANNEL_PROXY_H #include "parcel.h" #include "iremote_broker.h" diff --git a/services/include/input_control_channel_stub.h b/services/include/input_control_channel_stub.h index dd52ac0..6d5f7fe 100644 --- a/services/include/input_control_channel_stub.h +++ b/services/include/input_control_channel_stub.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTCONTROLCHANNELSTUB_H -#define FM_IMMS_PROJECT_INPUTCONTROLCHANNELSTUB_H +#ifndef SERVICES_INCLUDE_INPUT_CONTROL_CHANNEL_STUB_H +#define SERVICES_INCLUDE_INPUT_CONTROL_CHANNEL_STUB_H #include #include diff --git a/services/include/input_method_ability_connection_stub.h b/services/include/input_method_ability_connection_stub.h index 295c533..c6f8cfc 100644 --- a/services/include/input_method_ability_connection_stub.h +++ b/services/include/input_method_ability_connection_stub.h @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef SERVICES_INPUTMETHODABILITYCONNECTIONSTUB_H -#define SERVICES_INPUTMETHODABILITYCONNECTIONSTUB_H +#ifndef SERVICES_INCLUDE_INPUT_METHOD_ABILITY_CONNECTION_STUB_H +#define SERVICES_INCLUDE_INPUT_METHOD_ABILITY_CONNECTION_STUB_H #include "ability_connect_callback_stub.h" #include "want.h" #include "element_name.h" diff --git a/services/include/input_method_property.h b/services/include/input_method_property.h index da0e5f7..8602692 100644 --- a/services/include/input_method_property.h +++ b/services/include/input_method_property.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTMETHODPROPERTY_H -#define FM_IMMS_PROJECT_INPUTMETHODPROPERTY_H +#ifndef SERVICES_INCLUDE_INPUT_METHOD_PROPERTY_H +#define SERVICES_INCLUDE_INPUT_METHOD_PROPERTY_H #include #include #include "parcel.h" diff --git a/services/include/input_method_setting.h b/services/include/input_method_setting.h index 5ede921..060968a 100644 --- a/services/include/input_method_setting.h +++ b/services/include/input_method_setting.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTMETHODSETTING_H -#define FM_IMMS_PROJECT_INPUTMETHODSETTING_H +#ifndef SERVICES_INCLUDE_INPUT_METHOD_SETTING_H +#define SERVICES_INCLUDE_INPUT_METHOD_SETTING_H #include #include #include "string.h" diff --git a/services/include/input_method_system_ability.h b/services/include/input_method_system_ability.h index 12940fc..9f434a8 100644 --- a/services/include/input_method_system_ability.h +++ b/services/include/input_method_system_ability.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTMETHODSYSTEMABILITY_H -#define FM_IMMS_PROJECT_INPUTMETHODSYSTEMABILITY_H +#ifndef SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_H +#define SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_H #include #include diff --git a/services/include/input_method_system_ability_stub.h b/services/include/input_method_system_ability_stub.h index 7e6e91f..ee18380 100644 --- a/services/include/input_method_system_ability_stub.h +++ b/services/include/input_method_system_ability_stub.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_INPUTMETHODSYSTEMABILITY_SK_H -#define FM_IMMS_PROJECT_INPUTMETHODSYSTEMABILITY_SK_H +#ifndef SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H +#define SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H #include #include "refbase.h" #include "i_input_method_system_ability.h" diff --git a/services/include/keyboard_type.h b/services/include/keyboard_type.h index 9d14aeb..7344362 100644 --- a/services/include/keyboard_type.h +++ b/services/include/keyboard_type.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_KEYBOARDTYPE_H -#define FM_IMMS_PROJECT_KEYBOARDTYPE_H +#ifndef SERVICES_INCLUDE_KEYBOARD_TYPE_H +#define SERVICES_INCLUDE_KEYBOARD_TYPE_H #include #include diff --git a/services/include/message.h b/services/include/message.h index 8073b49..47815a1 100644 --- a/services/include/message.h +++ b/services/include/message.h @@ -14,8 +14,8 @@ */ /*! \file MessageHandler.h */ -#ifndef FM_IMMS_PROJECT_MESSAGE_H -#define FM_IMMS_PROJECT_MESSAGE_H +#ifndef SERVICES_INCLUDE_MESSAGE_H +#define SERVICES_INCLUDE_MESSAGE_H #include "global.h" #include "message_parcel.h" diff --git a/services/include/message_handler.h b/services/include/message_handler.h index 672374e..8c00a8e 100644 --- a/services/include/message_handler.h +++ b/services/include/message_handler.h @@ -14,8 +14,8 @@ */ /*! \file MessageHandler.h */ -#ifndef FM_IMMS_PROJECT_MESSAGEHANDLER_H -#define FM_IMMS_PROJECT_MESSAGEHANDLER_H +#ifndef SERVICES_INCLUDE_MESSAGE_HANDLER_H +#define SERVICES_INCLUDE_MESSAGE_HANDLER_H #include #include diff --git a/services/include/peruser_session.h b/services/include/peruser_session.h index 936373a..10c992e 100644 --- a/services/include/peruser_session.h +++ b/services/include/peruser_session.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_PERUSERSESSION_H -#define FM_IMMS_PROJECT_PERUSERSESSION_H +#ifndef SERVICES_INCLUDE_PERUSER_SESSION_H +#define SERVICES_INCLUDE_PERUSER_SESSION_H #include #include diff --git a/services/include/peruser_setting.h b/services/include/peruser_setting.h index e73b82f..50546ab 100644 --- a/services/include/peruser_setting.h +++ b/services/include/peruser_setting.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_PERUSERSETTING_H -#define FM_IMMS_PROJECT_PERUSERSETTING_H +#ifndef SERVICES_INCLUDE_PERUSER_SETTING_H +#define SERVICES_INCLUDE_PERUSER_SETTING_H #include #include diff --git a/services/include/platform.h b/services/include/platform.h index 227bde4..d069241 100644 --- a/services/include/platform.h +++ b/services/include/platform.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_PLATFORMAPI_H -#define FM_IMMS_PROJECT_PLATFORMAPI_H +#ifndef SERVICES_INCLUDE_PLATFORM_H +#define SERVICES_INCLUDE_PLATFORM_H #include #include diff --git a/services/include/platform_callback_stub.h b/services/include/platform_callback_stub.h index a0cff16..deee786 100644 --- a/services/include/platform_callback_stub.h +++ b/services/include/platform_callback_stub.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef FM_IMMS_PROJECT_PLATFORMCALLBACK_SK_H -#define FM_IMMS_PROJECT_PLATFORMCALLBACK_SK_H +#ifndef SERVICES_INCLUDE_PLATFORM_CALLBACK_STUB_H +#define SERVICES_INCLUDE_PLATFORM_CALLBACK_STUB_H #include #include "iremote_stub.h" diff --git a/services/include/utils.h b/services/include/utils.h index 2c43c4b..df65aac 100644 --- a/services/include/utils.h +++ b/services/include/utils.h @@ -15,8 +15,8 @@ /*! \file utils.h */ -#ifndef FM_IMMS_PROJECT_UTILS_H -#define FM_IMMS_PROJECT_UTILS_H +#ifndef SERVICES_INCLUDE_UTILS_H +#define SERVICES_INCLUDE_UTILS_H #include #include diff --git a/services/src/im_common_event_manager.cpp b/services/src/im_common_event_manager.cpp index 31a628c..9585342 100644 --- a/services/src/im_common_event_manager.cpp +++ b/services/src/im_common_event_manager.cpp @@ -40,9 +40,9 @@ namespace MiscServices { sptr ImCommonEventManager::GetInstance() { - if (instance_ == nullptr) { + if (!instance_) { std::lock_guard autoLock(instanceLock_); - if (instance_ == nullptr) { + if (!instance_) { IMSA_HILOGI("ImCommonEventManager::GetInstance instance_ is nullptr"); instance_ = new ImCommonEventManager(); } @@ -58,7 +58,7 @@ namespace MiscServices { EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); std::shared_ptr subscriber = std::make_shared(subscriberInfo); - if (subscriber == nullptr) { + if (!subscriber) { IMSA_HILOGI("ImCommonEventManager::SubscribeEvent subscriber is nullptr"); return false; } diff --git a/services/src/input_attribute.cpp b/services/src/input_attribute.cpp index dfdc64d..8d9119a 100644 --- a/services/src/input_attribute.cpp +++ b/services/src/input_attribute.cpp @@ -89,10 +89,7 @@ namespace MiscServices { */ bool InputAttribute::GetSecurityFlag() { - if (inputPattern == PATTERN_PASSWORD) { - return true; - } - return false; + return inputPattern == PATTERN_PASSWORD; } /*! Set input pattern. diff --git a/services/src/input_method_ability_connection_stub.cpp b/services/src/input_method_ability_connection_stub.cpp index 20cdca4..1877569 100644 --- a/services/src/input_method_ability_connection_stub.cpp +++ b/services/src/input_method_ability_connection_stub.cpp @@ -32,7 +32,7 @@ namespace MiscServices { const sptr &remoteObject, int resultCode) { IMSA_HILOGE("ConnectAbility: OnAbilityConnectDone."); - if (messageHandler != nullptr) { + if (messageHandler) { MessageParcel *data = new MessageParcel(); data->WriteParcelable(&element); data->WriteRemoteObject(remoteObject); @@ -46,7 +46,7 @@ namespace MiscServices { int resultCode) { IMSA_HILOGE("ConnectAbility: OnAbilityDisconnectDone."); - if (messageHandler != nullptr) { + if (messageHandler) { MessageParcel *data = new MessageParcel(); data->WriteParcelable(&element); data->WriteInt32(mIndex); diff --git a/services/src/input_method_property.cpp b/services/src/input_method_property.cpp index 8d1ecc4..53bd881 100644 --- a/services/src/input_method_property.cpp +++ b/services/src/input_method_property.cpp @@ -103,7 +103,7 @@ namespace MiscServices { return false; int32_t size = (int32_t)mTypes.size(); parcel.WriteInt32(size); - if (size == 0) { + if (!size) { return true; } for (int i = 0; i < size; i++) { @@ -132,7 +132,7 @@ namespace MiscServices { info->description = parcel.ReadString16(); int32_t size = parcel.ReadInt32(); - if (size == 0) + if (!size) return info; for (int i = 0; i < size; i++) { info->mTypes.push_back(parcel.ReadParcelable()); diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index c4c3fb9..603a588 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -97,9 +97,9 @@ namespace MiscServices { sptr InputMethodSystemAbility::GetInstance() { - if (instance_ == nullptr) { + if (!instance_) { std::lock_guard autoLock(instanceLock_); - if (instance_ == nullptr) { + if (!instance_) { instance_ = new InputMethodSystemAbility; } } @@ -156,7 +156,7 @@ namespace MiscServices { void InputMethodSystemAbility::InitServiceHandler() { IMSA_HILOGI("InitServiceHandler started."); - if (serviceHandler_ != nullptr) { + if (serviceHandler_) { IMSA_HILOGI("InitServiceHandler already init."); return; } @@ -209,7 +209,7 @@ namespace MiscServices { if (it == msgHandlers.end()) { IMSA_HILOGE("InputMethodSystemAbility::StartInputService() need start handler"); MessageHandler *handler = new MessageHandler(); - if (session != nullptr) { + if (session) { IMSA_HILOGE("InputMethodSystemAbility::OnPrepareInput session is not nullptr"); session->CreateWorkThread(*handler); msgHandlers.insert(std::pair(MAIN_USER_ID, handler)); @@ -218,13 +218,13 @@ namespace MiscServices { bool isStartSuccess = false; sptr abms = GetAbilityManagerService(); - if (abms != nullptr) { + if (abms) { AAFwk::Want want; want.SetAction("action.system.inputmethod"); std::string::size_type pos = imeId.find("/"); want.SetElementName(imeId.substr(0, pos), imeId.substr(pos + 1)); int32_t result = abms->StartAbility(want); - if (result != 0) { + if (result) { IMSA_HILOGE("InputMethodSystemAbility::StartInputService fail. result = %{public}d", result); isStartSuccess = false; } else { @@ -243,7 +243,7 @@ namespace MiscServices { { IMSA_HILOGE("InputMethodSystemAbility::StopInputService(%{public}s)", imeId.c_str()); PerUserSession *session = GetUserSession(MAIN_USER_ID); - if (session == nullptr){ + if (!session){ IMSA_HILOGE("InputMethodSystemAbility::StopInputService abort session is nullptr"); return; } @@ -259,7 +259,7 @@ namespace MiscServices { int32_t InputMethodSystemAbility::GetUserState(int32_t userId) { PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr) { + if (!setting) { return UserState::USER_STATE_NOT_AVAILABLE; } return setting->GetUserState(); @@ -290,7 +290,7 @@ namespace MiscServices { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -309,7 +309,7 @@ namespace MiscServices { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -333,17 +333,17 @@ namespace MiscServices { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } PerUserSession *userSession = GetUserSession(userId); - if (userSession == nullptr) { + if (user!session) { return ErrorCode::ERROR_NULL_POINTER; } KeyboardType *type = userSession->GetCurrentKeyboardType(); - if (type == nullptr) { + if (!type) { return ErrorCode::ERROR_NULL_POINTER; } *retType = *type; @@ -361,7 +361,7 @@ namespace MiscServices { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -400,7 +400,7 @@ namespace MiscServices { } for (auto extension : extensionInfos) { std::shared_ptr resourceManager(Global::Resource::CreateResourceManager()); - if (resourceManager == nullptr) { + if (!resourceManager) { IMSA_HILOGI("InputMethodSystemAbility::listInputMethodByUserId resourcemanager is nullptr"); break; } @@ -434,7 +434,7 @@ namespace MiscServices { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -540,7 +540,7 @@ namespace MiscServices { Message *destMsg = new Message(MSG_ID_EXIT_SERVICE, nullptr); handler->SendMessage(destMsg); PerUserSession *userSession = GetUserSession(it->first); - if (userSession == nullptr) { + if (user!session) { IMSA_HILOGE("getUserSession fail."); return; } @@ -568,7 +568,7 @@ namespace MiscServices { int32_t InputMethodSystemAbility::OnUserStarted(const Message *msg) { IMSA_HILOGI("InputMethodSystemAbility::OnUserStarted Start...\n"); - if (msg->msgContent_ == nullptr) { + if (!msg->msgContent_) { IMSA_HILOGE("Aborted! %s\n", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS)); return ErrorCode::ERROR_BAD_PARAMETERS; } @@ -585,7 +585,7 @@ namespace MiscServices { } PerUserSetting *setting = GetUserSetting(userId); - if (setting != nullptr) { + if (setting) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_ALREADY_STARTED), userId); return ErrorCode::ERROR_USER_ALREADY_STARTED; } @@ -607,14 +607,14 @@ namespace MiscServices { int32_t InputMethodSystemAbility::OnUserStopped(const Message *msg) { IMSA_HILOGI("Start...\n"); - if (msg->msgContent_ == nullptr) { + if (!msg->msgContent_) { IMSA_HILOGE("Aborted! %s\n", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS)); return ErrorCode::ERROR_BAD_PARAMETERS; } int32_t userId = msg->msgContent_->ReadInt32(); PerUserSetting *setting = GetUserSetting(userId); PerUserSession *session = GetUserSession(userId); - if (setting == nullptr || session == nullptr) { + if (!setting || !session) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_STARTED), userId); return ErrorCode::ERROR_USER_NOT_STARTED; } @@ -643,14 +643,14 @@ namespace MiscServices { int32_t InputMethodSystemAbility::OnUserUnlocked(const Message *msg) { IMSA_HILOGI("Start...\n"); - if (msg->msgContent_ == nullptr) { + if (!msg->msgContent_) { IMSA_HILOGE("Aborted! %s\n", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS)); return ErrorCode::ERROR_BAD_PARAMETERS; } int32_t userId = msg->msgContent_->ReadInt32(); PerUserSetting *setting = GetUserSetting(userId); PerUserSession *session = GetUserSession(userId); - if (setting == nullptr || session == nullptr) { + if (!setting || !session) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_STARTED), userId); return ErrorCode::ERROR_USER_NOT_STARTED; } @@ -678,13 +678,13 @@ namespace MiscServices { int32_t InputMethodSystemAbility::OnUserLocked(const Message *msg) { IMSA_HILOGI("Start...\n"); - if (msg->msgContent_ == nullptr) { + if (!msg->msgContent_) { IMSA_HILOGE("Aborted! %s\n", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS)); return ErrorCode::ERROR_BAD_PARAMETERS; } int32_t userId = msg->msgContent_->ReadInt32(); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -692,10 +692,10 @@ namespace MiscServices { if (it != msgHandlers.end()) { MessageHandler *handler = it->second; Message *destMsg = new Message(MSG_ID_USER_LOCK, nullptr); - if (destMsg != nullptr) { + if (destMsg) { handler->SendMessage(destMsg); PerUserSession *userSession = GetUserSession(userId); - if (userSession != nullptr) { + if (userSession) { userSession->JoinWorkThread(); } msgHandlers.erase(it); @@ -719,10 +719,10 @@ namespace MiscServices { MessageParcel *data = msg->msgContent_; int32_t userId = data->ReadInt32(); PerUserSetting *setting = GetUserSetting(MAIN_USER_ID); - if (setting == nullptr) { + if (!setting) { IMSA_HILOGE("InputMethodSystemAbility::OnHandleMessage Aborted! setting is nullptr"); } - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("InputMethodSystemAbility::OnHandleMessage Aborted! userId = %{public}d,", userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -755,7 +755,7 @@ namespace MiscServices { } std::u16string packageName = data->ReadString16(); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -785,7 +785,7 @@ namespace MiscServices { { IMSA_HILOGI("Start...\n"); MessageParcel *data = msg->msgContent_; - if (data == nullptr) { + if (!data) { IMSA_HILOGI("InputMethodSystemAbility::OnPackageRemoved data is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } @@ -798,12 +798,12 @@ namespace MiscServices { } std::u16string packageName = data->ReadString16(); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } PerUserSession *session = GetUserSession(userId); - if (session == nullptr) { + if (!session) { IMSA_HILOGI("InputMethodSystemAbility::OnPackageRemoved session is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } @@ -842,12 +842,12 @@ namespace MiscServices { std::u16string updatedKey = data->ReadString16(); std::u16string updatedValue = data->ReadString16(); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } PerUserSession *session = GetUserSession(userId); - if (session == nullptr) { + if (!session) { return ErrorCode::ERROR_NULL_POINTER; } int32_t ret = session->OnSettingChanged(updatedKey, updatedValue); @@ -864,7 +864,7 @@ namespace MiscServices { } ret = setting->OnSettingChanged(updatedKey, updatedValue); - if (ret != 0) { + if (ret) { IMSA_HILOGI("End...No need to update\n"); return ret; } @@ -881,7 +881,7 @@ namespace MiscServices { IMSA_HILOGI("InputMethodSystemAbility::OnDisplayOptionalInputMethod"); std::vector properties; listInputMethodByUserId(userId, &properties); - if (properties.size() == 0) { + if (!properties.size()) { IMSA_HILOGI("InputMethodSystemAbility::OnDisplayOptionalInputMethod has no ime"); return; } @@ -899,11 +899,11 @@ namespace MiscServices { std::string imeId = Str16ToStr8(property->mPackageName) + "/" + Str16ToStr8(property->mAbilityName); params += "{\"ime\": \"" + imeId + "\","; params += "\"labelId\": \"" + std::to_string(property->labelId) + "\","; - params += "\"discriptionId\": \"" + std::to_string(property->descriptionId) + "\","; + params += "\"descriptionId\": \"" + std::to_string(property->descriptionId) + "\","; std::string isDefaultIme = defaultIme == imeId ? "true" : "false"; params += "\"isDefaultIme\": \"" + isDefaultIme + "\","; params += "\"label\": \"" + Str16ToStr8(property->label) + "\","; - params += "\"discription\": \"" + Str16ToStr8(property->description) + "\""; + params += "\"description\": \"" + Str16ToStr8(property->description) + "\""; } params += "}]}"; @@ -951,7 +951,7 @@ namespace MiscServices { int32_t userId = data->ReadInt32(); std::u16string imeId = data->ReadString16(); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -977,7 +977,7 @@ namespace MiscServices { int32_t userId = data->ReadInt32(); bool isCurrentIme = data->ReadBool(); PerUserSetting *setting = GetUserSetting(userId); - if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { + if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) { IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId); return ErrorCode::ERROR_USER_NOT_UNLOCKED; } @@ -999,7 +999,7 @@ namespace MiscServices { IMSA_HILOGI("InputMethodSystemAbility::GetBundleMgr"); sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - if (systemAbilityManager == nullptr) { + if (!systemAbilityManager) { IMSA_HILOGI("InputMethodSystemAbility::GetBundleMgr systemAbilityManager is nullptr"); return nullptr; } @@ -1013,7 +1013,7 @@ namespace MiscServices { IMSA_HILOGE("InputMethodSystemAbility::GetAbilityManagerService start"); sptr abilityMsObj = OHOS::DelayedSingleton::GetInstance()->GetSystemAbility(ABILITY_MGR_SERVICE_ID); - if (abilityMsObj == nullptr) { + if (!abilityMsObj) { IMSA_HILOGE("failed to get ability manager service"); return nullptr; } diff --git a/services/src/message.cpp b/services/src/message.cpp index a33ed29..e39f48c 100644 --- a/services/src/message.cpp +++ b/services/src/message.cpp @@ -36,7 +36,7 @@ namespace MiscServices { Message::Message(const Message& msg) { msgId_ = msg.msgId_; - if (msgContent_ != nullptr) { + if (msgContent_) { delete msgContent_; msgContent_ = nullptr; } @@ -53,7 +53,7 @@ namespace MiscServices { return *this; } msgId_ = msg.msgId_; - if (msgContent_ != nullptr) { + if (msgContent_) { delete msgContent_; msgContent_ = nullptr; } diff --git a/services/src/message_handler.cpp b/services/src/message_handler.cpp index d9e8e50..fe5ad2a 100644 --- a/services/src/message_handler.cpp +++ b/services/src/message_handler.cpp @@ -28,7 +28,7 @@ namespace MiscServices { MessageHandler::~MessageHandler() { std::unique_lock lock(mMutex); - while (! mQueue.empty()) { + while (!mQueue.empty()) { Message *msg = mQueue.front(); mQueue.pop(); delete msg; @@ -71,7 +71,7 @@ namespace MiscServices { MessageHandler *MessageHandler::Instance() { static MessageHandler *handler = nullptr; - if (handler == nullptr) { + if (!handler) { handler = new MessageHandler(); } return handler; diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 1460126..00f6929 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -118,7 +118,7 @@ namespace MiscServices { */ void PerUserSession::WorkThread() { - if (msgHandler == nullptr) { + if (!msgHandler) { return; } while (1) { @@ -239,7 +239,7 @@ namespace MiscServices { std::unique_lock lock(mtx); InputMethodProperty *ime[] = {defaultIme, securityIme}; for (int i = 0; i < MIN_IME; i++) { - if (currentIme[i] == ime[i] && ime[i] != nullptr) { + if (currentIme[i] == ime[i] && ime[i]) { continue; } if (imsCore[i]) { @@ -247,7 +247,7 @@ namespace MiscServices { } IncreaseOrResetImeError(true, i); currentIme[i] = ime[i]; - if (currentIme[i] == nullptr) { + if (!currentIme[i]) { if (needReshowClient && GetImeIndex(needReshowClient) == i) { needReshowClient = nullptr; } @@ -327,13 +327,13 @@ namespace MiscServices { { IMSA_HILOGI("PerUserSession::AddClient"); ClientInfo *clientInfo = GetClientInfo(inputClient); - if (clientInfo != nullptr) { + if (clientInfo) { IMSA_HILOGE("PerUserSession::AddClient clientInfo is exist, not need add."); return ErrorCode::NO_ERROR; } sptr obj = inputClient->AsObject(); - if (obj == nullptr) { + if (!obj) { IMSA_HILOGE("PerUserSession::AddClient inputClient AsObject is nullptr"); return ErrorCode::ERROR_REMOTE_CLIENT_DIED; } @@ -399,7 +399,7 @@ namespace MiscServices { { IMSA_HILOGI("PerUserSession::StartInputMethod index = %{public}d [%{public}d]\n", index, userId_); - if (imsCore[index] == nullptr) { + if (!imsCore[index]) { IMSA_HILOGI("PerUserSession::StartInputMethod imscore is null"); return ErrorCode::ERROR_IME_BIND_FAILED; } @@ -433,11 +433,11 @@ namespace MiscServices { IMSA_HILOGE("Aborted! %{public}s", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS)); return ErrorCode::ERROR_BAD_PARAMETERS; } - if (imsCore[index] == nullptr || currentIme[index] == nullptr) { + if (!imsCore[index] || !currentIme[index]) { IMSA_HILOGE("Aborted! %{public}s", ErrorCode::ToString(ErrorCode::ERROR_IME_NOT_STARTED)); return ErrorCode::ERROR_IME_NOT_STARTED; } - if (currentIme[index] == currentIme[1 - index] && imsCore[1 - index] != nullptr) { + if (currentIme[index] == currentIme[1 - index] && imsCore[1 - index]) { imsCore[index] = nullptr; inputControlChannel[index] = nullptr; localControlChannel[index] = nullptr; @@ -482,12 +482,12 @@ namespace MiscServices { IMSA_HILOGI("PerUserSession::ShowKeyboard"); ClientInfo *clientInfo = GetClientInfo(inputClient); int index = GetImeIndex(inputClient); - if (index == -1 || clientInfo == nullptr) { + if (index == -1 || !clientInfo) { IMSA_HILOGE("PerUserSession::ShowKeyboard Aborted! index = -1 or clientInfo is nullptr"); return ErrorCode::ERROR_CLIENT_NOT_FOUND; } - if (imsCore[0] == nullptr) { + if (!imsCore[0]) { IMSA_HILOGE("PerUserSession::ShowKeyboard Aborted! imsCore[%{public}d] is nullptr", index); return ErrorCode::ERROR_NULL_POINTER; } @@ -516,10 +516,10 @@ namespace MiscServices { return ErrorCode::ERROR_CLIENT_NOT_FOUND; } ClientInfo *clientInfo = GetClientInfo(inputClient); - if (clientInfo == nullptr) { + if (!clientInfo) { IMSA_HILOGE("PerUserSession::HideKeyboard GetClientInfo pointer nullptr"); } - if (imsCore[0] == nullptr) { + if (!imsCore[0]) { IMSA_HILOGE("PerUserSession::HideKeyboard imsCore[index] is nullptr"); return ErrorCode::ERROR_IME_NOT_STARTED; } @@ -527,7 +527,7 @@ namespace MiscServices { bool ret = imsCore[0]->hideKeyboard(1); if (!ret) { IMSA_HILOGE("PerUserSession::HideKeyboard [imsCore->hideKeyboard] failed"); - ret = ErrorCode::ERROR_KBD_HIDE_FAILED; + return ErrorCode::ERROR_KBD_HIDE_FAILED; } return ErrorCode::NO_ERROR; @@ -535,7 +535,7 @@ namespace MiscServices { /*! Get the display mode of the current keyboard showing \return return display mode. - \n 0 - part sceen mode, 1 - full sceen mode + \n 0 - part screen mode, 1 - full screen mode */ int PerUserSession::GetDisplayMode() { @@ -548,7 +548,7 @@ namespace MiscServices { */ int PerUserSession::GetKeyboardWindowHeight(int retHeight) { - if (imsCore[lastImeIndex] != nullptr) { + if (imsCore[lastImeIndex]) { int ret = imsCore[lastImeIndex]->getKeyboardWindowHeight(retHeight); if (ret != ErrorCode::NO_ERROR) { IMSA_HILOGE("getKeyboardWindowHeight return : %{public}s", ErrorCode::ToString(ret)); @@ -566,7 +566,7 @@ namespace MiscServices { */ KeyboardType *PerUserSession::GetCurrentKeyboardType() { - if (inputMethodSetting == nullptr || currentIme[DEFAULT_IME] == nullptr) { + if (!inputMethodSetting || !currentIme[DEFAULT_IME]) { IMSA_HILOGI("Ime has not started ! [%{public}d]\n", userId_); return nullptr; } @@ -576,7 +576,7 @@ namespace MiscServices { int hashCode = inputMethodSetting->GetCurrentKeyboardType(); // To be checked. if (hashCode == -1) { std::vector hashCodeList = inputMethodSetting->GetEnabledKeyboardTypes(currentIme[DEFAULT_IME]->mImeId); - if (hashCodeList.size() == 0) { + if (!hashCodeList.size()) { IMSA_HILOGE("Cannot find any keyboard types for the current ime [%{public}d]\n", userId_); return nullptr; } @@ -614,7 +614,7 @@ namespace MiscServices { sptr client = it->second->client; int remainClientNum = 0; - if (currentClient != nullptr) { + if (currentClient) { HideKeyboard(client); } RemoveClient(client, remainClientNum); @@ -630,7 +630,7 @@ namespace MiscServices { IMSA_HILOGI("Start...[%{public}d]\n", userId_); int index = 0; for (int i = 0; i < MAX_IME; i++) { - if (imsCore[i] == nullptr) { + if (!imsCore[i]) { continue; } sptr b = imsCore[i]->AsObject(); @@ -680,7 +680,7 @@ namespace MiscServices { { IMSA_HILOGI("Start...[%{public}d]\n", userId_); std::unique_lock lock(mtx); - if (inputMethodSetting == nullptr) { + if (!inputMethodSetting) { return ErrorCode::ERROR_NULL_POINTER; } std::u16string currentValue = inputMethodSetting->GetValue(key); @@ -699,11 +699,11 @@ namespace MiscServices { } else if (key == InputMethodSetting::CURRENT_SYS_KEYBOARD_TYPE_TAG) { return OnCurrentKeyboardTypeChanged(SECURITY_IME, value); } else if (key == InputMethodSetting::CURRENT_INPUT_METHOD_TAG) { - if (currentIme[DEFAULT_IME] == nullptr || + if (!currentIme[DEFAULT_IME] || value == currentIme[DEFAULT_IME]->mImeId) { return ErrorCode::NO_ERROR; } - if (currentClient != nullptr && GetImeIndex(currentClient) == DEFAULT_IME) { + if (currentClient && GetImeIndex(currentClient) == DEFAULT_IME) { needReshowClient = currentClient; HideKeyboard(currentClient); } @@ -714,7 +714,7 @@ namespace MiscServices { } else if (key == InputMethodSetting::ENABLED_INPUT_METHODS_TAG) { if (currentIme[DEFAULT_IME] && currentIme[DEFAULT_IME] != currentIme[SECURITY_IME] && value.find(currentIme[DEFAULT_IME]->mImeId) == std::string::npos) { - if (currentClient != nullptr && GetImeIndex(currentClient) == DEFAULT_IME) { + if (currentClient && GetImeIndex(currentClient) == DEFAULT_IME) { needReshowClient = currentClient; HideKeyboard(currentClient); } @@ -768,8 +768,8 @@ namespace MiscServices { } } KeyboardType *type = GetKeyboardType(index, currentKbdIndex[index]); - if (type != nullptr) { - if (currentClient != nullptr) { + if (type) { + if (currentClient) { int ret = imsCore[index]->setKeyboardType(*type); if (ret != ErrorCode::NO_ERROR) { IMSA_HILOGE("setKeyboardType return : %{public}s [%{public}d]\n", ErrorCode::ToString(ret), userId_); @@ -821,11 +821,11 @@ namespace MiscServices { } int num = currentKbdIndex[index]+1; - if (size != 0) { + if (size) { num %= size; } KeyboardType *type = GetKeyboardType(index, num); - if (type == nullptr) { + if (!type) { IMSA_HILOGW("No next keyboard is available. [%{public}d]\n", userId_); return; } @@ -844,13 +844,13 @@ namespace MiscServices { /*! Set display mode \param mode the display mode of soft keyboard UI. - \n 0 - part sceen mode, 1 - full sceen mode + \n 0 - part screen mode, 1 - full screen mode */ void PerUserSession::OnSetDisplayMode(int mode) { currentDisplayMode = mode; ClientInfo *clientInfo = GetClientInfo(currentClient); - if (clientInfo == nullptr) { + if (!clientInfo) { IMSA_HILOGE("%{public}s [%{public}d]\n", ErrorCode::ToString(ErrorCode::ERROR_CLIENT_NOT_FOUND), userId_); return; } @@ -893,7 +893,7 @@ namespace MiscServices { } userState = UserState::USER_STATE_STARTED; // hide current keyboard - if (currentClient != nullptr) { + if (currentClient) { HideKeyboard(currentClient); } for (int i = 0; i < MIN_IME; i++) { @@ -906,7 +906,7 @@ namespace MiscServices { sptr b = it->first; b->RemoveDeathRecipient(clientDeathRecipient); ClientInfo *clientInfo = it->second; - if (clientInfo != nullptr) { + if (clientInfo) { int ret = clientInfo->client->onInputReleased(0); if (ret != ErrorCode::NO_ERROR) { IMSA_HILOGE("2-onInputReleased return : %{public}s", ErrorCode::ToString(ret)); @@ -1033,7 +1033,7 @@ namespace MiscServices { currentKbdIndex[1 - imeIndex] = currentKbdIndex[imeIndex]; } } - if (type != nullptr) { + if (type) { InputMethodSetting tmpSetting; if (imsCore[imeIndex] == imsCore[1 - imeIndex]) { inputMethodSetting->SetCurrentKeyboardType(type->getHashCode()); @@ -1060,13 +1060,13 @@ namespace MiscServices { */ int PerUserSession::GetImeIndex(const sptr& inputClient) { - if (inputClient == nullptr) { + if (!inputClient) { IMSA_HILOGW("PerUserSession::GetImeIndex inputClient is nullptr"); return -1; } ClientInfo *clientInfo = GetClientInfo(inputClient); - if (clientInfo == nullptr) { + if (!clientInfo) { IMSA_HILOGW("PerUserSession::GetImeIndex clientInfo is nullptr"); return -1; } @@ -1112,7 +1112,7 @@ namespace MiscServices { */ ClientInfo *PerUserSession::GetClientInfo(const sptr& inputClient) { - if (inputClient == nullptr) { + if (!inputClient) { IMSA_HILOGE("PerUserSession::GetClientInfo inputClient is nullptr"); return nullptr; } @@ -1129,14 +1129,14 @@ namespace MiscServices { { IMSA_HILOGE("PerUserSession::StartInputService"); sptr ams = GetAbilityManagerService(); - if (ams == nullptr) { + if (!ams) { return false; } AAFwk::Want want; want.SetAction("action.system.inputmethod"); want.SetElementName("com.example.kikakeyboard", "com.example.kikakeyboard.ServiceExtAbility"); int32_t result = ams->StartAbility(want); - if (result != 0) { + if (result) { IMSA_HILOGE("PerUserSession::StartInputService fail. result = %{public}d", result); return false; } @@ -1148,7 +1148,7 @@ namespace MiscServices { IMSA_HILOGE("GetAbilityManagerService start"); sptr abilityMsObj = OHOS::DelayedSingleton::GetInstance()->GetSystemAbility(ABILITY_MGR_SERVICE_ID); - if (abilityMsObj == nullptr) { + if (!abilityMsObj) { IMSA_HILOGE("failed to get ability manager service"); return nullptr; } @@ -1169,18 +1169,19 @@ namespace MiscServices { int displayId = data->ReadInt32(); sptr clientObject = data->ReadRemoteObject(); - if (clientObject == nullptr) { + if (!clientObject) { IMSA_HILOGI("PerUserSession::OnPrepareInput clientObject is null"); return; } sptr client = new InputClientProxy(clientObject); sptr channelObject = data->ReadRemoteObject(); - if (channelObject == nullptr) { + if (!channelObject) { IMSA_HILOGI("PerUserSession::OnPrepareInput channelObject is null"); + return; } sptr channel = new InputDataChannelProxy(channelObject); InputAttribute *attribute = data->ReadParcelable(); - if (attribute == nullptr) { + if (!attribute) { IMSA_HILOGI("PerUserSession::OnPrepareInput attribute is nullptr"); return; } @@ -1197,12 +1198,12 @@ namespace MiscServices { void PerUserSession::SendAgentToSingleClient(const sptr& inputClient) { IMSA_HILOGI("PerUserSession::SendAgentToSingleClient"); - if (imsAgent == nullptr) { + if (!imsAgent) { IMSA_HILOGI("PerUserSession::SendAgentToSingleClient imsAgent is nullptr"); return; } ClientInfo *clientInfo = GetClientInfo(inputClient); - if (clientInfo == nullptr) { + if (!clientInfo) { IMSA_HILOGE("PerUserSession::SendAgentToSingleClient clientInfo is nullptr"); return; } @@ -1223,7 +1224,7 @@ namespace MiscServices { sptr client = new InputClientProxy(clientObject); sptr interface = client; int remainClientNum = 0; - if (imsCore[0] != nullptr) { + if (imsCore[0]) { imsCore[0]->SetClientState(false); } HideKeyboard(client); @@ -1245,7 +1246,7 @@ namespace MiscServices { MessageParcel *data = msg->msgContent_; sptr clientObject = data->ReadRemoteObject(); sptr client = new InputClientProxy(clientObject); - if (imsCore[0] != nullptr) { + if (imsCore[0]) { imsCore[0]->SetClientState(true); } ShowKeyboard(client); @@ -1258,7 +1259,7 @@ namespace MiscServices { sptr coreObject = data->ReadRemoteObject(); sptr core = new InputMethodCoreProxy(coreObject); - if (imsCore[0] != nullptr) { + if (imsCore[0]) { IMSA_HILOGI("PerUserSession::SetCoreAndAgent Input Method Service has already been started ! "); } imsCore[0] = core; @@ -1275,7 +1276,7 @@ namespace MiscServices { void PerUserSession::SendAgentToAllClients() { IMSA_HILOGI("PerUserSession::SendAgentToAllClients"); - if (imsAgent == nullptr) { + if (!imsAgent) { IMSA_HILOGI("PerUserSession::SendAgentToAllClients imsAgent is nullptr"); return; } @@ -1283,7 +1284,7 @@ namespace MiscServices { for (std::map, ClientInfo*>::iterator it = mapClients.begin(); it != mapClients.end(); ++it) { ClientInfo *clientInfo = (ClientInfo*) it->second; - if (clientInfo != nullptr) { + if (clientInfo) { clientInfo->client->onInputReady(imsAgent); } } @@ -1317,7 +1318,7 @@ namespace MiscServices { void PerUserSession::StopInputService(std::string imeId) { IMSA_HILOGI("PerUserSession::StopInputService"); - if (imsCore[0] != nullptr) { + if (imsCore[0]) { imsCore[0]->StopInputService(imeId); } } diff --git a/services/src/peruser_setting.cpp b/services/src/peruser_setting.cpp index 017f33d..902ce6f 100644 --- a/services/src/peruser_setting.cpp +++ b/services/src/peruser_setting.cpp @@ -53,7 +53,7 @@ namespace MiscServices { IMSA_HILOGE("Failed to listInputMethod [%d]\n", userId_); } int size = inputMethodProperties.size(); - if (size == 0) { + if (!size) { currentImeId = Utils::to_utf16(""); } @@ -82,7 +82,7 @@ namespace MiscServices { isSecurityIme = false; } std::u16string imeId = GetImeId(packageName); - if (imeId.size() != 0) { + if (imeId.size()) { IMSA_HILOGI("%s [%d]\n", ErrorCode::ToString(ErrorCode::ERROR_IME_PACKAGE_DUPLICATED), userId_); return ErrorCode::ERROR_IME_PACKAGE_DUPLICATED; } @@ -132,7 +132,7 @@ namespace MiscServices { isSecurityIme = false; } std::u16string imeId = GetImeId(packageName); - if (imeId.size() == 0) { + if (!imeId.size()) { IMSA_HILOGI("%s [%d]\n", ErrorCode::ToString(ErrorCode::ERROR_NOT_IME_PACKAGE), userId_); return ErrorCode::ERROR_NOT_IME_PACKAGE; } @@ -193,7 +193,7 @@ namespace MiscServices { currentImeId = inputMethodSetting.GetCurrentInputMethod(); } else if (key == InputMethodSetting::ENABLED_INPUT_METHODS_TAG) { if ((currentImeId.size() > 0 && value.find(currentImeId) == std::string::npos) || - currentImeId.size() == 0) { + !currentImeId.size()) { ResetCurrentInputMethod(); InputMethodSetting tmpSetting; tmpSetting.ClearData(); @@ -222,18 +222,18 @@ namespace MiscServices { if (flag) { nextImeId = imeId; break; - } else if (firstEnabledProperty == nullptr) { + } else if (!firstEnabledProperty) { firstEnabledProperty = inputMethodProperties[i]; } } } - if (nextImeId.size() == 0 && firstEnabledProperty) { + if (!nextImeId.size() && firstEnabledProperty) { nextImeId = firstEnabledProperty->mImeId; } // next enabled ime is not available. - if (nextImeId.size() == 0) { + if (!nextImeId.size()) { IMSA_HILOGW("No next IME is available. [%d]\n", userId_); return; } @@ -261,7 +261,7 @@ namespace MiscServices { std::vector::iterator it; for (it = inputMethodProperties.begin(); it < inputMethodProperties.end();) { InputMethodProperty *node = (InputMethodProperty*)*it; - if (node != nullptr) { + if (node) { it = inputMethodProperties.erase(it); delete node; node = nullptr; @@ -342,10 +342,10 @@ namespace MiscServices { continue; } // if systemLocales is not setting, return the first security ime - if (systemLocales.size() == 0) { + if (!systemLocales.size()) { return imp; } - if (ime == nullptr) { + if (!ime) { ime = imp; } for (int j = 0; j < (int)inputMethodProperties[i]->mTypes.size(); j++) { @@ -377,7 +377,7 @@ namespace MiscServices { } else if (enabledInputMethods.find(imeId) != std::string::npos) { if (flag) { return inputMethodProperties[i]; - } else if (firstEnabledProperty == nullptr) { + } else if (!firstEnabledProperty) { firstEnabledProperty = inputMethodProperties[i]; } } @@ -523,7 +523,7 @@ namespace MiscServices { if (enabledInputMethods.find(imeId) == std::string::npos) { continue; } - if (firstEnabledIme == nullptr) { + if (!firstEnabledIme) { firstEnabledIme = inputMethodProperties[i]; } diff --git a/services/src/platform.cpp b/services/src/platform.cpp index 57c10cd..a095501 100644 --- a/services/src/platform.cpp +++ b/services/src/platform.cpp @@ -43,7 +43,7 @@ namespace MiscServices { Platform *Platform::Instance() { static Platform *platform = nullptr; - if (platform == nullptr) { + if (!platform) { platform = new Platform(); } return platform; @@ -58,7 +58,7 @@ namespace MiscServices { sptr Platform::BindInputMethodService(int userId, const std::u16string& packageName, const std::u16string& intention) { - if (platformApi == nullptr) { + if (!platformApi) { return nullptr; } return platformApi->bindInputMethodService(packageName, intention, userId); @@ -71,7 +71,7 @@ namespace MiscServices { */ int Platform::UnbindInputMethodService(int userId, const std::u16string& packageName) { - if (platformApi == nullptr) { + if (!platformApi) { return ErrorCode::ERROR_NULL_POINTER; } return platformApi->unbindInputMethodService(userId, packageName); @@ -85,7 +85,7 @@ namespace MiscServices { */ sptr < IRemoteObject > Platform::CreateWindowToken(int userId, int displayId, const std::u16string& packageName) { - if (platformApi == nullptr) { + if (!platformApi) { return nullptr; } return platformApi->createWindowToken(userId, displayId, packageName); @@ -98,7 +98,7 @@ namespace MiscServices { */ int Platform::DestroyWindowToken(int userId, const std::u16string& packageName) { - if (platformApi == nullptr) { + if (!platformApi) { return ErrorCode::ERROR_NULL_POINTER; } return platformApi->destroyWindowToken(userId, packageName); @@ -123,7 +123,7 @@ namespace MiscServices { int Platform::GetInputMethodProperty(int userId, const std::u16string& packageName, InputMethodProperty *inputMethodProperty) { - if (platformApi == nullptr) { + if (!platformApi) { return ErrorCode::ERROR_NULL_POINTER; } return platformApi->getInputMethodProperty(userId, packageName, inputMethodProperty); @@ -147,7 +147,7 @@ namespace MiscServices { */ int Platform::SetInputMethodSetting(int userId, const InputMethodSetting& inputMethodSetting) { - if (platformApi == nullptr) { + if (!platformApi) { return ErrorCode::ERROR_NULL_POINTER; } return platformApi->setInputMethodSetting(userId, inputMethodSetting);