From 5551e8f04c84d1427fc39b0927eebc6dd58a772f Mon Sep 17 00:00:00 2001 From: Ima Mechanique Date: Wed, 5 Feb 2014 16:29:43 +0000 Subject: Checking version for cached files so older versions cannot sneak through on upgrading of format. --- indra/newview/llsyntaxid.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 4d7cc550af..4b84098b39 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -371,6 +371,10 @@ void LLSyntaxIdLSL::loadKeywordsIntoLLSD() << "Trying to open cached or default keyword file ;-)" << LL_ENDL; + // Is this the right thing to do, or should we leave the old content + // even if it isn't entirely accurate anymore? + sKeywordsXml = LLSD().emptyMap(); + LLSD content; llifstream file; file.open(mFullFileSpec); @@ -379,16 +383,25 @@ void LLSyntaxIdLSL::loadKeywordsIntoLLSD() sLoaded = (bool)LLSDSerialize::fromXML(content, file); if (!sLoaded) { - LL_ERRS("SyntaxLSL") << "Unable to deserialise file: " << mFullFileSpec << LL_ENDL; - - // Is this the right thing to do, or should we leave the old content - // even if it isn't entirely accurate anymore? - sKeywordsXml = LLSD().emptyMap(); + LL_ERRS("SyntaxLSL") + << "Unable to deserialise file: " + << mFullFileSpec << LL_ENDL; } else { - sKeywordsXml = content; - LL_INFOS("SyntaxLSL") << "Deserialised file: " << mFullFileSpec << LL_ENDL; + if (isSupportedVersion(content)) + { + sKeywordsXml = content; + LL_INFOS("SyntaxLSL") + << "Deserialised file: " << mFullFileSpec << LL_ENDL; + } + else + { + LLSyntaxIdLSL::sLoaded = false; + LLSyntaxIdLSL::sLoadFailed = true; + LL_WARNS("SyntaxLSL") + << "Unknown or unsupported version of syntax file." << LL_ENDL; + } } } else -- cgit v1.2.3