fix warning

Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
This commit is contained in:
zhouyongfei
2021-09-29 10:01:23 +08:00
parent af4b8865fe
commit c9c411fea4
53 changed files with 1320 additions and 1449 deletions
@@ -34,6 +34,7 @@ using namespace MessageID;
{
if (msgHandler != nullptr) {
delete msgHandler;
msgHandler = nullptr;
}
}
@@ -64,6 +65,8 @@ using namespace MessageID;
workThreadHandler = std::thread([this]{WorkThread();});
mAttribute.SetInputPattern(InputAttribute::PATTERN_TEXT);
textListener = nullptr;
return true;
}
@@ -94,72 +97,73 @@ using namespace MessageID;
void InputMethodController::WorkThread()
{
while(1) {
while (1) {
Message *msg = msgHandler->GetMessage();
switch(msg->msgId_) {
case MSG_ID_INSERT_CHAR:{
switch (msg->msgId_) {
case MSG_ID_INSERT_CHAR: {
MessageParcel *data = msg->msgContent_;
std::u16string text = data->ReadString16();
if(textListener != nullptr){
if (textListener != nullptr) {
textListener->InsertText(text);
}
break;
}
case MSG_ID_DELETE_BACKWARD:{
case MSG_ID_DELETE_BACKWARD: {
MessageParcel *data = msg->msgContent_;
int32_t length = data->ReadInt32();
if(textListener != nullptr){
if (textListener != nullptr) {
textListener->DeleteBackward(length);
}
break;
}
case MSG_ID_SET_DISPLAY_MODE:{
case MSG_ID_SET_DISPLAY_MODE: {
MessageParcel *data = msg->msgContent_;
int32_t ret = data->ReadInt32();
IMSA_HILOGI("MSG_ID_SET_DISPLAY_MODE : %{public}d", ret);
break;
}
case MSG_ID_ON_INPUT_READY:{
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;
mAgent = nullptr;
break;
}
sptr<IRemoteObject> object = data->ReadRemoteObject();
mAgent = new InputMethodAgentProxy(object);
if (textListener != nullptr){
if (textListener != nullptr) {
textListener->SetKeyboardStatus(true);
}
break;
}
case MSG_ID_EXIT_SERVICE:{
case MSG_ID_EXIT_SERVICE: {
MessageParcel *data = msg->msgContent_;
int32_t ret = data->ReadInt32();
textListener = nullptr;
IMSA_HILOGI("MSG_ID_EXIT_SERVICE : %{public}d", ret);
break;
}
default:{
default: {
break;
}
}
delete msg;
msg = nullptr;
}
}
void InputMethodController::Attach()
{
PrepareInput(0,mClient,mInputDataChannel,mAttribute);
PrepareInput(0, mClient, mInputDataChannel, mAttribute);
}
void InputMethodController::ShowTextInput(sptr<OnTextChangedListener> &listener)
{
IMSA_HILOGI("InputMethodController::ShowTextInput");
textListener=listener;
textListener = listener;
StartInput(mClient);
}
@@ -178,15 +182,15 @@ using namespace MessageID;
sptr<InputDataChannelStub> &channel, InputAttribute &attribute)
{
IMSA_HILOGI("InputMethodController::PrepareInput");
if(mImms == nullptr){
if (mImms == nullptr) {
return;
}
MessageParcel data;
if(!(data.WriteInterfaceToken(mImms->GetDescriptor())
&&data.WriteInt32(displayId)
&&data.WriteRemoteObject(client->AsObject())
&&data.WriteRemoteObject(channel->AsObject())
&&data.WriteParcelable(&attribute))){
if (!(data.WriteInterfaceToken(mImms->GetDescriptor())
&& data.WriteInt32(displayId)
&& data.WriteRemoteObject(client->AsObject())
&& data.WriteRemoteObject(channel->AsObject())
&& data.WriteParcelable(&attribute))) {
return;
}
mImms->prepareInput(data);
@@ -195,12 +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()))){
if (!(data.WriteInterfaceToken(mImms->GetDescriptor())
&& data.WriteRemoteObject(client->AsObject()))) {
return;
}
mImms->startInput(data);
@@ -209,12 +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()))) {
if (!(data.WriteInterfaceToken(mImms->GetDescriptor())
&& data.WriteRemoteObject(client->AsObject().GetRefPtr()))) {
return;
}
mImms->releaseInput(data);
@@ -223,12 +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()))) {
if (!(data.WriteInterfaceToken(mImms->GetDescriptor())
&& data.WriteRemoteObject(client->AsObject().GetRefPtr()))) {
return;
}
mImms->stopInput(data);