diff options
author | Philipp Hofer <philipp.hofer@protonmail.com> | 2020-11-12 12:56:36 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2020-11-21 13:17:51 +0100 |
commit | d0b3815392d1fb253ed05218422a7f9b37c9df24 (patch) | |
tree | 3dbf28ba79e4d27ec030c2ef12acd39b2eb5914f /extensions | |
parent | 70e36068a43cb6747232441ee67e609c86362aa0 (diff) |
tdf#123936 Formatting files in module extensions with clang-format
Change-Id: I6e86641bc93bf4b3941b01fbef69c1e7984aad3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105667
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Jenkins
Diffstat (limited to 'extensions')
19 files changed, 98 insertions, 185 deletions
diff --git a/extensions/source/activex/SOActionsApproval.cxx b/extensions/source/activex/SOActionsApproval.cxx index dec824dcebfa..a4092166272b 100644 --- a/extensions/source/activex/SOActionsApproval.cxx +++ b/extensions/source/activex/SOActionsApproval.cxx @@ -39,17 +39,16 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP SOActionsApproval::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = - { + static const IID* arr[] = { &IID_ISOActionsApproval, }; - for (std::size_t i=0;i<SAL_N_ELEMENTS(arr);i++) + for (std::size_t i = 0; i < SAL_N_ELEMENTS(arr); i++) { #ifdef _MSC_VER - if (InlineIsEqualGUID(*arr[i],riid)) + if (InlineIsEqualGUID(*arr[i], riid)) #else - if (::ATL::InlineIsEqualGUID(*arr[i],riid)) + if (::ATL::InlineIsEqualGUID(*arr[i], riid)) #endif return S_OK; } diff --git a/extensions/source/activex/SOComWindowPeer.cxx b/extensions/source/activex/SOComWindowPeer.cxx index 92303cd12f25..0a556466d32f 100644 --- a/extensions/source/activex/SOComWindowPeer.cxx +++ b/extensions/source/activex/SOComWindowPeer.cxx @@ -38,17 +38,16 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP SOComWindowPeer::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = - { + static const IID* arr[] = { &IID_ISOComWindowPeer, }; - for (std::size_t i=0;i<SAL_N_ELEMENTS(arr);i++) + for (std::size_t i = 0; i < SAL_N_ELEMENTS(arr); i++) { #ifdef _MSC_VER - if (InlineIsEqualGUID(*arr[i],riid)) + if (InlineIsEqualGUID(*arr[i], riid)) #else - if (::ATL::InlineIsEqualGUID(*arr[i],riid)) + if (::ATL::InlineIsEqualGUID(*arr[i], riid)) #endif return S_OK; } diff --git a/extensions/source/activex/StdAfx2.h b/extensions/source/activex/StdAfx2.h index 4d8deddf604d..01665c2001e3 100644 --- a/extensions/source/activex/StdAfx2.h +++ b/extensions/source/activex/StdAfx2.h @@ -28,9 +28,9 @@ #define _ATL_APARTMENT_THREADED #define _ATL_STATIC_REGISTRY -#pragma warning (push) -#pragma warning (disable:4189) - // local variable is initialized but not referenced - in atlctl.h +#pragma warning(push) +// local variable is initialized but not referenced - in atlctl.h +#pragma warning(disable : 4189) #if defined __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wall" @@ -49,7 +49,7 @@ #pragma clang diagnostic ignored "-Wtypename-missing" #endif -#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define min(a, b) (((a) < (b)) ? (a) : (b)) #include <atlbase.h> //You may derive a class from CComModule and use it if you want to override @@ -61,7 +61,7 @@ extern CComModule _Module; #if defined __clang__ #pragma clang diagnostic pop #endif -#pragma warning (pop) +#pragma warning(pop) //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/extensions/source/config/ldap/ldapaccess.hxx b/extensions/source/config/ldap/ldapaccess.hxx index 34ba5a04f625..274cdb88009d 100644 --- a/extensions/source/config/ldap/ldapaccess.hxx +++ b/extensions/source/config/ldap/ldapaccess.hxx @@ -26,7 +26,7 @@ #ifdef _WIN32 #if !defined WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #include <winldap.h> @@ -38,28 +38,27 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> -namespace extensions::config::ldap { - -namespace uno = css::uno ; -namespace lang = css::lang ; -namespace ldap = css::ldap ; +namespace extensions::config::ldap +{ +namespace uno = css::uno; +namespace lang = css::lang; +namespace ldap = css::ldap; struct LdapUserProfile; - /** Struct containing the information on LDAP connection */ struct LdapDefinition { /** LDAP server name */ - OUString mServer ; + OUString mServer; /** LDAP server port number */ - sal_Int32 mPort ; + sal_Int32 mPort; /** Repository base DN */ - OUString mBaseDN ; + OUString mBaseDN; /** DN to use for "anonymous" connection */ - OUString mAnonUser ; + OUString mAnonUser; /** Credentials to use for "anonymous" connection */ - OUString mAnonCredentials ; + OUString mAnonCredentials; /** User Entity Object Class */ OUString mUserObjectClass; /** User Entity Unique Attribute */ @@ -71,23 +70,27 @@ struct LdapDefinition } }; -typedef std::map< OUString, OUString > LdapData; // key/value pairs +typedef std::map<OUString, OUString> LdapData; // key/value pairs /** Class encapsulating all LDAP functionality */ class LdapConnection { friend struct LdapMessageHolder; -public: +public: /** Default constructor */ - LdapConnection() : mConnection(nullptr),mLdapDefinition() {} + LdapConnection() + : mConnection(nullptr) + , mLdapDefinition() + { + } /** Destructor, releases the connection */ - ~LdapConnection() ; + ~LdapConnection(); /** Make connection to LDAP server @throws ldap::LdapConnectionException @throws ldap::LdapGenericException */ - void connectSimple(const LdapDefinition& aDefinition); + void connectSimple(const LdapDefinition& aDefinition); /** Gets LdapUserProfile from LDAP repository for specified user @@ -98,7 +101,7 @@ public: @throws css::ldap::LdapGenericException if an LDAP error occurs. */ - void getUserProfile(const OUString& aUser, LdapData * data); + void getUserProfile(const OUString& aUser, LdapData* data); /** finds DN of user @return DN of User @@ -116,18 +119,16 @@ private: Indicates whether the connection is in a valid state. @return sal_True if connection is valid, sal_False otherwise */ - bool isValid() const { return mConnection != nullptr ; } + bool isValid() const { return mConnection != nullptr; } /// @throws ldap::LdapConnectionException /// @throws ldap::LdapGenericException - void connectSimple(); + void connectSimple(); /** LDAP connection object */ - LDAP* mConnection ; + LDAP* mConnection; LdapDefinition mLdapDefinition; -} ; - - +}; } #endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_ diff --git a/extensions/source/dbpilots/dbptypes.hxx b/extensions/source/dbpilots/dbptypes.hxx index 976e4f24d0d9..6832b5160a17 100644 --- a/extensions/source/dbpilots/dbptypes.hxx +++ b/extensions/source/dbpilots/dbptypes.hxx @@ -27,16 +27,12 @@ #include <map> #include <set> - namespace dbp { +typedef std::set<OUString> StringBag; +typedef std::map<sal_uInt32, OUString> MapInt2String; - - typedef std::set<OUString> StringBag; - typedef std::map<sal_uInt32, OUString> MapInt2String; - - -} // namespace dbp +} // namespace dbp #endif // INCLUDED_EXTENSIONS_SOURCE_DBPILOTS_DBPTYPES_HXX diff --git a/extensions/source/macosx/spotlight/OOoSpotlightImporter.h b/extensions/source/macosx/spotlight/OOoSpotlightImporter.h index c00007832de5..947f8dbf1656 100644 --- a/extensions/source/macosx/spotlight/OOoSpotlightImporter.h +++ b/extensions/source/macosx/spotlight/OOoSpotlightImporter.h @@ -19,10 +19,13 @@ #import <Cocoa/Cocoa.h> -@interface OOoSpotlightImporter : NSObject { +@interface OOoSpotlightImporter : NSObject +{ } -- (BOOL)importDocument:(NSString*)pathToFile contentType:(NSString*)contentTypeUTI attributes:(NSMutableDictionary*)attributes; +- (BOOL)importDocument:(NSString*)pathToFile + contentType:(NSString*)contentTypeUTI + attributes:(NSMutableDictionary*)attributes; - (NSFileHandle*)openZipFileAtPath:(NSString*)pathToFile; diff --git a/extensions/source/ole/oledll.cxx b/extensions/source/ole/oledll.cxx index fb6b673a9dba..1275f4dc60c5 100644 --- a/extensions/source/ole/oledll.cxx +++ b/extensions/source/ole/oledll.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #define STRICT #define _WIN32_DCOM @@ -54,8 +53,7 @@ END_OBJECT_MAP() // DLL Entry Point -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { if (dwReason == DLL_PROCESS_ATTACH) { @@ -66,7 +64,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { _Module.Term(); } - return TRUE; // ok + return TRUE; // ok } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/modulepcr.cxx b/extensions/source/propctrlr/modulepcr.cxx index fdaf3b2a6348..74d4b5daff7c 100644 --- a/extensions/source/propctrlr/modulepcr.cxx +++ b/extensions/source/propctrlr/modulepcr.cxx @@ -23,10 +23,7 @@ namespace pcr { - OUString PcrRes(const char* pId) - { - return Translate::get(pId, Translate::Create("pcr")); - } +OUString PcrRes(const char* pId) { return Translate::get(pId, Translate::Create("pcr")); } } // namespace pcr diff --git a/extensions/source/propctrlr/modulepcr.hxx b/extensions/source/propctrlr/modulepcr.hxx index ee44cc6bbad3..ba23a795cb2c 100644 --- a/extensions/source/propctrlr/modulepcr.hxx +++ b/extensions/source/propctrlr/modulepcr.hxx @@ -24,7 +24,7 @@ namespace pcr { - OUString PcrRes(const char* pId); +OUString PcrRes(const char* pId); } // namespace pcr #endif // _ INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MODULEPCR_HXX_ diff --git a/extensions/source/propctrlr/pcrcommontypes.hxx b/extensions/source/propctrlr/pcrcommontypes.hxx index 0fe62c6330c5..aebb3d47f420 100644 --- a/extensions/source/propctrlr/pcrcommontypes.hxx +++ b/extensions/source/propctrlr/pcrcommontypes.hxx @@ -25,18 +25,12 @@ #include <unordered_map> - namespace pcr { - - - typedef std::unordered_map< OUString, css::beans::Property > - PropertyMap; - +typedef std::unordered_map<OUString, css::beans::Property> PropertyMap; } // namespace pcr - #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMONTYPES_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/update/check/download.hxx b/extensions/source/update/check/download.hxx index c21671ef44db..9762a567fc5c 100644 --- a/extensions/source/update/check/download.hxx +++ b/extensions/source/update/check/download.hxx @@ -50,12 +50,13 @@ protected: virtual ~DownloadInteractionHandler() override {} }; - class Download { public: - Download(const css::uno::Reference< css::uno::XComponentContext >& xContext, - const rtl::Reference< DownloadInteractionHandler >& rHandler) : m_xContext(xContext), m_aHandler(rHandler) {}; + Download(const css::uno::Reference<css::uno::XComponentContext>& xContext, + const rtl::Reference<DownloadInteractionHandler>& rHandler) + : m_xContext(xContext) + , m_aHandler(rHandler){}; // returns true when the content of rURL was successfully written to rLocalFile bool start(const OUString& rURL, const OUString& rFile, const OUString& rDestinationDir); @@ -64,14 +65,13 @@ public: void stop(); protected: - // Determines the appropriate proxy settings for the given URL. Returns true if a proxy should be used void getProxyForURL(const OUString& rURL, OString& rHost, sal_Int32& rPort) const; private: osl::Condition m_aCondition; - const css::uno::Reference< css::uno::XComponentContext >& m_xContext; - const rtl::Reference< DownloadInteractionHandler > m_aHandler; + const css::uno::Reference<css::uno::XComponentContext>& m_xContext; + const rtl::Reference<DownloadInteractionHandler> m_aHandler; }; #endif // INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_DOWNLOAD_HXX diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.cpp b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp index a981e7b43eeb..ca7d37457f7d 100644 --- a/extensions/test/ole/AxTestComponents/AxTestComponents.cpp +++ b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - // Note: Proxy/Stub Information // To build a separate proxy/stub DLL, // run nmake -f AxTestComponentsps.mk in the project directory. @@ -29,7 +28,6 @@ #include "Basic.h" #include "Foo.h" - CComModule _Module; BEGIN_OBJECT_MAP(ObjectMap) @@ -37,11 +35,9 @@ OBJECT_ENTRY(CLSID_Basic, CBasic) OBJECT_ENTRY(CLSID_Foo, CFoo) END_OBJECT_MAP() - // DLL Entry Point -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { if (dwReason == DLL_PROCESS_ATTACH) { @@ -50,17 +46,12 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) } else if (dwReason == DLL_PROCESS_DETACH) _Module.Term(); - return TRUE; // ok + return TRUE; // ok } - // Used to determine whether the DLL can be unloaded by OLE -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - +STDAPI DllCanUnloadNow(void) { return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; } // Returns a class factory to create an object of the requested type @@ -69,7 +60,6 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) return _Module.GetClassObject(rclsid, riid, ppv); } - // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) @@ -78,14 +68,9 @@ STDAPI DllRegisterServer(void) return _Module.RegisterServer(TRUE); } - // DllUnregisterServer - Removes entries from the system registry -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - +STDAPI DllUnregisterServer(void) { return _Module.UnregisterServer(TRUE); } //VT_I4 size_t V_ERROR VARIANT VARIANT_FALSE CComVariant FADF_EMBEDDED diff --git a/extensions/test/ole/AxTestComponents/Foo.cpp b/extensions/test/ole/AxTestComponents/Foo.cpp index a5064278b8ff..9faefd393ec8 100644 --- a/extensions/test/ole/AxTestComponents/Foo.cpp +++ b/extensions/test/ole/AxTestComponents/Foo.cpp @@ -20,21 +20,11 @@ #include "stdafx.h" #include "Foo.h" - - // CBasic -CFoo::CFoo() -{ -} - -CFoo::~CFoo() -{ +CFoo::CFoo() {} -} +CFoo::~CFoo() {} -STDMETHODIMP CFoo::Foo(IUnknown *pVal) -{ - return S_OK; -} +STDMETHODIMP CFoo::Foo(IUnknown* pVal) { return S_OK; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp b/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp index 5509cd99aa67..ad42dda6255b 100644 --- a/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp +++ b/extensions/test/ole/EventListenerSample/EventListener/EventListener.cpp @@ -18,7 +18,6 @@ */ // EventListener.cpp : Implementation of DLL Exports. - // Note: Proxy/Stub Information // To build a separate proxy/stub DLL, // run nmake -f EventListenerps.mk in the project directory. @@ -31,18 +30,15 @@ #include "EventListener_i.c" #include "EvtListener.h" - CComModule _Module; BEGIN_OBJECT_MAP(ObjectMap) OBJECT_ENTRY(CLSID_EvtListener, CEvtListener) END_OBJECT_MAP() - // DLL Entry Point -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { if (dwReason == DLL_PROCESS_ATTACH) { @@ -51,17 +47,12 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) } else if (dwReason == DLL_PROCESS_DETACH) _Module.Term(); - return TRUE; // ok + return TRUE; // ok } - // Used to determine whether the DLL can be unloaded by OLE -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - +STDAPI DllCanUnloadNow(void) { return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; } // Returns a class factory to create an object of the requested type @@ -70,7 +61,6 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) return _Module.GetClassObject(rclsid, riid, ppv); } - // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) @@ -79,13 +69,8 @@ STDAPI DllRegisterServer(void) return _Module.RegisterServer(TRUE); } - // DllUnregisterServer - Removes entries from the system registry -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - +STDAPI DllUnregisterServer(void) { return _Module.UnregisterServer(TRUE); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/MfcControl/MfcControl.cpp b/extensions/test/ole/MfcControl/MfcControl.cpp index 74f10830e927..cb7f723e399b 100644 --- a/extensions/test/ole/MfcControl/MfcControl.cpp +++ b/extensions/test/ole/MfcControl/MfcControl.cpp @@ -27,16 +27,13 @@ static char THIS_FILE[] = __FILE__; #endif - CMfcControlApp NEAR theApp; -const GUID CDECL BASED_CODE _tlid = - { 0xac221fb3, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; +const GUID CDECL BASED_CODE _tlid + = { 0xac221fb3, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } }; const WORD _wVerMajor = 1; const WORD _wVerMinor = 0; - - // CMfcControlApp::InitInstance - DLL initialization BOOL CMfcControlApp::InitInstance() @@ -51,8 +48,6 @@ BOOL CMfcControlApp::InitInstance() return bInit; } - - // CMfcControlApp::ExitInstance - DLL termination int CMfcControlApp::ExitInstance() @@ -62,8 +57,6 @@ int CMfcControlApp::ExitInstance() return COleControlModule::ExitInstance(); } - - // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) @@ -79,8 +72,6 @@ STDAPI DllRegisterServer(void) return NOERROR; } - - // DllUnregisterServer - Removes entries from the system registry STDAPI DllUnregisterServer(void) diff --git a/extensions/test/ole/MfcControl/MfcControl.h b/extensions/test/ole/MfcControl/MfcControl.h index 64edc9ae7063..49ef5e72fe6d 100644 --- a/extensions/test/ole/MfcControl/MfcControl.h +++ b/extensions/test/ole/MfcControl/MfcControl.h @@ -25,13 +25,12 @@ // MfcControl.h : main header file for MFCCONTROL.DLL -#if !defined( __AFXCTL_H__ ) - #error include 'afxctl.h' before including this file +#if !defined(__AFXCTL_H__) +#error include 'afxctl.h' before including this file #endif #include "resource.h" - // CMfcControlApp : See MfcControl.cpp for implementation. class CMfcControlApp : public COleControlModule diff --git a/extensions/test/ole/OleClient/axhost.cxx b/extensions/test/ole/OleClient/axhost.cxx index a163a6a7de4a..47709f383483 100644 --- a/extensions/test/ole/OleClient/axhost.cxx +++ b/extensions/test/ole/OleClient/axhost.cxx @@ -21,24 +21,19 @@ HostWin::HostWin(LPWSTR progid) { - controlName= progid; - RECT rcPos={0,0,200,200}; + controlName = progid; + RECT rcPos = { 0, 0, 200, 200 }; Create(0, rcPos, _T("HostWin")); } -HostWin::~HostWin() -{ - DestroyWindow(); -} - +HostWin::~HostWin() { DestroyWindow(); } LRESULT HostWin::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CAxWindow wnd(m_hWnd); - HRESULT hr= wnd.CreateControlEx( controlName, NULL, NULL,&spControl.p); + HRESULT hr = wnd.CreateControlEx(controlName, NULL, NULL, &spControl.p); return 0; } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/cpptest/cpptest.cxx b/extensions/test/ole/cpptest/cpptest.cxx index f87a0663d192..ff083a05220c 100644 --- a/extensions/test/ole/cpptest/cpptest.cxx +++ b/extensions/test/ole/cpptest/cpptest.cxx @@ -19,11 +19,10 @@ // cpptest.cpp : Defines the entry point for the console application. - #ifdef _MSC_VER #pragma once #endif -#pragma warning(disable: 4917) +#pragma warning(disable : 4917) #include <comdef.h> #include <atlbase.h> #include <atlcom.h> @@ -33,17 +32,17 @@ HRESULT doTest(); int main(int /*argc*/, char** /*argv*/) { HRESULT hr; - if( FAILED( hr=CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) + if (FAILED(hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED))) { printf("CoInitializeEx failed \n"); return -1; } - if( FAILED(hr=doTest())) + if (FAILED(hr = doTest())) { - _com_error err( hr); - const CHAR * errMsg= err.ErrorMessage(); - MessageBoxA( NULL, errMsg, "Test failed", MB_ICONERROR); + _com_error err(hr); + const CHAR* errMsg = err.ErrorMessage(); + MessageBoxA(NULL, errMsg, "Test failed", MB_ICONERROR); } CoUninitialize(); @@ -55,13 +54,12 @@ HRESULT doTest() HRESULT hr; CComPtr<IUnknown> spUnkMgr; - - if( FAILED(hr= spUnkMgr.CoCreateInstance(L"com.sun.star.ServiceManager"))) + if (FAILED(hr = spUnkMgr.CoCreateInstance(L"com.sun.star.ServiceManager"))) return hr; IDispatchPtr starManager; // var starManager=new ActiveXObject("com.sun.star.ServiceManager"); - if (FAILED(hr= starManager.CreateInstance(_T("com.sun.star.ServiceManager")))) + if (FAILED(hr = starManager.CreateInstance(_T("com.sun.star.ServiceManager")))) { fprintf(stderr, "creating ServiceManager failed\n"); return hr; @@ -70,9 +68,9 @@ HRESULT doTest() _variant_t varP1(L"com.sun.star.frame.Desktop"); _variant_t varRet; CComDispatchDriver dispMgr(starManager); - if (FAILED(hr= dispMgr.Invoke1(L"createInstance", &varP1, &varRet))) + if (FAILED(hr = dispMgr.Invoke1(L"createInstance", &varP1, &varRet))) { - fprintf(stderr,"createInstance of Desktop failed\n"); + fprintf(stderr, "createInstance of Desktop failed\n"); return hr; } CComDispatchDriver dispDesk(varRet.pdispVal); @@ -83,22 +81,21 @@ HRESULT doTest() // var noArgs=new Array(); // var oDoc=starDesktop.loadComponentFromURL("private:factory/swriter", "Test", 40, noArgs); IDispatchPtr oDoc; - SAFEARRAY* ar= SafeArrayCreateVector(VT_DISPATCH, 0, 0); + SAFEARRAY* ar = SafeArrayCreateVector(VT_DISPATCH, 0, 0); _variant_t args[4]; - args[3]= _variant_t(L"private:factory/swriter"); - args[2]= _variant_t(L"Test"); - args[1]= _variant_t((long) 40); - args[0].vt= VT_ARRAY | VT_DISPATCH; - args[0].parray= ar; - if (FAILED(hr= dispDesk.InvokeN(L"loadComponentFromURL", args, 4, &varRet))) + args[3] = _variant_t(L"private:factory/swriter"); + args[2] = _variant_t(L"Test"); + args[1] = _variant_t((long)40); + args[0].vt = VT_ARRAY | VT_DISPATCH; + args[0].parray = ar; + if (FAILED(hr = dispDesk.InvokeN(L"loadComponentFromURL", args, 4, &varRet))) { - fprintf(stderr,"loadComponentFromURL failed\n"); + fprintf(stderr, "loadComponentFromURL failed\n"); return hr; } CComDispatchDriver dispDoc(varRet.pdispVal); varRet.Clear(); return S_OK; - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp index 2d44a5937e3d..73969591439f 100644 --- a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp +++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp @@ -18,7 +18,6 @@ */ // XCallback_Impl.cpp : Implementation of DLL Exports. - // Note: Proxy/Stub Information // To build a separate proxy/stub DLL, // run nmake -f XCallback_Implps.mk in the project directory. @@ -32,7 +31,6 @@ #include "Callback.h" #include "Simple.h" - CComModule _Module; BEGIN_OBJECT_MAP(ObjectMap) @@ -40,11 +38,9 @@ OBJECT_ENTRY(CLSID_Callback, CCallback) OBJECT_ENTRY(CLSID_Simple, CSimple) END_OBJECT_MAP() - // DLL Entry Point -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) { if (dwReason == DLL_PROCESS_ATTACH) { @@ -53,17 +49,12 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) } else if (dwReason == DLL_PROCESS_DETACH) _Module.Term(); - return TRUE; // ok + return TRUE; // ok } - // Used to determine whether the DLL can be unloaded by OLE -STDAPI DllCanUnloadNow(void) -{ - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - +STDAPI DllCanUnloadNow(void) { return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; } // Returns a class factory to create an object of the requested type @@ -72,7 +63,6 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) return _Module.GetClassObject(rclsid, riid, ppv); } - // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) @@ -81,14 +71,8 @@ STDAPI DllRegisterServer(void) return _Module.RegisterServer(TRUE); } - // DllUnregisterServer - Removes entries from the system registry -STDAPI DllUnregisterServer(void) -{ - return _Module.UnregisterServer(TRUE); -} - - +STDAPI DllUnregisterServer(void) { return _Module.UnregisterServer(TRUE); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |