[Libreoffice-commits] core.git: sfx2/qa sfx2/source sw/qa
sfx2/qa/cppunit/doc.cxx |2 +- sfx2/source/control/unoctitm.cxx|2 +- sw/qa/uibase/uno/uno.cxx|2 +- sw/qa/uitest/writer_tests7/tdf145093.py |2 +- 4 files changed, 4 insertions(+), 4 deletions(-) New commits: commit bf3562cf38c2dd7776a160ee8259a6fb97c0e7ba Author: Andrea Gelmini AuthorDate: Thu Dec 22 11:32:11 2022 +0100 Commit: Andrea Gelmini CommitDate: Thu Dec 22 15:54:50 2022 + Fix typo "an other" -> "another" Change-Id: Id0a2b8f99fd4f87e94e65570ebc75bfdf0d205ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143597 Reviewed-by: Julien Nabet Tested-by: Jenkins Reviewed-by: Andrea Gelmini diff --git a/sfx2/qa/cppunit/doc.cxx b/sfx2/qa/cppunit/doc.cxx index d7538925113e..902ac48646e5 100644 --- a/sfx2/qa/cppunit/doc.cxx +++ b/sfx2/qa/cppunit/doc.cxx @@ -92,7 +92,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTempFilePath) CPPUNIT_TEST_FIXTURE(Test, testSetDocumentPropertiesUpdate) { -// Given a document with 3 custom props, 2 Zotero ones and an other: +// Given a document with 3 custom props, 2 Zotero ones and one other: mxComponent = loadFromDesktop("private:factory/swriter"); auto pBaseModel = dynamic_cast(mxComponent.get()); CPPUNIT_ASSERT(pBaseModel); diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 6f68292f46b4..76f4c9693dc0 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -252,7 +252,7 @@ void SAL_CALL SfxOfficeDispatch::dispatch( const css::util::URL& aURL, const css { // Make sure that we own the solar mutex, otherwise later // vcl::SolarThreadExecutor::execute() will release the solar mutex, even if it's owned by -// an other thread, leading to an std::abort() at the end. +// another thread, leading to an std::abort() at the end. SolarMutexGuard aGuard; vcl::solarthread::syncExecute([this, , ]() { pImpl->dispatch(aURL, aArgs, diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx index 45fc50999e65..64d2a70fe4e2 100644 --- a/sw/qa/uibase/uno/uno.cxx +++ b/sw/qa/uibase/uno/uno.cxx @@ -246,7 +246,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormFields) CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetDocumentProperties) { -// Given a document with 3 custom properties: 2 zotero ones and an other one: +// Given a document with 3 custom properties: 2 Zotero ones and one other: createSwDoc(); SwDoc* pDoc = getSwDoc(); SwDocShell* pDocShell = pDoc->GetDocShell(); diff --git a/sw/qa/uitest/writer_tests7/tdf145093.py b/sw/qa/uitest/writer_tests7/tdf145093.py index 7dcd67b378d2..59d4c3d3c15c 100644 --- a/sw/qa/uitest/writer_tests7/tdf145093.py +++ b/sw/qa/uitest/writer_tests7/tdf145093.py @@ -19,7 +19,7 @@ class tdf145093(UITestCase): # Move Up/Down a list item over a tracked paragraph insertion resulted a crash # (Note: not only at the end of the document, but check the original -# bug report temporarily, where the problem is triggered by an other problem). +# bug report temporarily, where the problem is triggered by another problem). self.xUITest.executeCommand(".uno:MoveDown") self.xUITest.executeCommand(".uno:MoveDown")
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/cppunit/test_classification.cxx | 12 +++--- sfx2/qa/cppunit/test_misc.cxx |6 +-- sfx2/source/appl/appdata.cxx |2 - sfx2/source/appl/appopen.cxx |6 +-- sfx2/source/appl/appserv.cxx | 10 ++--- sfx2/source/appl/childwin.cxx |2 - sfx2/source/appl/fileobj.cxx |2 - sfx2/source/appl/macroloader.cxx |2 - sfx2/source/appl/newhelp.cxx | 28 +++ sfx2/source/appl/sfxhelp.cxx |2 - sfx2/source/bastyp/fltfnc.cxx | 10 ++--- sfx2/source/dialog/basedlgs.cxx |2 - sfx2/source/dialog/dinfdlg.cxx|2 - sfx2/source/dialog/documentfontsdialog.cxx| 10 ++--- sfx2/source/dialog/filedlghelper.cxx | 40 +++--- sfx2/source/dialog/splitwin.cxx |2 - sfx2/source/dialog/srchdlg.cxx|2 - sfx2/source/dialog/tabdlg.cxx |4 +- sfx2/source/dialog/templdlg.cxx |2 - sfx2/source/dialog/versdlg.cxx|2 - sfx2/source/doc/DocumentMetadataAccess.cxx| 18 - sfx2/source/doc/SfxDocumentMetaData.cxx |8 ++-- sfx2/source/doc/SfxRedactionHelper.cxx| 18 - sfx2/source/doc/autoredactdialog.cxx |2 - sfx2/source/doc/docfac.cxx|4 +- sfx2/source/doc/docfile.cxx | 26 +++--- sfx2/source/doc/docmacromode.cxx |4 +- sfx2/source/doc/doctempl.cxx |2 - sfx2/source/doc/doctemplates.cxx | 22 ++-- sfx2/source/doc/guisaveas.cxx | 16 sfx2/source/doc/new.cxx |2 - sfx2/source/doc/objmisc.cxx |8 ++-- sfx2/source/doc/objserv.cxx | 32 - sfx2/source/doc/objstor.cxx | 32 - sfx2/source/doc/sfxbasemodel.cxx |8 ++-- sfx2/source/doc/templatedlg.cxx |6 +-- sfx2/source/doc/watermarkitem.cxx | 10 ++--- sfx2/source/notebookbar/NotebookbarTabControl.cxx |4 +- sfx2/source/notebookbar/SfxNotebookBar.cxx|2 - sfx2/source/sidebar/ControllerFactory.cxx | 18 - sfx2/source/sidebar/ResourceManager.cxx |6 +-- sfx2/source/sidebar/SidebarController.cxx | 18 - sfx2/source/view/classificationcontroller.cxx |4 +- sfx2/source/view/classificationhelper.cxx |4 +- sfx2/source/view/ipclient.cxx |4 +- sfx2/source/view/sfxbasecontroller.cxx|2 - sfx2/source/view/viewfrm.cxx |6 +-- sfx2/source/view/viewprn.cxx | 12 +++--- sfx2/source/view/viewsh.cxx |4 +- 49 files changed, 225 insertions(+), 225 deletions(-) New commits: commit 0bfa6a180850898ec5038ad70e09a2ff7baafa1a Author: Stephan Bergmann AuthorDate: Tue May 3 23:21:30 2022 +0200 Commit: Stephan Bergmann CommitDate: Wed May 4 06:54:23 2022 +0200 Just use Any ctor instead of makeAny in sfx2 Change-Id: Ie707881d6f4cd4a2f92f4f5a89aa9e0b051db8a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133783 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sfx2/qa/cppunit/test_classification.cxx b/sfx2/qa/cppunit/test_classification.cxx index c086d2e973cb..45d2947882f3 100644 --- a/sfx2/qa/cppunit/test_classification.cxx +++ b/sfx2/qa/cppunit/test_classification.cxx @@ -62,8 +62,8 @@ void ClassificationTest::testClassification() { uno::Sequence aPropertyValues(comphelper::InitPropertySequence( { -{"Name", uno::makeAny(OUString("Non-Business"))}, -{"Type", uno::makeAny(OUString("urn:bails:ExportControl:"))}, +{"Name", uno::Any(OUString("Non-Business"))}, +{"Type", uno::Any(OUString("urn:bails:ExportControl:"))}, })); dispatchCommand(mxComponent, ".uno:ClassificationApply", aPropertyValues); @@ -76,8 +76,8 @@ void ClassificationTest::testClassification() aPropertyValues = comphelper::InitPropertySequence( { -{"Name", uno::makeAny(OUString("Confidential"))}, -{"Type", uno::makeAny(OUString("urn:bails:NationalSecurity:"))}, +{"Name", uno::Any(OUString("Confidential"))}, +{"Type", uno::Any(OUString("urn:bails:NationalSecurity:"))}, }); dispatchCommand(mxComponent, ".uno:ClassificationApply", aPropertyValues); aAny = xPropertySet->getPropertyValue("urn:bails:NationalSecurity:BusinessAuthorizationCategory:Identifier"); @@ -85,8 +85,8 @@ void ClassificationTest::testClassification()
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/cppunit/test_controlleritem.cxx |2 sfx2/source/appl/appuno.cxx | 124 ++-- sfx2/source/appl/childwin.cxx |2 sfx2/source/appl/shutdownicon.cxx |2 sfx2/source/appl/workwin.cxx| 10 +- sfx2/source/bastyp/fltfnc.cxx |4 sfx2/source/bastyp/frmhtml.cxx |8 - sfx2/source/bastyp/frmhtmlw.cxx |4 sfx2/source/bastyp/sfxhtml.cxx |2 sfx2/source/control/recentdocsview.cxx |4 sfx2/source/control/templatedefaultview.cxx |4 sfx2/source/dialog/dockwin.cxx |2 sfx2/source/dialog/filtergrouping.cxx |2 sfx2/source/dialog/mailmodel.cxx|2 sfx2/source/doc/DocumentMetadataAccess.cxx |8 - sfx2/source/doc/Metadatable.cxx |4 sfx2/source/doc/SfxDocumentMetaData.cxx |2 sfx2/source/doc/objxtor.cxx |2 sfx2/source/notebookbar/SfxNotebookBar.cxx |4 sfx2/source/sidebar/DeckLayouter.cxx|2 sfx2/source/sidebar/DeckTitleBar.cxx|4 sfx2/source/sidebar/PanelTitleBar.cxx |4 sfx2/source/sidebar/SidebarController.cxx |8 - sfx2/source/sidebar/TitleBar.cxx|4 sfx2/source/view/lokhelper.cxx |4 25 files changed, 109 insertions(+), 109 deletions(-) New commits: commit 69861703cb40a27ed0427313a2ab0237140d54a8 Author: Stephan Bergmann AuthorDate: Wed Jul 1 22:39:03 2020 +0200 Commit: Stephan Bergmann CommitDate: Wed Jul 1 23:48:44 2020 +0200 Upcoming improved loplugin:staticanonymous -> redundantstatic: sfx2 Change-Id: I67ac4f4ed5ddd488c3fd5bae83d1fce18d6213d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97662 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sfx2/qa/cppunit/test_controlleritem.cxx b/sfx2/qa/cppunit/test_controlleritem.cxx index 9576e7b192a5..75d220536712 100644 --- a/sfx2/qa/cppunit/test_controlleritem.cxx +++ b/sfx2/qa/cppunit/test_controlleritem.cxx @@ -30,7 +30,7 @@ public: private: }; -static bool bDeleted = false; +bool bDeleted = false; class FooController : public SfxControllerItem { public: diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 1bdb0c0e9831..7ac8358696be 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -92,68 +92,68 @@ SfxFormalArgument const aFormalArgs[] = { { reinterpret_cast(_Impl), "RedactionStyle", SID_REDACTION_STYLE }, }; -static sal_uInt16 const nMediaArgsCount = SAL_N_ELEMENTS(aFormalArgs); - -static char const sTemplateRegionName[] = "TemplateRegionName"; -static char const sTemplateName[] = "TemplateName"; -static char const sAsTemplate[] = "AsTemplate"; -static char const sOpenNewView[] = "OpenNewView"; -static char const sViewId[] = "ViewId"; -static char const sPluginMode[] = "PluginMode"; -static char const sReadOnly[] = "ReadOnly"; -static char const sDdeReconnect[] = "DDEReconnect"; -static char const sStartPresentation[] = "StartPresentation"; -static char const sFrameName[] = "FrameName"; -static char const sMediaType[] = "MediaType"; -static char const sPostData[] = "PostData"; -static char const sCharacterSet[] = "CharacterSet"; -static char const sInputStream[] = "InputStream"; -static char const sStream[] = "Stream"; -static char const sOutputStream[] = "OutputStream"; -static char const sHidden[] = "Hidden"; -static char const sPreview[] = "Preview"; -static char const sViewOnly[] = "ViewOnly"; -static char const sDontEdit[] = "DontEdit"; -static char const sSilent[] = "Silent"; -static char const sJumpMark[] = "JumpMark"; -static char const sSalvagedFile[] = "SalvagedFile"; -static char const sStatusInd[] = "StatusIndicator"; -static char const sModel[] = "Model"; -static char const sFrame[] = "Frame"; -static char const sViewData[] = "ViewData"; -static char const sFilterData[] = "FilterData"; -static char const sSelectionOnly[] = "SelectionOnly"; -static char const sMacroExecMode[] = "MacroExecutionMode"; -static char const sUpdateDocMode[] = "UpdateDocMode"; -static char const sMinimized[] = "Minimized"; -static char const sInteractionHdl[] = "InteractionHandler"; -static char const sUCBContent[] = "UCBContent"; -static char const sRepairPackage[] = "RepairPackage"; -static char const sDocumentTitle[] = "DocumentTitle"; -static char const sComponentData[] = "ComponentData"; -static char const sComponentContext[] = "ComponentContext"; -static char const sDocumentBaseURL[] = "DocumentBaseURL"; -static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName"; -static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible"; -static char const sNoAutoSave[] = "NoAutoSave"; -static char const sFolderName[] = "FolderName"; -static char const sUseSystemDialog[] = "UseSystemDialog"; -static char const sStandardDir[] = "StandardDir"; -static char const sBlackList[]
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/cppunit/test_metadatable.cxx|9 +++-- sfx2/source/dialog/dockwin.cxx |3 +-- sfx2/source/dialog/mailmodel.cxx|3 +-- sfx2/source/dialog/partwnd.cxx |3 +-- sfx2/source/doc/SfxDocumentMetaData.cxx |4 +--- sfx2/source/doc/doctemplates.cxx|3 +-- sfx2/source/doc/guisaveas.cxx |3 +-- sfx2/source/doc/templatedlg.cxx |3 +-- sfx2/source/view/viewsh.cxx |3 +-- 9 files changed, 11 insertions(+), 23 deletions(-) New commits: commit 7653e4f209a5e81860d029c8a6c5436c0b25efdb Author: Stephan Bergmann AuthorDate: Fri Jun 5 07:36:56 2020 +0200 Commit: Stephan Bergmann CommitDate: Fri Jun 5 14:20:51 2020 +0200 Upcoming loplugin:elidestringvar: sfx2 Change-Id: I58b77dd04fb0de28fcbf34a22ed73fe248f0c6b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95547 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sfx2/qa/cppunit/test_metadatable.cxx b/sfx2/qa/cppunit/test_metadatable.cxx index 06b18edfec43..7508d467a7ac 100644 --- a/sfx2/qa/cppunit/test_metadatable.cxx +++ b/sfx2/qa/cppunit/test_metadatable.cxx @@ -84,15 +84,12 @@ void MetadatableTest::test() MockMetadatable m5(*pReg); OUString empty; OUString content( "content.xml" ); -OUString const styles( "styles.xml" ); -OUString const sid1( "id1" ); -OUString const sid2( "id2" ); OUString sid3( "id3" ); OUString sid4( "id4" ); -beans::StringPair id1(content, sid1); -beans::StringPair id2(content, sid2); +beans::StringPair id1(content, "id1"); +beans::StringPair id2(content, "id2"); beans::StringPair id3(content, sid3); -beans::StringPair id4(styles, sid4); +beans::StringPair id4("styles.xml", sid4); beans::StringPair id3e(empty, sid3); beans::StringPair id4e(empty, sid4); m1.SetMetadataReference(id1); diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 926a68ab8bfa..0287b1ac1fb8 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -128,7 +128,6 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd , : SfxChildWindow( pParentWnd , nId ) { uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); -const OUString aDockWindowResourceURL( "private:resource/dockingwindow/" ); VclPtr pTitleDockWindow = VclPtr::Create( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE); @@ -141,7 +140,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd , SfxDispatcher* pDispatcher = pBindings->GetDispatcher(); uno::Reference< frame::XFrame > xFrame = pDispatcher->GetFrame()->GetFrame().GetFrameInterface(); // create a resource URL from the nId provided by the sfx2 -OUString aResourceURL = aDockWindowResourceURL + OUString::number(nId); +OUString aResourceURL = "private:resource/dockingwindow/" + OUString::number(nId); uno::Sequence aArgs(comphelper::InitAnyPropertySequence( { {"Frame", uno::Any(xFrame)}, diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 63e29270d6c2..a58080b601ee 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -432,8 +432,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( if ( !bHasLocation ) { // Create a noname file name with the correct extension -const OUString aNoNameFileName( "noname" ); -aFileName = aNoNameFileName; +aFileName = "noname"; } else { diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx index 367eb49e0d93..e387d2c5ba1c 100644 --- a/sfx2/source/dialog/partwnd.cxx +++ b/sfx2/source/dialog/partwnd.cxx @@ -105,8 +105,7 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl { css::uno::Reference< css::beans::XPropertySet > xLMPropSet( xFrame->getLayoutManager(), css::uno::UNO_QUERY_THROW ); -const OUString aAutomaticToolbars( "AutomaticToolbars" ); -xLMPropSet->setPropertyValue( aAutomaticToolbars, css::uno::Any( false )); +xLMPropSet->setPropertyValue( "AutomaticToolbars", css::uno::Any( false )); } catch( css::uno::RuntimeException& ) { diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 8c2e577eda67..c8638a52fa33 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -1054,13 +1054,11 @@ void SfxDocumentMetaData::init( // NB: we do not handle the single-XML-file ODF variant, which would // have the root element office:document. // The root of such documents must be converted in the importer! -
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/cppunit/test_misc.cxx |9 + sfx2/source/doc/docfile.cxx | 11 ++- 2 files changed, 15 insertions(+), 5 deletions(-) New commits: commit 72be5ac08aa963bdd42d2e56a62f43e69f728caa Author: Miklos Vajna AuthorDate: Mon Sep 3 21:07:00 2018 +0200 Commit: Miklos Vajna CommitDate: Tue Sep 4 14:33:37 2018 +0200 tdf#119381 sfx2 store: don't break symlink targets osl::File::move() would not follow symlinks for the target, so don't move the file in that case. Change-Id: I907e1ba8db04dad670c884ea0283947f953117da Reviewed-on: https://gerrit.libreoffice.org/59949 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index fa3a2c1bca6d..83c4c8db77f7 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -186,6 +186,15 @@ void MiscTest::testHardLinks() // This failed: hard link count was 1, the hard link broke on store. CPPUNIT_ASSERT(buf.st_nlink > 1); +// Test that symlinks are presreved as well. +remove(aNew.getStr()); +symlink(aOld.getStr(), aNew.getStr()); +xStorable->storeToURL(aURL + ".2", {}); +nRet = lstat(aNew.getStr(), ); +CPPUNIT_ASSERT_EQUAL(0, nRet); +// This failed, the hello.odt.2 symlink was replaced with a real file. +CPPUNIT_ASSERT(bool(S_ISLNK(buf.st_mode))); + xComponent->dispose(); #endif } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index f8f5c85f757b..5d1888a60d5c 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -200,8 +200,8 @@ sal_uInt64 GetDefaultFileAttributes(const OUString& rURL) return nRet; } -/// Determines if rURL is a non-hard-linked file:// URL. -bool IsNotHardLinkedFile(const OUString& rURL) +/// Determines if rURL is a non-linked (symlink or hardlink) file:// URL. +bool IsNotLinkedFile(const OUString& rURL) { if (!comphelper::isFileUrl(rURL)) return false; @@ -212,10 +212,11 @@ bool IsNotHardLinkedFile(const OUString& rURL) return false; struct stat buf; -if (stat(rPath.toUtf8().getStr(), ) != 0) +if (lstat(rPath.toUtf8().getStr(), ) != 0) return false; -if (buf.st_nlink > 1) +// Hardlink or symlink: osl::File::move() doesn't play with these nicely. +if (buf.st_nlink > 1 || S_ISLNK(buf.st_mode)) return false; #endif @@ -1843,7 +1844,7 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, OUString aDestMainURL = aDest.GetMainURL(INetURLObject::DecodeMechanism::NONE); sal_uInt64 nAttributes = GetDefaultFileAttributes(aDestMainURL); -if (IsNotHardLinkedFile(aDestMainURL) && osl::File::move(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None) +if (IsNotLinkedFile(aDestMainURL) && osl::File::move(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None) { if (nAttributes) // Adjust attributes, source might be created with ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/cppunit/test_misc.cxx |8 sfx2/source/doc/docfile.cxx |4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) New commits: commit 38afe2976eea427999c39ee3a73e7938ec8d5f7b Author: Miklos Vajna AuthorDate: Tue Aug 28 09:05:06 2018 +0200 Commit: Miklos Vajna CommitDate: Tue Aug 28 15:28:09 2018 +0200 tdf#119050 sfx2 store: don't inherit temp file permissions when overwriting The too aggressive error handling in commit fb04780cf8523ad4e900ae8b9cecbe7a2697a12a (tdf#116117 sfx2 store: don't inherit temp file permissions when renaming, 2018-03-12) means that if the file is already there, then we don't try to stat() it; even if there is no problem with that. Change-Id: Ie0b9084064834e339bcae3ad7b4a35c54cb9d3c2 Reviewed-on: https://gerrit.libreoffice.org/59684 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index 9c21ae95d704..fa3a2c1bca6d 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -146,6 +146,14 @@ void MiscTest::testNoThumbnail() // umask requested so: CPPUNIT_ASSERT(aStatus.getAttributes() & osl_File_Attribute_GrpRead); CPPUNIT_ASSERT(aStatus.getAttributes() & osl_File_Attribute_OthRead); + +// Now "save as" again to trigger the "overwrite" case. +xStorable->storeToURL(aTempFile.GetURL(), {}); +CPPUNIT_ASSERT_EQUAL(osl::DirectoryItem::E_None, aItem.getFileStatus(aStatus)); +// The following check used to fail in the past, result had temp file +// permissions. +CPPUNIT_ASSERT(aStatus.getAttributes() & osl_File_Attribute_GrpRead); + umask(nMask); #endif diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 638ecb5fc2f0..f8f5c85f757b 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -180,8 +180,10 @@ sal_uInt64 GetDefaultFileAttributes(const OUString& rURL) if (!comphelper::isFileUrl(rURL)) return nRet; +// Make sure the file exists (and create it if not). osl::File aFile(rURL); -if (aFile.open(osl_File_OpenFlag_Create) != osl::File::E_None) +osl::File::RC nRes = aFile.open(osl_File_OpenFlag_Create); +if (nRes != osl::File::E_None && nRes != osl::File::E_EXIST) return nRet; aFile.close(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/cppunit/test_misc.cxx | 32 sfx2/source/doc/docfile.cxx | 28 +++- 2 files changed, 59 insertions(+), 1 deletion(-) New commits: commit 546ed01e62c9a36a675c7390371aaec7f1647a33 Author: Miklos VajnaDate: Mon Mar 26 10:40:52 2018 +0200 sfx2 store: avoid rename() for files with >1 hard link count Rename would break the hard link; in practice e.g. Online's 'make run' debug feature depends on not breaking hardlinks. Change-Id: Id3ac19493b6b473274b7ed53a4ca06fc34bc1668 Reviewed-on: https://gerrit.libreoffice.org/51858 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index a1ecc01a7c61..72f21fc66c3a 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -11,6 +11,7 @@ #ifndef _WIN32 #include +#include #endif #include @@ -51,6 +52,7 @@ public: virtual void setUp() override; void testODFCustomMetadata(); void testNoThumbnail(); +void testHardLinks(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override { @@ -66,6 +68,7 @@ public: CPPUNIT_TEST_SUITE(MiscTest); CPPUNIT_TEST(testODFCustomMetadata); CPPUNIT_TEST(testNoThumbnail); +CPPUNIT_TEST(testHardLinks); CPPUNIT_TEST_SUITE_END(); private: @@ -147,6 +150,35 @@ void MiscTest::testNoThumbnail() xComponent->dispose(); } +void MiscTest::testHardLinks() +{ +#ifndef _WIN32 +OUString aSourceDir = m_directories.getURLFromSrc("/sfx2/qa/cppunit/misc/"); +OUString aTargetDir = m_directories.getURLFromWorkdir("/CppunitTest/sfx2_misc.test.user/"); +const OUString aURL(aTargetDir + "hello.odt"); +osl::File::copy(aSourceDir + "hello.odt", aURL); +OUString aTargetPath; +osl::FileBase::getSystemPathFromFileURL(aURL, aTargetPath); +OString aOld = aTargetPath.toUtf8(); +aTargetPath += ".2"; +OString aNew = aTargetPath.toUtf8(); +link(aOld.getStr(), aNew.getStr()); + +uno::Reference xComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument"); +CPPUNIT_ASSERT(xComponent.is()); + +uno::Reference xStorable(xComponent, uno::UNO_QUERY); +xStorable->store(); + +struct stat buf; +stat(aOld.getStr(), ); +// This failed: hard link count was 1, the hard link broke on store. +CPPUNIT_ASSERT(buf.st_nlink > 1); + +xComponent->dispose(); +#endif +} + CPPUNIT_TEST_SUITE_REGISTRATION(MiscTest); } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 63ce058f0a47..d3f78d2d6078 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -19,6 +19,10 @@ #include +#ifdef UNX +#include +#endif + #include #include @@ -190,6 +194,28 @@ sal_uInt64 GetDefaultFileAttributes(const OUString& rURL) return nRet; } +/// Determines if rURL is a non-hard-linked file:// URL. +bool IsNotHardLinkedFile(const OUString& rURL) +{ +if (!comphelper::isFileUrl(rURL)) +return false; + +#ifdef UNX +OUString rPath; +if (osl::FileBase::getSystemPathFromFileURL(rURL, rPath) != osl::FileBase::E_None) +return false; + +struct stat buf; +if (stat(rPath.toUtf8().getStr(), ) != 0) +return false; + +if (buf.st_nlink > 1) +return false; +#endif + +return true; +} + } // anonymous namespace class SfxMedium_Impl @@ -1812,7 +1838,7 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, OUString aDestMainURL = aDest.GetMainURL(INetURLObject::DecodeMechanism::NONE); sal_uInt64 nAttributes = GetDefaultFileAttributes(aDestMainURL); -if (comphelper::isFileUrl(aDestMainURL) && osl::File::move(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None) +if (IsNotHardLinkedFile(aDestMainURL) && osl::File::move(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None) { if (nAttributes) // Adjust attributes, source might be created with ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/cppunit/test_misc.cxx | 22 ++ sfx2/source/doc/docfile.cxx | 34 ++ 2 files changed, 56 insertions(+) New commits: commit fb04780cf8523ad4e900ae8b9cecbe7a2697a12a Author: Miklos VajnaDate: Mon Mar 12 21:24:09 2018 +0100 tdf#116117 sfx2 store: don't inherit temp file permissions when renaming This has to be handled explicitly, otherwise the tempfile permissions (which intentionally don't respect umask()) would be preserved on rename(). Change-Id: I0a2681dbf06986e73f6e12d294e35e87b93b4f8a Reviewed-on: https://gerrit.libreoffice.org/51169 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index 5f36b438f089..a1ecc01a7c61 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -9,6 +9,9 @@ #include +#ifndef _WIN32 +#include +#endif #include #include @@ -31,6 +34,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -117,11 +121,29 @@ void MiscTest::testNoThumbnail() utl::TempFile aTempFile; uno::Sequence aProperties( comphelper::InitPropertySequence({ { "NoThumbnail", uno::makeAny(true) } })); +osl::File::remove(aTempFile.GetURL()); xStorable->storeToURL(aTempFile.GetURL(), aProperties); uno::Reference xZipFile = packages::zip::ZipFileAccess::createWithURL(m_xContext, aTempFile.GetURL()); CPPUNIT_ASSERT(!xZipFile->hasByName("Thumbnails/thumbnail.png")); +#ifndef _WIN32 +// Check permissions of the URL after store. +mode_t nMask = umask(022); +osl::DirectoryItem aItem; +CPPUNIT_ASSERT_EQUAL(osl::DirectoryItem::E_None, + osl::DirectoryItem::get(aTempFile.GetURL(), aItem)); + +osl::FileStatus aStatus(osl_FileStatus_Mask_Attributes); +CPPUNIT_ASSERT_EQUAL(osl::DirectoryItem::E_None, aItem.getFileStatus(aStatus)); + +// This failed, osl_File_Attribute_GrpRead was not set even if umask +// requested so. +CPPUNIT_ASSERT(aStatus.getAttributes() & osl_File_Attribute_GrpRead); +CPPUNIT_ASSERT(aStatus.getAttributes() & osl_File_Attribute_OthRead); +umask(nMask); +#endif + xComponent->dispose(); } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 9635f872b210..916acba81659 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -165,6 +165,32 @@ bool IsLockingUsed() #endif +/// Gets default attributes of a file:// URL. +sal_uInt64 GetDefaultFileAttributes(const OUString& rURL) +{ +sal_uInt64 nRet = 0; + +if (!comphelper::isFileUrl(rURL)) +return nRet; + +osl::File aFile(rURL); +if (aFile.open(osl_File_OpenFlag_Create) != osl::File::E_None) +return nRet; + +aFile.close(); + +osl::DirectoryItem aItem; +if (osl::DirectoryItem::get(rURL, aItem) != osl::DirectoryItem::E_None) +return nRet; + +osl::FileStatus aStatus(osl_FileStatus_Mask_Attributes); +if (aItem.getFileStatus(aStatus) != osl::DirectoryItem::E_None) +return nRet; + +nRet = aStatus.getAttributes(); +return nRet; +} + } // anonymous namespace class SfxMedium_Impl @@ -1785,8 +1811,16 @@ void SfxMedium::TransactedTransferForFS_Impl( const INetURLObject& aSource, { OUString aSourceMainURL = aSource.GetMainURL(INetURLObject::DecodeMechanism::NONE); OUString aDestMainURL = aDest.GetMainURL(INetURLObject::DecodeMechanism::NONE); + +sal_uInt64 nAttributes = GetDefaultFileAttributes(aDestMainURL); if (comphelper::isFileUrl(aDestMainURL) && osl::File::move(aSourceMainURL, aDestMainURL) == osl::FileBase::E_None) +{ +if (nAttributes) +// Adjust attributes, source might be created with +// the osl_File_OpenFlag_Private flag. +osl::File::setAttributes(aDestMainURL, nAttributes); bResult = true; +} else { if (bOverWrite && ::utl::UCBContentHelper::IsDocument(aDestMainURL)) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/cppunit/test_metadatable.cxx |6 - sfx2/source/appl/appdispatchprovider.cxx |5 sfx2/source/appl/appserv.cxx | 149 ++--- sfx2/source/appl/shutdownicon.cxx |8 - sfx2/source/control/dispatch.cxx |3 sfx2/source/control/emojiviewitem.cxx |3 sfx2/source/control/recentdocsviewitem.cxx |3 sfx2/source/control/templatelocalview.cxx |3 sfx2/source/control/templateviewitem.cxx |3 sfx2/source/dialog/dinfdlg.cxx |3 sfx2/source/dialog/filedlghelper.cxx |3 sfx2/source/dialog/printopt.cxx|3 sfx2/source/dialog/templdlg.cxx|8 - sfx2/source/doc/docfilt.cxx|3 sfx2/source/doc/doctempl.cxx |6 - sfx2/source/doc/doctemplates.cxx | 15 -- sfx2/source/doc/guisaveas.cxx |4 sfx2/source/doc/objserv.cxx| 22 sfx2/source/doc/objstor.cxx|7 - sfx2/source/doc/sfxbasemodel.cxx | 17 --- sfx2/source/doc/templatedlg.cxx|9 - sfx2/source/inet/inettbc.cxx |4 sfx2/source/sidebar/Theme.cxx |3 sfx2/source/view/frame2.cxx|3 sfx2/source/view/sfxbasecontroller.cxx |5 sfx2/source/view/viewfrm2.cxx |3 sfx2/source/view/viewprn.cxx |3 sfx2/source/view/viewsh.cxx| 12 -- 28 files changed, 119 insertions(+), 197 deletions(-) New commits: commit 2dbe6a2d57956be392966c363d03f54cb68dd4fa Author: Noel GrandinDate: Sun Jun 25 19:11:12 2017 +0200 loplugin:oncevar in sfx2 Change-Id: I9aadcb9a12ef9b0c3f93ea255f2542e51d31fbf7 Reviewed-on: https://gerrit.libreoffice.org/39242 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/sfx2/qa/cppunit/test_metadatable.cxx b/sfx2/qa/cppunit/test_metadatable.cxx index bb883b6a9cc2..d469859c4cf0 100644 --- a/sfx2/qa/cppunit/test_metadatable.cxx +++ b/sfx2/qa/cppunit/test_metadatable.cxx @@ -88,9 +88,9 @@ void MetadatableTest::test() MockMetadatable m5(*pReg); OUString empty; OUString content( "content.xml" ); -OUString styles( "styles.xml" ); -OUString sid1( "id1" ); -OUString sid2( "id2" ); +OUString const styles( "styles.xml" ); +OUString const sid1( "id1" ); +OUString const sid2( "id2" ); OUString sid3( "id3" ); OUString sid4( "id4" ); beans::StringPair id1(content, sid1); diff --git a/sfx2/source/appl/appdispatchprovider.cxx b/sfx2/source/appl/appdispatchprovider.cxx index e840361d2b3f..e7e70a878cf2 100644 --- a/sfx2/source/appl/appdispatchprovider.cxx +++ b/sfx2/source/appl/appdispatchprovider.cxx @@ -205,7 +205,6 @@ Sequence< frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfi SfxSlotPool& rAppSlotPool = SfxGetpApp()->GetAppSlotPool_Impl(); const SfxSlotMode nMode( SfxSlotMode::TOOLBOXCONFIG|SfxSlotMode::ACCELCONFIG|SfxSlotMode::MENUCONFIG ); -OUString aCmdPrefix( ".uno:" ); // Select group ( group 0 is internal ) for (sal_uInt16 i=0; i< rAppSlotPool.GetGroupCount(); ++i) @@ -222,9 +221,7 @@ Sequence< frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfi if ( pSfxSlot->GetMode() & nMode ) { frame::DispatchInformation aCmdInfo; -OUStringBuffer aBuf( aCmdPrefix ); -aBuf.appendAscii( pSfxSlot->GetUnoName() ); -aCmdInfo.Command = aBuf.makeStringAndClear(); +aCmdInfo.Command = ".uno:" + OUString::createFromAscii(pSfxSlot->GetUnoName()); aCmdInfo.GroupId = nCommandGroup; aCmdList.push_back( aCmdInfo ); } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 4ee7dc17a2fe..efdd469b424e 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -791,7 +791,6 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) css::uno::Sequence aUserToolbars; std::vector aBackupList; OUString aSidebarMode; -bool bCorrectMode = true; OUStringBuffer aPath = OUStringBuffer( "org.openoffice.Office.UI.ToolbarMode/Applications/" ); aPath.append( lcl_getAppName( eApp ) ); @@ -828,103 +827,100 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) } } -if ( bCorrectMode ) +// Backup visible toolbar list and hide all toolbars +Sequence aUIElements = xLayoutManager->getElements(); +for ( sal_Int32 i
[Libreoffice-commits] core.git: sfx2/qa sfx2/source
sfx2/qa/complex/sfx2/DocumentProperties.java |3 ++- sfx2/source/doc/SfxDocumentMetaData.cxx | 15 +++ 2 files changed, 13 insertions(+), 5 deletions(-) New commits: commit 6adddbc2a80456cc2ad3b62deada7ecd4a6cf641 Author: Stephan Bergmann sberg...@redhat.com Date: Mon Oct 7 12:10:14 2013 +0200 Use URL as fallback for DocumentBaseURL in css.document.MediaDescriptor ...in SfxDocumentMetaData::getURLProperties, to avoid tools/source/fsys/urlobj.cxx:1741: cannot make [...] absolute against broken base warnings when SvXMLImport::GetAbsoluteReference tries to make absolute against an erroneously empty base URI any relative URIs contained in the document's meta data. As a consequence, such relative URIs contained in the document's meta data will now be made absolute upon loading in SfxDocumentMetaData::getURLProperties. However, I saw no negative consequences of that (other than having to adapt sfx2/qa/complex/sfx2/DocumentProperties.java in the obvious way). Whether a document written out again contains such meta data URIs as absolute or relative is only controlled by Tools - Options... - Load/Save - General - Save - Save URLs relative to file system and not affected by this fix. (I verified that by loading sfx2/qa/complex/sfx2/testdocuments/TEST.odt, which contains a relative meta:auto-reload xlink:href=../TEST.odt in its meta.xml, and saving it as a new file, with and without Save URLs relative to file system checked, and inspecting the resulting documen's meta.xml entries.) Change-Id: Ia1b6004c8597a726eb59c6b2234fd3ecb0bdcc09 diff --git a/sfx2/qa/complex/sfx2/DocumentProperties.java b/sfx2/qa/complex/sfx2/DocumentProperties.java index 88f0f4c..0588979 100644 --- a/sfx2/qa/complex/sfx2/DocumentProperties.java +++ b/sfx2/qa/complex/sfx2/DocumentProperties.java @@ -199,7 +199,8 @@ public class DocumentProperties assertTrue(TemplateURL, xDP.getTemplateURL().endsWith(memmodern.ott)); assertEquals(TemplateDate, 17, xDP.getTemplateDate().Hours); -assertEquals(AutoloadURL, ../TEST.odt, xDP.getAutoloadURL()); +assertTrue( +AutoloadURL, xDP.getAutoloadURL().endsWith(/TEST.odt)); assertEquals(AutoloadSecs, 0, xDP.getAutoloadSecs()); assertEquals(DefaultTarget, _blank, xDP.getDefaultTarget()); assertEquals(EditingCycles, 3, xDP.getEditingCycles()); diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index fe9cc58..4e89b6a 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -649,12 +649,14 @@ SfxDocumentMetaData::getURLProperties( { css::uno::Reference css::beans::XPropertyBag xPropArg = css::beans::PropertyBag::createDefault( m_xContext ); try { +css::uno::Any baseUri; for (sal_Int32 i = 0; i i_rMedium.getLength(); ++i) { if (i_rMedium[i].Name == DocumentBaseURL) { -xPropArg-addProperty( -OUString(BaseURI), -css::beans::PropertyAttribute::MAYBEVOID, -i_rMedium[i].Value); +baseUri = i_rMedium[i].Value; +} else if (i_rMedium[i].Name == URL) { +if (!baseUri.hasValue()) { +baseUri = i_rMedium[i].Value; +} } else if (i_rMedium[i].Name == HierarchicalDocumentName) { xPropArg-addProperty( OUString(StreamRelPath), @@ -662,6 +664,11 @@ SfxDocumentMetaData::getURLProperties( i_rMedium[i].Value); } } +if (baseUri.hasValue()) { +xPropArg-addProperty( +BaseURI, css::beans::PropertyAttribute::MAYBEVOID, +baseUri); +} xPropArg-addProperty(OUString(StreamName), css::beans::PropertyAttribute::MAYBEVOID, css::uno::makeAny(OUString(s_meta))); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits