| 1 |
diff -Naur notification-daemon-0.3.5.orig/src/daemon.c notification-daemon-0.3.5/src/daemon.c |
|---|
| 2 |
--- notification-daemon-0.3.5.orig/src/daemon.c 2006-04-26 10:32:50.000000000 +0200 |
|---|
| 3 |
+++ notification-daemon-0.3.5/src/daemon.c 2006-06-18 05:07:47.000000000 +0200 |
|---|
| 4 |
@@ -399,14 +399,54 @@ |
|---|
| 5 |
GValueArray *image_struct; |
|---|
| 6 |
GValue *value; |
|---|
| 7 |
GArray *tmp_array; |
|---|
| 8 |
+ GType type = G_VALUE_TYPE (icon_data); |
|---|
| 9 |
+ |
|---|
| 10 |
+ static const GType types[] = { |
|---|
| 11 |
+ G_TYPE_INT, |
|---|
| 12 |
+ G_TYPE_INT, |
|---|
| 13 |
+ G_TYPE_INT, |
|---|
| 14 |
+ G_TYPE_BOOLEAN, |
|---|
| 15 |
+ G_TYPE_INT, |
|---|
| 16 |
+ G_TYPE_INT |
|---|
| 17 |
+ }; |
|---|
| 18 |
+ |
|---|
| 19 |
+ |
|---|
| 20 |
+ if (dbus_g_type_is_struct (type)) |
|---|
| 21 |
+ { |
|---|
| 22 |
+ int n; |
|---|
| 23 |
+ |
|---|
| 24 |
+ if (dbus_g_type_get_struct_size (type) < 7) |
|---|
| 25 |
+ { |
|---|
| 26 |
+ g_warning("_notify_daemon_process_icon_data expected 7 data members, got only %d", dbus_g_type_get_struct_size (type)); |
|---|
| 27 |
+ return FALSE; |
|---|
| 28 |
+ } |
|---|
| 29 |
+ |
|---|
| 30 |
+ for (n = 0; n < G_N_ELEMENTS (types); ++n) |
|---|
| 31 |
+ { |
|---|
| 32 |
+ GType check = dbus_g_type_get_struct_member_type (type, n); |
|---|
| 33 |
+ if (check != types[n]) |
|---|
| 34 |
+ { |
|---|
| 35 |
+ g_warning("_notify_daemon_process_icon_data expected '%s' at position %d, but got '%s'", |
|---|
| 36 |
+ g_type_name (types[n]), n, g_type_name (check)); |
|---|
| 37 |
+ return FALSE; |
|---|
| 38 |
+ } |
|---|
| 39 |
|
|---|
| 40 |
- if (!G_VALUE_HOLDS(icon_data, G_TYPE_VALUE_ARRAY)) |
|---|
| 41 |
+ /* We must check this separately as it's not a constant and can't be part of the types[] array */ |
|---|
| 42 |
+ if (dbus_g_type_get_struct_member_type (type, 6) != DBUS_TYPE_G_UCHAR_ARRAY) |
|---|
| 43 |
+ { |
|---|
| 44 |
+ g_warning("_notify_daemon_process_icon_data expected '%s' at position %d, but got '%s'", |
|---|
| 45 |
+ g_type_name (DBUS_TYPE_G_UCHAR_ARRAY), 6, g_type_name (dbus_g_type_get_struct_member_type (type,6))); |
|---|
| 46 |
+ return FALSE; |
|---|
| 47 |
+ } |
|---|
| 48 |
+ } |
|---|
| 49 |
+ } |
|---|
| 50 |
+ else |
|---|
| 51 |
{ |
|---|
| 52 |
- g_warning("_notify_daemon_process_icon_data expected a " |
|---|
| 53 |
- "GValue of type GValueArray"); |
|---|
| 54 |
- return FALSE; |
|---|
| 55 |
+ g_warning("_notify_daemon_process_icon_data got wrong data"); |
|---|
| 56 |
+ return FALSE; |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
+ |
|---|
| 60 |
image_struct = (GValueArray *)g_value_get_boxed(icon_data); |
|---|
| 61 |
value = g_value_array_get_nth(image_struct, 0); |
|---|
| 62 |
|
|---|