IAttributeList::getString()

SDK for VST 3 audio plug-in and host development.
Post Reply
gck
Posts: 1
Joined: Wed Sep 26, 2018 2:32 pm

IAttributeList::getString()

Post 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

Arne Scheffler
Posts: 347
Joined: Mon Jun 20, 2016 7:53 am

Re: IAttributeList::getString()

Post by Arne Scheffler »

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

Post Reply