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:

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?


Looks like a bug in HostAttributeList to me. Will be fixed in the next release.