dbus/test Makefile.am, 1.34, 1.35 break-loader.c, 1.13, 1.14 test-service.c, 1.17, 1.18

Havoc Pennington hp@freedesktop.org
Fri Jan 14 23:15:40 PST 2005


Update of /cvs/dbus/dbus/test
In directory gabe:/tmp/cvs-serv28195/test

Modified Files:
	Makefile.am break-loader.c test-service.c 
Log Message:
2005-01-15  Havoc Pennington  <hp@redhat.com>

	* Land the new message args API and type system.

	This patch is huge, but the public API change is not 
	really large. The set of D-BUS types has changed somewhat, 
	and the arg "getters" are more geared toward language bindings;
	they don't make a copy, etc.

	There are also some known issues. See these emails for details
	on this huge patch:
	http://lists.freedesktop.org/archives/dbus/2004-December/001836.html
        http://lists.freedesktop.org/archives/dbus/2005-January/001922.html
	
	* dbus/dbus-marshal-*: all the new stuff

	* dbus/dbus-message.c: basically rewritten

	* dbus/dbus-memory.c (check_guards): with "guards" enabled, init
	freed blocks to be all non-nul bytes so using freed memory is less
	likely to work right

	* dbus/dbus-internals.c (_dbus_test_oom_handling): add
	DBUS_FAIL_MALLOC=N environment variable, so you can do
	DBUS_FAIL_MALLOC=0 to skip the out-of-memory checking, or
	DBUS_FAIL_MALLOC=10 to make it really, really, really slow and
	thorough.

	* qt/message.cpp: port to the new message args API
	(operator<<): use str.utf8() rather than str.unicode()
	(pretty sure this is right from the Qt docs?)

	* glib/dbus-gvalue.c: port to the new message args API

	* bus/dispatch.c, bus/driver.c: port to the new message args API

	* dbus/dbus-string.c (_dbus_string_init_const_len): initialize the
	"locked" flag to TRUE and align_offset to 0; I guess we never
	looked at these anyhow, but seems cleaner.

	* dbus/dbus-string.h (_DBUS_STRING_ALLOCATION_PADDING):
	move allocation padding macro to this header; use it to implement
	(_DBUS_STRING_STATIC): ability to declare a static string.

	* dbus/dbus-message.c (_dbus_message_has_type_interface_member):
	change to return TRUE if the interface is not set.

	* dbus/dbus-string.[hc]: move the D-BUS specific validation stuff
	to dbus-marshal-validate.[hc]

	* dbus/dbus-marshal-basic.c (_dbus_type_to_string): move here from
	dbus-internals.c

	* dbus/Makefile.am: cut over from dbus-marshal.[hc]
	to dbus-marshal-*.[hc]

	* dbus/dbus-object-tree.c (_dbus_decompose_path): move this
	function here from dbus-marshal.c



Index: Makefile.am
===================================================================
RCS file: /cvs/dbus/dbus/test/Makefile.am,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- Makefile.am	20 Sep 2004 11:24:38 -0000	1.34
+++ Makefile.am	15 Jan 2005 07:15:38 -0000	1.35
@@ -10,7 +10,8 @@
 
 
 if DBUS_BUILD_TESTS
-TEST_BINARIES=test-service break-loader spawn-test test-segfault test-exit test-sleep-forever
+## break-loader removed for now
+TEST_BINARIES=test-service spawn-test test-segfault test-exit test-sleep-forever
 else
 TEST_BINARIES=
 endif
@@ -28,8 +29,8 @@
 	test-utils.c				\
 	test-utils.h
 
-break_loader_SOURCES=				\
-	break-loader.c
+##break_loader_SOURCES=				\
+##	break-loader.c
 
 spawn_test_SOURCES=				\
 	spawn-test.c
@@ -49,7 +50,7 @@
 TEST_LIBS=$(DBUS_TEST_LIBS) $(top_builddir)/dbus/libdbus-convenience.la
 
 test_service_LDADD=$(TEST_LIBS)
-break_loader_LDADD= $(TEST_LIBS)
+## break_loader_LDADD= $(TEST_LIBS)
 spawn_test_LDADD=$(TEST_LIBS)
 decode_gcov_LDADD=$(TEST_LIBS)
 

Index: break-loader.c
===================================================================
RCS file: /cvs/dbus/dbus/test/break-loader.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- break-loader.c	10 Aug 2004 03:07:01 -0000	1.13
+++ break-loader.c	15 Jan 2005 07:15:38 -0000	1.14
@@ -36,7 +36,7 @@
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-internals.h>
 #include <dbus/dbus-test.h>
-#include <dbus/dbus-marshal.h>
+#include <dbus/dbus-marshal-basic.h>
 #undef DBUS_COMPILATION
 
 static DBusString failure_dir;

Index: test-service.c
===================================================================
RCS file: /cvs/dbus/dbus/test/test-service.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- test-service.c	7 Jun 2004 19:27:50 -0000	1.17
+++ test-service.c	15 Jan 2005 07:15:38 -0000	1.18
@@ -58,7 +58,7 @@
     die ("No memory\n");
   
   if (!dbus_message_append_args (reply,
-                                 DBUS_TYPE_STRING, s,
+                                 DBUS_TYPE_STRING, &s,
                                  DBUS_TYPE_INVALID))
     die ("No memory");
   
@@ -67,8 +67,6 @@
 
   fprintf (stderr, "Echo service echoed string: \"%s\"\n", s);
   
-  dbus_free (s);
-  
   dbus_message_unref (reply);
     
   return DBUS_HANDLER_RESULT_HANDLED;
@@ -104,6 +102,7 @@
     {
       /* Emit the Foo signal */
       DBusMessage *signal;
+      double v_DOUBLE;
 
       _dbus_verbose ("emitting signal Foo\n");
       
@@ -112,9 +111,10 @@
                                         "Foo");
       if (signal == NULL)
         die ("No memory\n");
-      
+
+      v_DOUBLE = 42.6;
       if (!dbus_message_append_args (signal,
-                                     DBUS_TYPE_DOUBLE, 42.6,
+                                     DBUS_TYPE_DOUBLE, &v_DOUBLE,
                                      DBUS_TYPE_INVALID))
         die ("No memory");
   



More information about the dbus-commit mailing list