Kaydet (Commit) 7de833a6 authored tarafından Noel Grandin's avatar Noel Grandin

simplify calls OUString::copy in foo.copy(x, foo.getLength() - x)

Change-Id: I20318c77dcc3bc2a64336541ef5a3f412bfd9483
Reviewed-on: https://gerrit.libreoffice.org/39803Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 6f9f9491
......@@ -1223,7 +1223,7 @@ OUString SAL_CALL InternalDataProvider::convertRangeFromXML( const OUString& aXM
{
const OUString aPivotTableID("PT@");
if (aXMLRange.startsWith(aPivotTableID))
return aXMLRange.copy(aPivotTableID.getLength(), aXMLRange.getLength() - aPivotTableID.getLength());
return aXMLRange.copy(aPivotTableID.getLength());
XMLRangeHelper::CellRange aRange( XMLRangeHelper::getCellRangeFromXMLString( aXMLRange ));
if( aRange.aUpperLeft.bIsEmpty )
......
......@@ -115,15 +115,15 @@ bool SfxStylesInfo_Impl::parseStyleCommand(SfxStyleInfo_Impl& aStyle)
OUString sArg = sCmdArgs.copy(0, i);
if (sArg.startsWith(CMDURL_SPART_ONLY))
aStyle.sStyle = sArg.copy(LEN_SPART, sArg.getLength()-LEN_SPART);
aStyle.sStyle = sArg.copy(LEN_SPART);
else if (sArg.startsWith(CMDURL_FPART_ONLY))
aStyle.sFamily = sArg.copy(LEN_FPART, sArg.getLength()-LEN_FPART);
aStyle.sFamily = sArg.copy(LEN_FPART);
sArg = sCmdArgs.copy(i+1, sCmdArgs.getLength()-i-1);
if (sArg.startsWith(CMDURL_SPART_ONLY))
aStyle.sStyle = sArg.copy(LEN_SPART, sArg.getLength()-LEN_SPART);
aStyle.sStyle = sArg.copy(LEN_SPART);
else if (sArg.startsWith(CMDURL_FPART_ONLY))
aStyle.sFamily = sArg.copy(LEN_FPART, sArg.getLength()-LEN_FPART);
aStyle.sFamily = sArg.copy(LEN_FPART);
return !(aStyle.sFamily.isEmpty() || aStyle.sStyle.isEmpty());
}
......
......@@ -224,7 +224,7 @@ bool SvxChartOptions::RetrieveOptions()
{
aPrefix = aResName.copy( 0, nPos );
sal_Int32 idx = nPos + sizeof( "$(ROW)" ) - 1;
aPostfix = aResName.copy( idx, aResName.getLength()-idx );
aPostfix = aResName.copy( idx );
}
else
aPrefix = aResName;
......
......@@ -48,7 +48,7 @@ namespace dbaui
nMatch = i + 1;
}
}
_rsCorrected += _sToCheck.copy( nMatch, _sToCheck.getLength() - nMatch );
_rsCorrected += _sToCheck.copy( nMatch );
}
return bCorrected;
}
......
......@@ -947,7 +947,7 @@ bool OSelectionBrowseBox::SaveModified()
{ // special case, we have a table field so we must cut the table name
OUString sTableAlias = aFieldName.getToken(0,'.');
pEntry->SetAlias(sTableAlias);
OUString sColumnName = aFieldName.copy(sTableAlias.getLength()+1,aFieldName.getLength() - sTableAlias.getLength() -1);
OUString sColumnName = aFieldName.copy(sTableAlias.getLength()+1);
Reference<XConnection> xConnection = rController.getConnection();
if ( !xConnection.is() )
return false;
......
......@@ -48,7 +48,7 @@ QueryTokenizer::QueryTokenizer(const OUString& sQuery)
if (equal > 0)
{
sKey = sToken.copy(0 , equal );
sVal = sToken.copy(equal+1, sToken.getLength()-(equal+1));
sVal = sToken.copy(equal+1);
}
if (find(sKey) != end())
......
......@@ -1337,7 +1337,7 @@ void EscherPropertyContainer::CreateEmbeddedBitmapProperties(
nIndex += aVndUrl.getLength();
if( rBitmapUrl.getLength() > nIndex )
{
OString aUniqueId(OUStringToOString(rBitmapUrl.copy(nIndex, rBitmapUrl.getLength() - nIndex), RTL_TEXTENCODING_UTF8));
OString aUniqueId(OUStringToOString(rBitmapUrl.copy(nIndex), RTL_TEXTENCODING_UTF8));
bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId );
if( bRetValue )
{
......@@ -1540,7 +1540,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(
{
nIndex = nIndex + aVndUrl.getLength();
if ( aGraphicUrl.getLength() > nIndex )
aUniqueId = OUStringToOString(aGraphicUrl.copy(nIndex, aGraphicUrl.getLength() - nIndex), RTL_TEXTENCODING_UTF8);
aUniqueId = OUStringToOString(aGraphicUrl.copy(nIndex), RTL_TEXTENCODING_UTF8);
}
else
{
......
......@@ -6998,7 +6998,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
if ( nCount )
{
pBefCPS = new PPTCharPropSet( *pSet );
pSet->maString = pSet->maString.copy(nCount, pSet->maString.getLength() - nCount);
pSet->maString = pSet->maString.copy(nCount);
}
sal_uInt32 nIdx = n;
sal_Int32 nHyperLenLeft = nHyperLen;
......
......@@ -994,7 +994,7 @@ bool ODatabaseForm::InsertFilePart( INetMIMEMessage& rParent, const OUString& rN
pStream = nullptr;
}
sal_Int32 nSepInd = aFileName.lastIndexOf('.');
OUString aExtension = aFileName.copy( nSepInd + 1, aFileName.getLength() - nSepInd - 1 );
OUString aExtension = aFileName.copy( nSepInd + 1 );
INetContentType eContentType = INetContentTypes::GetContentType4Extension( aExtension );
if (eContentType != CONTENT_TYPE_UNKNOWN)
aContentType = INetContentTypes::GetContentType(eContentType);
......
......@@ -374,7 +374,7 @@ void LwpFribField::RegisterTimeField(LwpFieldMark* pFieldMark)
OUString tag = sFormula.copy(0,index);
if (tag == "Now()" || tag == "CreateDate" || tag == "EditDate")
RegisterDateTimeStyle(sFormula.copy(index+1,sFormula.getLength()-index-1));
RegisterDateTimeStyle(sFormula.copy(index+1));
}
}
......
......@@ -436,19 +436,19 @@ bool LwpFieldMark::IsDateTimeField(sal_uInt8& type,OUString& formula)
if (tag == "Now()")
{
type = DATETIME_NOW;
formula = sFormula.copy(index+1,sFormula.getLength()-index-1);
formula = sFormula.copy(index+1);
return true;
}
else if (tag == "CreateDate")
{
type = DATETIME_CREATE;
formula = sFormula.copy(index+1,sFormula.getLength()-index-1);
formula = sFormula.copy(index+1);
return true;
}
else if (tag == "EditDate")
{
type = DATETIME_LASTEDIT;
formula = sFormula.copy(index+1,sFormula.getLength()-index-1);
formula = sFormula.copy(index+1);
return true;
}
else if (tag == "YesterdaysDate" || tag == "TomorrowsDate"
......@@ -482,13 +482,13 @@ bool LwpFieldMark::IsCrossRefField(sal_uInt8& nType, OUString& sMarkName)
OUString tag = sFormula.copy(0,index);
if (tag == "PageRef")
{
sMarkName = sFormula.copy(index+1,sFormula.getLength()-index-1);
sMarkName = sFormula.copy(index+1);
nType = CROSSREF_PAGE;
return true;
}
else if (tag == "ParaRef")
{
sMarkName = sFormula.copy(index+1,sFormula.getLength()-index-1);
sMarkName = sFormula.copy(index+1);
nType = CROSSREF_PARANUMBER;
return true;
}
......
......@@ -209,7 +209,7 @@ drawing::EnhancedCustomShapeTextFrame lcl_parseEnhancedCustomShapeTextFrame(cons
}
}
OString aToken = rValue.copy(nStart, rValue.getLength() - nStart);
OString aToken = rValue.copy(nStart);
static const char aExpectedPrefix[] = "BottomRight = (com.sun.star.drawing.EnhancedCustomShapeParameterPair) { ";
if (aToken.startsWith(aExpectedPrefix))
{
......
......@@ -526,7 +526,7 @@ void ZipPackage::getZipFileContents()
if ( rName.getLength() -1 != nStreamIndex )
{
nStreamIndex++;
sTemp = rName.copy( nStreamIndex, rName.getLength() - nStreamIndex );
sTemp = rName.copy( nStreamIndex );
pPkgStream = new ZipPackageStream( *this, m_xContext, m_nFormat, m_bAllowRemoveOnInsert );
pPkgStream->SetPackageMember( true );
pPkgStream->setZipEntryOnLoading( rEntry );
......@@ -826,7 +826,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
return makeAny ( uno::Reference < XUnoTunnel > ( pCurrent ) );
}
sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex );
sTemp = aName.copy( nOldIndex );
if ( pCurrent->hasByName ( sTemp ) )
{
......@@ -908,7 +908,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
}
else
{
sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex );
sTemp = aName.copy( nOldIndex );
if ( pCurrent->hasByName( sTemp ) )
{
......
......@@ -1374,7 +1374,7 @@ void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xRepor
OUString sFieldData = _xReportElement->getDataField();
static const char s_sPageNumber[] = "PageNumber()";
static const char s_sReportPrefix[] = "rpt:";
sFieldData = sFieldData.copy(strlen(s_sReportPrefix), sFieldData.getLength() - strlen(s_sReportPrefix));
sFieldData = sFieldData.copy(strlen(s_sReportPrefix));
sal_Int32 nPageNumberIndex = sFieldData.indexOf(s_sPageNumber);
if ( nPageNumberIndex != -1 )
{
......
......@@ -1188,7 +1188,7 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
nStartPos = nPos + 1;
}
while( ( nPos = aStrOut.indexOf( '\n', nStartPos ) ) != -1 );
OUString aSingleLine = aStrOut.copy( nStartPos, aStrOut.getLength() - nStartPos );
OUString aSingleLine = aStrOut.copy( nStartPos );
OUT_STR( aSingleLine );
}
}
......
......@@ -758,7 +758,7 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(ScMyContentAction* pAction)
}
else
{
sFormula2 = sFormula.copy( 1, sFormula.getLength() - 1 );
sFormula2 = sFormula.copy( 1 );
}
aNewCell.meType = CELLTYPE_FORMULA;
......
......@@ -1117,7 +1117,7 @@ void AnimationImporter::fillNode( Reference< XAnimationNode >& xNode, const Anim
if( nPos >= 0 )
{
pValues->Time = aToken.copy( 0, nPos ).toDouble();
pValues->Progress = aToken.copy( nPos+1, aToken.getLength() - nPos - 1 ).toDouble();
pValues->Progress = aToken.copy( nPos+1 ).toDouble();
}
pValues++;
}
......
......@@ -382,7 +382,7 @@ void PresenterController::UpdatePaneTitles()
if (nStartIndex < 0)
{
// Add the remaining part of the string.
sResult.append(sTemplate.copy(nIndex, sTemplate.getLength()-nIndex));
sResult.append(sTemplate.copy(nIndex));
break;
}
else
......
......@@ -90,8 +90,7 @@ std::unique_ptr<GraphicObject> importShapeGraphic(uno::Reference<beans::XPropert
// unique ID string found in URL, extract
// to separate string
OUString const aUniqueId(
aURL.copy( nIndex, aURL.getLength() - nIndex ) );
OUString const aUniqueId( aURL.copy( nIndex ) );
// TODO(T2): Creating a GraphicObject is not
// thread safe (internally calls VCL, and has
......
......@@ -157,7 +157,7 @@ SocketPermission::SocketPermission(
else // A-B
{
m_lowerPort = m_host.copy( colon +1, minus - colon -1 ).toInt32();
m_upperPort = m_host.copy( minus +1, m_host.getLength() -minus -1 ).toInt32();
m_upperPort = m_host.copy( minus +1 ).toInt32();
}
m_host = m_host.copy( 0, colon );
}
......
......@@ -51,7 +51,7 @@ CollatorResource::GetTranslation(const OUString &r_Algorithm)
else
{
nIndex += 1;
aLocaleFreeAlgorithm = r_Algorithm.copy(nIndex, r_Algorithm.getLength() - nIndex);
aLocaleFreeAlgorithm = r_Algorithm.copy(nIndex);
}
for (size_t i = 0; i < m_aData.size(); ++i)
......
......@@ -46,7 +46,7 @@ const OUString& IndexEntryResource::GetTranslation(const OUString &r_Algorithm)
aLocaleFreeAlgorithm = r_Algorithm;
else {
nIndex += 1;
aLocaleFreeAlgorithm = r_Algorithm.copy(nIndex, r_Algorithm.getLength() - nIndex);
aLocaleFreeAlgorithm = r_Algorithm.copy(nIndex);
}
for (size_t i = 0; i < m_aData.size(); ++i)
......
......@@ -83,7 +83,7 @@ void HTMLParser::RemoveSGMLComment( OUString &rString, bool bFull )
sal_Unicode c = 0;
while( !rString.isEmpty() &&
( ' '==(c=rString[0]) || '\t'==c || '\r'==c || '\n'==c ) )
rString = rString.copy( 1, rString.getLength() - 1 );
rString = rString.copy( 1 );
while( !rString.isEmpty() &&
( ' '==(c=rString[rString.getLength()-1])
......@@ -109,7 +109,7 @@ void HTMLParser::RemoveSGMLComment( OUString &rString, bool bFull )
nPos = 3;
}
++nPos;
rString = rString.copy( nPos, rString.getLength() - nPos );
rString = rString.copy( nPos );
}
if( rString.endsWith("-->") )
......
......@@ -819,7 +819,7 @@ OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObjectURL( const OUString& r
{
aURL = rURL.copy( 0, nUser );
nUser++;
aUserData = rURL.copy( nUser, rURL.getLength() - nUser );
aUserData = rURL.copy( nUser );
}
if ( !aUserData.isEmpty() )
{
......@@ -831,7 +831,7 @@ OUString SAL_CALL SvXMLGraphicHelper::resolveGraphicObjectURL( const OUString& r
if ( ( n > 0 ) && ( ( n + 1 ) < aToken.getLength() ) )
{
OUString aParam( aToken.copy( 0, n ) );
OUString aValue( aToken.copy( n + 1, aToken.getLength() - ( n + 1 ) ) );
OUString aValue( aToken.copy( n + 1 ) );
const OUString sRequestedName( "requestedName" );
if ( aParam.match( sRequestedName ) )
......
......@@ -1127,7 +1127,7 @@ bool CSS1Parser::ParseStyleSheet( const OUString& rIn )
sal_Unicode c;
while( !aTmp.isEmpty() &&
( ' '==(c=aTmp[0]) || '\t'==c || '\r'==c || '\n'==c ) )
aTmp = aTmp.copy( 1, aTmp.getLength() - 1 );
aTmp = aTmp.copy( 1 );
while( !aTmp.isEmpty() && ( ' '==(c=aTmp[aTmp.getLength()-1])
|| '\t'==c || '\r'==c || '\n'==c ) )
......@@ -1136,7 +1136,7 @@ bool CSS1Parser::ParseStyleSheet( const OUString& rIn )
// remove SGML comments
if( aTmp.getLength() >= 4 &&
aTmp.startsWith( "<!--" ) )
aTmp = aTmp.copy( 4, aTmp.getLength() - 4 );
aTmp = aTmp.copy( 4 );
if( aTmp.getLength() >=3 &&
aTmp.endsWith("-->") )
......
......@@ -459,8 +459,8 @@ class CountWithPrefixSort
// Get order numbers from entry name without prefix.
// e.g. "m10" => 10
// "m5" => 5
sal_Int32 n1 = s1.copy( 1, s1.getLength()-1 ).toInt32();
sal_Int32 n2 = s2.copy( 1, s2.getLength()-1 ).toInt32();
sal_Int32 n1 = s1.copy( 1 ).toInt32();
sal_Int32 n2 = s2.copy( 1 ).toInt32();
// MUST be in [0,1] ... because it's a difference between
// insert-positions of given entries in sorted list!
return( n1<n2 );
......
......@@ -98,7 +98,7 @@ namespace DOM
count = tmp.getLength() - offset;
OUString tmp2 = tmp.copy(0, offset);
tmp2 += tmp.copy(offset+count, tmp.getLength() - (offset+count));
tmp2 += tmp.copy(offset+count);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
......@@ -167,7 +167,7 @@ namespace DOM
OUString tmp2 = tmp.copy(0, offset);
tmp2 += arg;
tmp2 += tmp.copy(offset, tmp.getLength() - offset);
tmp2 += tmp.copy(offset);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
......@@ -203,7 +203,7 @@ namespace DOM
OUString tmp2 = tmp.copy(0, offset);
tmp2 += arg;
tmp2 += tmp.copy(offset+count, tmp.getLength() - (offset+count));
tmp2 += tmp.copy(offset+count);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
......
......@@ -457,7 +457,7 @@ namespace DOM
if (i != -1)
{
oPrefix = OUStringToOString(qname.copy(0, i), RTL_TEXTENCODING_UTF8);
oName = OUStringToOString(qname.copy(i+1, qname.getLength()-i-1), RTL_TEXTENCODING_UTF8);
oName = OUStringToOString(qname.copy(i+1), RTL_TEXTENCODING_UTF8);
}
else
{
......@@ -548,7 +548,7 @@ namespace DOM
if ( i != -1) {
o1 = OUStringToOString(qname.copy(0, i), RTL_TEXTENCODING_UTF8);
pPrefix = reinterpret_cast<xmlChar const *>(o1.getStr());
o2 = OUStringToOString(qname.copy(i+1, qname.getLength()-i-1), RTL_TEXTENCODING_UTF8);
o2 = OUStringToOString(qname.copy(i+1), RTL_TEXTENCODING_UTF8);
pName = reinterpret_cast<xmlChar const *>(o2.getStr());
} else {
// default prefix
......
......@@ -244,7 +244,7 @@ STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, B
if(nPos > -1)
{
::rtl::OUString attrName = attr.copy(0, nPos);
::rtl::OUString attrValue = attr.copy(nPos + 1, attr.getLength() - nPos - 1);
::rtl::OUString attrValue = attr.copy(nPos + 1);
beanSeq[i].Name = attrName;
get_AnyFromOLECHAR(attrName, attrValue, beanSeq[i].Value);
}
......@@ -444,7 +444,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
pos = ouValue.indexOf("Height=", pos);
if(pos != -1)
{
ouSubValue = ouValue.copy(pos + 7, ouValue.getLength() - pos - 7);
ouSubValue = ouValue.copy(pos + 7);
lineSpacing.Height = (sal_Int16)ouSubValue.toInt32();
}
else
......
......@@ -193,7 +193,7 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const OUString& rStr
if( nLastPos != 0 &&
rStr.getLength() > nLastPos )
{
aVec.push_back( rStr.copy( nLastPos, (rStr.getLength() - nLastPos) ).toInt32() );
aVec.push_back( rStr.copy( nLastPos ).toInt32() );
}
const sal_Int32 nVecSize = aVec.size();
......
......@@ -411,7 +411,7 @@ Any AnimationsImportHelperImpl::convertValue( XMLTokenEnum eAttributeName, const
{
ValuePair aPair;
aPair.First = convertValue( eAttributeName, rValue.copy( 0, nCommaPos ) );
aPair.Second = convertValue( eAttributeName, rValue.copy( nCommaPos+1, rValue.getLength() - nCommaPos - 1 ) );
aPair.Second = convertValue( eAttributeName, rValue.copy( nCommaPos+1 ) );
return makeAny( aPair );
}
else
......@@ -607,7 +607,7 @@ Sequence< TimeFilterPair > AnimationsImportHelperImpl::convertTimeFilter( const
if( nPos >= 0 )
{
pValues->Time = aToken.copy( 0, nPos ).toDouble();
pValues->Progress = aToken.copy( nPos+1, aToken.getLength() - nPos - 1 ).toDouble();
pValues->Progress = aToken.copy( nPos+1 ).toDouble();
}
pValues++;
}
......
......@@ -2290,10 +2290,10 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
{
bIsEmbeddedImageWithExistingStreamInPackage = true;
OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
OUString sRequestedName = aStreamURL.copy( sPackageURL.getLength() );
sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex );
sRequestedName = sRequestedName.copy( nLastIndex );
nLastIndex = sRequestedName.lastIndexOf( '.' );
if ( nLastIndex >= 0 )
sRequestedName = sRequestedName.copy( 0, nLastIndex );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment