From d91c703725488a7f98d2ff0007383b71dc9c13d8 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 22 Aug 2010 01:00:24 +0200 Subject: [PATCH] ZynAddSubFX/QtXmlWrapper: fixed loading of oddly formatted presets Some ZynAddSubFX presets have one or more leading blank lines which confuses the QtXml module. Therefore dynamically remove characters from the beginning of the data until we encounter a '<' character. Closes #3047560. (cherry picked from commit 32dbda5b3374e1e0a5cd717656f484fa7fe88c64) --- plugins/zynaddsubfx/src/Misc/QtXmlWrapper.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.cpp b/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.cpp index 4cac88171..a329e043a 100644 --- a/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.cpp +++ b/plugins/zynaddsubfx/src/Misc/QtXmlWrapper.cpp @@ -279,16 +279,10 @@ int QtXmlWrapper::loadXMLfile(const std::string &filename) } QByteArray b( xmldata ); - if( b[0] != '<' ) + while( !b.isEmpty() && b[0] != '<' ) { // remove first blank line - b.remove( 0, -#ifdef LMMS_BUILD_WIN32 - 2 -#else - 1 -#endif - ); + b.remove( 0, 1 ); } if( !d->m_doc.setContent( b ) )