!773 [Bug]: fix ffi getValue

Merge pull request !773 from dinghong/fix_settings
This commit is contained in:
openharmony_ci 2024-10-30 04:48:01 +00:00 committed by Gitee
commit c2985a818c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -52,11 +52,10 @@ char* TransformFromString(std::string str, int32_t* ret)
bool CheckoutStatus(int32_t status, int32_t* result)
{
*result = 0;
if (status >= 0) {
*result = 0;
return true;
}
*result = status;
if (status == PERMISSION_DENIED_CODE) {
*result = PERMISSION_EXCEPTION_CODE;
}
@ -265,6 +264,9 @@ char* Settings::GetValue(
int64_t len = info.value.size();
if (len <= 0) {
CheckoutStatus(info.status, ret);
if (*ret == 0) {
return TransformFromString(value, ret);
}
return nullptr;
}
return TransformFromString(info.value, ret);