[FX-620] Message::encode is wrong after first time done - Fix8 JIRA

Message::encode is wrong after first time done

Description

Do something like the following where you do an Message::encode() on a message twice.

_f8String f8s;
int siz1 = msg->encode(f8s);
qDebug() << "Fix8ToolsMessage::check message1:" << QString::fromStdString(f8s) << "Size = " << siz1;

f8String f8s1;
int siz2 = msg->encode(f8s1);
qDebug() << "Fix8ToolsMessage::check message2:" << QString::fromStdString(f8s1) << "Size = " << siz2;
_

One would think that they would produce the same output, but in fact the second output seems to be a concatenation of the first string. It appears that the output buffer used in the encode method is not being cleared.

Here is what I get for my Test message which only has one field.
>>>Fix8ToolsMessage::check message: "8=FIX.4.4\u00019=16\u000135=1\u0001112=gracie\u000110=019\u0001" Size = 38 ../fix8toolslib/fix8toolsmessage.cpp 73
>>>Fix8ToolsMessage::check message2: "8=FIX.4.4\u00019=38\u00018=FIX.4.4\u00019=16\u000135=1\u0001112=gracie\u000110=019\u000110=079\u0001" Size = 60 ../

Environment

Ubuntu, using FIX8 Pro from git

Status

Assignee

David Dight

Reporter

David Boosalis

Labels

None

Branch

dev

Products

Pro

Components

Fix versions

Affects versions

2.4.0

Priority

Major