|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
C++ MQI - bug in ImqItm.writeOut() ? |
« View previous topic :: View next topic » |
Author |
Message
|
royr |
Posted: Sun Nov 13, 2005 10:30 am Post subject: C++ MQI - bug in ImqItm.writeOut() ? |
|
|
 Acolyte
Joined: 30 Jun 2001 Posts: 65 Location: Israel
|
Hi,
I've been working lately with the C++ API, and I noticed some strange behaviour with ImqMessage and ImqItem: It seems that the ImqItm::writeOut() method does not increment the message data offset pointer after the first write. This happens for both of the "primitive" item types - ImqStr and ImqBin.
The following program demonstrates the problem using ImqStr:
Code: |
#include <cassert>
#include "imqi.hpp"
void main()
{
ImqStr s("hello");
ImqMsg m;
// Assert OK - initial data offset zero
assert(m.dataOffset() == 0);
m.writeItem(s);
// Assert OK - data offset incremented by string length
assert(m.dataOffset() == 5);
m.writeItem(s);
// Assert fails - data offset still 5, not incremented -- bug??
assert(m.dataOffset() == 10);
}
|
I noticed that this method of writing to a message object is not used in the samples. Instead a user-allocated buffer is used via ImqCac::useEmptyBuffer().
Did I misunderstand the docs, or is this a bug that survived ten CSD's?
-Roy.
|
|
Back to top |
|
 |
jsware |
Posted: Wed Nov 23, 2005 6:00 am Post subject: |
|
|
 Chevalier
Joined: 17 May 2001 Posts: 455
|
The manual has the following to say about the writeItem method:
Quote: |
ImqBoolean writeItem( ImqItem & item );
Writes from the item object into the message buffer, using the ImqItem copyOut method. Writing can take the form of insertion, replacement, or an append: this depends on the class of the item object. This method returns TRUE if successful. |
The important bit here might be "Writing can take the form of insertion, replacement, or an append: this depends on the class of the item object"
You might want to check that data pointer field of the message aswell to see where the item might be copied into.
HTH _________________ Regards
John
The pain of low quaility far outlasts the joy of low price. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|