aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-09-24 16:12:56 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-09-26 09:25:05 +0200
commitf88c6029d0f9504e2d88b95d25f1bae7bccbdf9f (patch)
tree0642be4aa5afa1530e89755407e3189af9c50661
parentd6613195a98aea78163e8118c524d25d22f70f8b (diff)
downloadexternal_libqmi-f88c6029d0f9504e2d88b95d25f1bae7bccbdf9f.zip
external_libqmi-f88c6029d0f9504e2d88b95d25f1bae7bccbdf9f.tar.gz
external_libqmi-f88c6029d0f9504e2d88b95d25f1bae7bccbdf9f.tar.bz2
message: renamed `qmi_message_tlv_foreach()' to `qmi_message_foreach_raw_tlv()'
-rw-r--r--build-aux/qmi-codegen/Message.py8
-rw-r--r--libqmi-glib/qmi-message.c26
-rw-r--r--libqmi-glib/qmi-message.h14
3 files changed, 28 insertions, 20 deletions
diff --git a/build-aux/qmi-codegen/Message.py b/build-aux/qmi-codegen/Message.py
index 016c416..5e23f08 100644
--- a/build-aux/qmi-codegen/Message.py
+++ b/build-aux/qmi-codegen/Message.py
@@ -280,8 +280,8 @@ class Message:
'static void\n'
'${type}_${underscore}_get_tlv_printable (\n'
' guint8 type,\n'
+ ' const guint8 *value,\n'
' gsize length,\n'
- ' gconstpointer value,\n'
' struct ${type}_${underscore}_context *ctx)\n'
'{\n'
' const gchar *tlv_type_str = NULL;\n'
@@ -388,9 +388,9 @@ class Message:
' ctx.self = self;\n'
' ctx.line_prefix = line_prefix;\n'
' ctx.printable = printable;\n'
- ' qmi_message_tlv_foreach (self,\n'
- ' (QmiMessageForeachTlvFn)${type}_${underscore}_get_tlv_printable,\n'
- ' &ctx);\n'
+ ' qmi_message_foreach_raw_tlv (self,\n'
+ ' (QmiMessageForeachRawTlvFn)${type}_${underscore}_get_tlv_printable,\n'
+ ' &ctx);\n'
' }\n')
template += (
'\n'
diff --git a/libqmi-glib/qmi-message.c b/libqmi-glib/qmi-message.c
index 9cc566c..378eccf 100644
--- a/libqmi-glib/qmi-message.c
+++ b/libqmi-glib/qmi-message.c
@@ -491,21 +491,29 @@ qmi_message_get_raw_tlv (QmiMessage *self,
return NULL;
}
+/**
+ * qmi_message_foreach_raw_tlv:
+ * @self: a #QmiMessage.
+ * @func: the function to call for each TLV.
+ * @user_data: user data to pass to the function.
+ *
+ * Calls the given function for each TLV found within the #QmiMessage.
+ */
void
-qmi_message_tlv_foreach (QmiMessage *self,
- QmiMessageForeachTlvFn callback,
- gpointer user_data)
+qmi_message_foreach_raw_tlv (QmiMessage *self,
+ QmiMessageForeachRawTlvFn func,
+ gpointer user_data)
{
struct tlv *tlv;
- g_assert (self != NULL);
- g_assert (callback != NULL);
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (func != NULL);
for (tlv = qmi_tlv_first (self); tlv; tlv = qmi_tlv_next (self, tlv)) {
- callback (tlv->type,
- (gsize)(le16toh (tlv->length)),
- (gconstpointer)tlv->value,
- user_data);
+ func (tlv->type,
+ (const guint8 *)tlv->value,
+ (gsize)(GUINT16_FROM_LE (tlv->length)),
+ user_data);
}
}
diff --git a/libqmi-glib/qmi-message.h b/libqmi-glib/qmi-message.h
index 40ab5e4..b60b0fd 100644
--- a/libqmi-glib/qmi-message.h
+++ b/libqmi-glib/qmi-message.h
@@ -48,13 +48,13 @@ QmiMessage *qmi_message_new_from_raw (const guint8 *raw,
QmiMessage *qmi_message_ref (QmiMessage *self);
void qmi_message_unref (QmiMessage *self);
-typedef void (* QmiMessageForeachTlvFn) (guint8 type,
- gsize length,
- gconstpointer value,
- gpointer user_data);
-void qmi_message_tlv_foreach (QmiMessage *self,
- QmiMessageForeachTlvFn callback,
- gpointer user_data);
+typedef void (* QmiMessageForeachRawTlvFn) (guint8 type,
+ const guint8 *value,
+ gsize length,
+ gpointer user_data);
+void qmi_message_foreach_raw_tlv (QmiMessage *self,
+ QmiMessageForeachRawTlvFn func,
+ gpointer user_data);
const guint8 *qmi_message_get_raw_tlv (QmiMessage *self,
guint8 type,