Signed-off-by: wangdongqi <wangdongqi2@huawei.com>

Changes to be committed:
This commit is contained in:
wangdongqi 2024-09-03 16:27:58 +08:00
parent 4d1abf7617
commit d66affce5f
8 changed files with 18 additions and 18 deletions

View File

@ -531,7 +531,7 @@ napi_value JsInputMethodEngineSetting::GetResultOnSetSubtype(napi_env env, const
napi_set_named_property(env, subType, "label", label);
napi_value labelId = nullptr;
napi_create_int32(env, property.labelId, &labelId);
napi_create_uint32(env, property.labelId, &labelId);
napi_set_named_property(env, subType, "labelId", labelId);
napi_value name = nullptr;
@ -559,7 +559,7 @@ napi_value JsInputMethodEngineSetting::GetResultOnSetSubtype(napi_env env, const
napi_set_named_property(env, subType, "icon", icon);
napi_value iconId = nullptr;
napi_create_int32(env, property.iconId, &iconId);
napi_create_uint32(env, property.iconId, &iconId);
napi_set_named_property(env, subType, "iconId", iconId);
napi_value extra = nullptr;

View File

@ -120,7 +120,7 @@ napi_value JsInputMethod::GetJsInputMethodProperty(napi_env env, const Property
napi_set_named_property(env, prop, "icon", icon);
napi_value iconId = nullptr;
napi_create_int32(env, property.iconId, &iconId);
napi_create_uint32(env, property.iconId, &iconId);
napi_set_named_property(env, prop, "iconId", iconId);
napi_value label = nullptr;
@ -128,7 +128,7 @@ napi_value JsInputMethod::GetJsInputMethodProperty(napi_env env, const Property
napi_set_named_property(env, prop, "label", label);
napi_value labelId = nullptr;
napi_create_int32(env, property.labelId, &labelId);
napi_create_uint32(env, property.labelId, &labelId);
napi_set_named_property(env, prop, "labelId", labelId);
return prop;
}
@ -147,7 +147,7 @@ napi_value JsInputMethod::GetJsInputMethodSubProperty(napi_env env, const SubPro
napi_set_named_property(env, prop, "label", label);
napi_value labelId = nullptr;
napi_create_int32(env, subProperty.labelId, &labelId);
napi_create_uint32(env, subProperty.labelId, &labelId);
napi_set_named_property(env, prop, "labelId", labelId);
napi_value name = nullptr;
@ -171,7 +171,7 @@ napi_value JsInputMethod::GetJsInputMethodSubProperty(napi_env env, const SubPro
napi_set_named_property(env, prop, "icon", icon);
napi_value iconId = nullptr;
napi_create_int32(env, subProperty.iconId, &iconId);
napi_create_uint32(env, subProperty.iconId, &iconId);
napi_set_named_property(env, prop, "iconId", iconId);
return prop;
}

View File

@ -26,21 +26,21 @@ struct Property {
std::string name; // the bundleName of inputMethod
std::string id; // the extensionName of inputMethod
std::string label; // the label of inputMethod
int32_t labelId = 0; // the labelId of inputMethod
uint32_t labelId = 0; // the labelId of inputMethod
std::string icon; // the icon of inputMethod
int32_t iconId = 0; // the icon id of inputMethod
uint32_t iconId = 0; // the icon id of inputMethod
};
struct SubProperty {
std::string label; // the label of subtype
int32_t labelId = 0; // the labelId of subtype
uint32_t labelId = 0; // the labelId of subtype
std::string name; // the bundleName of inputMethod
std::string id; // the name of subtype
std::string mode; // the mode of subtype, containing "upper" and "lower"
std::string locale; // the tongues of subtype, such as "zh_CN", "en_US", etc.
std::string language; // the language of subtype
std::string icon; // the icon of subtype
int32_t iconId = 0; // the icon id of subtype
uint32_t iconId = 0; // the icon id of subtype
};
struct FullImeInfo {

View File

@ -103,7 +103,7 @@ private:
~ImeInfoInquirer() = default;
OHOS::sptr<OHOS::AppExecFwk::IBundleMgr> GetBundleMgr();
SubProperty GetExtends(const std::vector<OHOS::AppExecFwk::Metadata> &metaData);
std::string GetStringById(const std::string &bundleName, const std::string &moduleName, const int32_t labelId,
std::string GetStringById(const std::string &bundleName, const std::string &moduleName, const uint32_t labelId,
const int32_t userId);
bool GetAppIdByBundleName(int32_t userId, const std::string &bundleName, std::string &appId);
std::shared_ptr<ImeInfo> GetImeInfoFromCache(const int32_t userId, const std::string &bundleName,

View File

@ -29,8 +29,8 @@ struct InputMethodInfo {
std::string mConfigurationPage;
bool isSystemIme = false;
int32_t mDefaultImeId = 0;
int32_t labelId = 0;
int32_t descriptionId = 0;
uint32_t labelId = 0;
uint32_t descriptionId = 0;
std::string label;
std::string description;
};

View File

@ -620,7 +620,7 @@ void ImeInfoInquirer::CovertToLanguage(const std::string &locale, std::string &l
}
std::string ImeInfoInquirer::GetStringById(const std::string &bundleName, const std::string &moduleName,
int32_t labelId, int32_t userId)
uint32_t labelId, int32_t userId)
{
auto bundleMgr = GetBundleMgr();
return bundleMgr == nullptr ? "" : bundleMgr->GetStringById(bundleName, moduleName, labelId, userId);

View File

@ -40,7 +40,7 @@ void TestListInputMethod(sptr<InputMethodController> imc)
imc->DisplayOptionalInputMethod();
}
void TestListInputMethodSubtype(sptr<InputMethodController> imc, const std::string &fuzzedString, int32_t fuzzedInt32)
void TestListInputMethodSubtype(sptr<InputMethodController> imc, const std::string &fuzzedString, uint32_t fuzzedUint32)
{
std::vector<SubProperty> subProperties = {};
Property property;
@ -48,7 +48,7 @@ void TestListInputMethodSubtype(sptr<InputMethodController> imc, const std::stri
property.id = fuzzedString;
property.label = fuzzedString;
property.icon = fuzzedString;
property.iconId = fuzzedInt32;
property.iconId = fuzzedUint32;
imc->ListInputMethodSubtype(property, subProperties);
}
@ -206,7 +206,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
OHOS::sptr<InputMethodController> imc = InputMethodController::GetInstance();
OHOS::TestListInputMethod(imc);
OHOS::TestListInputMethodSubtype(imc, fuzzedString, fuzzedInt32);
OHOS::TestListInputMethodSubtype(imc, fuzzedString, fuzzedUint32);
OHOS::TestOnSelectionChange(imc, fuzzedU16String, fuzzedInt, fuzzedDouble);
OHOS::TestOnConfigurationChange(imc);
OHOS::TestSwitchInputMethod(fuzzedTrigger, imc, fuzzedString);

View File

@ -28,7 +28,7 @@ struct Property {
std::string name;
std::string id;
std::string icon;
int32_t iconId = 0;
uint32_t iconId = 0;
};
struct JsProperty {
static napi_value Write(napi_env env, const std::shared_ptr<Property> &nativeObject)