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

Michael Stahl mstahl at redhat.com
Wed Jun 10 05:44:56 PDT 2015


 include/svl/itemprop.hxx              |   10 +++++--
 pyuno/source/module/pyuno_runtime.cxx |   44 ----------------------------------
 2 files changed, 7 insertions(+), 47 deletions(-)

New commits:
commit 1ee5e1a17cbd50f84990fb43fac7e8c811e604a9
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jun 10 13:07:17 2015 +0200

    pyuno: remove obsolete LC_NUMERIC to "C" mangling code
    
    The CPython changelog says for version 2.4:
    
    - Python no longer relies on the LC_NUMERIC locale setting to be
      the "C" locale; as a result, it no longer tries to prevent changing
      the LC_NUMERIC category.
    
    Change-Id: I6d63c4dedca48c99bf81135d69285d9116a19740

diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 309f148..2509997 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -29,7 +29,6 @@
 #include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/bootstrap.hxx>
-#include <locale.h>
 
 #include <typelib/typedescription.hxx>
 
@@ -982,26 +981,6 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue,
 }
 
 
-static const char * g_NUMERICID = "pyuno.lcNumeric";
-static ::std::vector< OString > g_localeList;
-
-static const char *ensureUnlimitedLifetime( const char *str )
-{
-    int size = g_localeList.size();
-    int i;
-    for( i = 0 ; i < size ; i ++ )
-    {
-        if( 0 == strcmp( g_localeList[i].getStr(), str ) )
-            break;
-    }
-    if( i == size )
-    {
-        g_localeList.push_back( str );
-    }
-    return g_localeList[i].getStr();
-}
-
-
 PyThreadAttach::PyThreadAttach( PyInterpreterState *interp)
     throw ( com::sun::star::uno::RuntimeException )
 {
@@ -1009,35 +988,18 @@ PyThreadAttach::PyThreadAttach( PyInterpreterState *interp)
     if( !tstate  )
         throw RuntimeException( "Couldn't create a pythreadstate" );
     PyEval_AcquireThread( tstate);
-    // set LC_NUMERIC to "C"
-    const char * oldLocale =
-        ensureUnlimitedLifetime( setlocale( LC_NUMERIC, 0 )  );
-    setlocale( LC_NUMERIC, "C" );
-    PyRef locale( // python requires C locale
-        PyLong_FromVoidPtr( const_cast<char *>(oldLocale) ), SAL_NO_ACQUIRE);
-    PyDict_SetItemString(
-        PyThreadState_GetDict(), g_NUMERICID, locale.get() );
 }
 
 PyThreadAttach::~PyThreadAttach()
 {
-    PyObject *value =
-        PyDict_GetItemString( PyThreadState_GetDict( ), g_NUMERICID );
-    if( value )
-        setlocale( LC_NUMERIC, static_cast<const char *>(PyLong_AsVoidPtr( value )) );
     PyThreadState_Clear( tstate );
     PyEval_ReleaseThread( tstate );
     PyThreadState_Delete( tstate );
-
 }
 
 PyThreadDetach::PyThreadDetach() throw ( com::sun::star::uno::RuntimeException )
 {
     tstate = PyThreadState_Get();
-    PyObject *value =
-        PyDict_GetItemString( PyThreadState_GetDict( ), g_NUMERICID );
-    if( value )
-        setlocale( LC_NUMERIC, static_cast<const char *>(PyLong_AsVoidPtr( value )) );
     PyEval_ReleaseThread( tstate );
 }
 
@@ -1047,12 +1009,6 @@ PyThreadDetach::PyThreadDetach() throw ( com::sun::star::uno::RuntimeException )
 PyThreadDetach::~PyThreadDetach()
 {
     PyEval_AcquireThread( tstate );
-//     PyObject *value =
-//         PyDict_GetItemString( PyThreadState_GetDict( ), g_NUMERICID );
-
-    // python requires C LC_NUMERIC locale,
-    // always set even when it is already "C"
-    setlocale( LC_NUMERIC, "C" );
 }
 
 
commit 82dbf859f18eeda9f7051a4e5d1b5613e6b53434
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jun 9 22:38:39 2015 +0200

    svl: document SfxItemPropertyMapEntry
    
    Change-Id: I7caa540d069addb610310830c26ecd647afc6538

diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx
index 6da36a3..ea5d7e5 100644
--- a/include/svl/itemprop.hxx
+++ b/include/svl/itemprop.hxx
@@ -27,12 +27,16 @@
 #include <svl/svldllapi.h>
 #include <vector>
 
+/// map a property between beans::XPropertySet and SfxPoolItem
 struct SfxItemPropertyMapEntry
 {
-    OUString                            aName;
-    sal_uInt16                          nWID;
-    com::sun::star::uno::Type           aType;
+    OUString                            aName; ///< name of property
+    sal_uInt16                          nWID;  ///< WhichId of SfxPoolItem
+    com::sun::star::uno::Type           aType; ///< UNO type of property
+    /// flag bitmap, @see com::sun::star::beans::PropertyAttribute
     long                                nFlags;
+    /// "member ID" to tell QueryValue/PutValue which property it is
+    /// (when multiple properties map to the same nWID)
     sal_uInt8                           nMemberId;
 
 };


More information about the Libreoffice-commits mailing list