From e01c10ffcac06df9813989b54cfd01f74c0d059b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 10 Jun 2011 14:10:00 +0100 Subject: [PATCH 6/9] writer_recurse_variant: set type_str to a non-NULL value This will allow us to guarantee that type_str is not, in fact, NULL. --- dbus/dbus-marshal-recursive.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dbus/dbus-marshal-recursive.c b/dbus/dbus-marshal-recursive.c index 3e0c634..5e9070e 100644 --- a/dbus/dbus-marshal-recursive.c +++ b/dbus/dbus-marshal-recursive.c @@ -1948,13 +1948,16 @@ writer_recurse_variant (DBusTypeWriter *writer, if (!write_or_verify_typecode (writer, DBUS_TYPE_VARIANT)) return FALSE; - /* If not enabled, mark that we have no type_str anymore ... */ - + /* If not enabled, we are about to (pretend to) write the contained type */ if (!writer->enabled) { - sub->type_str = NULL; - sub->type_pos = -1; - + /* this is set in writer_recurse_init_and_check for a variant + * sub-iterator ... */ + _dbus_assert (sub->type_pos_is_expectation); + /* ... and it means that we won't actually be writing to this + * string, so casting away its constness is OK */ + sub->type_str = (DBusString *) contained_type; + sub->type_pos = contained_type_start; return TRUE; } -- 1.7.6.3