fix warning

Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
This commit is contained in:
zhouyongfei
2021-09-29 10:54:13 +08:00
parent e6e1eb6bd0
commit 4ff4c472a8
9 changed files with 30 additions and 13 deletions
@@ -53,6 +53,7 @@ namespace MiscServices {
int32_t displyId = 0;
sptr<IRemoteObject> startInputToken;
InputChannel *writeInputChannel;
bool stop_;
// communicating with IMSA
sptr<IInputControlChannel> inputControlChannel;
@@ -29,7 +29,7 @@ namespace MiscServices {
sptr<InputMethodAbility> InputMethodAbility::instance_;
std::mutex InputMethodAbility::instanceLock_;
InputMethodAbility::InputMethodAbility()
InputMethodAbility::InputMethodAbility() : stop_(false)
{
Initialize();
OnConnect();
@@ -41,6 +41,7 @@ namespace MiscServices {
delete msgHandler;
msgHandler = nullptr;
}
stop_ = true;
}
sptr<InputMethodAbility> InputMethodAbility::GetInstance()
@@ -109,7 +110,7 @@ namespace MiscServices {
void InputMethodAbility::WorkThread()
{
while (1) {
while (!stop_) {
Message *msg = msgHandler->GetMessage();
switch (msg->msgId_) {
case MSG_ID_INITIALIZE_INPUT: {
@@ -33,6 +33,7 @@ namespace MiscServices {
InputMethodCoreStub::InputMethodCoreStub(int userId)
{
userId_ = userId;
msgHandler_ = nullptr;
}
InputMethodCoreStub::~InputMethodCoreStub()
@@ -77,6 +77,7 @@ namespace MiscServices {
static sptr<InputMethodController> instance_;
std::thread workThreadHandler;
MessageHandler *msgHandler;
bool stop_;
};
}
}
@@ -24,7 +24,7 @@ using namespace MessageID;
sptr<InputMethodController> InputMethodController::instance_;
std::mutex InputMethodController::instanceLock_;
InputMethodController::InputMethodController()
InputMethodController::InputMethodController() : stop_(false)
{
IMSA_HILOGI("InputMethodController structure");
Initialize();
@@ -35,6 +35,7 @@ using namespace MessageID;
if (msgHandler != nullptr) {
delete msgHandler;
msgHandler = nullptr;
stop_ = false;
}
}
@@ -97,7 +98,7 @@ using namespace MessageID;
void InputMethodController::WorkThread()
{
while (1) {
while (!stop_) {
Message *msg = msgHandler->GetMessage();
switch (msg->msgId_) {
case MSG_ID_INSERT_CHAR: {
@@ -303,7 +303,7 @@ namespace MiscServices {
KeyboardType *keyType = reply.ReadParcelable<KeyboardType>();
if (keyType == nullptr) {
return ERROR_STATUS_BAD_INDEX;
return ERROR_NULL_POINTER;
}
*retType = *keyType;
delete keyType;
@@ -171,7 +171,6 @@ namespace MiscServices {
eventTarget->Off(type);
}
delete type;
delete type;
type = nullptr;
napi_value result = nullptr;
+18 -5
View File
@@ -583,11 +583,16 @@ namespace MiscServices {
if (it != msgHandlers.end()) {
MessageHandler *handler = it->second;
Message *destMsg = new Message(MSG_ID_USER_LOCK , nullptr);
handler->SendMessage(destMsg);
GetUserSession(userId)->JoinWorkThread();
msgHandlers.erase(it);
delete handler;
handler = nullptr;
if (destMsg != nullptr) {
handler->SendMessage(destMsg);
PerUserSession *userSession = GetUserSession(userId);
if (userSession != nullptr) {
userSession->JoinWorkThread();
}
msgHandlers.erase(it);
delete handler;
handler = nullptr;
}
}
setting->OnUserLocked();
IMSA_HILOGI("End...[%d]\n", userId);
@@ -705,6 +710,10 @@ namespace MiscServices {
{
IMSA_HILOGI("Start...\n");
MessageParcel *data = msg->msgContent_;
if (data == nullptr) {
IMSA_HILOGI("InputMethodSystemAbility::OnPackageRemoved data is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
int32_t userId = data->ReadInt32();
int32_t size = data->ReadInt32();
@@ -719,6 +728,10 @@ namespace MiscServices {
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
PerUserSession *session = GetUserSession(userId);
if (session == nullptr) {
IMSA_HILOGI("InputMethodSystemAbility::OnPackageRemoved session is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
session->OnPackageRemoved(packageName);
bool securityImeFlag = false;
int32_t ret = setting->OnPackageRemoved(packageName, securityImeFlag);
+2 -2
View File
@@ -977,8 +977,8 @@ namespace MiscServices {
*/
int PerUserSession::IncreaseOrResetImeError(bool resetFlag, int imeIndex)
{
static int errorNum[MIN_IME] = {0, 0};
static time_t past[MIN_IME] = {time(0), time(0)};
static int errorNum[2] = {0, 0};
static time_t past[2] = {time(0), time(0)};
if (resetFlag == true) {
errorNum[imeIndex] = 0;
past[imeIndex] = 0;