mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
sample: introduce pa_proplist_setp()
This commit is contained in:
parent
346a708c2c
commit
261a4830fb
3 changed files with 24 additions and 0 deletions
|
|
@ -175,6 +175,7 @@ pa_proplist_iterate;
|
||||||
pa_proplist_new;
|
pa_proplist_new;
|
||||||
pa_proplist_set;
|
pa_proplist_set;
|
||||||
pa_proplist_setf;
|
pa_proplist_setf;
|
||||||
|
pa_proplist_setp;
|
||||||
pa_proplist_sets;
|
pa_proplist_sets;
|
||||||
pa_proplist_size;
|
pa_proplist_size;
|
||||||
pa_proplist_to_string;
|
pa_proplist_to_string;
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,21 @@ static int proplist_setn(pa_proplist *p, const char *key, size_t key_length, con
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Will accept only valid UTF-8 */
|
||||||
|
int pa_proplist_setp(pa_proplist *p, const char *pair) {
|
||||||
|
const char *t;
|
||||||
|
|
||||||
|
pa_assert(p);
|
||||||
|
pa_assert(pair);
|
||||||
|
|
||||||
|
if (!(t = strchr(pair, '=')))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return proplist_setn(p,
|
||||||
|
pair, t - pair,
|
||||||
|
t + 1, strchr(pair, 0) - t - 1);
|
||||||
|
}
|
||||||
|
|
||||||
static int proplist_sethex(pa_proplist *p, const char *key, size_t key_length, const char *value, size_t value_length) {
|
static int proplist_sethex(pa_proplist *p, const char *key, size_t key_length, const char *value, size_t value_length) {
|
||||||
struct property *prop;
|
struct property *prop;
|
||||||
pa_bool_t add = FALSE;
|
pa_bool_t add = FALSE;
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,14 @@ void pa_proplist_free(pa_proplist* p);
|
||||||
* UTF-8. \since 0.9.11 */
|
* UTF-8. \since 0.9.11 */
|
||||||
int pa_proplist_sets(pa_proplist *p, const char *key, const char *value);
|
int pa_proplist_sets(pa_proplist *p, const char *key, const char *value);
|
||||||
|
|
||||||
|
/** Append a new string entry to the property list, possibly
|
||||||
|
* overwriting an already existing entry with the same key. An
|
||||||
|
* internal copy of the data passed is made. Will accept only valid
|
||||||
|
* UTF-8. The string passed in must contain a '='. Left hand side of
|
||||||
|
* the '=' is used as key name, the right hand side as string
|
||||||
|
* data. \since 0.9.16 */
|
||||||
|
int pa_proplist_setp(pa_proplist *p, const char *pair);
|
||||||
|
|
||||||
/** Append a new string entry to the property list, possibly
|
/** Append a new string entry to the property list, possibly
|
||||||
* overwriting an already existing entry with the same key. An
|
* overwriting an already existing entry with the same key. An
|
||||||
* internal copy of the data passed is made. Will accept only valid
|
* internal copy of the data passed is made. Will accept only valid
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue