2020-06-16 21:39:45 +00:00
|
|
|
#include "webfuse_provider/impl/json_util.h"
|
2020-02-28 22:17:41 +00:00
|
|
|
|
2020-06-16 21:57:41 +00:00
|
|
|
int wfp_impl_json_get_int(json_t const * object, char const * key, int default_value)
|
2020-02-28 22:17:41 +00:00
|
|
|
{
|
|
|
|
int result = default_value;
|
|
|
|
|
|
|
|
json_t * holder = json_object_get(object, key);
|
|
|
|
if ((NULL != holder) && (json_is_integer(holder)))
|
|
|
|
{
|
|
|
|
result = json_integer_value(holder);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-06-16 21:57:41 +00:00
|
|
|
wfp_status
|
|
|
|
wfp_impl_jsonrpc_get_status(
|
2020-02-28 22:17:41 +00:00
|
|
|
json_t const * error)
|
|
|
|
{
|
2020-06-16 21:57:41 +00:00
|
|
|
wfp_status status = WFP_GOOD;
|
2020-02-28 22:17:41 +00:00
|
|
|
if (NULL != error)
|
|
|
|
{
|
2020-06-16 21:57:41 +00:00
|
|
|
status = wfp_impl_json_get_int(error, "code", WFP_BAD_FORMAT);
|
2020-02-28 22:17:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|