mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-06 16:30:18 +01:00
2003-06-24 Havoc Pennington <hp@pobox.com>
* mono/*.cs: Use IntPtr.Zero instead of ((IntPtr) 0)
This commit is contained in:
parent
f55377a708
commit
6fba6839f5
4 changed files with 24 additions and 20 deletions
|
|
@ -1,3 +1,7 @@
|
|||
2003-06-24 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* mono/*.cs: Use IntPtr.Zero instead of ((IntPtr) 0)
|
||||
|
||||
2003-06-23 Anders Carlsson <andersca@codefactory.se>
|
||||
|
||||
* configure.in:
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace DBus {
|
|||
Error error = new Error ();
|
||||
error.Init ();
|
||||
raw = dbus_connection_open (address, ref error);
|
||||
if (raw != (IntPtr) 0) {
|
||||
if (raw != IntPtr.Zero) {
|
||||
dbus_connection_unref (raw);
|
||||
} else {
|
||||
Exception e = new Exception (ref error);
|
||||
|
|
@ -33,14 +33,14 @@ namespace DBus {
|
|||
error.Init ();
|
||||
|
||||
IntPtr ptr = dbus_bus_get ((int) bus, ref error);
|
||||
if (ptr != (IntPtr) 0) {
|
||||
if (ptr != IntPtr.Zero) {
|
||||
Connection c = Wrap (ptr);
|
||||
dbus_connection_unref (ptr);
|
||||
return c;
|
||||
} else {
|
||||
Exception e = new Exception (ref error);
|
||||
error.Free ();
|
||||
throw e;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ namespace DBus {
|
|||
IntPtr gch_ptr;
|
||||
|
||||
gch_ptr = dbus_connection_get_data (ptr, wrapper_slot);
|
||||
if (gch_ptr != (IntPtr) 0) {
|
||||
if (gch_ptr != IntPtr.Zero) {
|
||||
return (DBus.Connection) ((GCHandle)gch_ptr).Target;
|
||||
} else {
|
||||
return new Connection (ptr);
|
||||
|
|
@ -85,15 +85,15 @@ namespace DBus {
|
|||
if (value == raw_)
|
||||
return;
|
||||
|
||||
if (raw_ != (IntPtr) 0) {
|
||||
if (raw_ != IntPtr.Zero) {
|
||||
IntPtr gch_ptr;
|
||||
|
||||
gch_ptr = dbus_connection_get_data (raw_,
|
||||
wrapper_slot);
|
||||
Debug.Assert (gch_ptr != (IntPtr) 0);
|
||||
Debug.Assert (gch_ptr != IntPtr.Zero);
|
||||
|
||||
dbus_connection_set_data (raw_, wrapper_slot,
|
||||
(IntPtr) 0, (IntPtr) 0);
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
|
||||
((GCHandle) gch_ptr).Free ();
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ namespace DBus {
|
|||
|
||||
raw_ = value;
|
||||
|
||||
if (raw_ != (IntPtr) 0) {
|
||||
if (raw_ != IntPtr.Zero) {
|
||||
GCHandle gch;
|
||||
|
||||
dbus_connection_ref (raw_);
|
||||
|
|
@ -111,16 +111,16 @@ namespace DBus {
|
|||
gch = GCHandle.Alloc (this, GCHandleType.WeakTrackResurrection);
|
||||
|
||||
dbus_connection_set_data (raw_, wrapper_slot,
|
||||
(IntPtr) gch, (IntPtr) 0);
|
||||
(IntPtr) gch, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~Connection () {
|
||||
if (raw != (IntPtr) 0) {
|
||||
if (raw != IntPtr.Zero) {
|
||||
Disconnect ();
|
||||
}
|
||||
raw = (IntPtr) 0; // free the native object
|
||||
raw = IntPtr.Zero; // free the native object
|
||||
}
|
||||
|
||||
Connection (IntPtr r) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace DBus {
|
|||
internal static void Init () {
|
||||
if (!initialized) {
|
||||
initialized = true;
|
||||
g_thread_init ((IntPtr) 0);
|
||||
g_thread_init (IntPtr.Zero);
|
||||
dbus_gthread_init ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace DBus {
|
|||
string dest_service) {
|
||||
// the assignment bumps the refcount
|
||||
raw = dbus_message_new (name, dest_service);
|
||||
if (raw == (IntPtr) 0)
|
||||
if (raw == IntPtr.Zero)
|
||||
throw new OutOfMemoryException ();
|
||||
dbus_message_unref (raw);
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ namespace DBus {
|
|||
IntPtr gch_ptr;
|
||||
|
||||
gch_ptr = dbus_message_get_data (ptr, wrapper_slot);
|
||||
if (gch_ptr != (IntPtr) 0) {
|
||||
if (gch_ptr != IntPtr.Zero) {
|
||||
return (DBus.Message) ((GCHandle)gch_ptr).Target;
|
||||
} else {
|
||||
return new Message (ptr);
|
||||
|
|
@ -43,15 +43,15 @@ namespace DBus {
|
|||
if (value == raw_)
|
||||
return;
|
||||
|
||||
if (raw_ != (IntPtr) 0) {
|
||||
if (raw_ != IntPtr.Zero) {
|
||||
IntPtr gch_ptr;
|
||||
|
||||
gch_ptr = dbus_message_get_data (raw_,
|
||||
wrapper_slot);
|
||||
Debug.Assert (gch_ptr != (IntPtr) 0);
|
||||
Debug.Assert (gch_ptr != IntPtr.Zero);
|
||||
|
||||
dbus_message_set_data (raw_, wrapper_slot,
|
||||
(IntPtr) 0, (IntPtr) 0);
|
||||
IntPtr.Zero, IntPtr.Zero);
|
||||
|
||||
((GCHandle) gch_ptr).Free ();
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ namespace DBus {
|
|||
|
||||
raw_ = value;
|
||||
|
||||
if (raw_ != (IntPtr) 0) {
|
||||
if (raw_ != IntPtr.Zero) {
|
||||
GCHandle gch;
|
||||
|
||||
dbus_message_ref (raw_);
|
||||
|
|
@ -69,13 +69,13 @@ namespace DBus {
|
|||
gch = GCHandle.Alloc (this, GCHandleType.WeakTrackResurrection);
|
||||
|
||||
dbus_message_set_data (raw_, wrapper_slot,
|
||||
(IntPtr) gch, (IntPtr) 0);
|
||||
(IntPtr) gch, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~Message () {
|
||||
raw = (IntPtr) 0; // free the native object
|
||||
raw = IntPtr.Zero; // free the native object
|
||||
}
|
||||
|
||||
Message (IntPtr r) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue