View Issue Details

IDProjectCategoryView StatusLast Update
0004171Slicer4Module OpenIGTLinkIFpublic2017-08-14 09:39
Reporterleochan2009Assigned Totokuda 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
PlatformMacOSOSX CaptianOS Version10.11.4
Product Version 
Target VersionFixed in VersionSlicer 4.7.0 
Summary0004171: bindMessage
Description

in function
"int BindMessage::GetChildMessage(unsigned int i, igtl::MessageBase * child)"

child message is unpacked before the assignment, so the unpack is not performed.
The user need to do a unpack call again.

the current order is:

child->Unpack();
child->AllocatePack();
// TODO: Is there any way to avoid this memory copy?
memcpy(child->GetPackBodyPointer(),
this->m_ChildMessages[i].ptr, this->m_ChildMessages[i].size);

shouldn't it be:

child->AllocatePack();
// TODO: Is there any way to avoid this memory copy?
memcpy(child->GetPackBodyPointer(),
this->m_ChildMessages[i].ptr, this->m_ChildMessages[i].size);
child->Unpack();

Steps To Reproduce

int BindMessage::GetChildMessage(unsigned int i, igtl::MessageBase child)
{
if (i < this->m_ChildMessages.size())
{
child->InitPack();
igtl_header
header = (igtl_header *) child->GetPackPointer();
header->version = 1;
strncpy( header->name, this->m_ChildMessages[i].type.c_str(), IGTL_HEADER_TYPE_SIZE);
strncpy( header->device_name, this->m_ChildMessages[i].name.c_str(), IGTL_HEADER_NAME_SIZE);

// Time stamp -- same as the bind message
igtl_uint64 ts  =  m_TimeStampSec & 0xFFFFFFFF;
ts = (ts << 32) | (m_TimeStampSecFraction & 0xFFFFFFFF);
header->timestamp = ts;
header->body_size = this->m_ChildMessages[i].size;
header->crc = 0;

// Convert to network byte order
igtl_header_convert_byte_order(header);
child->Unpack();
child->AllocatePack();

// TODO: Is there any way to avoid this memory copy?
memcpy(child->GetPackBodyPointer(),
       this->m_ChildMessages[i].ptr, this->m_ChildMessages[i].size);

return 1;
}

else
{
return 0;
}
}

TagsNo tags attached.

Activities

lassoan

lassoan

2017-06-13 00:15

developer   ~0014796

Is this still an issue?

jcfr

jcfr

2017-08-14 09:39

administrator   ~0015048

Hi,

The version of OpenIGTLink used in Slicer is recent (from June 28), if this is still a problem, consider submitting a pull request on https://github.com/openigtlink/OpenIGTLink

Thanks

Issue History

Date Modified Username Field Change
2016-04-14 16:41 leochan2009 New Issue
2016-04-14 16:41 leochan2009 Status new => assigned
2016-04-14 16:41 leochan2009 Assigned To => tokuda
2017-06-13 00:15 lassoan Note Added: 0014796
2017-08-14 09:39 jcfr Status assigned => resolved
2017-08-14 09:39 jcfr Resolution open => no change required
2017-08-14 09:39 jcfr Fixed in Version => Slicer 4.7.0
2017-08-14 09:39 jcfr Note Added: 0015048