Argument array of strings

Peter Clifton pcjc2 at cam.ac.uk
Thu Oct 12 20:35:05 PDT 2006


On Fri, 2006-10-13 at 04:14 +0100, Peter Clifton wrote:
> What I can't seem to do is get the size of that array without the
> program crashing.

I see from googling to:
https://svn.cronos.be/svn/deconf/deconf-desk/trunk/frontends/dbus/dbus-shared.c

That they use code similar to what I'm trying to do.

I changed the dbus_message_iter_get_array_len call to use &subiter as
its parameter, not the parent (of type DBUS_TYPE_ARRAY, signature 'as').

However, you will see from the output below, that it returns "54", not
"2". Is it returning the byte count of the array? I make that about 45,
including null terminators. Am I doing something stupid here?

Regards

Peter Clifton

(OUTPUT:)

pcb_dbus: DEBUG: Method call message
pcb_dbus: DEBUG: Method name was 'Introspect'
pcb_dbus: DEBUG: Method interface was
'org.freedesktop.DBus.Introspectable'
pcb_dbus: DEBUG: Method call message
pcb_dbus: DEBUG: Method name was 'GetFilename'
pcb_dbus: DEBUG: Method interface was 'org.seul.geda.pcb'
pcb_dbus: DEBUG: Method call message
pcb_dbus: DEBUG: Method name was 'ExecAction'
pcb_dbus: DEBUG: Method interface was 'org.seul.geda.pcb.actions'
pcb_dbus: DEBUG: ExecAction called with action 'SaveTo'
pcb_dbus: DEBUG: Signature of args = 'as'
pcb_dbus: DEBUG: Signature of subiter = 's'
pcb_dbus: DEBUG: Argument count is 54
  Got argument #0 = 'Layout'
  Got argument #1 = '/home/pcjc2/xgsch2pcb_test/mytest.pcb'
type invalid 0 not a basic type
Segmentation fault (core dumped)

(Crash is when the while loop keeps trying to retrieve data off the end
of the array).





More information about the dbus mailing list