Latest Git update


#1

Has anybody experienced a problem with getXmlfromBinary in the latest git?

With that new update, my plugin can’t read from a binary blob anymore.
I guess it has something to do with the “ByteOrder::littleEndianInt ((const char*) data)” call
because the predef section in amalgamated.h has changed.

Joerg


#2

that should still work… I changed it to use utf8 instead of ascii, but that shouldn’t break anything.


#3

Strange, maybe sombody else could double check?

You’ve changed “xmlString.copyToUTF8 (d + 8, stringLength + 1)” in AudioProcessor::copyXmlToBinary.
If I load a freshly saved file using juce pluginhost, your following code returns 0! sizeInBytes is higher 8!

XmlElement* AudioProcessor::getXmlFromBinary (const void* data, const int sizeInBytes)
{
	if (sizeInBytes > 8
		 && ByteOrder::littleEndianInt ((const char*) data) == magicXmlNumber)
	{
		const int stringLength = (int) ByteOrder::littleEndianInt (((const char*) data) + 4);

		if (stringLength > 0)
		{
			XmlDocument doc (String::fromUTF8 (((const char*) data) + 8,
											   jmin ((sizeInBytes - 8), stringLength)));

			return doc.getDocumentElement();
		}
	}

	return 0;
}

#4

Maybe I’m going mad, but I can’t see any bugs in that code…


#5

Hi Jules,

I have re- compiled the juce demo plugin with latest source code from Git
and have experienced the same issue. It does not load the plugin state from a host file i.e. Pluginhost.exe.

I had to do a few changes to get it compiled:

…adding .getData()

GetModuleFileNameW (0, (WCHAR*) buffer.getData(), size / sizeof (WCHAR));
return String (reinterpret_cast <const WCHAR*> ((char*) buffer.getData()), size);

… adding “&” to memoryChunk in VstInt32 getChunk (void** data, bool onlyStoreCurrentProgramData)
data = (void) &chunkMemory;

Then it compiles okay but it still skip loading settings from the host file.

What else can I do?

Joerg


#6

This is nonsense:

It’s returning a pointer to some random stack address.

I’ll check in a correct fix for that line shortly, but there’s no bug in the xml chunk stuff.


#7

Hi Jules,

Your fix made it work again!

Thank you!

Joerg