You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2013/09/05 16:41:31 UTC
svn commit: r1520334 - in /qpid/trunk/qpid/extras/dispatch/src: message.c
message_private.h
Author: tross
Date: Thu Sep 5 14:41:30 2013
New Revision: 1520334
URL: http://svn.apache.org/r1520334
Log:
QPID-5068 - Fixed a bug in the replacement of delivery annotations.
Modified:
qpid/trunk/qpid/extras/dispatch/src/message.c
qpid/trunk/qpid/extras/dispatch/src/message_private.h
Modified: qpid/trunk/qpid/extras/dispatch/src/message.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/message.c?rev=1520334&r1=1520333&r2=1520334&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/message.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/message.c Thu Sep 5 14:41:30 2013
@@ -96,7 +96,10 @@ static int traverse_field(unsigned char
{
unsigned char tag = next_octet(cursor, buffer);
if (!(*cursor)) return 0;
- int consume = 0;
+
+ int consume = 0;
+ size_t hdr_length = 1;
+
switch (tag & 0xF0) {
case 0x40 : consume = 0; break;
case 0x50 : consume = 1; break;
@@ -108,6 +111,7 @@ static int traverse_field(unsigned char
case 0xB0 :
case 0xD0 :
case 0xF0 :
+ hdr_length += 3;
consume |= ((int) next_octet(cursor, buffer)) << 24;
if (!(*cursor)) return 0;
consume |= ((int) next_octet(cursor, buffer)) << 16;
@@ -119,16 +123,18 @@ static int traverse_field(unsigned char
case 0xA0 :
case 0xC0 :
case 0xE0 :
+ hdr_length++;
consume |= (int) next_octet(cursor, buffer);
if (!(*cursor)) return 0;
break;
}
if (field && !field->parsed) {
- field->buffer = *buffer;
- field->offset = *cursor - dx_buffer_base(*buffer);
- field->length = consume;
- field->parsed = 1;
+ field->buffer = *buffer;
+ field->offset = *cursor - dx_buffer_base(*buffer);
+ field->length = consume;
+ field->hdr_length = hdr_length;
+ field->parsed = 1;
}
advance(cursor, buffer, consume, 0, 0);
@@ -238,10 +244,11 @@ static int dx_check_and_advance(dx_buffe
//
// Pattern matched and tag is expected. Mark the beginning of the section.
//
- location->parsed = 1;
- location->buffer = test_buffer;
- location->offset = test_cursor - dx_buffer_base(test_buffer);
- location->length = 0;
+ location->parsed = 1;
+ location->buffer = test_buffer;
+ location->offset = test_cursor - dx_buffer_base(test_buffer);
+ location->length = 0;
+ location->hdr_length = pattern_length;
//
// Advance the pointers to consume the whole section.
@@ -613,7 +620,9 @@ void dx_message_send(dx_message_t *in_ms
// Skip over replaced delivery annotations
//
if (content->section_delivery_annotation.length > 0)
- advance(&cursor, &buf, content->section_delivery_annotation.length, 0, 0);
+ advance(&cursor, &buf,
+ content->section_delivery_annotation.hdr_length + content->section_delivery_annotation.length,
+ 0, 0);
//
// Send remaining partial buffer
Modified: qpid/trunk/qpid/extras/dispatch/src/message_private.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/message_private.h?rev=1520334&r1=1520333&r2=1520334&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/message_private.h (original)
+++ qpid/trunk/qpid/extras/dispatch/src/message_private.h Thu Sep 5 14:41:30 2013
@@ -45,10 +45,11 @@
*/
typedef struct {
- dx_buffer_t *buffer; // Buffer that contains the first octet of the field, null if the field is not present
- size_t offset; // Offset in the buffer to the first octet
- size_t length; // Length of the field or zero if unneeded
- int parsed; // non-zero iff the buffer chain has been parsed to find this field
+ dx_buffer_t *buffer; // Buffer that contains the first octet of the field, null if the field is not present
+ size_t offset; // Offset in the buffer to the first octet
+ size_t length; // Length of the field or zero if unneeded
+ size_t hdr_length; // Length of the field's header (not included in the length of the field)
+ int parsed; // non-zero iff the buffer chain has been parsed to find this field
} dx_field_location_t;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org