Re: Function pn_message_encode() returns -2

2015-12-07 Thread aconway
traverse is intended to walk the data structure from the beginning.
Node "1" is the first child node (node 0 is the "root" of the tree).
Nodes are referred to by number rather than pointer because the node
storage can be re-allocated if the pn_data object grows which changes
the node addresses. So while your fix may solve your immediate problem
it is not correct in general.

Can you post a small C program that illustrates the error? That would
help to figure out the problem.

On Sun, 2015-12-06 at 23:36 -0700, sanddune008 wrote:
> I see that following function pn_message_encode() returns -2 with
> send.c
> example.
> 
> My findings, Kindly review the below code:
> 
> Changes made to fix is highlighted in bold, What is the significance
> of
> passing '1' first node? 
> 
> int *pni_data_traverse*(pn_data_t *data,
>   int (*enter)(void *ctx, pn_data_t *data,
> pni_node_t
> *node),
>   int (*exit)(void *ctx, pn_data_t *data,
> pni_node_t
> *node),
>   void *ctx)
> {
>   *pni_node_t *node = data->size ? pn_data_node(data, data->current)
> :
> NULL;*
>   //pni_node_t *node = data->size ? pn_data_node(data,* 1*) : NULL;
> 
> 
> Thanks in Advance
> 
> 
> 
> 
> 
> --
> View this message in context: http://qpid.2158936.n2.nabble.com/Funct
> ion-pn-message-encode-returns-2-tp7634948.html
> Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: Function pn_message_encode() returns -2

2015-12-07 Thread sanddune008
I awaiting review comments.Kindly confirm.



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Function-pn-message-encode-returns-2-tp7634948p7634950.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Function pn_message_encode() returns -2

2015-12-06 Thread sanddune008
I see that following function pn_message_encode() returns -2 with send.c
example.

My findings, Kindly review the below code:

Changes made to fix is highlighted in bold, What is the significance of
passing '1' first node? 

int *pni_data_traverse*(pn_data_t *data,
  int (*enter)(void *ctx, pn_data_t *data, pni_node_t
*node),
  int (*exit)(void *ctx, pn_data_t *data, pni_node_t
*node),
  void *ctx)
{
  *pni_node_t *node = data->size ? pn_data_node(data, data->current) :
NULL;*
  //pni_node_t *node = data->size ? pn_data_node(data,* 1*) : NULL;


Thanks in Advance





--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Function-pn-message-encode-returns-2-tp7634948.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.