_E("The type(%d) of keynode(%s) is not integer",
static_cast<int>(type), key.c_str());
set_last_result(PREFERENCE_ERROR_INVALID_PARAMETER);
+ auto& raw = d->GetRaw();
+ if (raw.size() == 0 || raw.size() > sizeof(int))
+ THROW(PREFERENCE_ERROR_INVALID_PARAMETER);
}
return d->GetInt();
_E("The type(%d) of keynode(%s) is not double",
static_cast<int>(type), key.c_str());
set_last_result(PREFERENCE_ERROR_INVALID_PARAMETER);
+ auto& raw = d->GetRaw();
+ if (raw.size() == 0 || raw.size() > sizeof(double))
+ THROW(PREFERENCE_ERROR_INVALID_PARAMETER);
}
return d->GetDouble();
} else {
_E("The type(%d) of keynode(%s) is not string",
static_cast<int>(type), key.c_str());
- set_last_result(PREFERENCE_ERROR_INVALID_PARAMETER);
+ THROW(PREFERENCE_ERROR_INVALID_PARAMETER);
}
return d->GetString();
_E("The type(%d) of keynode(%s) is not boolean",
static_cast<int>(type), key.c_str());
set_last_result(PREFERENCE_ERROR_INVALID_PARAMETER);
+ auto& raw = d->GetRaw();
+ if (raw.size() == 0 || raw.size() > sizeof(int))
+ THROW(PREFERENCE_ERROR_INVALID_PARAMETER);
}
return d->GetBoolean();