]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
htsmsg: add ability to set/update a u32
authorAdam Sutton <dev@adamsutton.me.uk>
Tue, 9 Apr 2013 21:23:02 +0000 (22:23 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Tue, 9 Apr 2013 21:23:02 +0000 (22:23 +0100)
src/htsmsg.c
src/htsmsg.h

index 90f4e4eb4fcbb72a0da85ea4c4df6264b347a18c..62307dac07c938f77f46183ddd7be19b3572459e 100644 (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;
+}
+
 /*
  *
  */
index 8343634f7471c0cb0fc612f2ac3e0ea9aff4c116..05beb2cf35bc59784ccb114af5ec918ed394a9c1 100644 (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.
  */