[Libreoffice-commits] .: 2 commits - unoxml/source writerfilter/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Jun 2 03:43:21 PDT 2011


 unoxml/source/dom/node.cxx                            |   22 +++++-------------
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   19 +++++----------
 2 files changed, 14 insertions(+), 27 deletions(-)

New commits:
commit 7de04768bc2c5b1dc9aa978f9902743d856ff786
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 2 00:21:52 2011 +0100

    use standard template for this

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 7e588f7..6cd244d 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -29,7 +29,7 @@
 #include <stdio.h>
 #include <iostream>
 #include <set>
-#include <rtl/uuid.h>
+#include <comphelper/servicehelper.hxx>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <resourcemodel/QNameToString.hxx>
 #include <resourcemodel/XPathLogger.hxx>
@@ -67,15 +67,6 @@ using ::com::sun::star::lang::XMultiComponentFactory;
 using namespace ::com::sun::star;
 using namespace ::std;
 
-static uno::Sequence< sal_Int8 >  CreateUnoTunnelId()
-{
-    static osl::Mutex aCreateMutex;
-    osl::Guard<osl::Mutex> aGuard( aCreateMutex );
-    uno::Sequence< sal_Int8 > aSeq( 16 );
-    rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0,	sal_True );
-    return aSeq;
-}
-
 static string resourceToString
 (OOXMLFastContextHandler::ResourceEnum_t eResource)
 {
@@ -340,10 +331,14 @@ throw (uno::RuntimeException, xml::sax::SAXException)
     OOXMLFactory::getInstance()->characters(this, rString);
 }
 
+namespace
+{
+    class theOOXMLFastContextHandlerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theOOXMLFastContextHandlerUnoTunnelId > {};
+}
+
 const uno::Sequence< sal_Int8 > & OOXMLFastContextHandler::getUnoTunnelId()
 {
-    static uno::Sequence< sal_Int8 > aSeq = CreateUnoTunnelId();
-    return aSeq;
+    return theOOXMLFastContextHandlerUnoTunnelId::get().getSeq();
 }
 
 sal_Int64 SAL_CALL OOXMLFastContextHandler::getSomething( const uno::Sequence< sal_Int8 >& rId )
commit 3f80defe085bb1a0db56ec8c9e983a0b4b5e831c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 2 00:18:25 2011 +0100

    swap in the standard template for this

diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index cbfbf4f..6be2d1b 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -43,6 +43,8 @@
 
 #include <com/sun/star/xml/sax/FastToken.hpp>
 
+#include <comphelper/servicehelper.hxx>
+
 #include <document.hxx>
 #include <attr.hxx>
 #include <childlist.hxx>
@@ -54,19 +56,9 @@
 
 using namespace ::com::sun::star;
 
-
-namespace {
-    struct UnoTunnelId
-        : public ::rtl::StaticWithInit< Sequence<sal_Int8>, UnoTunnelId >
-    {
-        Sequence<sal_Int8> operator() ()
-        {
-            Sequence<sal_Int8> ret(16);
-            rtl_createUuid(
-                reinterpret_cast<sal_uInt8*>(ret.getArray()), 0, sal_True);
-            return ret;
-        }
-    };
+namespace
+{
+    class theCNodeUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theCNodeUnoTunnelId > {};
 }
 
 namespace DOM
@@ -192,7 +184,7 @@ namespace DOM
         if (!xUnoTunnel.is()) { return 0; }
         CNode *const pCNode( reinterpret_cast< CNode* >(
                         ::sal::static_int_cast< sal_IntPtr >(
-                            xUnoTunnel->getSomething(UnoTunnelId::get()))));
+                            xUnoTunnel->getSomething(theCNodeUnoTunnelId::get().getSeq()))));
         return pCNode;
     }
 
@@ -1053,7 +1045,7 @@ namespace DOM
         throw (RuntimeException)
     {
         if ((rId.getLength() == 16) &&
-            (0 == rtl_compareMemory(UnoTunnelId::get().getConstArray(),
+            (0 == rtl_compareMemory(theCNodeUnoTunnelId::get().getSeq().getConstArray(),
                                     rId.getConstArray(), 16)))
         {
             return ::sal::static_int_cast< sal_Int64 >(


More information about the Libreoffice-commits mailing list