format: Use json_object_object_get_ex() instead of deprecated json_object_object_get()

pulse/format.c: In function 'pa_format_info_get_prop_type':
pulse/format.c:252:5: warning: implicit declaration of function 'is_error' [-Wimplicit-function-declaration]
pulse/format.c:287:13: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:293:13: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c: In function 'pa_format_info_get_prop_int_range':
pulse/format.c:364:5: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:369:5: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c: In function 'pa_format_info_prop_compatible':
pulse/format.c:676:9: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]
pulse/format.c:680:9: warning: 'json_object_object_get' is deprecated (declared at /usr/local/include/json-c/json_object.h:290) [-Wdeprecated-declarations]

json-c 0.10 (released 20120530) added json_object_object_get_ex()
json-c 0.12 (released 20140410) deprecated json_object_object_get()

PulseAudio depends on json 0.9 or json-c 0.11, drop support for json 0.9
in a subsequent patch and require json-c 0.11 (this will also avoids confusion
which json package is needed due to the upstream rename)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
Peter Meerwald 2014-08-18 14:04:59 +02:00
parent 514766a79f
commit a940877224

View file

@ -283,14 +283,12 @@ pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char
case json_type_object: case json_type_object:
/* We actually know at this point that it's a int range, but let's /* We actually know at this point that it's a int range, but let's
* confirm. */ * confirm. */
o1 = json_object_object_get(o, PA_JSON_MIN_KEY); if (!json_object_object_get_ex(o, PA_JSON_MIN_KEY, NULL)) {
if (!o1) {
type = PA_PROP_TYPE_INVALID; type = PA_PROP_TYPE_INVALID;
break; break;
} }
o1 = json_object_object_get(o, PA_JSON_MAX_KEY); if (!json_object_object_get_ex(o, PA_JSON_MAX_KEY, NULL)) {
if (!o1) {
type = PA_PROP_TYPE_INVALID; type = PA_PROP_TYPE_INVALID;
break; break;
} }
@ -360,12 +358,12 @@ int pa_format_info_get_prop_int_range(const pa_format_info *f, const char *key,
if (json_object_get_type(o) != json_type_object) if (json_object_get_type(o) != json_type_object)
goto out; goto out;
if (!(o1 = json_object_object_get(o, PA_JSON_MIN_KEY))) if (!json_object_object_get_ex(o, PA_JSON_MIN_KEY, &o1))
goto out; goto out;
*min = json_object_get_int(o1); *min = json_object_get_int(o1);
if (!(o1 = json_object_object_get(o, PA_JSON_MAX_KEY))) if (!json_object_object_get_ex(o, PA_JSON_MAX_KEY, &o1))
goto out; goto out;
*max = json_object_get_int(o1); *max = json_object_get_int(o1);
@ -668,12 +666,12 @@ static int pa_format_info_prop_compatible(const char *one, const char *two) {
goto out; goto out;
} }
o_min = json_object_object_get(o1, PA_JSON_MIN_KEY); if (!json_object_object_get_ex(o1, PA_JSON_MIN_KEY, &o_min) ||
if (!o_min || json_object_get_type(o_min) != json_type_int) json_object_get_type(o_min) != json_type_int)
goto out; goto out;
o_max = json_object_object_get(o1, PA_JSON_MAX_KEY); if (!json_object_object_get_ex(o1, PA_JSON_MAX_KEY, &o_max) ||
if (!o_max || json_object_get_type(o_max) != json_type_int) json_object_get_type(o_max) != json_type_int)
goto out; goto out;
v = json_object_get_int(o2); v = json_object_get_int(o2);