summaryrefslogtreecommitdiff
path: root/legacy/edbus/src/lib/edbus_message.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-12-17 18:24:31 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-12-17 18:24:31 +0000
commite53c47bcf08fed5d66bdf350b680551902acb546 (patch)
tree1ab60fb73ec7660af0a5247cf18554f5c25e77db /legacy/edbus/src/lib/edbus_message.c
parent7a2a31a436a629dbff6d60b5ca1e324d280d9c0c (diff)
edbus: Let arguments_get fail if getting less args than passed
If user passed a string with more elements, return EINA_FALSE on edbus_message_arguments_get() so he knows not all elements are initialized. Before this patch, we would notify user of its error if he did something like: i) edbus_message_arguments_get(msg, "uu", &a) ii) edbus_message_arguments_get(msg, "uu", &a, &b) And "msg" containing only 1 argument. This also fixes the case in which user is getting the elements of an array iterator and the array is empty. We were previously returning EINA_TRUE, even if we were not filling the variable. Last but not least, if the user was calling edbus_message_iter_arguments_get() in an empty array, we would return EINA_FALSE, even if we didn't actually get any element. SVN revision: 81170
Diffstat (limited to '')
-rw-r--r--legacy/edbus/src/lib/edbus_message.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/legacy/edbus/src/lib/edbus_message.c b/legacy/edbus/src/lib/edbus_message.c
index c44cc9d839..eeab1db1bc 100644
--- a/legacy/edbus/src/lib/edbus_message.c
+++ b/legacy/edbus/src/lib/edbus_message.c
@@ -721,6 +721,7 @@ edbus_message_iter_arguments_vget(EDBus_Message_Iter *iter, const char *signatur
721 721
722 dbus_signature_iter_init(&sig_iter, signature); 722 dbus_signature_iter_init(&sig_iter, signature);
723 iter_type = dbus_message_iter_get_arg_type(&iter->dbus_iterator); 723 iter_type = dbus_message_iter_get_arg_type(&iter->dbus_iterator);
724
724 while (iter_type != DBUS_TYPE_INVALID) 725 while (iter_type != DBUS_TYPE_INVALID)
725 { 726 {
726 int sig_type = dbus_signature_iter_get_current_type(&sig_iter); 727 int sig_type = dbus_signature_iter_get_current_type(&sig_iter);
@@ -751,7 +752,8 @@ edbus_message_iter_arguments_vget(EDBus_Message_Iter *iter, const char *signatur
751 dbus_signature_iter_next(&sig_iter); 752 dbus_signature_iter_next(&sig_iter);
752 iter_type = dbus_message_iter_get_arg_type(&iter->dbus_iterator); 753 iter_type = dbus_message_iter_get_arg_type(&iter->dbus_iterator);
753 } 754 }
754 return EINA_TRUE; 755
756 return dbus_signature_iter_get_current_type(&sig_iter) == DBUS_TYPE_INVALID;
755} 757}
756 758
757EAPI void 759EAPI void