[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - slideshow/source

Michael Meeks michael.meeks at collabora.com
Tue Feb 9 19:07:20 UTC 2016


 slideshow/source/engine/animationnodes/basecontainernode.cxx |    4 +--
 slideshow/source/engine/animationnodes/basenode.cxx          |    6 ++--
 slideshow/source/engine/animationnodes/nodetools.cxx         |   14 +++++++----
 slideshow/source/engine/animationnodes/nodetools.hxx         |    4 +--
 4 files changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 5f2db838a0bbadc9e0f710237a39dde231a138f2
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Feb 9 13:41:27 2016 +0000

    slideshow: Don't de-reference Nodes cast to const char *.
    
    This crept in with a conversion in:
        7bdc6be9c23517eec02ce7139edd7003abbee1f8
    
    Change-Id: Ic1c62122934d5857326258565e4b54ef6e81b884
    Reviewed-on: https://gerrit.libreoffice.org/22237
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/22240
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/slideshow/source/engine/animationnodes/basecontainernode.cxx b/slideshow/source/engine/animationnodes/basecontainernode.cxx
index 95e9ef1..cf4c238 100644
--- a/slideshow/source/engine/animationnodes/basecontainernode.cxx
+++ b/slideshow/source/engine/animationnodes/basecontainernode.cxx
@@ -181,9 +181,9 @@ void BaseContainerNode::showState() const
             boost::dynamic_pointer_cast<BaseNode>(maChildren[i]);
         SAL_INFO("slideshow.verbose",
                  "Node connection: n" <<
-                 reinterpret_cast<const char*>(this)+debugGetCurrentOffset() <<
+                 debugGetNodeName(this) <<
                  " -> n" <<
-                 reinterpret_cast<const char*>(pNode.get())+debugGetCurrentOffset() );
+                 debugGetNodeName(pNode.get()));
         pNode->showState();
     }
 
diff --git a/slideshow/source/engine/animationnodes/basenode.cxx b/slideshow/source/engine/animationnodes/basenode.cxx
index 5e0b3fb..edfe95e 100644
--- a/slideshow/source/engine/animationnodes/basenode.cxx
+++ b/slideshow/source/engine/animationnodes/basenode.cxx
@@ -681,13 +681,13 @@ void BaseNode::showState() const
 
     if( eNodeState == AnimationNode::INVALID )
         SAL_INFO("slideshow.verbose", "Node state: n" <<
-                 reinterpret_cast<const char*>(this)+debugGetCurrentOffset() <<
+                 debugGetNodeName(this) <<
                  " [label=\"" <<
                  getDescription() <<
                  "\",style=filled, fillcolor=\"0.5,0.2,0.5\"]");
     else
         SAL_INFO("slideshow.verbose", "Node state: n" <<
-                 reinterpret_cast<const char*>(this)+debugGetCurrentOffset() <<
+                 debugGetNodeName(this) <<
                  " [label=\"" <<
                  getDescription() <<
                  "fillcolor=\"" <<
@@ -721,7 +721,7 @@ void BaseNode::showState() const
             if( xPropSet->getPropertyValue("Name") >>= aName )
             {
                 SAL_INFO("slideshow.verbose", "Node info: n" <<
-                         reinterpret_cast<const char*>(this)+debugGetCurrentOffset() <<
+                         debugGetNodeName(this) <<
                          ", name \"" <<
                          aName <<
                          "\"");
diff --git a/slideshow/source/engine/animationnodes/nodetools.cxx b/slideshow/source/engine/animationnodes/nodetools.cxx
index 1d0b122..e38445b 100644
--- a/slideshow/source/engine/animationnodes/nodetools.cxx
+++ b/slideshow/source/engine/animationnodes/nodetools.cxx
@@ -31,11 +31,15 @@ namespace slideshow
     namespace internal
     {
 #if defined(DBG_UTIL)
-        int& debugGetCurrentOffset()
-        {
-            static int lcl_nOffset = 0; // to make each tree output distinct
+        static sal_Int32 lcl_nOffset = 0;
 
-            return lcl_nOffset;
+        OUString debugGetNodeName( const BaseNode *pNode )
+        {
+            OUStringBuffer aBuf;
+            aBuf.append(lcl_nOffset);
+            aBuf.append(" - 0x");
+            aBuf.append(reinterpret_cast<sal_Int64>(pNode), 16);
+            return aBuf.makeStringAndClear();
         }
 
         void debugNodesShowTree( const BaseNode* pNode )
@@ -43,7 +47,7 @@ namespace slideshow
             if( pNode )
                 pNode->showState();
 
-            ++debugGetCurrentOffset();
+            ++lcl_nOffset;
         }
 #endif
 
diff --git a/slideshow/source/engine/animationnodes/nodetools.hxx b/slideshow/source/engine/animationnodes/nodetools.hxx
index cf25d79..55a4c4f 100644
--- a/slideshow/source/engine/animationnodes/nodetools.hxx
+++ b/slideshow/source/engine/animationnodes/nodetools.hxx
@@ -45,8 +45,8 @@ namespace slideshow
 
 
 #if defined(DBG_UTIL)
-        int& debugGetCurrentOffset();
-        void debugNodesShowTree( const BaseNode* );
+        OUString debugGetNodeName( const BaseNode *pNode );
+        void     debugNodesShowTree( const BaseNode* );
 #endif
 
         /** Look up an AttributableShape from ShapeManager.


More information about the Libreoffice-commits mailing list