# HG changeset patch # User Frank Benoit # Date 1194621452 -3600 # Node ID 44c987465a203fd85a0cd54457fc786c5e6954b7 # Parent 19117ffaee677b17b2b8ffe0f41013cce2a4ee7b fixed assertion error for open_container diff -r 19117ffaee67 -r 44c987465a20 dbus-d/dsrc/org/freedesktop/dbus/DBus.d --- a/dbus-d/dsrc/org/freedesktop/dbus/DBus.d Sun Oct 28 20:04:15 2007 +0100 +++ b/dbus-d/dsrc/org/freedesktop/dbus/DBus.d Fri Nov 09 16:17:32 2007 +0100 @@ -2,7 +2,7 @@ * Copyright (C) 2007 Frank Benoit * * Licensed under the Academic Free License version 2.1 - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -12,7 +12,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -200,7 +200,7 @@ class DBusConnectionImpl { DBusConnection* conn; - + public this( char[] addr ){ DBusError err; int trial = 0; @@ -208,19 +208,19 @@ trial++; dbus_error_init(&err); - scope(exit) + scope(exit) if( dbus_error_is_set(&err) ){ dbus_error_free(&err); } - + conn = dbus_connection_open_private( XtoUtf8z(addr), & err ); - + if( !dbus_error_is_set(&err) && conn !is null ){ return; } if( trial > 10 ){ if( dbus_error_is_set(&err) ){ - Stdout.formatln( "Connect Error ({})\n", fromUtf8z( err.message)); + Stdout.formatln( "Connect Error ({})\n", fromUtf8z( err.message)); throw new Exception(""); } if( conn is null ){ @@ -232,7 +232,7 @@ } } } - + /+ public DBusInterface getRemoteObject( char[] path ){ return null; }+/ @@ -249,7 +249,7 @@ dbus_error_init(&err); //CBus.dbus_bus_request_name(conn, XtoUtf8z("test.method.caller"), DBUS_NAME_FLAG_REPLACE_EXISTING , &err); if( dbus_error_is_set(&err) ){ - Stdout.formatln( "Name Error ({})\n", fromUtf8z( err.message)); + Stdout.formatln( "Name Error ({})\n", fromUtf8z( err.message)); dbus_error_free(&err); throw new Exception(""); } @@ -512,7 +512,8 @@ else if( DBusVariantStruct v = cast(DBusVariantStruct)value ){ DBusMessageIter sub2; - ensureDBus( dbus_message_iter_open_container( &sub, DBUS_TYPE_STRUCT, XtoUtf8z( v.getSig() ), &sub2 )); + // open_cont: if type=STRUCT => sig shall be null + ensureDBus( dbus_message_iter_open_container( &sub, DBUS_TYPE_STRUCT, null/*XtoUtf8z( v.getSig() )*/, &sub2 )); foreach( el; v.values ){ appendMsgParamVariant( conn, &sub2, el ); } @@ -539,7 +540,7 @@ ensureDBus( dbus_message_iter_close_container( &sub, &sub2 )); } else{ - Stdout.formatln( "appendMsgParamVariant not handled case for sig: {}", value.getSig() ).flush(); + Stdout.formatln( "appendMsgParamVariant not handled case for sig: {}", value.getSig() ).flush(); ensure( false, "appendMsgParamVariant not handled case for sig: %0", value.getSig() ); } ensureDBus( dbus_message_iter_close_container( iter, &sub )); @@ -559,7 +560,8 @@ void appendMsgParamStruct( T... )( DBusConnection* conn, DBusMessageIter* iter, T t ){ //pragma( msg, "appendMsgParamStruct: "~typeof(T).stringof ); DBusMessageIter sub; - ensureDBus( dbus_message_iter_open_container( iter, DBUS_TYPE_STRUCT, XtoUtf8z( createDBusSignature!(T)), &sub )); + // open_cont: if type=STRUCT => sig shall be null + ensureDBus( dbus_message_iter_open_container( iter, DBUS_TYPE_STRUCT, null, &sub )); foreach( item; t ){ appendItem( conn, &sub, item ); } @@ -800,7 +802,7 @@ buf.length = name.length; } buf[ 0 .. name.length ] = name; - + char[] sig = fromUtf8z( dbus_message_get_signature(message)); int sz = name.length+sig.length+1; if( buf.length < sz ){ @@ -1105,7 +1107,7 @@ } -/** +/** * this function shall be used like so: * --- * mixin( createJavaImplementation( "MyClass", ["I1", "I2" ] ));