[Libreoffice-commits] core.git: 7 commits - distro-configs/LibreOfficeiOS.conf include/sal sal/osl sfx2/source sw/source tools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 11 16:59:07 UTC 2018


 distro-configs/LibreOfficeiOS.conf |    1 -
 include/sal/log-areas.dox          |    3 ++-
 sal/osl/unx/file.cxx               |   12 ++++++++----
 sfx2/source/doc/objstor.cxx        |   17 +++++++++++++++--
 sw/source/core/doc/docnew.cxx      |    2 ++
 sw/source/uibase/app/docsh.cxx     |    3 ++-
 tools/source/stream/strmunx.cxx    |    2 +-
 7 files changed, 30 insertions(+), 10 deletions(-)

New commits:
commit b0bed2457ffd74f772aec6d5fc76862822f79bbe
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 11 19:37:00 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Oct 11 19:57:40 2018 +0300

    No reason to have --disable-dependency-tracking here ffs
    
    Change-Id: Ia42daaf0dbb8fcd0230c7cee21a0f5d560885c22

diff --git a/distro-configs/LibreOfficeiOS.conf b/distro-configs/LibreOfficeiOS.conf
index 96524c42b76e..1968f52a79c0 100644
--- a/distro-configs/LibreOfficeiOS.conf
+++ b/distro-configs/LibreOfficeiOS.conf
@@ -16,7 +16,6 @@
 --disable-cups
 --disable-database-connectivity
 --disable-dconf
---disable-dependency-tracking
 --disable-extensions
 --disable-kde4
 --disable-odk
commit 0f2c0238dc988d49acc8687c83a49d199df8f9d0
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 11 18:58:37 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Oct 11 19:57:40 2018 +0300

    Don't just log the file name, at least say what we are doing with it
    
    Change-Id: I9ff0b4287c5be0dfc83740b75d58cab78dc990f7

diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index a74262fac383..057ac61f121f 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -542,7 +542,7 @@ void SvFileStream::Close()
 
     if ( IsOpen() )
     {
-        SAL_INFO("tools", aFilename);
+        SAL_INFO("tools", "Closing " << aFilename);
         Flush();
         osl_closeFile( pInstanceData->rHandle );
         pInstanceData->rHandle = nullptr;
commit e519d7b58454d39fb39e4420872c9a677e1b2296
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 11 18:35:50 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Oct 11 19:57:40 2018 +0300

    Change {read,write}FileAt() SAL_INFO calls to use a separate log area
    
    Keep sal.file for the SAL_INFO logging of file system calls (open,
    close, rename, etc), and use sal.fileio for the (very verbose) file
    I/O.
    
    Change-Id: I0e166d83e20921696a8a0880f9fcbbdec55053dd

diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index d718f649be70..7acc54463d0e 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -22,7 +22,8 @@ certain functionality.
 
 @li @c sal.bootstrap - SAL bootstrap
 @li @c sal.debug - SAL debugging functionality
- at li @c sal.file
+ at li @c sal.file - file system operations
+ at li @c sal.fileio - file I/O
 @li @c sal.osl - SAL OSL library
 @li @c sal.osl.condition
 @li @c sal.osl.mutex
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 6ef6196f8c37..62ed5ed734d0 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -425,7 +425,7 @@ oslFileError FileHandle_Impl::readFileAt(
         }
 
         size_t const bytes = std::min(m_buflen - bufpos, nBytesRequested);
-        SAL_INFO("sal.file", "FileHandle_Impl::readFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
+        SAL_INFO("sal.fileio", "FileHandle_Impl::readFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
 
         memcpy(&(buffer[*pBytesRead]), &(m_buffer[bufpos]), bytes);
         nBytesRequested -= bytes;
@@ -500,7 +500,7 @@ oslFileError FileHandle_Impl::writeFileAt(
         }
 
         size_t const bytes = std::min(m_bufsiz - bufpos, nBytesToWrite);
-        SAL_INFO("sal.file", "FileHandle_Impl::writeFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
+        SAL_INFO("sal.fileio", "FileHandle_Impl::writeFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
 
         memcpy(&(m_buffer[bufpos]), &(buffer[*pBytesWritten]), bytes);
         nBytesToWrite -= bytes;
commit c387836fa6782c7efff9ade6bfa18fac21ec0e05
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 11 18:25:22 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Oct 11 19:57:40 2018 +0300

    Don't use GetDBManager() without checking it for nullness
    
    Change-Id: Idb7b16a6976df62a1beea8a01c812206a0b8b85a

diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 86d72ac8fb88..8a7d196ea3c2 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -454,7 +454,8 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium )
     CalcLayoutForOLEObjects();  // format for OLE objects
 
     const bool bURLChanged = !GetMedium() || GetMedium()->GetURLObject() != rMedium.GetURLObject();
-    const bool bHasEmbedded = !m_xDoc->GetDBManager()->getEmbeddedName().isEmpty();
+    auto pMgr = m_xDoc->GetDBManager();
+    const bool bHasEmbedded = pMgr ? !pMgr->getEmbeddedName().isEmpty() : false;
     bool bSaveDS = bHasEmbedded && bURLChanged;
     if (bSaveDS)
     {
commit 5268927d390295015abb68abcd310167abe8b8bd
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 11 18:24:42 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Oct 11 19:57:40 2018 +0300

    Initialise m_pDBManager to nullptr in the !HAVE_FEATURE_DBCONNECTIVITY case
    
    Change-Id: Id18bafaaf8f5315a0590687d98ea97952bdf883b

diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 4e0cfb24c2f2..c75b2fd76f30 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -345,6 +345,8 @@ SwDoc::SwDoc()
     // Create DBManager
     m_pOwnDBManager.reset(new SwDBManager(this));
     m_pDBManager = m_pOwnDBManager.get();
+#else
+    m_pDBManager = nullptr;
 #endif
 
     // create TOXTypes
commit 4dcd54067d27376bd66402318ac891257191d805
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 11 18:20:29 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Oct 11 19:57:40 2018 +0300

    Skip the backup dance on iOS for now
    
    The code is much too convoluted for my little brain. We can't create a
    backup copy of a file from outside the sandbox in the same folder as
    the original file. At least not using just normal Unix APIs. And if we
    store it somewhere else, how would the user find it anyway? Let's just
    skipt this mess for now.
    
    No idea how the code manages to create backup files in the same folder
    as the actual document in a sandboxed LibreOffice on macOS. Or does
    it? Maybe we do some similar bypassing of the backup dance at some
    other place in the code already, and I should just have made that
    happen for iOS, too?
    
    Change-Id: I0c90edf9e72f54cce78b2cd325e67c710b6df745

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 9ff4ce357c2b..8181e1336a8a 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -1743,6 +1743,19 @@ bool SfxObjectShell::DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& r
     uno::Reference< embed::XStorage > xStorage = rSrcMedium.GetStorage();
 
     bool bResult = false;
+#ifdef IOS
+    // On iOS, we typically can't create a backup file in the same folder as where the document is
+    // because that is outside the sandbox, like "/private/var/mobile/Library/Mobile
+    // Documents/com~apple~CloudDocs" for documents opened from the iCloud Drive. So bypass this
+    // whole backup dance for now.
+
+    // FIXME: Also, should investigate whether iOS has some native high-level API that can be used
+    // for automatic keeping of some suitable number of backup copies from various pooints in time,
+    // or something. Although, even if it has, marrying that to the horrible mess here in sfx2, and
+    // in ucb, sal, etc won't be fun.
+    (void) rTargetMedium;
+    bResult = true;
+#else
     if ( xStorage == pImpl->m_xDocStorage )
     {
         try
@@ -1781,7 +1794,7 @@ bool SfxObjectShell::DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMedium& r
         catch ( uno::Exception& )
         {}
     }
-
+#endif // !IOS
     return bResult;
 }
 
commit fb4c929328027b1a804f214c4d189c9b59e0af51
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Oct 11 18:19:25 2018 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Oct 11 19:57:40 2018 +0300

    Do the SAL_INFO() for the fsync() call only when we know the result
    
    Change-Id: I4bea64f959a6d6f3010809261804748b4fcd7718

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 910345d74f28..6ef6196f8c37 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -1061,15 +1061,19 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle)
 
     FileHandle_Impl::Guard lock(&(pImpl->m_mutex));
 
-    SAL_INFO("sal.file", "osl_syncFile(" << pImpl->m_fd << ")");
-
     oslFileError result = pImpl->syncFile();
 
     if (result != osl_File_E_None)
         return result;
 
     if (fsync(pImpl->m_fd) == -1)
+    {
+        int e = errno;
+        SAL_INFO("sal.file", "fsync(" << pImpl->m_fd << "): errno " << e << ": " << strerror(e));
         return oslTranslateFileError(errno);
+    }
+    else
+        SAL_INFO("sal.file", "fsync(" << pImpl->m_fd << "): OK");
 
     return osl_File_E_None;
 }


More information about the Libreoffice-commits mailing list