i18nlangtag/source/languagetag/languagetag.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 3fd0800f00da9d5c956b4868c73eff1d23e747f0
Author:     Noel Grandin <[email protected]>
AuthorDate: Sat Feb 7 13:40:00 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat Feb 7 20:18:19 2026 +0100

    fix appendAscii
    
    where we should be appending to the buffer, not writing
    to the start.
    
    regression from
      commit fba849c048ce41a3e726778b7a088a47faf84b29
      Author: Noel Grandin <[email protected]>
      Date:   Tue Jan 27 13:29:55 2026 +0200
      tdf#148218 reduce OUString allocations
    
    spotted by mike kaganski
    
    Change-Id: Ifc8ad791126b8279b39208d0cd18ba68b28c9be8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198884
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/i18nlangtag/source/languagetag/languagetag.cxx 
b/i18nlangtag/source/languagetag/languagetag.cxx
index 9420c1d387af..2b686a0ea3ed 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -2877,9 +2877,10 @@ OUString LanguageTagImpl::convertToBcp47( const 
css::lang::Locale& rLocale )
 */
 static void appendAscii(StackString64& rBuf, const OUString& s)
 {
-    rBuf.setLength(rBuf.getLength() + s.getLength());
+    const sal_Int32 nDestLen = rBuf.getLength();
+    rBuf.setLength(nDestLen + s.getLength());
     const sal_Unicode* pSrc = s.getStr();
-    char* pDest = rBuf.getMutableStr();
+    char* pDest = rBuf.getMutableStr() + nDestLen;
     for (int i=0; i<s.getLength(); i++)
     {
         assert(*pSrc < 127);

Reply via email to