ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » C++ MQI - bug in ImqItm.writeOut() ?

Post new topic  Reply to topic
 C++ MQI - bug in ImqItm.writeOut() ? « View previous topic :: View next topic » 
Author Message
royr
PostPosted: Sun Nov 13, 2005 10:30 am    Post subject: C++ MQI - bug in ImqItm.writeOut() ? Reply with quote

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.
Code:
Code:
Back to top
View user's profile Send private message
jsware
PostPosted: Wed Nov 23, 2005 6:00 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » C++ MQI - bug in ImqItm.writeOut() ?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.