fix warning

Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
This commit is contained in:
zhouyongfei
2022-03-26 08:36:32 +00:00
parent 792925aa2c
commit 60c93da455
86 changed files with 427 additions and 385 deletions
@@ -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"
@@ -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 <errors.h>
#include "iremote_broker.h"
#include "global.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"
@@ -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"
@@ -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"
@@ -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"
@@ -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 <mutex>
#include <thread>
@@ -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 <vector>
#include "iremote_proxy.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 <stdint.h>
@@ -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();
@@ -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);
@@ -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> InputMethodController::GetInstance()
{
if (instance_ == nullptr) {
if (!instance_) {
std::lock_guard<std::mutex> 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<ISystemAbilityManager> 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<IRemoteObject> 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<Direction>(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<InputDataChannelStub> &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<InputMethodProperty*> properties;
if (mImms == nullptr) {
if (!mImms) {
return properties;
}
mImms->listInputMethod(&properties);
@@ -279,7 +279,7 @@ using namespace MessageID;
void InputMethodController::StartInput(sptr<InputClientStub> &client)
{
IMSA_HILOGI("InputMethodController::StartInput");
if (mImms == nullptr) {
if (!mImms) {
return;
}
MessageParcel data;
@@ -293,7 +293,7 @@ using namespace MessageID;
void InputMethodController::ReleaseInput(sptr<InputClientStub> &client)
{
IMSA_HILOGI("InputMethodController::ReleaseInput");
if (mImms == nullptr) {
if (!mImms) {
return;
}
MessageParcel data;
@@ -307,7 +307,7 @@ using namespace MessageID;
void InputMethodController::StopInput(sptr<InputClientStub> &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<MMI::KeyEvent> keyEvent)
{
IMSA_HILOGI("InputMethodController::dispatchKeyEvent");
if (mAgent == nullptr) {
if (!mAgent) {
IMSA_HILOGI("InputMethodController::dispatchKeyEvent mAgent is nullptr");
return false;
}
@@ -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<KeyboardType>();
if (keyType == nullptr) {
if (!keyType) {
return ERROR_NULL_POINTER;
}
*retType = *keyType;
@@ -340,7 +340,7 @@ namespace MiscServices {
int32_t InputMethodSystemAbilityProxy::listInputMethodEnabled(std::vector<InputMethodProperty*> *properties)
{
if (properties == nullptr) {
if (!properties) {
return ERROR_NULL_POINTER;
}
@@ -373,7 +373,7 @@ namespace MiscServices {
int32_t InputMethodSystemAbilityProxy::listInputMethod(std::vector<InputMethodProperty*> *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<KeyboardType*> *types)
{
if (types == nullptr) {
if (!types) {
return ERROR_NULL_POINTER;
}