Пример #1
0
void MessageIter::copy_data(MessageIter &to)
{
	for (MessageIter &from = *this; !from.at_end(); ++from)
	{
		if (is_basic_type(from.type()))
		{
			debug_log("copying basic type: %c", from.type());

			unsigned char value[8];
			from.get_basic(from.type(), &value);
			to.append_basic(from.type(), &value);
		}
		else
		{
			MessageIter from_container = from.recurse();
			char *sig = from_container.signature();

			debug_log("copying compound type: %c[%s]", from.type(), sig);

			MessageIter to_container (to.msg());
			dbus_message_iter_open_container
			(
				(DBusMessageIter *)&(to._iter),
				from.type(),
				from.type() == DBUS_TYPE_VARIANT ? NULL : sig,
				(DBusMessageIter *)&(to_container._iter)
			);

			from_container.copy_data(to_container);
			to.close_container(to_container);
			free(sig);
		}
	}
}
Пример #2
0
void MessageIter::copy_data(MessageIter &to)
{
  for (MessageIter &from = *this; !from.at_end(); ++from)
  {
    if (is_basic_type(from.type()))
    {
      debug_log("copying basic type: %c", from.type());

      unsigned char value[8];
      from.get_basic(from.type(), &value);
      to.append_basic(from.type(), &value);
    }
    else
    {
      MessageIter from_container = from.recurse();
      char *sig = from_container.signature();

      debug_log("copying compound type: %c[%s]", from.type(), sig);

      MessageIter to_container(to.msg());
      /**
       * Replaced

      dbus_message_iter_open_container
      (
        (DBusMessageIter *) & (to._iter),
        from.type(),
        from.type() == DBUS_TYPE_VARIANT ? NULL : sig,
        (DBusMessageIter *) & (to_container._iter)
      );
      */
      /**
       * Added by toolmmy <*****@*****.**>
       * see https://bugs.launchpad.net/ubuntu/+source/dbus-c++/+bug/1098723
       */
      dbus_message_iter_open_container(
    		  (DBusMessageIter *) &(to._iter), from.type(),
    		  ((from.type() == DBUS_TYPE_STRUCT) || (from.type() == DBUS_TYPE_DICT_ENTRY) ?  NULL : sig),
    		  (DBusMessageIter *) &(to_container._iter)
      );

      from_container.copy_data(to_container);
      to.close_container(to_container);
      free(sig);
    }
  }
}