sFormel is just a duplicate of rFormel

Change-Id: Ib3eb3f517845776ba3ed51f63692f18d51c3f1cc
This commit is contained in:
Matteo Casalin
2013-09-28 01:18:44 +02:00
parent 27a236601b
commit 5f3ec872c2

View File

@@ -1926,7 +1926,6 @@ void SwDoc::ReplaceUsedDBs( const std::vector<String>& rUsedDBNames,
const String& rNewName, OUString& rFormel ) const String& rNewName, OUString& rFormel )
{ {
const CharClass& rCC = GetAppCharClass(); const CharClass& rCC = GetAppCharClass();
String sFormel(rFormel);
String sNewName( rNewName ); String sNewName( rNewName );
sNewName.SearchAndReplace( DB_DELIM, '.'); sNewName.SearchAndReplace( DB_DELIM, '.');
//the command type is not part of the condition //the command type is not part of the condition
@@ -1942,19 +1941,17 @@ void SwDoc::ReplaceUsedDBs( const std::vector<String>& rUsedDBNames,
sDBName = sDBName.GetToken(0, DB_DELIM); sDBName = sDBName.GetToken(0, DB_DELIM);
if( !sDBName.Equals( sUpperNewNm )) if( !sDBName.Equals( sUpperNewNm ))
{ {
xub_StrLen nPos = 0; sal_Int32 nPos = 0;
while ((nPos = rFormel.indexOf(sDBName, nPos))>=0)
while ((nPos = sFormel.Search(sDBName, nPos)) != STRING_NOTFOUND)
{ {
if( sFormel.GetChar( nPos + sDBName.Len() ) == '.' && if( rFormel[nPos + sDBName.Len()] == '.' &&
(!nPos || !rCC.isLetterNumeric( sFormel, nPos - 1 ))) (!nPos || !rCC.isLetterNumeric( rFormel, nPos - 1 )))
{ {
rFormel = rFormel.replaceAt(nPos, sDBName.Len(), sNewName); rFormel = rFormel.replaceAt(nPos, sDBName.Len(), sNewName);
//prevent re-searching - this is useless and provokes //prevent re-searching - this is useless and provokes
//endless loops when names containing each other and numbers are exchanged //endless loops when names containing each other and numbers are exchanged
//e.g.: old ?12345.12345 new: i12345.12345 //e.g.: old ?12345.12345 new: i12345.12345
nPos = nPos + sNewName.Len(); nPos = nPos + sNewName.Len();
sFormel = rFormel;
} }
} }
} }