diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-12-06 08:35:23 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-12-06 11:26:02 +0100 |
commit | cef1740a0369e7c7873b6c4772e2bc371c6e2093 (patch) | |
tree | ccf812dad5a6cbc7a4534cff28e4593de0198b61 | |
parent | 4415d2410cae282da8f8970c393561ec67fc5171 (diff) |
VCL always use nullptr terminated plugin lists
... and respect more defines. Almost just a refactoring.
Change-Id: I5d9dce742b2ef69f7f27af1970af1f8c019abfc8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126401
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r-- | vcl/README.md | 3 | ||||
-rw-r--r-- | vcl/source/app/salplug.cxx | 42 |
2 files changed, 26 insertions, 19 deletions
diff --git a/vcl/README.md b/vcl/README.md index 66d4c1bd20b3..2aa78eb54f87 100644 --- a/vcl/README.md +++ b/vcl/README.md @@ -45,9 +45,6 @@ VCL provides a graphical toolkit similar to gtk+, Qt, SWING etc. + generic/ + raw X11 support - + plugadapt/ - + pluggable framework to select correct unx backend - + dtrans/ + "data transfer" - clipboard handling + http://stackoverflow.com/questions/3261379/getting-html-source-or-rich-text-from-the-x-clipboard diff --git a/vcl/source/app/salplug.cxx b/vcl/source/app/salplug.cxx index 7c2a91cec471..2737fb85663d 100644 --- a/vcl/source/app/salplug.cxx +++ b/vcl/source/app/salplug.cxx @@ -178,25 +178,33 @@ SalInstance* autodetect_plugin() #if ENABLE_GTK3_KDE5 "gtk3_kde5", #endif - "gtk3", "gen", nullptr +#if ENABLE_GTK3 + "gtk3", +#endif + "gen", + nullptr }; static const char* const pStandardFallbackList[] = { - "gtk3", "gen", nullptr +#if ENABLE_GTK3 + "gtk3", +#endif + "gen", + nullptr }; #ifdef HEADLESS_VCLPLUG static const char* const pHeadlessFallbackList[] = { - "svp", nullptr + "svp", + nullptr }; #endif SalInstance* pInst = nullptr; DesktopType desktop = lcl_get_desktop_environment(); const char * const * pList = pStandardFallbackList; - int nListEntry = 0; #ifdef HEADLESS_VCLPLUG // no server at all: dummy plugin @@ -212,14 +220,11 @@ SalInstance* autodetect_plugin() else if (desktop == DESKTOP_PLASMA5 || desktop == DESKTOP_LXQT) pList = pKDEFallbackList; - while( pList[nListEntry] && pInst == nullptr ) + for (int i = 0; !pInst && pList[i]; ++i) { - OUString aTry( OUString::createFromAscii( pList[nListEntry] ) ); + OUString aTry(OUString::createFromAscii(pList[i])); pInst = tryInstance( aTry ); - SAL_INFO_IF( - pInst, "vcl.plugadapt", - "plugin autodetection: " << pList[nListEntry]); - nListEntry++; + SAL_INFO_IF(pInst, "vcl.plugadapt", "plugin autodetection: " << pList[i]); } return pInst; #endif // !DISABLE_DYNLOADING @@ -278,17 +283,22 @@ SalInstance *CreateSalInstance() // fallback, try everything static const char* const pPlugin[] = { #ifdef _WIN32 - "win" -#else -#ifdef MACOSX - "osx" + "win", +#elif defined(MACOSX) + "osx", #else - "gtk3", "kf5", "gen" +#if ENABLE_GTK3 + "gtk3", +#endif +#if ENABLE_KF5 + "kf5", #endif + "gen", #endif + nullptr }; - for ( int i = 0; !pInst && i != SAL_N_ELEMENTS(pPlugin); ++i ) + for (int i = 0; !pInst && pPlugin[i]; ++i) pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) ); if( ! pInst ) |