fix warning

Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
This commit is contained in:
zhouyongfei
2021-09-27 18:04:00 +08:00
parent d60350cebe
commit 54fa4803ab
12 changed files with 113 additions and 227 deletions
@@ -32,8 +32,7 @@ using namespace MessageID;
InputMethodController::~InputMethodController()
{
if (msgHandler != nullptr)
{
if (msgHandler != nullptr) {
delete msgHandler;
msgHandler = nullptr;
}
@@ -42,11 +41,9 @@ using namespace MessageID;
sptr<InputMethodController> InputMethodController::GetInstance()
{
IMSA_HILOGI("InputMethodController::GetInstance");
if (instance_ == nullptr)
{
if (instance_ == nullptr) {
std::lock_guard<std::mutex> autoLock(instanceLock_);
if (instance_ == nullptr)
{
if (instance_ == nullptr) {
IMSA_HILOGI("InputMethodController::GetInstance instance_ is nullptr");
instance_ = new InputMethodController();
}
@@ -78,21 +75,18 @@ using namespace MessageID;
IMSA_HILOGI("InputMethodController::GetImsaProxy");
sptr<ISystemAbilityManager> systemAbilityManager =
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (systemAbilityManager == nullptr)
{
if (systemAbilityManager == nullptr) {
IMSA_HILOGI("InputMethodController::GetImsaProxy systemAbilityManager is nullptr");
return nullptr;
}
auto systemAbility = systemAbilityManager->GetSystemAbility(INPUT_METHOD_SYSTEM_ABILITY_ID, "");
if (systemAbility == nullptr)
{
if (systemAbility == nullptr) {
IMSA_HILOGI("InputMethodController::GetImsaProxy systemAbility is nullptr");
return nullptr;
}
if (deathRecipient_ == nullptr)
{
if (deathRecipient_ == nullptr) {
deathRecipient_ = new ImsaDeathRecipient();
}
systemAbility->AddDeathRecipient(deathRecipient_);
@@ -109,8 +103,7 @@ using namespace MessageID;
case MSG_ID_INSERT_CHAR: {
MessageParcel *data = msg->msgContent_;
std::u16string text = data->ReadString16();
if (textListener != nullptr)
{
if (textListener != nullptr) {
textListener->InsertText(text);
}
break;
@@ -118,8 +111,7 @@ using namespace MessageID;
case MSG_ID_DELETE_BACKWARD: {
MessageParcel *data = msg->msgContent_;
int32_t length = data->ReadInt32();
if (textListener != nullptr)
{
if (textListener != nullptr) {
textListener->DeleteBackward(length);
}
break;
@@ -133,10 +125,8 @@ using namespace MessageID;
case MSG_ID_ON_INPUT_READY: {
MessageParcel *data = msg->msgContent_;
int32_t ret = data->ReadInt32();
if (ret != ErrorCode::NO_ERROR)
{
if (textListener != nullptr)
{
if (ret != ErrorCode::NO_ERROR) {
if (textListener != nullptr) {
textListener->SetKeyboardStatus(false);
}
mAgent = nullptr;
@@ -144,8 +134,7 @@ using namespace MessageID;
}
sptr<IRemoteObject> object = data->ReadRemoteObject();
mAgent = new InputMethodAgentProxy(object);
if (textListener != nullptr)
{
if (textListener != nullptr) {
textListener->SetKeyboardStatus(true);
}
break;
@@ -193,8 +182,7 @@ using namespace MessageID;
sptr<InputDataChannelStub> &channel, InputAttribute &attribute)
{
IMSA_HILOGI("InputMethodController::PrepareInput");
if (mImms == nullptr)
{
if (mImms == nullptr) {
return;
}
MessageParcel data;
@@ -202,8 +190,7 @@ using namespace MessageID;
&& data.WriteInt32(displayId)
&& data.WriteRemoteObject(client->AsObject())
&& data.WriteRemoteObject(channel->AsObject())
&& data.WriteParcelable(&attribute)))
{
&& data.WriteParcelable(&attribute))) {
return;
}
mImms->prepareInput(data);
@@ -212,14 +199,12 @@ using namespace MessageID;
void InputMethodController::StartInput(sptr<InputClientStub> &client)
{
IMSA_HILOGI("InputMethodController::StartInput");
if (mImms == nullptr)
{
if (mImms == nullptr) {
return;
}
MessageParcel data;
if (!(data.WriteInterfaceToken(mImms->GetDescriptor())
&& data.WriteRemoteObject(client->AsObject())))
{
&& data.WriteRemoteObject(client->AsObject()))) {
return;
}
mImms->startInput(data);
@@ -228,14 +213,12 @@ using namespace MessageID;
void InputMethodController::ReleaseInput(sptr<InputClientStub> &client)
{
IMSA_HILOGI("InputMethodController::ReleaseInput");
if (mImms == nullptr)
{
if (mImms == nullptr) {
return;
}
MessageParcel data;
if (!(data.WriteInterfaceToken(mImms->GetDescriptor())
&& data.WriteRemoteObject(client->AsObject().GetRefPtr())))
{
&& data.WriteRemoteObject(client->AsObject().GetRefPtr()))) {
return;
}
mImms->releaseInput(data);
@@ -244,14 +227,12 @@ using namespace MessageID;
void InputMethodController::StopInput(sptr<InputClientStub> &client)
{
IMSA_HILOGI("InputMethodController::StopInput");
if (mImms == nullptr)
{
if (mImms == nullptr) {
return;
}
MessageParcel data;
if (!(data.WriteInterfaceToken(mImms->GetDescriptor())
&& data.WriteRemoteObject(client->AsObject().GetRefPtr())))
{
&& data.WriteRemoteObject(client->AsObject().GetRefPtr()))) {
return;
}
mImms->stopInput(data);