DBus: remove unused macro, check memory allocation
authorRafaël Carré <funman@videolan.org>
Thu, 27 Mar 2008 00:10:58 +0000 (01:10 +0100)
committerRafaël Carré <funman@videolan.org>
Thu, 27 Mar 2008 00:11:40 +0000 (01:11 +0100)
modules/control/dbus.c
modules/control/dbus.h

index ec2914d..514f2c1 100644 (file)
@@ -136,10 +136,20 @@ DBUS_METHOD( MprisVersion )
     dbus_uint16_t i_minor = VLC_MPRIS_VERSION_MINOR;
     DBusMessageIter version;
 
-    dbus_message_iter_open_container( &args, DBUS_TYPE_STRUCT, NULL, &version );
-    dbus_message_iter_append_basic( &version, DBUS_TYPE_UINT16, &i_major );
-    dbus_message_iter_append_basic( &version, DBUS_TYPE_UINT16, &i_minor );
-    dbus_message_iter_close_container( &args, &version );
+    if( !dbus_message_iter_open_container( &args, DBUS_TYPE_STRUCT, NULL,
+            &version ) )
+        return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+    if( !dbus_message_iter_append_basic( &version, DBUS_TYPE_UINT16,
+            &i_major ) )
+        return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+    if( !dbus_message_iter_append_basic( &version, DBUS_TYPE_UINT16,
+            &i_minor ) )
+        return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+    if( !dbus_message_iter_close_container( &args, &version ) )
+        return DBUS_HANDLER_RESULT_NEED_MEMORY;
     REPLY_SEND;
 }
 
index c9057d7..5956f0d 100644 (file)
@@ -80,7 +80,6 @@
 #define ADD_BOOL( b ) DBUS_ADD( DBUS_TYPE_BOOLEAN, b )
 #define ADD_INT32( i ) DBUS_ADD( DBUS_TYPE_INT32, i )
 #define ADD_BYTE( b ) DBUS_ADD( DBUS_TYPE_BYTE, b )
-#define ADD_UINT16( i ) DBUS_ADD( DBUS_TYPE_UINT16, i )
 
 /* XML data to answer org.freedesktop.DBus.Introspectable.Introspect requests */