simplify code and fix out of bounds read

Change-Id: I5be3a28d3d1ae43974f844d143a30bfd989cbe5b
This commit is contained in:
Markus Mohrhard
2013-10-30 16:30:33 +01:00
parent 3401213326
commit 4954e2a2f6
+3 -3
View File
@@ -326,10 +326,10 @@ void XSpreadsheets2::importSheetToCopy()
bool XSpreadsheets2::isExternalReference(const OUString& aDestContent, const OUString& aSrcContent )
{
OUString aStart("'file://");
const sal_Char* sSrcContent = OUStringToOString( aSrcContent, RTL_TEXTENCODING_UTF8 ).getStr();
return (aDestContent.endsWithIgnoreAsciiCaseAsciiL(sSrcContent, aSrcContent.getLength()) // same cell address
&& aDestContent.indexOf(aStart)==0 // starts with 'file://
CPPUNIT_ASSERT(aDestContent.startsWith(aStart));
return (aDestContent.endsWithIgnoreAsciiCase(aSrcContent, NULL) // same cell address
&& aDestContent.indexOf(aSrcFileName)>0); // contains source file name
}