[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/source

Stephan Bergmann sbergman at redhat.com
Mon Jun 15 00:54:21 PDT 2015


 include/vcl/vclptr.hxx    |   22 +++++++++++++++-------
 vcl/source/outdev/map.cxx |    3 ++-
 2 files changed, 17 insertions(+), 8 deletions(-)

New commits:
commit d7763d97fe836c013f2026a79f33e49a6b507efc
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jun 15 09:50:44 2015 +0200

    Assume that nDPI should never be zero in ImplLogicToPixel
    
    ...(same as is already done in ImplPixelToLogic), and that
    eacbead4f5a4dc7c8db3d60c948e28c199aa2b10 "vcl: handle nDPI == 0 in
    ImplPixelToLogic()" was a misguided attempt at fixing symptoms of the problem
    fixed with 670100fcfbb39d3dbe4afdb27fbced26d7b14283 "Remove FastLoader
    optimization."
    
    Change-Id: Ia42c6c7c7026f3a0b71e79938b33c140fec0afa6

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index c330f19..37db101 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -400,9 +400,10 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
 static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
                               long nThres )
 {
+    assert(nDPI > 0);
     // To "use" it...
    (void) nThres;
-   if (nMapNum == 0 || nDPI == 0)
+   if (nMapNum == 0)
    {
        return 0;
    }
commit 0f1976988a69fd91100a73331d12f21aa9861e83
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jun 15 09:17:40 2015 +0200

    Fix VclPtr assignment operators
    
    The original templated assignment operator would never have been used, as
    std::enable_if expects a bool value as first template argument.  But it was also
    unnecessary anyway:
    
    (1) Assignment from VclPtr<reference_type> was (and is) covered by the
        implicitly defined copy assignment operator.
    
    (2) Assignment from naked reference_type* was covered by the user-supplied
        constructor from reference_type* to temporary, followed by (1); it is now
        covered directly by the user-supplied assignment operator from
        reference_type*.
    
    (3) Assignment from VclPtr<derived_type> was covered by the user-supplied,
        templated constructor from VclPtr<derived_type> to temporary, followed by
        (1); it is now covered directly by the user-supplied, templated assignment
        operator from VclPtr<derived_type>.
    
    (4) Assignment from naked derived_type* was (and is) covered by an implicit
        pointer up-cast, followed by (2).
    
    Change-Id: I3c7527feea72fdda76d911a42ae856c353b700b5

diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
index cd8f46f..79c784f 100644
--- a/include/vcl/vclptr.hxx
+++ b/include/vcl/vclptr.hxx
@@ -65,7 +65,8 @@ private:
     };
 
 public:
-    typedef typename C< sizeof (f(H(), 0)) == 1, void *, void >::t t;
+    static bool const value = sizeof (f(H(), 0)) == 1;
+    typedef typename C< value, void *, void >::t t;
 };
 
 }; }; // namespace detail, namespace vcl
@@ -163,16 +164,23 @@ public:
         m_rInnerRef.set(pBody);
     }
 
-    /** Up-casting conversion constructor: Copies interface reference.
+    /** Up-casting assignment operator.
 
-        Does not work for up-casts to ambiguous bases.  For the special case of
-        up-casting to Reference< XInterface >, see the corresponding conversion
-        operator.
+        Does not work for up-casts to ambiguous bases.
 
         @param rRef another reference
     */
-    template< class derived_type, class = typename std::enable_if< ::vcl::detail::UpCast< reference_type, derived_type >::t >::type >
-    inline VclPtr<reference_type>& operator= (derived_type * pBody)
+    template<typename derived_type>
+    typename std::enable_if<
+        vcl::detail::UpCast<reference_type, derived_type>::value,
+        VclPtr &>::type
+    operator =(VclPtr<derived_type> const & rRef)
+    {
+        m_rInnerRef.set(rRef.get());
+        return *this;
+    }
+
+    VclPtr & operator =(reference_type * pBody)
     {
         m_rInnerRef.set(pBody);
         return *this;


More information about the Libreoffice-commits mailing list