htsmsg: add ability to set/update a u32

This commit is contained in:
Adam Sutton 2013-04-09 22:23:02 +01:00
parent 2c8835e470
commit 4706b29f19
2 changed files with 20 additions and 0 deletions

View file

@ -186,6 +186,21 @@ htsmsg_add_u32(htsmsg_t *msg, const char *name, uint32_t u32)
f->hmf_s64 = u32;
}
/*
*
*/
int
htsmsg_set_u32(htsmsg_t *msg, const char *name, uint32_t u32)
{
htsmsg_field_t *f = htsmsg_field_find(msg, name);
if (!f)
f = htsmsg_field_add(msg, name, HMF_S64, HMF_NAME_ALLOCED);
if (f->hmf_type != HMF_S64)
return 1;
f->hmf_s64 = u32;
return 0;
}
/*
*
*/

View file

@ -111,6 +111,11 @@ void htsmsg_destroy(htsmsg_t *msg);
*/
void htsmsg_add_u32(htsmsg_t *msg, const char *name, uint32_t u32);
/**
* Add/update an integer field
*/
int htsmsg_set_u32(htsmsg_t *msg, const char *name, uint32_t u32);
/**
* Add an integer field where source is signed 32 bit.
*/