Page 1 of 1

IAttributeList::getString()

Posted: Thu Jun 18, 2020 1:51 pm
by gck
Hi,

according to the SDK documentation the "size" parameter to "IAttributeList::getString()" is in bytes and not the length of the string:

"Note that Size is in Byte, not the string Length! (Do not forget to multiply the length by sizeof (TChar)!)"

But the example implementation in HostAttributeList is actually treating it as count of TChars:

Code: Select all

tresult PLUGIN_API HostAttributeList::getString (AttrID aid, TChar* string, uint32 size)
{
	mapIterator it = list.find (aid);
	if (it != list.end () && it->second)
	{
		uint32 stringSize = 0;
		const TChar* _string = it->second->stringValue (stringSize);
		memcpy (string, _string, std::min<uint32> (stringSize, size) * sizeof (TChar));
		return kResultTrue;
	}
	return kResultFalse;
}
Do I miss something here or is there a contradiction? And if so what is the correct way to use this method?

Best
Gregor

Re: IAttributeList::getString()

Posted: Thu Jun 18, 2020 4:00 pm
by Arne Scheffler
Looks like a bug in HostAttributeList to me. Will be fixed in the next release.