canvas/source/directx/dx_bitmapcanvashelper.cxx | 4 canvas/source/directx/dx_canvascustomsprite.cxx | 2 canvas/source/directx/dx_canvashelper.cxx | 4 canvas/source/directx/dx_canvashelper.hxx | 2 canvas/source/directx/dx_spritehelper.cxx | 6 dtrans/Library_dnd.mk | 1 dtrans/Library_dtrans.mk | 1 dtrans/Library_ftransl.mk | 1 dtrans/Library_sysdtrans.mk | 1 dtrans/source/generic/clipboardmanager.cxx | 100 +++-- dtrans/source/generic/clipboardmanager.hxx | 6 dtrans/source/generic/dtrans.component | 8 dtrans/source/generic/dtrans.cxx | 73 ---- dtrans/source/generic/generic_clipboard.cxx | 18 - dtrans/source/generic/generic_clipboard.hxx | 6 dtrans/source/win32/clipb/WinClipboard.cxx | 36 +- dtrans/source/win32/clipb/wcbentry.cxx | 80 ---- dtrans/source/win32/dnd/dndentry.cxx | 87 ----- dtrans/source/win32/dnd/globals.hxx | 6 dtrans/source/win32/dnd/source.cxx | 11 dtrans/source/win32/dnd/target.cxx | 12 dtrans/source/win32/ftransl/ftransl.cxx | 29 - dtrans/source/win32/ftransl/ftranslentry.cxx | 78 ---- dtrans/util/dnd.component | 8 dtrans/util/ftransl.component | 5 dtrans/util/sysdtrans.component | 5 external/nss/UnpackedTarball_nss.mk | 1 external/nss/Wincompatible-function-pointer-types.patch.0 | 234 ++++++++++++++ external/openldap/ExternalProject_openldap.mk | 13 external/openldap/UnpackedTarball_openldap.mk | 2 external/openldap/Wint-conversion.patch | 11 external/openldap/configure-c99.patch | 11 external/openldap/openldap-2.4.44.patch.1 | 12 vcl/win/gdi/gdiimpl.cxx | 6 vcl/win/gdi/salbmp.cxx | 2 winaccessibility/source/service/AccObject.cxx | 2 36 files changed, 425 insertions(+), 459 deletions(-)
New commits: commit f9fba877a3e3bcf5a8478ff02d1c2cfccd78d937 Author: Noel Grandin <n...@peralex.com> AuthorDate: Tue Jul 21 14:57:09 2020 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:44 2025 +0100 dtrans/ftransl: create instances with uno constructors See tdf#74608 for motivation. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99159 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143153 Tested-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> (cherry picked from commit 838a106c1c1debf95345cf15f246d0e0bf0eda0e) Conflicts: dtrans/source/win32/ftransl/ftransl.cxx dtrans/source/win32/ftransl/ftranslentry.cxx Change-Id: I7068fd727d57258a21001d24d2f6b14fa51f9870 diff --git a/dtrans/Library_ftransl.mk b/dtrans/Library_ftransl.mk index 5a16ee83c419..f418af318d3f 100644 --- a/dtrans/Library_ftransl.mk +++ b/dtrans/Library_ftransl.mk @@ -42,7 +42,6 @@ $(eval $(call gb_Library_use_static_libraries,ftransl,\ $(eval $(call gb_Library_add_exception_objects,ftransl,\ dtrans/source/win32/ftransl/ftransl \ - dtrans/source/win32/ftransl/ftranslentry \ )) $(eval $(call gb_Library_set_include,ftransl,\ diff --git a/dtrans/source/win32/ftransl/ftransl.cxx b/dtrans/source/win32/ftransl/ftransl.cxx index a5b7a9ee2d28..d659156fb4e3 100644 --- a/dtrans/source/win32/ftransl/ftransl.cxx +++ b/dtrans/source/win32/ftransl/ftransl.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/supportsservice.hxx> +#include <rtl/ref.hxx> #include "../misc/ImplHelper.hxx" #if defined _MSC_VER @@ -37,12 +38,8 @@ #pragma warning(pop) #endif -#define IMPL_NAME "com.sun.star.datatransfer.DataFormatTranslator" - #define CPPUTYPE_SEQSALINT8 cppu::UnoType<Sequence< sal_Int8 >>::get() #define CPPUTYPE_DEFAULT CPPUTYPE_SEQSALINT8 -#define CPPUTYPE_OUSTR cppu::UnoType<OUString>::get() -#define CPPUTYPE_SALINT32 cppu::UnoType<sal_Int32>::get() #define EMPTY_OUSTR OUString() const OUString Windows_FormatName ("windows_formatname"); @@ -59,12 +56,6 @@ using namespace com::sun::star::container; namespace { - Sequence< OUString > SAL_CALL DataFormatTranslator_getSupportedServiceNames( ) - { - Sequence< OUString > aRet { "com.sun.star.datatransfer.DataFormatTranslator" }; - return aRet; - } -} struct FormatEntry { @@ -81,6 +72,8 @@ struct FormatEntry sal_Int32 aStandardFormatId; }; +} + FormatEntry::FormatEntry( const char *mime_content_type, const char *human_presentable_name, @@ -530,14 +523,14 @@ DataFlavor SAL_CALL CDataFormatTranslatorUNO::getDataFlavorFromSystemDataType( c DataFlavor aFlavor = mkDataFlv( EMPTY_OUSTR, EMPTY_OUSTR, CPPUTYPE_SEQSALINT8 ); - if ( aSysDataType.getValueType( ) == CPPUTYPE_SALINT32 ) + if ( aSysDataType.getValueType( ) == cppu::UnoType<sal_Int32>::get() ) { sal_Int32 clipformat = CF_INVALID; aSysDataType >>= clipformat; if ( CF_INVALID != clipformat ) findDataFlavorForStandardFormatId( clipformat, aFlavor ); } - else if ( aSysDataType.getValueType( ) == CPPUTYPE_OUSTR ) + else if ( aSysDataType.getValueType( ) == cppu::UnoType<OUString>::get() ) { OUString nativeFormatName; aSysDataType >>= nativeFormatName; @@ -554,7 +547,7 @@ DataFlavor SAL_CALL CDataFormatTranslatorUNO::getDataFlavorFromSystemDataType( c OUString SAL_CALL CDataFormatTranslatorUNO::getImplementationName( ) { - return OUString( IMPL_NAME ); + return "com.sun.star.datatransfer.DataFormatTranslator"; } sal_Bool SAL_CALL CDataFormatTranslatorUNO::supportsService( const OUString& ServiceName ) @@ -564,7 +557,15 @@ sal_Bool SAL_CALL CDataFormatTranslatorUNO::supportsService( const OUString& Ser Sequence< OUString > SAL_CALL CDataFormatTranslatorUNO::getSupportedServiceNames( ) { - return DataFormatTranslator_getSupportedServiceNames( ); + return { "com.sun.star.datatransfer.DataFormatTranslator" }; } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +dtrans_CDataFormatTranslatorUNO_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) +{ + static rtl::Reference<CDataFormatTranslatorUNO> g_Instance(new CDataFormatTranslatorUNO(context)); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/ftransl/ftranslentry.cxx b/dtrans/source/win32/ftransl/ftranslentry.cxx deleted file mode 100644 index 8139b4a6b6b3..000000000000 --- a/dtrans/source/win32/ftransl/ftranslentry.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <cppuhelper/factory.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/container/XSet.hpp> - -#include <com/sun/star/datatransfer/XDataFormatTranslator.hpp> -#include "ftransl.hxx" - -#define SERVICE_NAME "com.sun.star.datatransfer.DataFormatTranslator" - -#define IMPL_NAME "com.sun.star.datatransfer.DataFormatTranslator" - -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::datatransfer; - -namespace -{ - - // functions to create a new Clipboad instance; is needed by factory helper implementation - // @param rServiceManager - service manager, useful if the component needs other uno services - // so we should give it to every UNO-Implementation component - - Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) - { - return Reference< XInterface >( static_cast< XDataFormatTranslator* >( new CDataFormatTranslatorUNO( comphelper::getComponentContext(rServiceManager) ) ) ); - } -} - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL ftransl_component_getFactory( const sal_Char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ ) -{ - void* pRet = nullptr; - - if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, IMPL_NAME ) ) ) - { - Sequence< OUString > aSNS { SERVICE_NAME }; - - Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory( - static_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), - createInstance, - aSNS ) ); - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/util/ftransl.component b/dtrans/util/ftransl.component index b1fe4b006460..e97a897f7437 100644 --- a/dtrans/util/ftransl.component +++ b/dtrans/util/ftransl.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="ftransl" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.datatransfer.DataFormatTranslator"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.datatransfer.DataFormatTranslator" + constructor="dtrans_CDataFormatTranslatorUNO_get_implementation"> <service name="com.sun.star.datatransfer.DataFormatTranslator"/> </implementation> </component> commit 45851dde704b80785bff43e170b3bbc0c562bcb8 Author: Noel Grandin <n...@peralex.com> AuthorDate: Tue Jul 21 15:05:56 2020 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:44 2025 +0100 dtrans/dnd: create instances with uno constructors See tdf#74608 for motivation. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99160 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143152 Tested-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> (cherry picked from commit 853259ee9adf3dfef5d20c13bbc14c296bcd49c9) Conflicts: dtrans/source/win32/dnd/dndentry.cxx dtrans/source/win32/dnd/source.cxx dtrans/source/win32/dnd/target.cxx Change-Id: I39821b05dc5148870e0bd9291e21815f4868b5ee diff --git a/dtrans/Library_dnd.mk b/dtrans/Library_dnd.mk index 8eecd53db50c..930b552827e1 100644 --- a/dtrans/Library_dnd.mk +++ b/dtrans/Library_dnd.mk @@ -48,7 +48,6 @@ $(eval $(call gb_Library_use_static_libraries,dnd,\ )) $(eval $(call gb_Library_add_exception_objects,dnd,\ - dtrans/source/win32/dnd/dndentry \ dtrans/source/win32/dnd/globals \ dtrans/source/win32/dnd/idroptarget \ dtrans/source/win32/dnd/sourcecontext \ diff --git a/dtrans/source/win32/dnd/dndentry.cxx b/dtrans/source/win32/dnd/dndentry.cxx deleted file mode 100644 index 83e972a2be38..000000000000 --- a/dtrans/source/win32/dnd/dndentry.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <cppuhelper/factory.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/container/XSet.hpp> - -#include "source.hxx" -#include "target.hxx" - -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::registry ; -using namespace ::cppu ; -using namespace ::com::sun::star::lang; - -Reference< XInterface > SAL_CALL createDragSource( const Reference< XMultiServiceFactory >& rServiceManager ) -{ - DragSource* pSource= new DragSource( comphelper::getComponentContext(rServiceManager) ); - return Reference<XInterface>( static_cast<XInitialization*>(pSource), UNO_QUERY); -} - -Reference< XInterface > SAL_CALL createDropTarget( const Reference< XMultiServiceFactory >& rServiceManager ) -{ - DropTarget* pTarget= new DropTarget( comphelper::getComponentContext(rServiceManager) ); - return Reference<XInterface>( static_cast<XInitialization*>(pTarget), UNO_QUERY); -} - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL -dnd_component_getFactory( const sal_Char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ ) -{ - void* pRet = nullptr; - Reference< XSingleServiceFactory > xFactory; - - if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDSOURCE_IMPL_NAME ) ) ) - { - Sequence< OUString > aSNS { DNDSOURCE_SERVICE_NAME }; - - xFactory= createSingleFactory( - static_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), - createDragSource, - aSNS); - - } - else if( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDTARGET_IMPL_NAME ) ) ) - { - Sequence< OUString > aSNS { DNDTARGET_SERVICE_NAME }; - - xFactory= createSingleFactory( - static_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), - createDropTarget, - aSNS); - - } - - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/dnd/globals.hxx b/dtrans/source/win32/dnd/globals.hxx index d8763189d3b3..5e619784ed0b 100644 --- a/dtrans/source/win32/dnd/globals.hxx +++ b/dtrans/source/win32/dnd/globals.hxx @@ -37,12 +37,6 @@ namespace com { namespace sun { namespace star { namespace datatransfer { #endif #include <sal/types.h> -#define DNDSOURCE_SERVICE_NAME "com.sun.star.datatransfer.dnd.OleDragSource" -#define DNDSOURCE_IMPL_NAME "com.sun.star.comp.datatransfer.dnd.OleDragSource_V1" - -#define DNDTARGET_SERVICE_NAME "com.sun.star.datatransfer.dnd.OleDropTarget" -#define DNDTARGET_IMPL_NAME "com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1" - // This maps key states as occur as parameter, e.g. in IDropTarget::DragEnter, // IDropSource::QueryContinueDrag, to actions as are declared in // css::datatransfer::dnd::DNDConstants ( ACTION_MOVE etc). diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx index b6d1d9a628bd..8a3eb8175343 100644 --- a/dtrans/source/win32/dnd/source.cxx +++ b/dtrans/source/win32/dnd/source.cxx @@ -279,7 +279,7 @@ dwEffect // XServiceInfo OUString SAL_CALL DragSource::getImplementationName( ) { - return OUString(DNDSOURCE_IMPL_NAME); + return "com.sun.star.comp.datatransfer.dnd.OleDragSource_V1"; } // XServiceInfo sal_Bool SAL_CALL DragSource::supportsService( const OUString& ServiceName ) @@ -289,9 +289,14 @@ sal_Bool SAL_CALL DragSource::supportsService( const OUString& ServiceName ) Sequence< OUString > SAL_CALL DragSource::getSupportedServiceNames( ) { - OUString names[1]= {OUString(DNDSOURCE_SERVICE_NAME)}; + return { "com.sun.star.datatransfer.dnd.OleDragSource" }; +} - return Sequence<OUString>(names, 1); +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +dtrans_DragSource_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(static_cast<cppu::OWeakObject*>(new DragSource(context))); } /** This function is called as extra thread from diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx index b797d4e769d8..7c532322da5c 100644 --- a/dtrans/source/win32/dnd/target.cxx +++ b/dtrans/source/win32/dnd/target.cxx @@ -248,7 +248,7 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams) // XServiceInfo OUString SAL_CALL DropTarget::getImplementationName( ) { - return OUString(DNDTARGET_IMPL_NAME); + return "com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1"; } // XServiceInfo sal_Bool SAL_CALL DropTarget::supportsService( const OUString& ServiceName ) @@ -258,8 +258,7 @@ sal_Bool SAL_CALL DropTarget::supportsService( const OUString& ServiceName ) Sequence< OUString > SAL_CALL DropTarget::getSupportedServiceNames( ) { - OUString names[1]= {OUString(DNDTARGET_SERVICE_NAME)}; - return Sequence<OUString>(names, 1); + return { "com.sun.star.datatransfer.dnd.OleDropTarget" }; } // XDropTarget @@ -627,4 +626,11 @@ inline sal_Int8 DropTarget::getFilteredActions( DWORD grfKeyState, DWORD dwEffec return actions & m_nDefaultActions; } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +dtrans_DropTarget_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(static_cast<cppu::OWeakObject*>(new DropTarget(context))); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/util/dnd.component b/dtrans/util/dnd.component index 2fdc916c514a..8a3f5feebbb2 100644 --- a/dtrans/util/dnd.component +++ b/dtrans/util/dnd.component @@ -18,11 +18,13 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="dnd" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1" + constructor="dtrans_DragSource_get_implementation"> <service name="com.sun.star.datatransfer.dnd.OleDragSource"/> </implementation> - <implementation name="com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1"> + <implementation name="com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1" + constructor="dtrans_DropTarget_get_implementation"> <service name="com.sun.star.datatransfer.dnd.OleDropTarget"/> </implementation> </component> commit 72da9c4ec94763c165a02ffa189c88d0feb53b9c Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Aug 4 15:47:53 2020 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:44 2025 +0100 loplugin:simplifypointertobool (clang-cl) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100108 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143151 Tested-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> (cherry picked from commit 0bed309b63439fe1439954b442157f441ae9b841) Change-Id: I6512e6e4217ef9084c74e46e3b4f1e8defbd1bec diff --git a/canvas/source/directx/dx_bitmapcanvashelper.cxx b/canvas/source/directx/dx_bitmapcanvashelper.cxx index d2c4fa7b7736..c948902f7b66 100644 --- a/canvas/source/directx/dx_bitmapcanvashelper.cxx +++ b/canvas/source/directx/dx_bitmapcanvashelper.cxx @@ -60,7 +60,7 @@ namespace dxcanvas { ENSURE_OR_THROW( rTarget, "BitmapCanvasHelper::setTarget(): Invalid target" ); - ENSURE_OR_THROW( !mpTarget.get(), + ENSURE_OR_THROW( !mpTarget, "BitmapCanvasHelper::setTarget(): target set, old target would be overwritten" ); mpTarget = rTarget; @@ -72,7 +72,7 @@ namespace dxcanvas { ENSURE_OR_THROW( rTarget, "BitmapCanvasHelper::setTarget(): invalid target" ); - ENSURE_OR_THROW( !mpTarget.get(), + ENSURE_OR_THROW( !mpTarget, "BitmapCanvasHelper::setTarget(): target set, old target would be overwritten" ); mpTarget = rTarget; diff --git a/canvas/source/directx/dx_canvascustomsprite.cxx b/canvas/source/directx/dx_canvascustomsprite.cxx index b1b0d58e102d..7ff38e3185b7 100644 --- a/canvas/source/directx/dx_canvascustomsprite.cxx +++ b/canvas/source/directx/dx_canvascustomsprite.cxx @@ -43,7 +43,7 @@ namespace dxcanvas mpSpriteCanvas( rRefDevice ), mpSurface() { - ENSURE_OR_THROW( rRefDevice.get(), + ENSURE_OR_THROW( rRefDevice, "CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" ); mpSurface.reset( diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index 72c63ffc2816..78b1a38e993d 100644 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -122,7 +122,7 @@ namespace dxcanvas { ENSURE_OR_THROW( rTarget, "CanvasHelper::setTarget(): Invalid target" ); - ENSURE_OR_THROW( !mpGraphicsProvider.get(), + ENSURE_OR_THROW( !mpGraphicsProvider, "CanvasHelper::setTarget(): target set, old target would be overwritten" ); mpGraphicsProvider = rTarget; @@ -133,7 +133,7 @@ namespace dxcanvas { ENSURE_OR_THROW( rTarget, "CanvasHelper::setTarget(): invalid target" ); - ENSURE_OR_THROW( !mpGraphicsProvider.get(), + ENSURE_OR_THROW( !mpGraphicsProvider, "CanvasHelper::setTarget(): target set, old target would be overwritten" ); mpGraphicsProvider = rTarget; diff --git a/canvas/source/directx/dx_canvashelper.hxx b/canvas/source/directx/dx_canvashelper.hxx index 0696231aadb3..1fbeee41c980 100644 --- a/canvas/source/directx/dx_canvashelper.hxx +++ b/canvas/source/directx/dx_canvashelper.hxx @@ -236,7 +236,7 @@ namespace dxcanvas /// Provides the Gdiplus::Graphics to render into GraphicsProviderSharedPtr mpGraphicsProvider; - bool needOutput() const { return mpGraphicsProvider.get() != nullptr; }; + bool needOutput() const { return bool(mpGraphicsProvider); }; // returns transparency of color void setupGraphicsState( GraphicsSharedPtr& rGraphics, diff --git a/canvas/source/directx/dx_spritehelper.cxx b/canvas/source/directx/dx_spritehelper.cxx index 10131dadf19d..9e376856660f 100644 --- a/canvas/source/directx/dx_spritehelper.cxx +++ b/canvas/source/directx/dx_spritehelper.cxx @@ -54,7 +54,7 @@ namespace dxcanvas const DXSurfaceBitmapSharedPtr& rBitmap, bool bShowSpriteBounds ) { - ENSURE_OR_THROW( rSpriteCanvas.get() && + ENSURE_OR_THROW( rSpriteCanvas && rRenderModule && rBitmap, "SpriteHelper::init(): Invalid device, sprite canvas or surface" ); @@ -86,7 +86,7 @@ namespace dxcanvas bool SpriteHelper::needRedraw() const { if( !mpBitmap || - !mpSpriteCanvas.get() ) + !mpSpriteCanvas ) { return false; // we're disposed, no redraw necessary } @@ -103,7 +103,7 @@ namespace dxcanvas void SpriteHelper::redraw( bool& io_bSurfaceDirty ) const { if( !mpBitmap || - !mpSpriteCanvas.get() ) + !mpSpriteCanvas ) { return; // we're disposed } diff --git a/dtrans/source/win32/clipb/WinClipboard.cxx b/dtrans/source/win32/clipb/WinClipboard.cxx index 9819618b12b5..80bf506d78a4 100644 --- a/dtrans/source/win32/clipb/WinClipboard.cxx +++ b/dtrans/source/win32/clipb/WinClipboard.cxx @@ -60,7 +60,7 @@ Reference< XTransferable > SAL_CALL CWinClipboard::getContents( ) throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( nullptr != m_pImpl.get( ) ) + if ( m_pImpl ) return m_pImpl->getContents( ); return Reference< XTransferable >( ); @@ -75,7 +75,7 @@ void SAL_CALL CWinClipboard::setContents( const Reference< XTransferable >& xTra throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( nullptr != m_pImpl.get( ) ) + if ( m_pImpl ) m_pImpl->setContents( xTransferable, xClipboardOwner ); } @@ -85,7 +85,7 @@ OUString SAL_CALL CWinClipboard::getName( ) throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( nullptr != m_pImpl.get( ) ) + if ( m_pImpl ) return m_pImpl->getName( ); return OUString(); @@ -101,7 +101,7 @@ void SAL_CALL CWinClipboard::flushClipboard( ) throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( nullptr != m_pImpl.get( ) ) + if ( m_pImpl ) m_pImpl->flushClipboard( ); } @@ -113,7 +113,7 @@ sal_Int8 SAL_CALL CWinClipboard::getRenderingCapabilities( ) throw DisposedException("object is already disposed", static_cast< XClipboardEx* >( this ) ); - if ( nullptr != m_pImpl.get( ) ) + if ( m_pImpl ) return CWinClipbImpl::getRenderingCapabilities( ); return 0; diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index 30a9c3488b98..52cb11d450f9 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -2183,7 +2183,7 @@ bool WinSalGraphicsImpl::tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBi const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& >(rSrcBitmap); std::shared_ptr< Gdiplus::Bitmap > aARGB(rSalBitmap.ImplGetGdiPlusBitmap()); - if(aARGB.get()) + if(aARGB) { Gdiplus::Graphics aGraphics(mrParent.getHDC()); @@ -2236,7 +2236,7 @@ bool WinSalGraphicsImpl::drawAlphaBitmap( const WinSalBitmap& rSalAlpha = static_cast< const WinSalBitmap& >(rAlphaBmp); std::shared_ptr< Gdiplus::Bitmap > aARGB(rSalBitmap.ImplGetGdiPlusBitmap(&rSalAlpha)); - if(aARGB.get()) + if(aARGB) { Gdiplus::Graphics aGraphics(mrParent.getHDC()); @@ -2273,7 +2273,7 @@ bool WinSalGraphicsImpl::drawTransformedBitmap( const WinSalBitmap* pSalAlpha = static_cast< const WinSalBitmap* >(pAlphaBitmap); std::shared_ptr< Gdiplus::Bitmap > aARGB(rSalBitmap.ImplGetGdiPlusBitmap(pSalAlpha)); - if(aARGB.get()) + if(aARGB) { const long nSrcWidth(aARGB->GetWidth()); const long nSrcHeight(aARGB->GetHeight()); diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx index 8b95249da6d8..e01e2cd32e45 100644 --- a/vcl/win/gdi/salbmp.cxx +++ b/vcl/win/gdi/salbmp.cxx @@ -676,7 +676,7 @@ bool WinSalBitmap::Create( const css::uno::Reference< css::rendering::XBitmapCan css::uno::Reference< css::beans::XFastPropertySet > xFastPropertySet( rBitmapCanvas, css::uno::UNO_QUERY ); - if( xFastPropertySet.get() ) { + if( xFastPropertySet ) { css::uno::Sequence< css::uno::Any > args; if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) { diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index 48c356184dc6..71c17463be11 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -395,7 +395,7 @@ void AccObject::SetValue( Any pAny ) case HEADING: case TABLE_CELL: - if(pRText.get()) + if(pRText) { val = pRText->getText(); } commit 03a69ca3f13e4d30c13fa6509f4d490eacbdf472 Author: Noel Grandin <n...@peralex.com> AuthorDate: Tue Jul 21 13:55:30 2020 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:44 2025 +0100 dtrans/clipboard: create instances with uno constructors See tdf#74608 for motivation. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99158 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143150 Tested-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> (cherry picked from commit ef0d6020df861e538ece233fbb0868862a4dfd93) Conflicts: dtrans/source/win32/clipb/WinClipboard.cxx dtrans/source/win32/clipb/wcbentry.cxx Change-Id: Iba30f1cf6892330495f57343619e234194bc5b5b diff --git a/dtrans/Library_sysdtrans.mk b/dtrans/Library_sysdtrans.mk index c9ab99cc1c14..2c9a4a6f221f 100644 --- a/dtrans/Library_sysdtrans.mk +++ b/dtrans/Library_sysdtrans.mk @@ -51,7 +51,6 @@ $(eval $(call gb_Library_use_static_libraries,sysdtrans,\ $(eval $(call gb_Library_add_exception_objects,sysdtrans,\ dtrans/source/win32/clipb/WinClipbImpl \ dtrans/source/win32/clipb/WinClipboard \ - dtrans/source/win32/clipb/wcbentry \ dtrans/source/win32/clipb/MtaOleClipb \ )) diff --git a/dtrans/source/win32/clipb/WinClipboard.cxx b/dtrans/source/win32/clipb/WinClipboard.cxx index 5efc5530d46d..9819618b12b5 100644 --- a/dtrans/source/win32/clipb/WinClipboard.cxx +++ b/dtrans/source/win32/clipb/WinClipboard.cxx @@ -22,7 +22,9 @@ #include <com/sun/star/datatransfer/clipboard/ClipboardEvent.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/supportsservice.hxx> +#include <rtl/ref.hxx> #include "WinClipbImpl.hxx" using namespace osl; @@ -34,17 +36,6 @@ using namespace com::sun::star::datatransfer; using namespace com::sun::star::datatransfer::clipboard; using namespace com::sun::star::lang; -#define WINCLIPBOARD_IMPL_NAME "com.sun.star.datatransfer.clipboard.ClipboardW32" - -namespace -{ - Sequence< OUString > SAL_CALL WinClipboard_getSupportedServiceNames() - { - Sequence< OUString > aRet { "com.sun.star.datatransfer.clipboard.SystemClipboard" }; - return aRet; - } -} - /*XEventListener,*/ CWinClipboard::CWinClipboard( const Reference< XComponentContext >& rxContext, const OUString& aClipboardName ) : WeakComponentImplHelper< XSystemClipboard, XFlushableClipboard, XServiceInfo >( m_aCbListenerMutex ), @@ -223,7 +214,7 @@ void SAL_CALL CWinClipboard::disposing() OUString SAL_CALL CWinClipboard::getImplementationName( ) { - return OUString( WINCLIPBOARD_IMPL_NAME ); + return "com.sun.star.datatransfer.clipboard.ClipboardW32"; } sal_Bool SAL_CALL CWinClipboard::supportsService( const OUString& ServiceName ) @@ -233,7 +224,16 @@ sal_Bool SAL_CALL CWinClipboard::supportsService( const OUString& ServiceName ) Sequence< OUString > SAL_CALL CWinClipboard::getSupportedServiceNames( ) { - return WinClipboard_getSupportedServiceNames(); + return { "com.sun.star.datatransfer.clipboard.SystemClipboard" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +dtrans_CWinClipboard_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) +{ + static rtl::Reference<CWinClipboard> g_Instance(new CWinClipboard(context, "")); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/win32/clipb/wcbentry.cxx b/dtrans/source/win32/clipb/wcbentry.cxx deleted file mode 100644 index 5e379bd894e0..000000000000 --- a/dtrans/source/win32/clipb/wcbentry.cxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <cppuhelper/factory.hxx> -#include <comphelper/processfactory.hxx> -#include <com/sun/star/container/XSet.hpp> -#include "WinClipboard.hxx" - -#define WINCLIPBOARD_SERVICE_NAME "com.sun.star.datatransfer.clipboard.SystemClipboard" - -#define WINCLIPBOARD_IMPL_NAME "com.sun.star.datatransfer.clipboard.ClipboardW32" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::cppu; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::datatransfer::clipboard; - -namespace -{ - - // functions to create a new Clipboad instance; is needed by factory helper implementation - // @param rServiceManager - service manager, useful if the component needs other uno services - // so we should give it to every UNO-Implementation component - - Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) - { - return Reference< XInterface >( static_cast< XClipboard* >( new CWinClipboard( comphelper::getComponentContext(rServiceManager), "" ) ) ); - } -} - -extern "C" -{ - -// component_getFactory -// returns a factory to create XFilePicker-Services - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL sysdtrans_component_getFactory( const sal_Char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ ) -{ - void* pRet = nullptr; - - if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, WINCLIPBOARD_IMPL_NAME ) ) ) - { - Sequence< OUString > aSNS { WINCLIPBOARD_SERVICE_NAME }; - - //OUString( FPS_IMPL_NAME ) - Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory( - static_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), - createInstance, - aSNS ) ); - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/util/sysdtrans.component b/dtrans/util/sysdtrans.component index 6551a964684b..263b1417258e 100644 --- a/dtrans/util/sysdtrans.component +++ b/dtrans/util/sysdtrans.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="sysdtrans" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.datatransfer.clipboard.ClipboardW32"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.datatransfer.clipboard.ClipboardW32" + constructor="dtrans_CWinClipboard_get_implementation"> <service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/> </implementation> </component> commit 7810629d94c6075e2273e0a251a856d92f7d183c Author: Noel Grandin <n...@peralex.com> AuthorDate: Tue Jul 21 15:16:21 2020 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:44 2025 +0100 dtrans/generic: create instances with uno constructors See tdf#74608 for motivation. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99161 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143149 Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Tested-by: Balazs Varga <balazs.varga.ext...@allotropia.de> (cherry picked from commit ab6d8dac13ced4b5077a8fe32d2834b3da50a932) Conflicts: dtrans/source/generic/clipboardmanager.cxx dtrans/source/generic/clipboardmanager.hxx dtrans/source/generic/dtrans.cxx dtrans/source/generic/generic_clipboard.cxx dtrans/source/generic/generic_clipboard.hxx Change-Id: Id5c585f28cb8696f37513bd2a2112af8d278648c diff --git a/dtrans/Library_dtrans.mk b/dtrans/Library_dtrans.mk index a4f3413fc4f6..e70d7215436b 100644 --- a/dtrans/Library_dtrans.mk +++ b/dtrans/Library_dtrans.mk @@ -31,7 +31,6 @@ $(eval $(call gb_Library_use_libraries,dtrans,\ $(eval $(call gb_Library_add_exception_objects,dtrans,\ dtrans/source/generic/clipboardmanager \ - dtrans/source/generic/dtrans \ dtrans/source/generic/generic_clipboard \ )) diff --git a/dtrans/source/generic/clipboardmanager.cxx b/dtrans/source/generic/clipboardmanager.cxx index 89ce1dc15ecb..957d1d94281c 100644 --- a/dtrans/source/generic/clipboardmanager.cxx +++ b/dtrans/source/generic/clipboardmanager.cxx @@ -22,8 +22,10 @@ #include <com/sun/star/container/NoSuchElementException.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/supportsservice.hxx> #include <comphelper/sequence.hxx> +#include <rtl/ref.hxx> using namespace com::sun::star::container; using namespace com::sun::star::datatransfer; @@ -36,6 +38,11 @@ using namespace std; using ::dtrans::ClipboardManager; +static osl::Mutex g_InstanceGuard; +static rtl::Reference<ClipboardManager> g_Instance; +static bool g_Disposed = false; + + ClipboardManager::ClipboardManager(): WeakComponentImplHelper< XClipboardManager, XEventListener, XServiceInfo > (m_aMutex), m_aDefaultName(OUString("default")) @@ -48,7 +55,7 @@ ClipboardManager::~ClipboardManager() OUString SAL_CALL ClipboardManager::getImplementationName( ) { - return OUString(CLIPBOARDMANAGER_IMPLEMENTATION_NAME); + return "com.sun.star.comp.datatransfer.ClipboardManager"; } sal_Bool SAL_CALL ClipboardManager::supportsService( const OUString& ServiceName ) @@ -58,7 +65,7 @@ sal_Bool SAL_CALL ClipboardManager::supportsService( const OUString& ServiceName Sequence< OUString > SAL_CALL ClipboardManager::getSupportedServiceNames( ) { - return ClipboardManager_getSupportedServiceNames(); + return { "com.sun.star.datatransfer.clipboard.ClipboardManager" }; } Reference< XClipboard > SAL_CALL ClipboardManager::getClipboard( const OUString& aName ) @@ -139,46 +146,50 @@ Sequence< OUString > SAL_CALL ClipboardManager::listClipboardNames() void SAL_CALL ClipboardManager::dispose() { - ClearableMutexGuard aGuard( rBHelper.rMutex ); - if (!rBHelper.bDisposed && !rBHelper.bInDispose) { - rBHelper.bInDispose = true; - aGuard.clear(); - - // give everyone a chance to save his clipboard instance - EventObject aEvt(static_cast < XClipboardManager * > (this)); - rBHelper.aLC.disposeAndClear( aEvt ); - - // removeClipboard is still allowed here, so make a copy of the - // list (to ensure integrity) and clear the original. - ClearableMutexGuard aGuard2( rBHelper.rMutex ); - ClipboardMap aCopy(m_aClipboardMap); - m_aClipboardMap.clear(); - aGuard2.clear(); - - // dispose all clipboards still in list - ClipboardMap::iterator iter = aCopy.begin(); - ClipboardMap::iterator imax = aCopy.end(); - - for (; iter != imax; ++iter) + osl::MutexGuard aGuard(g_InstanceGuard); + g_Instance.clear(); + g_Disposed = true; + } + { + ClearableMutexGuard aGuard( rBHelper.rMutex ); + if (!rBHelper.bDisposed && !rBHelper.bInDispose) { - Reference< XComponent > xComponent(iter->second, UNO_QUERY); - if (xComponent.is()) + rBHelper.bInDispose = true; + aGuard.clear(); + + // give everyone a chance to save his clipboard instance + EventObject aEvt(static_cast < XClipboardManager * > (this)); + rBHelper.aLC.disposeAndClear( aEvt ); + + // removeClipboard is still allowed here, so make a copy of the + // list (to ensure integrity) and clear the original. + ClearableMutexGuard aGuard2( rBHelper.rMutex ); + ClipboardMap aCopy(m_aClipboardMap); + m_aClipboardMap.clear(); + aGuard2.clear(); + + // dispose all clipboards still in list + for (auto const& elem : aCopy) { - try - { - xComponent->removeEventListener(static_cast < XEventListener * > (this)); - xComponent->dispose(); - } - catch (const Exception&) + Reference< XComponent > xComponent(elem.second, UNO_QUERY); + if (xComponent.is()) { - // exceptions can be safely ignored here. + try + { + xComponent->removeEventListener(static_cast < XEventListener * > (this)); + xComponent->dispose(); + } + catch (const Exception&) + { + // exceptions can be safely ignored here. + } } } - } - rBHelper.bDisposed = true; - rBHelper.bInDispose = false; + rBHelper.bDisposed = true; + rBHelper.bInDispose = false; + } } } @@ -190,16 +201,17 @@ void SAL_CALL ClipboardManager::disposing( const EventObject& event ) removeClipboard(xClipboard->getName()); } -Reference< XInterface > SAL_CALL ClipboardManager_createInstance( - const Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/) -{ - return Reference < XInterface >(static_cast<OWeakObject *>(new ClipboardManager())); -} - -Sequence< OUString > SAL_CALL ClipboardManager_getSupportedServiceNames() +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +dtrans_ClipboardManager_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - Sequence < OUString > SupportedServicesNames { "com.sun.star.datatransfer.clipboard.ClipboardManager" }; - return SupportedServicesNames; + osl::MutexGuard aGuard(g_InstanceGuard); + if (g_Disposed) + return nullptr; + if (!g_Instance) + g_Instance.set(new ClipboardManager()); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/generic/clipboardmanager.hxx b/dtrans/source/generic/clipboardmanager.hxx index 5d4889e9d53e..2750b61246cb 100644 --- a/dtrans/source/generic/clipboardmanager.hxx +++ b/dtrans/source/generic/clipboardmanager.hxx @@ -28,8 +28,6 @@ #include <map> -#define CLIPBOARDMANAGER_IMPLEMENTATION_NAME "com.sun.star.comp.datatransfer.ClipboardManager" - typedef std::map< OUString, css::uno::Reference< css::datatransfer::clipboard::XClipboard > > ClipboardMap; namespace dtrans @@ -90,10 +88,6 @@ namespace dtrans } -css::uno::Sequence< OUString > SAL_CALL ClipboardManager_getSupportedServiceNames(); -css::uno::Reference< css::uno::XInterface > SAL_CALL ClipboardManager_createInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory > & xMultiServiceFactory); - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/generic/dtrans.component b/dtrans/source/generic/dtrans.component index 915e3f0bcf8f..1bfb643be4d0 100644 --- a/dtrans/source/generic/dtrans.component +++ b/dtrans/source/generic/dtrans.component @@ -18,11 +18,13 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="dtrans" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.datatransfer.ClipboardManager"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.datatransfer.ClipboardManager" + constructor="dtrans_ClipboardManager_get_implementation"> <service name="com.sun.star.datatransfer.clipboard.ClipboardManager"/> </implementation> - <implementation name="com.sun.star.comp.datatransfer.clipboard.GenericClipboard"> + <implementation name="com.sun.star.comp.datatransfer.clipboard.GenericClipboard" + constructor="dtrans_GenericClipboard_get_implementation"> <service name="com.sun.star.datatransfer.clipboard.GenericClipboard"/> </implementation> </component> diff --git a/dtrans/source/generic/dtrans.cxx b/dtrans/source/generic/dtrans.cxx deleted file mode 100644 index 22be8aca3c22..000000000000 --- a/dtrans/source/generic/dtrans.cxx +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <cppuhelper/factory.hxx> -#include <clipboardmanager.hxx> -#include <generic_clipboard.hxx> - -using namespace com::sun::star::lang; -using namespace com::sun::star::registry; -using namespace com::sun::star::uno; -using namespace cppu; - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL dtrans_component_getFactory( - const sal_Char * pImplName, - void * pServiceManager, - void * /*pRegistryKey*/ -) -{ - void * pRet = nullptr; - - if (pServiceManager) - { - Reference< XSingleServiceFactory > xFactory; - - if (rtl_str_compare( pImplName, CLIPBOARDMANAGER_IMPLEMENTATION_NAME ) == 0) - { - xFactory = createOneInstanceFactory( - static_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - ClipboardManager_createInstance, - ClipboardManager_getSupportedServiceNames() ); - } - else if (rtl_str_compare( pImplName, GENERIC_CLIPBOARD_IMPLEMENTATION_NAME ) == 0) - { - xFactory = createSingleFactory( - static_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - GenericClipboard_createInstance, - GenericClipboard_getSupportedServiceNames() ); - } - - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/generic/generic_clipboard.cxx b/dtrans/source/generic/generic_clipboard.cxx index c9477e068c7f..9766d23892b4 100644 --- a/dtrans/source/generic/generic_clipboard.cxx +++ b/dtrans/source/generic/generic_clipboard.cxx @@ -20,6 +20,7 @@ #include <generic_clipboard.hxx> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/supportsservice.hxx> using namespace com::sun::star::datatransfer; @@ -56,7 +57,7 @@ void SAL_CALL GenericClipboard::initialize( const Sequence< Any >& aArguments ) OUString SAL_CALL GenericClipboard::getImplementationName( ) { - return OUString(GENERIC_CLIPBOARD_IMPLEMENTATION_NAME); + return "com.sun.star.comp.datatransfer.clipboard.GenericClipboard"; } sal_Bool SAL_CALL GenericClipboard::supportsService( const OUString& ServiceName ) @@ -66,7 +67,7 @@ sal_Bool SAL_CALL GenericClipboard::supportsService( const OUString& ServiceName Sequence< OUString > SAL_CALL GenericClipboard::getSupportedServiceNames( ) { - return GenericClipboard_getSupportedServiceNames(); + return { "com.sun.star.datatransfer.clipboard.GenericClipboard" }; } Reference< XTransferable > SAL_CALL GenericClipboard::getContents() @@ -137,16 +138,11 @@ void SAL_CALL GenericClipboard::removeClipboardListener( const Reference< XClipb rBHelper.aLC.removeInterface( cppu::UnoType<XClipboardListener>::get(), listener ); } -Sequence< OUString > SAL_CALL GenericClipboard_getSupportedServiceNames() +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +dtrans_GenericClipboard_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - Sequence< OUString > aRet { "com.sun.star.datatransfer.clipboard.GenericClipboard" }; - return aRet; -} - -Reference< XInterface > SAL_CALL GenericClipboard_createInstance( - const Reference< XMultiServiceFactory > & /*xMultiServiceFactory*/) -{ - return Reference < XInterface >(static_cast<OWeakObject *>(new GenericClipboard())); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new GenericClipboard())); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/generic/generic_clipboard.hxx b/dtrans/source/generic/generic_clipboard.hxx index f245096e9c60..f23a0cc9a120 100644 --- a/dtrans/source/generic/generic_clipboard.hxx +++ b/dtrans/source/generic/generic_clipboard.hxx @@ -29,8 +29,6 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> -#define GENERIC_CLIPBOARD_IMPLEMENTATION_NAME "com.sun.star.comp.datatransfer.clipboard.GenericClipboard" - namespace dtrans { @@ -101,10 +99,6 @@ namespace dtrans } -css::uno::Sequence< OUString > SAL_CALL GenericClipboard_getSupportedServiceNames(); -css::uno::Reference< css::uno::XInterface > SAL_CALL GenericClipboard_createInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory > & xMultiServiceFactory); - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 22a5a8a05d94b3f96e94669fee4c23ba4f097dfc Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Fri Apr 22 07:42:14 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:44 2025 +0100 external/openldap: Don't use pthread_get/setconcurrency without declarations At least with glibc on Linux, those two functions are only declared in <pthread.h> when _XOPEN_SOURCE is defined. And with <https://github.com/llvm/llvm-project/commit/7d644e1215b376ec5e915df9ea2eeb56e2d94626> "[C11/C2x] Change the behavior of the implicit function declaration warning" in Clang 15 trunk that now causes hard errors > thr_posix.c:93:9: error: call to undeclared function 'pthread_setconcurrency'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] > return pthread_setconcurrency( n ); > ^ > thr_posix.c:107:9: error: call to undeclared function 'pthread_getconcurrency'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] > return pthread_getconcurrency(); > ^ (vs. just silently ignored warnings) when building ExternalProject_openldap. (And the way the corresponding AC_CHECK_FUNCS in workdir/UnpackedTarball/openldap/configure.in works, it always set HAVE_PTHREAD_GET/SETCONCURRENCY because it effectively checks for availability of the symbols in a library, not for declarations of the C functions in an include file.) But if we explicitly define _XOPEN_SOURCE, we now also need to explicitly define _DEFAULT_SOURCE or _BSD_SOURCE (which is otherwise implicitly defined by default in glibc's features.h if no other such macros are defined). Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133312 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 02311766135700f8dd8528cc7cacda636c8f304d) (cherry picked from commit 11f556a65fcff1442209e049f6b9380dd1ed9b10) Change-Id: I148d50c82ee2efc2a54f2cf4f84dead3941a3568 diff --git a/external/openldap/ExternalProject_openldap.mk b/external/openldap/ExternalProject_openldap.mk index 6e66c436de9a..71c5e17bc067 100644 --- a/external/openldap/ExternalProject_openldap.mk +++ b/external/openldap/ExternalProject_openldap.mk @@ -15,6 +15,15 @@ $(eval $(call gb_ExternalProject_register_targets,openldap,\ build \ )) +openldap_CFLAGS = +ifeq ($(OS),LINUX) # i.e., assuming glibc +# glibc needs at least _XOPEN_SOURCE=500 to declare pthread_getconcurrency and +# pthread_setconcurrency in <pthread.h> (and once that is defined, it also needs either +# _DEFUALT_SOURCE (glibc >= 2.19) or the deprecated _BSD_SOURCE (glibc <= 2.18) to be defined +# explicitly, so that e.g. u_char is declared in <sys/types.h>): +openldap_CFLAGS = -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_BSD_SOURCE +endif + openldap_LDFLAGS = ifeq ($(SYSTEM_NSS),) openldap_LDFLAGS += -L$(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib \ @@ -41,10 +50,10 @@ $(call gb_ExternalProject_get_state_target,openldap,build) : ac_cv_func_memcmp_working=yes \ ) \ $(if $(SYSTEM_NSS), \ - CPPFLAGS="$(CPPFLAGS) $(NSS_CFLAGS)" CFLAGS="$(CFLAGS) $(NSS_CFLAGS)" LDFLAGS="$(LDFLAGS) $(NSS_LIBS)" \ + CPPFLAGS="$(CPPFLAGS) $(openldap_CFLAGS) $(NSS_CFLAGS)" CFLAGS="$(CFLAGS) $(NSS_CFLAGS)" LDFLAGS="$(LDFLAGS) $(NSS_LIBS)" \ , \ CPPFLAGS="$(CPPFLAGS) -I$(call gb_UnpackedTarball_get_dir,nss)/dist/public/nss -I$(call gb_UnpackedTarball_get_dir,nss)/dist/out/include" \ - CFLAGS="$(CFLAGS) -I$(call gb_UnpackedTarball_get_dir,nss)/dist/public/nss -I$(call gb_UnpackedTarball_get_dir,nss)/dist/out/include" \ + CFLAGS="$(CFLAGS) $(openldap_CFLAGS) -I$(call gb_UnpackedTarball_get_dir,nss)/dist/public/nss -I$(call gb_UnpackedTarball_get_dir,nss)/dist/out/include" \ ) \ $(if $(openldap_LDFLAGS),LDFLAGS="$(LDFLAGS) $(openldap_LDFLAGS)") \ && MAKEFLAGS= && $(MAKE) \ commit 61910f5cb578dce03ae0db10053e3cf550800a07 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Wed Nov 10 13:36:43 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:43 2025 +0100 Add forward declaration to openldap to fix compilation with current Xcode For some reason the warning about this undeclared function is treated as an error by the Clang version in current Xcode, at least for me, even if openldap isn't compiled with -Werror. Change-Id: Ic8479ca63031319ce55c6fb9d95132019ae82cae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124959 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 34b586dc84b810eece7ae08b4028caba78db319f) (cherry picked from commit 504526dbee35760858723759facd3d649352c696) diff --git a/external/openldap/openldap-2.4.44.patch.1 b/external/openldap/openldap-2.4.44.patch.1 index 0d3cf5b70c3f..317ef9a62e56 100644 --- a/external/openldap/openldap-2.4.44.patch.1 +++ b/external/openldap/openldap-2.4.44.patch.1 @@ -1,3 +1,4 @@ +-*- Mode: diff -*- --- openldap.org/configure +++ openldap/configure @@ -15735,7 +15735,7 @@ @@ -52,6 +53,17 @@ #undef NSS_VERSION_INT #define NSS_VERSION_INT ((NSS_VMAJOR << 24) | (NSS_VMINOR << 16) | \ +--- openldap.org/libraries/libldap/tls2.c ++++ openldap.org/libraries/libldap/tls2.c +@@ -80,6 +80,8 @@ + { BER_BVNULL, BER_BVNULL } + }; + ++int ldap_pvt_tls_check_hostname( LDAP *ld, void *s, const char *name_in ); ++ + #ifdef HAVE_TLS + + void --- openldap.org/Makefile.in +++ openldap/Makefile.in @@ -13,7 +13,7 @@ commit c5d11e3225efbda5388db208630dd7ea474b9713 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Aug 3 17:18:38 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:43 2025 +0100 external/openldap: Fix -Wint-conversion ...with recent Clang 16 trunk since <https://github.com/llvm/llvm-project/commit/7068aa98412ade19a34b7ed126f4669f581b2311> "Strengthen -Wint-conversion to default to an error", causing > checking for pthread_detach with <pthread.h>... no > configure: error: could not locate pthread_detach() because of > configure:19227: checking for pthread_detach with <pthread.h> > configure:19249: ~/llvm/inst/bin/clang -o conftest -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_BSD_SOURCE -O0 -fstrict-aliasing -fstrict-overflow -ggdb2 -gsplit-dwarf -Xclang -debug-info-kind=constructor -ggnu-pubnames -Iworkdir/UnpackedTarball/nss/dist/public/nss -Iworkdir/UnpackedTarball/nss/dist/out/include -Iworkdir/UnpackedTarball/nss/dist/public/nss -Iworkdir/UnpackedTarball/nss/dist/out/include -fuse-ld=lld --ld-path=~/llvm/inst/bin/ld.lld -Wl,--gdb-index -Lworkdir/UnpackedTarball/nss/dist/out/lib -pthread conftest.c >&5 > conftest.c:109:16: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'pthread_t' (aka 'unsigned long') [-Wint-conversion] > pthread_detach(NULL); > ^~~~ > ~/llvm/inst/lib/clang/16.0.0/include/stddef.h:89:16: note: expanded from macro 'NULL' > # define NULL ((void*)0) > ^~~~~~~~~~ > /usr/include/pthread.h:269:38: note: passing argument to parameter '__th' here > extern int pthread_detach (pthread_t __th) __THROW; > ^ > 1 error generated. > configure:19249: $? = 1 Change-Id: I3f2b8836e7aba6536e2877b492b43de588804f86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137758 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 49a5c32d6e29c6551531763bde126bdcc36ec93e) (cherry picked from commit 554d1067b207adcd4eba899889590c6f32b96d9e) diff --git a/external/openldap/UnpackedTarball_openldap.mk b/external/openldap/UnpackedTarball_openldap.mk index 999a1eddad0b..98c88a28ccc5 100644 --- a/external/openldap/UnpackedTarball_openldap.mk +++ b/external/openldap/UnpackedTarball_openldap.mk @@ -21,6 +21,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,openldap,\ $(eval $(call gb_UnpackedTarball_add_patches,openldap,\ external/openldap/openldap-2.4.44.patch.1 \ external/openldap/configure-c99.patch \ + external/openldap/Wint-conversion.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/openldap/Wint-conversion.patch b/external/openldap/Wint-conversion.patch new file mode 100644 index 000000000000..60e14c991cc0 --- /dev/null +++ b/external/openldap/Wint-conversion.patch @@ -0,0 +1,11 @@ +--- configure ++++ configure +@@ -19241,7 +19241,7 @@ + int + main () + { +-pthread_detach(NULL); ++pthread_t t; pthread_detach(t); + ; + return 0; + } commit e7b230de0447c23c9e707d5c85aa9d51676b2df7 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sat May 7 21:29:20 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:43 2025 +0100 external/openldap: Implicit int in configure check ...causing > checking for compatible POSIX regex... no > configure: error: broken POSIX regex! > make[1]: *** [external/openldap/ExternalProject_openldap.mk:40: workdir/ExternalProject/openldap/build] Error 1 due to > conftest.c:88:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] with Clang 15 trunk after <https://github.com/llvm/llvm-project/commit/2cb2cd242ca08d0bbd2a51a41f1317442e5414fc> "Change the behavior of implicit int diagnostics" Change-Id: I8fb70ce21a73293e20bbc5b09c133141aa9b0ca1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133995 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit ed977f0b6c849739d3c843c8425442265e2eb7ca) (cherry picked from commit 90ef30f79285bf6041275d8c42dfc6248225b832) diff --git a/external/openldap/UnpackedTarball_openldap.mk b/external/openldap/UnpackedTarball_openldap.mk index 61a083ddcd8a..999a1eddad0b 100644 --- a/external/openldap/UnpackedTarball_openldap.mk +++ b/external/openldap/UnpackedTarball_openldap.mk @@ -20,6 +20,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,openldap,\ $(eval $(call gb_UnpackedTarball_add_patches,openldap,\ external/openldap/openldap-2.4.44.patch.1 \ + external/openldap/configure-c99.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/openldap/configure-c99.patch b/external/openldap/configure-c99.patch new file mode 100644 index 000000000000..f1c3da6c4c23 --- /dev/null +++ b/external/openldap/configure-c99.patch @@ -0,0 +1,11 @@ +--- configure ++++ configure +@@ -14691,7 +14691,7 @@ + #include <sys/types.h> + #include <regex.h> + static char *pattern, *string; +-main() ++int main() + { + int rc; + regex_t re; commit a8982b4781fcbc61b339c09be3ac01783ef9a08d Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Mon Aug 15 08:19:55 2022 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Feb 12 11:09:43 2025 +0100 external/nss: Fix -Wincompatible-function-pointer-types ...with recent Clang 16 trunk since <https://github.com/llvm/llvm-project/commit/af01f717c48f0fd2481600ed6c00441763365b62> "Default implicit function pointer conversions diagnostic to be an error", causing > ../../../pr/tests/testfile.c:126:41: error: incompatible function pointer types passing 'void (*)(void *)' to parameter of type 'void *(*)(void *)' [-Wincompatible-function-pointer-types] > if (!pthread_create(&tid, NULL, start, arg)) { > ^~~~~ > /usr/include/pthread.h:204:15: note: passing argument to parameter '__start_routine' here > void *(*__start_routine) (void *), > ^ and > ../../../pr/tests/testfile.c:576:31: error: incompatible function pointer types passing 'PRInt32 (void *)' (aka 'int (void *)') to parameter of type 'void (*)(void *)' [-Wincompatible-function-pointer-types] > DirTest, &thrarg, > ^~~~~~~ > ../../../pr/tests/testfile.c:93:36: note: passing argument to parameter 'start' here > void (*start)(void *arg), > ^ Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138267 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 5b5f6b147f5f2a02476a14ed2d8feb247d5a7c79) (cherry picked from commit 3abaff87d77611809a9415954b9cf065a09f8621) Change-Id: I642e5ca69289993c86abafded65ac23a63fd837e diff --git a/external/nss/UnpackedTarball_nss.mk b/external/nss/UnpackedTarball_nss.mk index 04d098cadc19..6cb6ae2261a3 100644 --- a/external/nss/UnpackedTarball_nss.mk +++ b/external/nss/UnpackedTarball_nss.mk @@ -24,6 +24,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,nss,\ external/nss/nss.vs2015.pdb.patch \ $(if $(filter iOS,$(OS)), \ external/nss/nss-ios.patch) \ + external/nss/Wincompatible-function-pointer-types.patch.0 \ $(if $(filter MSC-INTEL,$(COM)-$(CPUNAME)), \ external/nss/nss.cygwin64.in32bit.patch) \ $(if $(findstring 120_70,$(VCVER)_$(WINDOWS_SDK_VERSION)), \ diff --git a/external/nss/Wincompatible-function-pointer-types.patch.0 b/external/nss/Wincompatible-function-pointer-types.patch.0 new file mode 100644 index 000000000000..1e9b7550e1da --- /dev/null +++ b/external/nss/Wincompatible-function-pointer-types.patch.0 @@ -0,0 +1,234 @@ +--- nspr/pr/tests/testfile.c ++++ nspr/pr/tests/testfile.c +@@ -86,7 +86,7 @@ + #endif + #define TMPDIR_LEN 64 + char testdir[TMPDIR_LEN]; +-static PRInt32 PR_CALLBACK DirTest(void *argunused); ++static void PR_CALLBACK DirTest(void *argunused); + PRInt32 dirtest_failed = 0; + + PRThread* create_new_thread(PRThreadType type, +@@ -123,7 +123,7 @@ + if (native_thread) { + #if defined(_PR_PTHREADS) + pthread_t tid; +- if (!pthread_create(&tid, NULL, start, arg)) { ++ if (!pthread_create(&tid, NULL, (void *(*)(void *))start, arg)) { + return((PRThread *) tid); + } + else { +@@ -594,7 +594,7 @@ + return 0; + } + +-static PRInt32 PR_CALLBACK DirTest(void *arg) ++static void PR_CALLBACK DirTest(void *arg) + { + struct dirtest_arg *tinfo = (struct dirtest_arg *) arg; + PRFileDesc *fd_file; +@@ -618,14 +618,14 @@ + printf( + "testfile failed to create dir %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + fd_dir = PR_OpenDir(TEST_DIR); + if (fd_dir == NULL) { + printf( + "testfile failed to open dirctory %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + strcpy(pathname, TEST_DIR); +@@ -645,7 +645,7 @@ + printf( + "testfile failed to create/open file %s [%d, %d] ", + pathname, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + PR_Close(fd_file); + } +@@ -664,7 +664,7 @@ + printf( + "testfile failed to create/open hidden file %s [%d, %d] ", + pathname, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + PR_Close(fd_file); +@@ -681,7 +681,7 @@ + if (hfile == INVALID_HANDLE_VALUE) { + printf("testfile failed to create/open hidden file %s [0, %d] ", + pathname, GetLastError()); +- return -1; ++ return; + } + CloseHandle(hfile); + +@@ -696,7 +696,7 @@ + if (hfile == INVALID_HANDLE_VALUE) { + printf("testfile failed to create/open hidden file %s [0, %d] ", + pathname, GetLastError()); +- return -1; ++ return; + } + CloseHandle(hfile); + +@@ -707,7 +707,7 @@ + if (fd_file == NULL) { + printf("testfile failed to create/open hidden file %s [%d, %d] ", + pathname, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + PR_Close(fd_file); + #endif /* XP_UNIX */ +@@ -720,14 +720,14 @@ + printf( + "testfile failed to close dirctory %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + fd_dir = PR_OpenDir(TEST_DIR); + if (fd_dir == NULL) { + printf( + "testfile failed to reopen dirctory %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + /* +@@ -750,14 +750,14 @@ + printf( + "testfile failed to GetFileInfo file %s [%d, %d] ", + pathname, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + if (info.type != PR_FILE_FILE) { + printf( + "testfile incorrect fileinfo for file %s [%d, %d] ", + pathname, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + } + if (num_files != 0) +@@ -765,7 +765,7 @@ + printf( + "testfile failed to find all files in directory %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + PR_CloseDir(fd_dir); +@@ -781,7 +781,7 @@ + printf( + "testfile failed to reopen dirctory %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + DPRINTF(("Listing non-hidden files in directory %s ",TEST_DIR)); +@@ -789,7 +789,7 @@ + DPRINTF((" %s ",dirEntry->name)); + if (!strcmp(HIDDEN_FILE_NAME, dirEntry->name)) { + printf("testfile found hidden file %s ", pathname); +- return -1; ++ return; + } + + } +@@ -803,7 +803,7 @@ + printf( + "testfile failed to delete hidden file %s [%d, %d] ", + pathname, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + PR_CloseDir(fd_dir); +@@ -815,41 +815,41 @@ + printf( + "testfile failed to rename directory %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + if (PR_FAILURE == PR_MkDir(TEST_DIR, 0777)) { + printf( + "testfile failed to recreate dir %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + if (PR_SUCCESS == PR_Rename(renamename, TEST_DIR)) { + printf( + "testfile renamed directory to existing name %s ", + renamename); +- return -1; ++ return; + } + + if (PR_FAILURE == PR_RmDir(TEST_DIR)) { + printf( + "testfile failed to rmdir %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + if (PR_FAILURE == PR_Rename(renamename, TEST_DIR)) { + printf( + "testfile failed to rename directory %s [%d, %d] ", + renamename, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + fd_dir = PR_OpenDir(TEST_DIR); + if (fd_dir == NULL) { + printf( + "testfile failed to reopen directory %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + + strcpy(pathname, TEST_DIR); +@@ -865,7 +865,7 @@ + printf( + "testfile failed to delete file %s [%d, %d] ", + pathname, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + } + +@@ -875,14 +875,13 @@ + printf( + "testfile failed to rmdir %s [%d, %d] ", + TEST_DIR, PR_GetError(), PR_GetOSError()); +- return -1; ++ return; + } + PR_EnterMonitor(tinfo->mon); + tinfo->done = 1; + PR_Notify(tinfo->mon); + PR_ExitMonitor(tinfo->mon); + +- return 0; + } + /************************************************************************/ +