[pulseaudio-commits] 4 commits - configure.ac src/pulse
Peter Meerwald
pmeerw at kemper.freedesktop.org
Fri Aug 22 06:39:45 PDT 2014
configure.ac | 3 +--
src/pulse/format.c | 43 ++++++++++++++++---------------------------
2 files changed, 17 insertions(+), 29 deletions(-)
New commits:
commit 3a04554f9edc57d885905d6aeec38f1c9c97f17a
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date: Mon Aug 18 14:38:30 2014 +0200
format: Don't use deprecated json-c is_error() macro
json_tokener_parse() simply returns NULL on error these days
latest json-c (post 0.12) doesn't automatically include json-c/bits.h anymore
causing compilation errors
Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
diff --git a/src/pulse/format.c b/src/pulse/format.c
index 2834965..1aa3377 100644
--- a/src/pulse/format.c
+++ b/src/pulse/format.c
@@ -249,7 +249,7 @@ pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char
return PA_PROP_TYPE_INVALID;
o = json_tokener_parse(str);
- if (is_error(o))
+ if (!o)
return PA_PROP_TYPE_INVALID;
switch (json_object_get_type(o)) {
@@ -318,7 +318,7 @@ int pa_format_info_get_prop_int(const pa_format_info *f, const char *key, int *v
return -PA_ERR_NOENTITY;
o = json_tokener_parse(str);
- if (is_error(o)) {
+ if (!o) {
pa_log_debug("Failed to parse format info property '%s'.", key);
return -PA_ERR_INVALID;
}
@@ -350,7 +350,7 @@ int pa_format_info_get_prop_int_range(const pa_format_info *f, const char *key,
return -PA_ERR_NOENTITY;
o = json_tokener_parse(str);
- if (is_error(o)) {
+ if (!o) {
pa_log_debug("Failed to parse format info property '%s'.", key);
return -PA_ERR_INVALID;
}
@@ -393,7 +393,7 @@ int pa_format_info_get_prop_int_array(const pa_format_info *f, const char *key,
return -PA_ERR_NOENTITY;
o = json_tokener_parse(str);
- if (is_error(o)) {
+ if (!o) {
pa_log_debug("Failed to parse format info property '%s'.", key);
return -PA_ERR_INVALID;
}
@@ -437,7 +437,7 @@ int pa_format_info_get_prop_string(const pa_format_info *f, const char *key, cha
return -PA_ERR_NOENTITY;
o = json_tokener_parse(str);
- if (is_error(o)) {
+ if (!o) {
pa_log_debug("Failed to parse format info property '%s'.", key);
return -PA_ERR_INVALID;
}
@@ -469,7 +469,7 @@ int pa_format_info_get_prop_string_array(const pa_format_info *f, const char *ke
return -PA_ERR_NOENTITY;
o = json_tokener_parse(str);
- if (is_error(o)) {
+ if (!o) {
pa_log_debug("Failed to parse format info property '%s'.", key);
return -PA_ERR_INVALID;
}
@@ -626,11 +626,11 @@ static int pa_format_info_prop_compatible(const char *one, const char *two) {
int i, ret = 0;
o1 = json_tokener_parse(one);
- if (is_error(o1))
+ if (!o1)
goto out;
o2 = json_tokener_parse(two);
- if (is_error(o2))
+ if (!o2)
goto out;
/* We don't deal with both values being non-fixed - just because there is no immediate need (FIXME) */
commit 329bb6d7df0dc8b814309211c3cd9143c24c8c37
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date: Mon Aug 18 14:10:44 2014 +0200
build-sys: Drop support for json 0.9
drop support for json 0.9 and require json-c 0.11 (this will also avoids confusion
which json package is needed due to the upstream rename)
json 0.9 lacks json_object_object_get_ex()
json-c 0.11 was released 20130402
Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
diff --git a/configure.ac b/configure.ac
index 094b356..7b56210 100644
--- a/configure.ac
+++ b/configure.ac
@@ -642,8 +642,7 @@ AM_CONDITIONAL([HAVE_TESTS], [test "x$HAVE_LIBCHECK" = x1])
#### json parsing ####
-PKG_CHECK_MODULES(LIBJSON, [ json-c >= 0.11 ], [],
- [PKG_CHECK_MODULES(LIBJSON, [ json >= 0.9 ])])
+PKG_CHECK_MODULES(LIBJSON, [ json-c >= 0.11 ])
#### Sound file ####
commit a9408772244f6e04c80aedbcbcbbe0a1c1522726
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date: Mon Aug 18 14:04:59 2014 +0200
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 at pmeerw.net>
diff --git a/src/pulse/format.c b/src/pulse/format.c
index b1276c7..2834965 100644
--- a/src/pulse/format.c
+++ b/src/pulse/format.c
@@ -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:
/* We actually know at this point that it's a int range, but let's
* confirm. */
- o1 = json_object_object_get(o, PA_JSON_MIN_KEY);
- if (!o1) {
+ if (!json_object_object_get_ex(o, PA_JSON_MIN_KEY, NULL)) {
type = PA_PROP_TYPE_INVALID;
break;
}
- o1 = json_object_object_get(o, PA_JSON_MAX_KEY);
- if (!o1) {
+ if (!json_object_object_get_ex(o, PA_JSON_MAX_KEY, NULL)) {
type = PA_PROP_TYPE_INVALID;
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)
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;
*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;
*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;
}
- o_min = json_object_object_get(o1, PA_JSON_MIN_KEY);
- if (!o_min || json_object_get_type(o_min) != json_type_int)
+ if (!json_object_object_get_ex(o1, PA_JSON_MIN_KEY, &o_min) ||
+ json_object_get_type(o_min) != json_type_int)
goto out;
- o_max = json_object_object_get(o1, PA_JSON_MAX_KEY);
- if (!o_max || json_object_get_type(o_max) != json_type_int)
+ if (!json_object_object_get_ex(o1, PA_JSON_MAX_KEY, &o_max) ||
+ json_object_get_type(o_max) != json_type_int)
goto out;
v = json_object_get_int(o2);
commit 514766a79f9a141951cfc359baa2b44ca9e0e779
Author: Peter Meerwald <p.meerwald at bct-electronic.com>
Date: Mon Aug 18 13:33:22 2014 +0200
format: Don't _put() objects obtained with json_object_object_get() or json_object_array_get_idx()
json-c documentation states that "No reference counts will be changed.
There is no need to manually adjust reference counts through the
json_object_put/json_object_get methods unless..."
hence fix pa_format_info_get_prop_type() and pa_format_info_get_prop_int_range();
note that pa_format_info_prop_compatible() is OK
the json_object_array_get_idx() bug reported by Arun, thanks!
Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
Cc: Arun Raghavan <arun at accosted.net>
diff --git a/src/pulse/format.c b/src/pulse/format.c
index 729c2d2..b1276c7 100644
--- a/src/pulse/format.c
+++ b/src/pulse/format.c
@@ -278,7 +278,6 @@ pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char
else
type = PA_PROP_TYPE_INVALID;
- json_object_put(o1);
break;
case json_type_object:
@@ -289,14 +288,12 @@ pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char
type = PA_PROP_TYPE_INVALID;
break;
}
- json_object_put(o1);
o1 = json_object_object_get(o, PA_JSON_MAX_KEY);
if (!o1) {
type = PA_PROP_TYPE_INVALID;
break;
}
- json_object_put(o1);
type = PA_PROP_TYPE_INT_RANGE;
break;
@@ -367,13 +364,11 @@ int pa_format_info_get_prop_int_range(const pa_format_info *f, const char *key,
goto out;
*min = json_object_get_int(o1);
- json_object_put(o1);
if (!(o1 = json_object_object_get(o, PA_JSON_MAX_KEY)))
goto out;
*max = json_object_get_int(o1);
- json_object_put(o1);
ret = 0;
@@ -415,12 +410,10 @@ int pa_format_info_get_prop_int_array(const pa_format_info *f, const char *key,
o1 = json_object_array_get_idx(o, i);
if (json_object_get_type(o1) != json_type_int) {
- json_object_put(o1);
goto out;
}
(*values)[i] = json_object_get_int(o1);
- json_object_put(o1);
}
ret = 0;
@@ -493,12 +486,10 @@ int pa_format_info_get_prop_string_array(const pa_format_info *f, const char *ke
o1 = json_object_array_get_idx(o, i);
if (json_object_get_type(o1) != json_type_string) {
- json_object_put(o1);
goto out;
}
(*values)[i] = pa_xstrdup(json_object_get_string(o1));
- json_object_put(o1);
}
ret = 0;
More information about the pulseaudio-commits
mailing list