[xiph-commits] r8710 - trunk/oggdsf/src/lib/codecs/cmml/libCMMLParse

ozone at motherfish-iii.xiph.org ozone at motherfish-iii.xiph.org
Sun Jan 9 16:20:51 PST 2005


Author: ozone
Date: 2005-01-09 16:20:50 -0800 (Sun, 09 Jan 2005)
New Revision: 8710

Modified:
   trunk/oggdsf/src/lib/codecs/cmml/libCMMLParse/CMMLParser.cpp
Log:
oggdsf:
 * libCMMLParse: Don't get killed by the XML preamble

Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLParse/CMMLParser.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLParse/CMMLParser.cpp	2005-01-10 00:19:59 UTC (rev 8709)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLParse/CMMLParser.cpp	2005-01-10 00:20:50 UTC (rev 8710)
@@ -95,6 +95,14 @@
 	// Widen the file stream
 	wstring locCMMLFileWString = StringHelper::toWStr(locBuffer);
 
+	// XTag doesn't currently handle preambles, so we'll have to skip until we find
+	// a <cmml> tag which it can handle ... (note that XML is case-sensitive, so
+	// we don't need to scan for "<CMML"
+	size_t locCMMLTagIndex = locCMMLFileWString.find(L"<cmml", 0);
+	if (locCMMLTagIndex != string::npos) {
+		locCMMLFileWString = locCMMLFileWString.substr(locCMMLTagIndex);
+	}
+
 	// Parse ourselves the CMML
 	C_CMMLRootTag* locRootTag = new C_CMMLRootTag;
 	locReturnValue = parseCMMLRootTag(locCMMLFileWString, locRootTag);



More information about the commits mailing list