[Libreoffice-commits] core.git: desktop/source

Douglas Mencken dougmencken at gmail.com
Thu Mar 17 07:03:18 UTC 2016


 desktop/source/deployment/misc/dp_platform.cxx |  138 ++++++++-----------------
 1 file changed, 47 insertions(+), 91 deletions(-)

New commits:
commit f3704e5756cafaa638724b227ae6a93df3c98eda
Author: Douglas Mencken <dougmencken at gmail.com>
Date:   Wed Mar 16 21:12:11 2016 -0400

    desktop.deployment • get rid of PLATFORM_ #define~s
    
    it’s just damn double work to maintain
    
    Change-Id: I1ea9f28024770460a575890333347cf8b8681e5c
    Reviewed-on: https://gerrit.libreoffice.org/23315
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/desktop/source/deployment/misc/dp_platform.cxx b/desktop/source/deployment/misc/dp_platform.cxx
index ece6182..2f7704d 100644
--- a/desktop/source/deployment/misc/dp_platform.cxx
+++ b/desktop/source/deployment/misc/dp_platform.cxx
@@ -27,48 +27,6 @@
 #include <osl/diagnose.h>
 
 #define PLATFORM_ALL                "all"
-#define PLATFORM_WIN_X86            "windows_x86"
-#define PLATFORM_WIN_X86_64         "windows_x86_64"
-#define PLATFORM_LINUX_X86          "linux_x86"
-#define PLATFORM_LINUX_X86_64       "linux_x86_64"
-#define PLATFORM_KFREEBSD_X86       "kfreebsd_x86"
-#define PLATFORM_KFREEBSD_X86_64    "kfreebsd_x86_64"
-#define PLATFORM_LINUX_SPARC        "linux_sparc"
-#define PLATFORM_LINUX_POWERPC      "linux_powerpc"
-#define PLATFORM_LINUX_POWERPC64    "linux_powerpc64"
-#define PLATFORM_LINUX_POWERPC64_LE "linux_powerpc64_le"
-#define PLATFORM_LINUX_ARM_EABI     "linux_arm_eabi"
-#define PLATFORM_LINUX_ARM_OABI     "linux_arm_oabi"
-#define PLATFORM_LINUX_MIPS_EL      "linux_mips_el"
-#define PLATFORM_LINUX_MIPS64_EL    "linux_mips64_el"
-#define PLATFORM_LINUX_MIPS_EB      "linux_mips_eb"
-#define PLATFORM_LINUX_MIPS64_EB    "linux_mips64_eb"
-#define PLATFORM_LINUX_IA64         "linux_ia64"
-#define PLATFORM_LINUX_M68K         "linux_m68k"
-#define PLATFORM_LINUX_S390         "linux_s390"
-#define PLATFORM_LINUX_S390x        "linux_s390x"
-#define PLATFORM_LINUX_HPPA         "linux_hppa"
-#define PLATFORM_LINUX_ALPHA        "linux_alpha"
-#define PLATFORM_LINUX_AARCH64      "linux_aarch64"
-
-
-#define PLATFORM_SOLARIS_SPARC      "solaris_sparc"
-#define PLATFORM_SOLARIS_SPARC64    "solaris_sparc64"
-#define PLATFORM_SOLARIS_X86        "solaris_x86"
-#define PLATFORM_FREEBSD_POWERPC    "freebsd_powerpc"
-#define PLATFORM_FREEBSD_X86        "freebsd_x86"
-#define PLATFORM_FREEBSD_X86_64     "freebsd_x86_64"
-#define PLATFORM_NETBSD_X86         "netbsd_x86"
-#define PLATFORM_NETBSD_X86_64      "netbsd_x86_64"
-#define PLATFORM_MACOSX_X86         "macosx_x86"
-#define PLATFORM_MACOSX_X86_64      "macosx_x86_64"
-#define PLATFORM_OPENBSD_X86        "openbsd_x86"
-#define PLATFORM_OPENBSD_X86_64     "openbsd_x86_64"
-#define PLATFORM_DRAGONFLY_X86      "dragonfly_x86"
-#define PLATFORM_DRAGONFLY_X86_64   "dragonfly_x86_64"
-
-
-#define PLATFORM_AIX_POWERPC        "aix_powerpc"
 
 
 namespace dp_misc
@@ -111,91 +69,89 @@ namespace
             && (cpu == StrCPU::get());
     }
 
-    bool isValidPlatform(OUString const &  token )
+    bool isPlatformSupported( OUString const &  token )
     {
         bool ret = false;
         if (token == PLATFORM_ALL)
             ret = true;
-        else if (token == PLATFORM_WIN_X86)
+        else if (token == "windows_x86")
             ret = checkOSandCPU("Windows", "x86");
-        else if (token == PLATFORM_WIN_X86_64)
+        else if (token == "windows_x86_64")
             ret = checkOSandCPU("Windows", "x86_64");
-        else if (token == PLATFORM_LINUX_X86)
+        else if (token == "solaris_sparc")
+            ret = checkOSandCPU("Solaris", "SPARC");
+        else if (token == "solaris_sparc64")
+            ret = checkOSandCPU("Solaris", "SPARC64");
+        else if (token == "solaris_x86")
+            ret = checkOSandCPU("Solaris", "x86");
+        else if (token == "aix_powerpc")
+            ret = checkOSandCPU("AIX", "PowerPC");
+        else if (token == "macosx_x86_64")
+            ret = checkOSandCPU("MacOSX", "X86_64");
+        else if (token == "linux_x86")
             ret = checkOSandCPU("Linux", "x86");
-        else if (token == PLATFORM_LINUX_X86_64)
+        else if (token == "linux_x86_64")
             ret = checkOSandCPU("Linux", "X86_64");
-        else if (token == PLATFORM_KFREEBSD_X86)
-            ret = checkOSandCPU("kFreeBSD", "x86");
-        else if (token == PLATFORM_KFREEBSD_X86_64)
-            ret = checkOSandCPU("kFreeBSD", "X86_64");
-        else if (token == PLATFORM_LINUX_SPARC)
+        else if (token == "linux_sparc")
             ret = checkOSandCPU("Linux", "SPARC");
-        else if (token == PLATFORM_LINUX_POWERPC)
+        else if (token == "linux_powerpc")
             ret = checkOSandCPU("Linux", "PowerPC");
-        else if (token == PLATFORM_LINUX_POWERPC64)
+        else if (token == "linux_powerpc64")
             ret = checkOSandCPU("Linux", "PowerPC_64");
-        else if (token == PLATFORM_LINUX_POWERPC64_LE)
+        else if (token == "linux_powerpc64_le")
             ret = checkOSandCPU("Linux", "PowerPC_64_LE");
-        else if (token == PLATFORM_LINUX_ARM_EABI)
+        else if (token == "linux_arm_eabi")
             ret = checkOSandCPU("Linux", "ARM_EABI");
-        else if (token == PLATFORM_LINUX_ARM_OABI)
+        else if (token == "linux_arm_oabi")
             ret = checkOSandCPU("Linux", "ARM_OABI");
-        else if (token == PLATFORM_LINUX_MIPS_EL)
+        else if (token == "linux_mips_el")
             ret = checkOSandCPU("Linux", "MIPS_EL");
-        else if (token == PLATFORM_LINUX_MIPS64_EL)
+        else if (token == "linux_mips64_el")
             ret = checkOSandCPU("Linux", "MIPS64_EL");
-        else if (token == PLATFORM_LINUX_MIPS_EB)
+        else if (token == "linux_mips_eb")
             ret = checkOSandCPU("Linux", "MIPS_EB");
-        else if (token == PLATFORM_LINUX_MIPS64_EB)
+        else if (token == "linux_mips64_eb")
             ret = checkOSandCPU("Linux", "MIPS64_EB");
-        else if (token == PLATFORM_LINUX_IA64)
+        else if (token == "linux_ia64")
             ret = checkOSandCPU("Linux", "IA64");
-        else if (token == PLATFORM_LINUX_M68K)
+        else if (token == "linux_m68k")
             ret = checkOSandCPU("Linux", "M68K");
-        else if (token == PLATFORM_LINUX_S390)
+        else if (token == "linux_s390")
             ret = checkOSandCPU("Linux", "S390");
-        else if (token == PLATFORM_LINUX_S390x)
+        else if (token == "linux_s390x")
             ret = checkOSandCPU("Linux", "S390x");
-        else if (token == PLATFORM_LINUX_HPPA)
+        else if (token == "linux_hppa")
             ret = checkOSandCPU("Linux", "HPPA");
-        else if (token == PLATFORM_LINUX_ALPHA)
+        else if (token == "linux_alpha")
             ret = checkOSandCPU("Linux", "ALPHA");
-        else if (token == PLATFORM_LINUX_AARCH64)
+        else if (token == "linux_aarch64")
             ret = checkOSandCPU("Linux", "AARCH64");
-        else if (token == PLATFORM_SOLARIS_SPARC)
-            ret = checkOSandCPU("Solaris", "SPARC");
-        else if (token == PLATFORM_SOLARIS_SPARC64)
-            ret = checkOSandCPU("Solaris", "SPARC64");
-        else if (token == PLATFORM_SOLARIS_X86)
-            ret = checkOSandCPU("Solaris", "x86");
-        else if (token == PLATFORM_FREEBSD_X86)
+        else if (token == "freebsd_x86")
             ret = checkOSandCPU("FreeBSD", "x86");
-        else if (token == PLATFORM_FREEBSD_X86_64)
+        else if (token == "freebsd_x86_64")
             ret = checkOSandCPU("FreeBSD", "X86_64");
-        else if (token == PLATFORM_FREEBSD_POWERPC)
+        else if (token == "freebsd_powerpc")
             ret = checkOSandCPU("FreeBSD", "PowerPC");
-        else if (token == PLATFORM_NETBSD_X86)
+        else if (token == "kfreebsd_x86")
+            ret = checkOSandCPU("kFreeBSD", "x86");
+        else if (token == "kfreebsd_x86_64")
+            ret = checkOSandCPU("kFreeBSD", "X86_64");
+        else if (token == "netbsd_x86")
             ret = checkOSandCPU("NetBSD", "x86");
-        else if (token == PLATFORM_NETBSD_X86_64)
+        else if (token == "netbsd_x86_64")
             ret = checkOSandCPU("NetBSD", "X86_64");
-        else if (token == PLATFORM_MACOSX_X86)
-            ret = checkOSandCPU("MacOSX", "x86");
-        else if (token == PLATFORM_MACOSX_X86_64)
-            ret = checkOSandCPU("MacOSX", "X86_64");
-        else if (token == PLATFORM_AIX_POWERPC)
-            ret = checkOSandCPU("AIX", "PowerPC");
-        else if (token == PLATFORM_OPENBSD_X86)
+        else if (token == "openbsd_x86")
             ret = checkOSandCPU("OpenBSD", "x86");
-        else if (token == PLATFORM_OPENBSD_X86_64)
+        else if (token == "openbsd_x86_64")
             ret = checkOSandCPU("OpenBSD", "X86_64");
-        else if (token == PLATFORM_DRAGONFLY_X86)
+        else if (token == "dragonfly_x86")
             ret = checkOSandCPU("DragonFly", "x86");
-        else if (token == PLATFORM_DRAGONFLY_X86_64)
+        else if (token == "dragonfly_x86_64")
             ret = checkOSandCPU("DragonFly", "X86_64");
         else
         {
             OSL_FAIL("Extension Manager: The extension supports an unknown platform. "
-            "Check the platform element in the description.xml");
+            "Check the platform in the description.xml");
             ret = false;
         }
         return ret;
@@ -234,7 +190,7 @@ bool hasValidPlatform( css::uno::Sequence<OUString> const & platformStrings)
     bool ret = false;
     for (sal_Int32 i  = 0; i < platformStrings.getLength(); i++)
     {
-        if (isValidPlatform(platformStrings[i]))
+        if ( isPlatformSupported( platformStrings[i] ))
         {
             ret = true;
             break;


More information about the Libreoffice-commits mailing list