[asterisk-dev] OT: C problems with access to "struct ast_frame.data" member

Holger Wirtz wirtz at dfn.de
Sun May 24 14:25:59 CDT 2009


Hi all,

sorry for this OT message but since my last Debian update I have some
trouble to access the data member of the structast_frame:

struct ast_frame {
...
        /*! Pointer to actual data */
        union { void *ptr; uint32_t uint32; char pad[8]; } data;
...
}

Before the update I used something like that:

struct ast_frame *f=NULL;
f=ast_read(chan);
if(f->frametype==AST_FRAME_TEXT) {
	ast_log(AST_CONF_DEBUG,"Text: %s\n",f->data);
}

Now I get the following error (with gcc version 4.3.3 (Debian 4.3.3-10))

$ cc  -I../asterisk/include -I/usr/lib/glib-2.0/include
-I/usr/include/glib-2.0 -Wall -c member.c -o member.o
member.c: In function 'member_exec':
member.c:146: warning: format '%s' expects type 'char *', but argument 6
has type 'union <anonymous>'

I tried to cast f->data with (char*)... but this won't work, too:

...
member.c:146: error: cannot convert to a pointer type
member.c:146: warning: reading through null pointer (argument 6)
member.c:147: error: cannot convert to a pointer type
...

Hell, what am I doing wrong?

Regards, Holger



More information about the asterisk-dev mailing list