compilerplugins/clang/stringadd.cxx | 3 --- editeng/source/misc/svxacorr.cxx | 14 ++++++-------- 2 files changed, 6 insertions(+), 11 deletions(-)
New commits: commit 7ff6d6017561c50b933b115452b210bdbce164bb Author: Mike Kaganski <[email protected]> AuthorDate: Sun Sep 28 15:55:28 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Sep 28 14:11:10 2025 +0200 Drop loplugin:stringadd exclusion for svxacorr.cxx Change-Id: I5fe854267738a9ab873c493effbac6bcfe70820c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191577 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/compilerplugins/clang/stringadd.cxx b/compilerplugins/clang/stringadd.cxx index 60e61f04a8bb..7348fc66a74f 100644 --- a/compilerplugins/clang/stringadd.cxx +++ b/compilerplugins/clang/stringadd.cxx @@ -59,9 +59,6 @@ public: // there is an ifdef here, but my check is not working, not sure why if (fn == SRCDIR "/pyuno/source/module/pyuno_runtime.cxx") return false; - // TODO the += depends on the result of the preceding assign, so can't merge - if (fn == SRCDIR "/editeng/source/misc/svxacorr.cxx") - return false; // TODO this file has a boatload of buffer appends' and I don't feel like fixing them all now if (fn == SRCDIR "/vcl/source/gdi/pdfwriter_impl.cxx") return false; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 1453f9f91921..62a946e11776 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1211,14 +1211,13 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT if ( !IsUpperLetter(rCC.getCharacterType(rTxt, nSttPos+1)) ) return false; - OUStringBuffer aConverted; - aConverted.append( rCC.uppercase(OUString(rTxt[nSttPos])) ); - aConverted.append( rCC.lowercase(OUString(rTxt[nSttPos+1])) ); - // No replacement for words in TWo INitial CApitals or sMALL iNITIAL list if (FindInWordStartExceptList(eLang, rTxt.copy(nSttPos, nEndPos - nSttPos))) return false; + OUStringBuffer aConverted(rCC.uppercase(rTxt, nSttPos, 1) + + rCC.lowercase(rTxt, nSttPos + 1, 1)); + for( sal_Int32 i = nSttPos+2; i < nEndPos; ++i ) { if ( IsLowerLetter(rCC.getCharacterType(rTxt, i)) ) @@ -1227,7 +1226,7 @@ bool SvxAutoCorrect::FnCorrectCapsLock( SvxAutoCorrDoc& rDoc, const OUString& rT if ( IsUpperLetter(rCC.getCharacterType(rTxt, i)) ) // Another uppercase letter. Convert it. - aConverted.append( rCC.lowercase(OUString(rTxt[i])) ); + aConverted.append( rCC.lowercase(rTxt, i, 1) ); else // This is not an alphabetic letter. Leave it as-is. aConverted.append( rTxt[i] ); @@ -1992,8 +1991,7 @@ bool SvxAutoCorrect::PutText( const css::uno::Reference < css::embed::XStorage > OUString EncryptBlockName_Imp(std::u16string_view rName) { - OUStringBuffer aName; - aName.append('#').append(rName); + OUStringBuffer aName(OUStringChar('#') + rName); for (size_t nLen = rName.size(), nPos = 1; nPos < nLen; ++nPos) { if (lcl_IsInArr( u"!/:.\", aName[nPos])) @@ -3279,7 +3277,7 @@ SvxAutocorrWordList::WordMatches(const SvxAutocorrWord *pFnd, if (nTmp < static_cast<sal_Int32>(nSttWdPos)) { break; // word delimiter found } - buf.append(rTxt.substr(nFndPos, nSttWdPos - nFndPos)).append(pFnd->GetLong()); + buf.append(rTxt.substr(nFndPos, nSttWdPos - nFndPos) + pFnd->GetLong()); nFndPos = nSttWdPos + sTmp.getLength(); } } while (nSttWdPos != std::u16string_view::npos);
