desktop/source/app/updater.cxx               |   14 ++++----------
 desktop/source/app/updater.hxx               |    1 -
 sc/source/filter/oox/numberformatsbuffer.cxx |   16 ++++++++++++++++
 3 files changed, 20 insertions(+), 11 deletions(-)

New commits:
commit b3f6d4f0d380b26fb88ff586a09b4525ed6585b9
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Wed May 29 19:37:22 2024 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Fri May 31 16:15:32 2024 +0200

    Related: tdf#161301 strip single stray leading "[$]" garbage from formatCode
    
    Which is the case if the actual format code is in an
    x16r2:formatCode16 attribute that isn't handled yet.
    
    Change-Id: Id35e774f8ccb167af2a46a8cc0f7611da76d708c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168232
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx 
b/sc/source/filter/oox/numberformatsbuffer.cxx
index dc35b84a87c3..4200a24d3782 100644
--- a/sc/source/filter/oox/numberformatsbuffer.cxx
+++ b/sc/source/filter/oox/numberformatsbuffer.cxx
@@ -1933,6 +1933,16 @@ void NumberFormat::setFormatCode( std::u16string_view 
aFmtCode )
         }  // tdf#81939 preserve other escape characters
         nPosEscape = lclPosToken( aFmtCode, u";", nPosEscape ); // skip to 
next format
     }
+
+    // tdf#161301 There may be a lone single stray leading "[$]" garbage, 
strip it.
+    if (sFormat.getLength() >= 3 && sFormat[0] == '[' && sFormat[1] == '$' && 
sFormat[2] == ']')
+    {
+        SAL_WARN("sc.filter",
+                "NumberFormat::setFormatCode: stripping leading [$] maybe due 
to x16r2:formatCode16 also being present: "
+                << sFormat.toString());
+        sFormat.remove(0, 3);
+    }
+
     maModel.maFmtCode = sFormat.makeStringAndClear();
 }
 
@@ -2005,6 +2015,12 @@ NumberFormatRef NumberFormatsBuffer::importNumFmt( const 
AttributeList& rAttribs
 {
     sal_Int32 nNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
     OUString aFmtCode = rAttribs.getXString( XML_formatCode, OUString() );
+    /* TODO: there may be a x16r2:formatCode16 attribute that would take
+     * precedence over the formatCode attribute, see
+     * 
https://learn.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/8c82391e-f128-499a-80a1-734b8504f60e
+     * The number format scanner would have to handle the
+     * [$<currency string>-<culture info>[,<calendar type and numeral system>]]
+     * part.*/
     return createNumFmt( nNumFmtId, aFmtCode );
 }
 
commit 48190a8f3783135c65538977cd38f34ba733f071
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Thu May 30 13:44:49 2024 +0200
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Fri May 31 16:15:25 2024 +0200

    Make sure updates dir exists when writing updating.log
    
    Change-Id: Ib652fedde970d01b701ad4b61e75028cd43974f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168258
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 676cc54f148e..d60c006f6b6f 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -805,14 +805,6 @@ void update_checker()
     }
 }
 
-OUString Updater::getUpdateInfoLog()
-{
-    OUString aUpdateInfoURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates/updating.log");
-    rtl::Bootstrap::expandMacros(aUpdateInfoURL);
-
-    return aUpdateInfoURL;
-}
-
 OUString Updater::getPatchDirURL()
 {
     OUString aPatchDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates/0/");
@@ -845,8 +837,10 @@ OUString Updater::getExecutableDirURL()
 void Updater::log(const OUString& rMessage)
 {
     SAL_INFO("desktop.updater", rMessage);
-    OUString aUpdateLog = getUpdateInfoLog();
-    SvFileStream aLog(aUpdateLog, StreamMode::STD_READWRITE);
+    OUString dir("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE("bootstrap") ":UserInstallation}/updates");
+    rtl::Bootstrap::expandMacros(dir);
+    osl::Directory::create(dir);
+    SvFileStream aLog(dir + "/updating.log", StreamMode::STD_READWRITE);
     aLog.Seek(aLog.Tell() + aLog.remainingSize()); // make sure we are at the 
end
     aLog.WriteLine(OUStringToOString(rMessage, RTL_TEXTENCODING_UTF8));
 }
diff --git a/desktop/source/app/updater.hxx b/desktop/source/app/updater.hxx
index 2ab4d4ea8eae..3fc767748094 100644
--- a/desktop/source/app/updater.hxx
+++ b/desktop/source/app/updater.hxx
@@ -18,7 +18,6 @@ void update_checker();
 class Updater
 {
 public:
-    static OUString getUpdateInfoLog();
     static OUString getPatchDirURL();
     static OUString getUpdateFileURL();
     static OUString getExecutableDirURL();

Reply via email to