[Libreoffice-commits] core.git: desktop/source drawinglayer/source include/android oox/source sc/source vcl/source vcl/unx writerfilter/source

brainbreaker gautamprajapati06 at gmail.com
Tue Jul 18 08:15:23 UTC 2017


 desktop/source/lib/init.cxx                               |   20 ----
 drawinglayer/source/primitive2d/borderlineprimitive2d.cxx |   11 --
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |   12 --
 include/android/compatibility.hxx                         |   68 ++++++++++++++
 oox/source/export/drawingml.cxx                           |   11 --
 sc/source/core/data/attrib.cxx                            |   14 --
 sc/source/filter/excel/xetable.cxx                        |   12 --
 vcl/source/filter/sgvspln.cxx                             |   11 --
 vcl/source/gdi/CommonSalLayout.cxx                        |   12 --
 vcl/unx/generic/gdi/cairotextrender.cxx                   |   11 --
 writerfilter/source/rtftok/rtfsdrimport.cxx               |   11 --
 11 files changed, 79 insertions(+), 114 deletions(-)

New commits:
commit e530689ef6ba79a26162670580ba28f9b09eb689
Author: brainbreaker <gautamprajapati06 at gmail.com>
Date:   Thu Jul 13 09:43:23 2017 +0530

    Clean up android specific template functions defined in std namespace
    
    Change-Id: I2094ee8eec00587f166d96723a02eb5957dbf79b
    Reviewed-on: https://gerrit.libreoffice.org/39890
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c57c4e4d6760..fd62da29d704 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -85,6 +85,7 @@
 #include <sfx2/sfxbasemodel.hxx>
 #include <svl/undo.hxx>
 #include <unotools/datetime.hxx>
+#include <android/compatibility.hxx>
 
 #include <app.hxx>
 
@@ -102,25 +103,6 @@ using namespace vcl;
 using namespace desktop;
 using namespace utl;
 
-#if defined(ANDROID)
-namespace std
-{
-template<typename T>
-std::string to_string(T x)
-{
-    std::ostringstream stream;
-    stream << x;
-    return stream.str();
-}
-
-long stol( const std::string& str, std::size_t* /*pos*/ = 0, int base = 10 )
-{
-    char* end;
-    return strtol(str.c_str(), &end, base);
-}
-}
-#endif
-
 static LibLibreOffice_Impl *gImpl = nullptr;
 static std::weak_ptr< LibreOfficeKitClass > gOfficeClass;
 static std::weak_ptr< LibreOfficeKitDocumentClass > gDocumentClass;
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index ce0ed78e3fbc..84ea9fff10ca 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -26,21 +26,12 @@
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
 #include <svtools/borderhelper.hxx>
 #include <editeng/borderline.hxx>
+#include <android/compatibility.hxx>
 
 #include <algorithm>
 #include <cmath>
 #include <numeric>
 
-#if defined(ANDROID)
-namespace std
-{
-template<typename T>
-T round(T x)
-{
-    return ::round(x);
-}
-}
-#endif
 
 namespace drawinglayer
 {
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 2ac5bbc0c8d6..4f9d16f76629 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -54,20 +54,10 @@
 #include <vcl/window.hxx>
 #include <svtools/borderhelper.hxx>
 #include <editeng/borderline.hxx>
+#include <android/compatibility.hxx>
 
 #include <com/sun/star/table/BorderLineStyle.hpp>
 
-#if defined(ANDROID)
-namespace std
-{
-template<typename T>
-T round(T x)
-{
-    return ::round(x);
-}
-}
-#endif
-
 using namespace com::sun::star;
 
 namespace drawinglayer
diff --git a/include/android/compatibility.hxx b/include/android/compatibility.hxx
new file mode 100644
index 000000000000..d52d1bdb2455
--- /dev/null
+++ b/include/android/compatibility.hxx
@@ -0,0 +1,68 @@
+/* -*- 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 <math.h>
+
+#if defined(ANDROID)
+namespace std
+{
+
+inline double fmax(double x, double y)
+{
+    return ::fmax(x, y);
+}
+
+inline long stol( const std::string& str, std::size_t* /*pos*/ = 0, int base = 10 )
+{
+    char* end;
+    return strtol(str.c_str(), &end, base);
+}
+
+template<typename T>
+T round(T x)
+{
+    return ::round(x);
+}
+
+template<typename T>
+T trunc(T x)
+{
+    return ::trunc(x);
+}
+
+template<typename T>
+T lround(T x)
+{
+    return ::lround(x);
+}
+
+template<typename T>
+T copysign(T x, T y)
+{
+    return ::copysign(x, y);
+}
+
+template <typename T> std::string to_string(const T& rNumber)
+{
+    std::ostringstream aStream;
+    aStream << rNumber;
+    return aStream.str();
+}
+}
+#endif
\ No newline at end of file
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7c50403f85b6..f04c0f3273d8 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -90,6 +90,7 @@
 #include <svx/svdoashp.hxx>
 #include <svx/unoapi.hxx>
 #include <svx/unoshape.hxx>
+#include <android/compatibility.hxx>
 
 using namespace ::css;
 using namespace ::css::beans;
@@ -104,16 +105,6 @@ using ::css::io::XOutputStream;
 using ::sax_fastparser::FSHelperPtr;
 using ::sax_fastparser::FastSerializerHelper;
 
-#if defined(ANDROID)
-namespace std
-{
-template<typename T>
-T lround(T x)
-{
-    return ::lround(x);
-}
-}
-#endif
 
 namespace oox {
 namespace drawingml {
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 5cde3aba4b4d..cdee5adcadd5 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -20,6 +20,8 @@
 #include <com/sun/star/util/CellProtection.hpp>
 
 #include "scitems.hxx"
+#include <android/compatibility.hxx>
+
 #include <editeng/eeitem.hxx>
 
 #include <editeng/boxitem.hxx>
@@ -36,22 +38,10 @@
 #include "sc.hrc"
 #include "mid.hrc"
 #include "globstr.hrc"
-
 #include "textuno.hxx"
 
 using namespace com::sun::star;
 
-#ifdef ANDROID
-namespace std
-{
-template <typename T> std::string to_string(const T& rNumber)
-{
-    std::ostringstream aStream;
-    aStream << rNumber;
-    return aStream.str();
-}
-}
-#endif
 
 SfxPoolItem* ScProtectionAttr::CreateDefault() { return new ScProtectionAttr; }
 SfxPoolItem* ScDoubleItem::CreateDefault() { SAL_WARN( "sc", "No ScDoubleItem factory available"); return nullptr; }
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 473f97a78daf..da8698aeebda 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -38,17 +38,7 @@
 #include <thread>
 #include <comphelper/threadpool.hxx>
 #include <oox/export/utils.hxx>
-
-#if defined(ANDROID)
-namespace std
-{
-template<typename T>
-T trunc(T x)
-{
-    return ::trunc(x);
-}
-}
-#endif
+#include <android/compatibility.hxx>
 
 using namespace ::oox;
 
diff --git a/vcl/source/filter/sgvspln.cxx b/vcl/source/filter/sgvspln.cxx
index 7781849cda9d..6fa9da2c7916 100644
--- a/vcl/source/filter/sgvspln.cxx
+++ b/vcl/source/filter/sgvspln.cxx
@@ -24,16 +24,7 @@
 #include <sgvspln.hxx>
 #include <cmath>
 
-#if defined(ANDROID)
-namespace std
-{
-template<typename T>
-T copysign(T x, T y)
-{
-    return ::copysign(x, y);
-}
-}
-#endif
+#include <android/compatibility.hxx>
 
 extern "C" {
 
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index cb4f3d3862cc..e826d38be1fe 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -27,17 +27,7 @@
 #include <limits>
 #include <salgdi.hxx>
 #include <unicode/uchar.h>
-
-#if defined(ANDROID)
-namespace std
-{
-template<typename T>
-T lround(T x)
-{
-    return ::lround(x);
-}
-}
-#endif
+#include <android/compatibility.hxx>
 
 static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData)
 {
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 3124725785d6..bb3ffa456377 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -24,6 +24,7 @@
 #include <vcl/sysdata.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/fontcharmap.hxx>
+#include <android/compatibility.hxx>
 
 #include "unx/printergfx.hxx"
 #include "unx/genpspgraphics.h"
@@ -38,16 +39,6 @@
 #include <cairo-ft.h>
 #include "CommonSalLayout.hxx"
 
-#ifdef ANDROID
-namespace std
-{
-double fmax(double x, double y)
-{
-    return ::fmax(x, y);
-}
-}
-#endif
-
 namespace {
 
 typedef struct FT_FaceRec_* FT_Face;
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index d270f212b9c3..cea03b801f9f 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -42,19 +42,10 @@
 #include <oox/helper/propertyset.hxx>
 #include <boost/logic/tribool.hpp>
 #include <basegfx/matrix/b2dhommatrix.hxx>
+#include <android/compatibility.hxx>
 
 using namespace com::sun::star;
 
-#if defined(ANDROID)
-namespace std
-{
-template<typename T>
-T lround(T x)
-{
-    return ::lround(x);
-}
-}
-#endif
 
 namespace writerfilter
 {


More information about the Libreoffice-commits mailing list