Re: [PATCH] QPIDMSG: Fixed getNumFields to work where sub messages present

Damian Maguire

Cheers Frank, and thanks for updating the Bugzilla (BZ103). Qpid fix, and easy unit test, so this has flown into next.



On Tue, Jun 10, 2014 at 5:34 PM, Frank Quinn <fquinn@...> wrote:

Previously, sub messages were considered when calculating the correct

number of fields. This patch ignores the sub messages and instead

counts only the number of top level fields to conform with other

payload bridges.


Signed-off-by: Frank Quinn <fquinn@...>


mama/c_cpp/src/c/payload/qpidmsg/payload.c |    9 ++++-----

1 files changed, 4 insertions(+), 5 deletions(-)


diff --git a/mama/c_cpp/src/c/payload/qpidmsg/payload.c b/mama/c_cpp/src/c/payload/qpidmsg/payload.c

index 4bf8d9f..74665bc 100644

--- a/mama/c_cpp/src/c/payload/qpidmsg/payload.c

+++ b/mama/c_cpp/src/c/payload/qpidmsg/payload.c

@@ -729,14 +729,13 @@ qpidmsgPayload_getNumFields (const msgPayload    msg,

         return MAMA_STATUS_NULL_ARG;


+    *numFields = 0;


     /* Move to where the first field is entered */

     qpidmsgPayloadImpl_moveDataToContentLocation (impl->mBody);

-    /*

-     * OpenMAMA fields are stored as a three element list of Name, FID, Value.

-     * The list element itself also counts as a QPID field so divide by four.

-     */

-    *numFields = pn_data_size (impl->mBody) / QPID_FIELDS_PER_MAMA_FIELD;

+    while (0 != pn_data_next (impl->mBody))

+             (*numFields)++;

     /* Revert to the previous iterator state if applicable */

     qpidmsgPayloadImpl_resetToIteratorState (impl);




This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange Group, Inc. (ICE), NYSE Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

Openmama-dev mailing list

Join { to automatically receive all group messages.