fix ffi code

Change-Id: I96bbf588a5cc588ddb1f8df79eeb44299b55c11c
Signed-off-by: dinghong <dinghong10@huawei.com>
This commit is contained in:
dinghong 2024-10-29 16:28:26 +08:00
parent c41cb6d287
commit de1a3ba5c3

View File

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