ssueNo:#I5I6SF:常量字符串整改

Description: Switch const string to char ptr for memory optimization。
Sig: SIG_ApplicationFramework
Feature or Bugfix: Bugfix
Binary Source: No

Signed-off-by: yanwenhao <yanwenhao9@huawei.com>
Change-Id: I6292006da3f8832804de01faf2733cadc956b96d
This commit is contained in:
yanwenhao 2022-07-21 15:04:30 +08:00
parent 001f4e9c34
commit 8d291f84da
2 changed files with 8 additions and 8 deletions

View File

@ -903,7 +903,7 @@ bool IsSpecialObject(napi_env env, napi_value param, std::string strProName, std
napi_valuetype jsValueType = napi_undefined;
napi_value jsProValue = nullptr;
NAPI_CALL_BASE(env, napi_get_named_property(env, jsWantParamProValue, TYPE_PROPERTY.c_str(), &jsProValue), false);
NAPI_CALL_BASE(env, napi_get_named_property(env, jsWantParamProValue, TYPE_PROPERTY, &jsProValue), false);
NAPI_CALL_BASE(env, napi_typeof(env, jsProValue, &jsValueType), false);
if (jsValueType != napi_string) {
return false;
@ -925,7 +925,7 @@ bool IsSpecialObject(napi_env env, napi_value param, std::string strProName, std
jsValueType = napi_undefined;
jsProValue = nullptr;
NAPI_CALL_BASE(env, napi_get_named_property(env, jsWantParamProValue, VALUE_PROPERTY.c_str(), &jsProValue),
NAPI_CALL_BASE(env, napi_get_named_property(env, jsWantParamProValue, VALUE_PROPERTY, &jsProValue),
false);
NAPI_CALL_BASE(env, napi_typeof(env, jsProValue, &jsValueType), false);
if (jsValueType != jsValueProType) {
@ -942,7 +942,7 @@ bool HandleFdObject(napi_env env, napi_value param, std::string strProName, AAFw
napi_value jsWantParamProValue = nullptr;
NAPI_CALL_BASE(env, napi_get_named_property(env, param, strProName.c_str(), &jsWantParamProValue), false);
napi_value jsProValue = nullptr;
NAPI_CALL_BASE(env, napi_get_named_property(env, jsWantParamProValue, VALUE_PROPERTY.c_str(), &jsProValue),
NAPI_CALL_BASE(env, napi_get_named_property(env, jsWantParamProValue, VALUE_PROPERTY, &jsProValue),
false);
int32_t natValue32 = 0;
@ -962,7 +962,7 @@ bool HandleRemoteObject(napi_env env, napi_value param, std::string strProName,
napi_value jsWantParamProValue = nullptr;
NAPI_CALL_BASE(env, napi_get_named_property(env, param, strProName.c_str(), &jsWantParamProValue), false);
napi_value jsProValue = nullptr;
NAPI_CALL_BASE(env, napi_get_named_property(env, jsWantParamProValue, VALUE_PROPERTY.c_str(), &jsProValue),
NAPI_CALL_BASE(env, napi_get_named_property(env, jsWantParamProValue, VALUE_PROPERTY, &jsProValue),
false);
sptr<IRemoteObject> remoteObject = NAPI_ohos_rpc_getNativeRemoteObject(env, jsProValue);

View File

@ -2162,7 +2162,7 @@ void AppMgrServiceInner::GetGlobalConfiguration()
#endif
// Assign to default colormode "light"
HILOG_INFO("current global colormode is : %{public}s", ConfigurationInner::COLOR_MODE_LIGHT.c_str());
HILOG_INFO("current global colormode is : %{public}s", ConfigurationInner::COLOR_MODE_LIGHT);
configuration_->AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_COLORMODE, ConfigurationInner::COLOR_MODE_LIGHT);
// Get input pointer device
@ -2540,11 +2540,11 @@ void AppMgrServiceInner::AddWatchParameter()
int ret;
auto context = new (std::nothrow) std::weak_ptr<AppMgrServiceInner>(shared_from_this());
ret = WatchParameter(AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE.c_str(), PointerDeviceEventCallback,
ret = WatchParameter(AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE, PointerDeviceEventCallback,
context);
if (ret != 0) {
HILOG_ERROR("watch parameter %{public}s failed with %{public}d.",
AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE.c_str(), ret);
AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE, ret);
}
}
@ -2563,7 +2563,7 @@ void AppMgrServiceInner::PointerDeviceEventCallback(const char *key, const char
return;
}
if ((strcmp(key, AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE.c_str()) != 0) ||
if ((strcmp(key, AAFwk::GlobalConfigurationKey::INPUT_POINTER_DEVICE) != 0) ||
((strcmp(value, "true") != 0) && (strcmp(value, "false") != 0))) {
HILOG_ERROR("key %{public}s or value %{public}s mismatch.", key, value);
return;