[Pidgin] #7432: BUG in ./dbus-analyze-functions.py | Dbus(libpurple-client) interface generate error (purple-client-bindings.c) (was: Dbus(libpurple-client) interface generate error (purple-client-bindings.c))

Pidgin trac at pidgin.im
Sun Nov 2 04:57:18 EST 2008


#7432: BUG in ./dbus-analyze-functions.py | Dbus(libpurple-client) interface
generate error (purple-client-bindings.c)
-----------------------+----------------------------------------------------
 Reporter:  Math2Gold  |        Owner:           
     Type:  patch      |       Status:  closed   
Milestone:             |    Component:  libpurple
  Version:  2.5.2      |   Resolution:  fixed    
 Keywords:  dbus       |  
-----------------------+----------------------------------------------------
Changes (by Math2Gold):

  * status:  new => closed
  * type:  defect => patch
  * resolution:  => fixed


Old description:

> function ''purple_conversation_new''  always return NULL on libpurple-
> client.
>
> i traced the code and checked this problem.
> i found this error is caused by PurpleConversationType  is converted to
> G_TYPE_INT  on dbus client side,but it is converted to UINT32 on dbus
> server side.
>
> i changed
>
> {{{
> PurpleConversation* purple_conversation_new(PurpleConversationType type,
> const PurpleAccount *account, const char *name) {
> int RESULT_ID = 0;
> dbus_g_proxy_call(purple_proxy, "PurpleConversationNew", NULL,
>         G_TYPE_INT, type,       G_TYPE_INT, GPOINTER_TO_INT(account),
> G_TYPE_STRING, name,  G_TYPE_INVALID,
>         G_TYPE_INT, &RESULT_ID,  G_TYPE_INVALID);
> return (PurpleConversation*) GINT_TO_POINTER(RESULT_ID);
> }
> }}}
>
> to
>
> {{{
> PurpleConversation* purple_conversation_new(PurpleConversationType type,
> const PurpleAccount *account, const char *name) {
> int RESULT_ID = 0;
> dbus_g_proxy_call(purple_proxy, "PurpleConversationNew", NULL,
>         G_TYPE_UINT, type,      G_TYPE_INT, GPOINTER_TO_INT(account),
> G_TYPE_STRING, name,  G_TYPE_INVALID,
>         G_TYPE_INT, &RESULT_ID,  G_TYPE_INVALID);
> return (PurpleConversation*) GINT_TO_POINTER(RESULT_ID);
> }
>
> }}}
>
> ''G_TYPE_INT, type'' changed to ''G_TYPE_UINT, type'' just.
>
> the function works.
>
> so i checked all PurpleConversationType and found the same problem on
> client side.
>
> as the file purple-client-bindings.c is generated by ./dbus-analyze-
> functions.py.  it would be rewritten while i compile it again.how to
> recover it without change the generated file directly?

New description:

 function ''purple_conversation_new''  always return NULL on libpurple-
 client.

 i traced the code and checked this problem.
 i found this error is caused by PurpleConversationType  is converted to
 G_TYPE_INT  on dbus client side,but it is converted to UINT32 on dbus
 server side.

 i changed

 {{{
 PurpleConversation* purple_conversation_new(PurpleConversationType type,
 const PurpleAccount *account, const char *name) {
 int RESULT_ID = 0;
 dbus_g_proxy_call(purple_proxy, "PurpleConversationNew", NULL,
         G_TYPE_INT, type,       G_TYPE_INT, GPOINTER_TO_INT(account),
 G_TYPE_STRING, name,  G_TYPE_INVALID,
         G_TYPE_INT, &RESULT_ID,  G_TYPE_INVALID);
 return (PurpleConversation*) GINT_TO_POINTER(RESULT_ID);
 }
 }}}

 to

 {{{
 PurpleConversation* purple_conversation_new(PurpleConversationType type,
 const PurpleAccount *account, const char *name) {
 int RESULT_ID = 0;
 dbus_g_proxy_call(purple_proxy, "PurpleConversationNew", NULL,
         G_TYPE_UINT, type,      G_TYPE_INT, GPOINTER_TO_INT(account),
 G_TYPE_STRING, name,  G_TYPE_INVALID,
         G_TYPE_INT, &RESULT_ID,  G_TYPE_INVALID);
 return (PurpleConversation*) GINT_TO_POINTER(RESULT_ID);
 }

 }}}

 ''G_TYPE_INT, type'' changed to ''G_TYPE_UINT, type'' just.

 the function works.

 so i checked all PurpleConversationType and found the same problem on
 client side.

 as the file purple-client-bindings.c is generated by ./dbus-analyze-
 functions.py.  it would be rewritten while i compile it again.how to
 recover it without change the generated file directly?

 ------
 Finally , i found the  bug in ./dbus-analyze-functions.py
 solve this problem:

 Change the condition check segment on the following code
 {{{
     def inputsimple(self, type, name, us):
         if us:
             self.cdecls.append("\tdbus_int32_t %s;" % name)
             self.cparams.append(("INT32", name))
             self.addintype("i", name)
         else:
             self.cdecls.append("\tdbus_uint32_t %s;" % name)
             self.cparams.append(("UINT32", name))
             self.addintype("u", name)
 }}}

 add ''not'' to ''if us:'',
 the correct segment is ''if not us:''
 (''us'' means ''unsigned'',so it should append UINT32 when the type is
 marked unsigned.)

--

Comment:

 please update it.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/7432#comment:1>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list