secureswitools/swisistools/source/interpretsislib/sisfile.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 24 5cc91383ab1e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
   205 	if (failed)
   205 	if (failed)
   206 		{
   206 		{
   207 		std::string x = wstring2string(this->GetPackageName());
   207 		std::string x = wstring2string(this->GetPackageName());
   208 		throw InvalidSis(x, error, SIS_NOT_SUPPORTED);
   208 		throw InvalidSis(x, error, SIS_NOT_SUPPORTED);
   209 		}
   209 		}
       
   210 
   210 	}
   211 	}
   211 
   212 
   212 bool SisFile::ProcessInstallOptionsWarning(const CSISInstallBlock& aInstallBlock, std::string& aError)
   213 bool SisFile::ProcessInstallOptionsWarning(const CSISInstallBlock& aInstallBlock, std::string& aError)
   213 	{
   214 	{
   214 	bool success = true;
   215 	bool success = true;
   216 	int fileCount = aInstallBlock.FileCount();
   217 	int fileCount = aInstallBlock.FileCount();
   217 	for(int i = 0; i < fileCount; ++i)
   218 	for(int i = 0; i < fileCount; ++i)
   218 		{
   219 		{
   219 		const CSISFileDescription& fD = aInstallBlock.FileDescription(i);
   220 		const CSISFileDescription& fD = aInstallBlock.FileDescription(i);
   220         const CSISFileDescription::TSISFileOperation operation = fD.Operation();
   221         const CSISFileDescription::TSISFileOperation operation = fD.Operation();
   221 		std::wstring target(fD.Target().GetString());
   222 		std::wstring target(fD.Target().GetString().c_str());
   222         //
   223         //
   223         switch( operation )
   224         switch( operation )
   224             {
   225             {
   225         case CSISFileDescription::EOpInstall:
   226         case CSISFileDescription::EOpInstall:
   226             success = true;
   227             success = true;
   274     		{
   275     		{
   275 			aError += "SIS File contains install options : "+operation;
   276 			aError += "SIS File contains install options : "+operation;
   276 			break;
   277 			break;
   277 	    	}
   278 	    	}
   278 		}
   279 		}
   279 	return success;
   280 		return success;
   280 	}
   281 	}
   281 
   282 
   282 
   283 
   283 std::wstring SisFile::GetVendorName() const
   284 std::wstring SisFile::GetVendorName() const
   284 	{
   285 	{
   420 		{
   421 		{
   421 		const CSISIf& ifBlock = ifs[i];
   422 		const CSISIf& ifBlock = ifs[i];
   422 
   423 
   423 		if (ifBlock.WasteOfSpace())
   424 		if (ifBlock.WasteOfSpace())
   424 			{
   425 			{
       
   426 			std::string x;
   425 			std::string error = "corrupt SIS file";
   427 			std::string error = "corrupt SIS file";
   426 			std::string x = wstring2string(this->GetPackageName());
   428 			throw InvalidSis(Ucs2ToUtf8(this->GetPackageName(),x), error, INVALID_SIS);
   427 			throw InvalidSis(x, error, INVALID_SIS);
       
   428 			}
   429 			}
   429 
   430 
   430 		// Main expression
   431 		// Main expression
   431 		const ExpressionResult expressionResult = aEvaluator.Evaluate( ifBlock.Expression() );
   432 		const ExpressionResult expressionResult = aEvaluator.Evaluate( ifBlock.Expression() );
   432 		const bool processBlock = expressionResult.BoolValue();
   433 		const bool processBlock = expressionResult.BoolValue();
   443 			if ( aEvaluator.Evaluate(ifElseBlock.Expression()).BoolValue())
   444 			if ( aEvaluator.Evaluate(ifElseBlock.Expression()).BoolValue())
   444 				{
   445 				{
   445 				ProcessInstallBlock(ifElseBlock.InstallBlock(), aFiles, aEvaluator, aDrivePath, aInstallingDrive);
   446 				ProcessInstallBlock(ifElseBlock.InstallBlock(), aFiles, aEvaluator, aDrivePath, aInstallingDrive);
   446 				break;	// Stop processing else if blocks
   447 				break;	// Stop processing else if blocks
   447 				}
   448 				}
   448 			// Process the rest of the files
   449 			
   449 			GetInstallableFiles(aFiles, ifElseBlock.InstallBlock(), aDrivePath, aInstallingDrive);
       
   450 			}
   450 			}
   451 		} 
   451 		} 
   452 	}
   452 	}
   453 
   453 
   454 PackageUids SisFile::GetEmbeddedPackageUids() const
   454 PackageUids SisFile::GetEmbeddedPackageUids() const