[Libreoffice-commits] .: 3 commits - padmin/source svtools/source vcl/inc vcl/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Jul 21 02:35:11 PDT 2011


 padmin/source/cmddlg.cxx          |    8 +++----
 padmin/source/newppdlg.cxx        |   10 ++++-----
 svtools/source/svhtml/htmlout.cxx |   42 ++++++++++++++++++++++++--------------
 vcl/inc/vcl/threadex.hxx          |   18 ----------------
 vcl/source/helper/threadex.cxx    |   40 ------------------------------------
 5 files changed, 36 insertions(+), 82 deletions(-)

New commits:
commit 26641caa9d5e2a5e8df76d9047a1d8ee0c93aa28
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 20 21:59:22 2011 +0100

    callcatcher: unused ThreadExecutor

diff --git a/vcl/inc/vcl/threadex.hxx b/vcl/inc/vcl/threadex.hxx
index 1e1ab0e..ed5a8aa 100644
--- a/vcl/inc/vcl/threadex.hxx
+++ b/vcl/inc/vcl/threadex.hxx
@@ -39,24 +39,6 @@
 
 namespace vcl
 {
-    class VCL_DLLPUBLIC ThreadExecutor
-    {
-        oslThread				m_aThread;
-        oslCondition			m_aFinish;
-        long					m_nReturn;
-
-    #ifdef THREADEX_IMPLEMENTATION
-    public:
-        SAL_DLLPRIVATE static void SAL_CALL worker( void* );
-    #endif
-    public:
-        ThreadExecutor();
-        virtual ~ThreadExecutor();
-
-        virtual long doIt() = 0;
-        long execute();
-    };
-
     class VCL_DLLPUBLIC SolarThreadExecutor
     {
         oslCondition            m_aStart;
diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx
index db08a80..672ae88 100644
--- a/vcl/source/helper/threadex.cxx
+++ b/vcl/source/helper/threadex.cxx
@@ -35,46 +35,6 @@
 
 using namespace vcl;
 
-ThreadExecutor::ThreadExecutor()
-{
-    m_aFinish = osl_createCondition();
-    m_aThread = NULL;
-}
-
-ThreadExecutor::~ThreadExecutor()
-{
-    osl_destroyCondition( m_aFinish );
-    if( m_aThread )
-        osl_destroyThread( m_aThread );
-}
-
-extern "C"
-{
-    static void call_worker( void* pInstance )
-    {
-        ThreadExecutor::worker( pInstance );
-    }
-}
-
-void ThreadExecutor::worker( void* pInstance )
-{
-    ThreadExecutor* pThis = ((ThreadExecutor*)pInstance);
-    pThis->m_nReturn = pThis->doIt();
-    osl_setCondition( pThis->m_aFinish );
-}
-
-long ThreadExecutor::execute()
-{
-    osl_resetCondition( m_aFinish );
-    if( m_aThread )
-        osl_destroyThread( m_aThread ), m_aThread = NULL;
-    m_aThread = osl_createThread( call_worker, this );
-    while( ! osl_checkCondition( m_aFinish ) )
-        Application::Reschedule();
-    return m_nReturn;
-}
-
-
 SolarThreadExecutor::SolarThreadExecutor()
     :m_nReturn( 0 )
     ,m_bTimeout( false )
commit a25797b8bf0e0649a5c16b82444a6a105240052b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 20 21:41:40 2011 +0100

    ByteString::CreateFromInt32->rtl::OString::valueOf

diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx
index 5288b43..7f85405 100644
--- a/padmin/source/cmddlg.cxx
+++ b/padmin/source/cmddlg.cxx
@@ -129,11 +129,11 @@ void CommandStore::getStoredCommands( const char* pGroup, ::std::list< String >&
 {
     Config& rConfig( getPadminRC() );
     rConfig.SetGroup( pGroup );
-    int nKeys = rConfig.GetKeyCount();
+    sal_Int32 nKeys = rConfig.GetKeyCount();
     ::std::list< String >::const_iterator it;
     while( nKeys-- )
     {
-        String aCommand( rConfig.ReadKey( ByteString::CreateFromInt32( nKeys ), RTL_TEXTENCODING_UTF8 ) );
+        String aCommand( rConfig.ReadKey(rtl::OString::valueOf(nKeys), RTL_TEXTENCODING_UTF8 ) );
         if( aCommand.Len() )
         {
             for( it = rCommands.begin(); it != rCommands.end() && *it != aCommand; ++it )
@@ -156,7 +156,7 @@ void CommandStore::setCommands(
     ::std::list< String >::const_iterator it, loop;
     ::std::list< String > aWriteList;
     
-    int nWritten = 0;
+    sal_Int32 nWritten = 0;
     for( it = rCommands.begin(); it != rCommands.end(); ++it )
     {
         if( it->Len() )
@@ -176,7 +176,7 @@ void CommandStore::setCommands(
         nWritten--;
     }
     for( nWritten = 0, it = aWriteList.begin(); it != aWriteList.end(); ++it, ++nWritten )
-        rConfig.WriteKey( ByteString::CreateFromInt32( nWritten ), ByteString( *it, RTL_TEXTENCODING_UTF8 ) );
+        rConfig.WriteKey( rtl::OString::valueOf(nWritten), ByteString( *it, RTL_TEXTENCODING_UTF8 ) );
 }
 
 
diff --git a/padmin/source/newppdlg.cxx b/padmin/source/newppdlg.cxx
index 4f08b03..5428a99 100644
--- a/padmin/source/newppdlg.cxx
+++ b/padmin/source/newppdlg.cxx
@@ -77,9 +77,9 @@ PPDImportDialog::PPDImportDialog( Window* pParent ) :
     Config& rConfig = getPadminRC();
     rConfig.SetGroup( PPDIMPORT_GROUP );
     m_aPathBox.SetText( String( rConfig.ReadKey( "LastDir" ), RTL_TEXTENCODING_UTF8 ) );
-    for( int i = 0; i < 11; i++ )
+    for (sal_Int32 i = 0; i < 11; ++i)
     {
-        ByteString aEntry( rConfig.ReadKey( ByteString::CreateFromInt32( i ) ) );
+        ByteString aEntry(rConfig.ReadKey(rtl::OString::valueOf(i)));
         if( aEntry.Len() )
             m_aPathBox.InsertEntry( String( aEntry, RTL_TEXTENCODING_UTF8 ) );
     }
@@ -117,10 +117,10 @@ void PPDImportDialog::Import()
             break;
     if( nEntries < 0 )
     {
-        int nNextEntry = rConfig.ReadKey( "NextEntry" ).ToInt32();
-        rConfig.WriteKey( ByteString::CreateFromInt32( nNextEntry ), ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) );
+        sal_Int32 nNextEntry = rConfig.ReadKey( "NextEntry" ).ToInt32();
+        rConfig.WriteKey( rtl::OString::valueOf(nNextEntry), ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) );
         nNextEntry = nNextEntry < 10 ? nNextEntry+1 : 0;
-        rConfig.WriteKey( "NextEntry", ByteString::CreateFromInt32( nNextEntry ) );
+        rConfig.WriteKey( "NextEntry", rtl::OString::valueOf(nNextEntry) );
         m_aPathBox.InsertEntry( aImportPath );
     }
     while( m_aDriverLB.GetEntryCount() )
commit 6d73fbd4472bf9d3552d08273e66c0cd132ec65c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jul 20 21:36:09 2011 +0100

    ByteString::CreateFromInt32->rtl::OStringBuffer::append

diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
index c3ac913..2e57391 100644
--- a/svtools/source/svhtml/htmlout.cxx
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -658,11 +658,16 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
                         (const IMapRectangleObject *)pObj;
                     pShape = OOO_STRING_SVTOOLS_HTML_SH_rect;
                     Rectangle aRect( pRectObj->GetRectangle() );
-                    ((((((aCoords =
-                        ByteString::CreateFromInt32(aRect.Left())) += ',')
-                        += ByteString::CreateFromInt32(aRect.Top())) += ',')
-                        += ByteString::CreateFromInt32(aRect.Right())) += ',')
-                        += ByteString::CreateFromInt32(aRect.Bottom());
+
+                    aCoords = rtl::OStringBuffer()
+                        .append(static_cast<sal_Int32>(aRect.Left()))
+                        .append(',')
+                        .append(static_cast<sal_Int32>(aRect.Top()))
+                        .append(',')
+                        .append(static_cast<sal_Int32>(aRect.Right()))
+                        .append(',')
+                        .append(static_cast<sal_Int32>(aRect.Bottom()))
+                        .makeStringAndClear();
                 }
                 break;
             case( IMAP_OBJ_CIRCLE ):
@@ -672,10 +677,14 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
                     pShape= OOO_STRING_SVTOOLS_HTML_SH_circ;
                     Point aCenter( pCirc->GetCenter() );
                     long nOff = pCirc->GetRadius();
-                    ((((aCoords =
-                        ByteString::CreateFromInt32(aCenter.X())) += ',')
-                        += ByteString::CreateFromInt32(aCenter.Y())) += ',')
-                        += ByteString::CreateFromInt32(nOff);
+
+                    aCoords = rtl::OStringBuffer()
+                        .append(static_cast<sal_Int32>(aCenter.X()))
+                        .append(',')
+                        .append(static_cast<sal_Int32>(aCenter.Y()))
+                        .append(',')
+                        .append(static_cast<sal_Int32>(nOff))
+                        .makeStringAndClear();
                 }
                 break;
             case( IMAP_OBJ_POLYGON ):
@@ -685,20 +694,23 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
                     pShape= OOO_STRING_SVTOOLS_HTML_SH_poly;
                     Polygon aPoly( pPolyObj->GetPolygon() );
                     sal_uInt16 nCount = aPoly.GetSize();
+                    rtl::OStringBuffer aTmpBuf;
                     if( nCount>0 )
                     {
                         const Point& rPoint = aPoly[0];
-                        ((aCoords =
-                            ByteString::CreateFromInt32(rPoint.X())) += ',')
-                            += ByteString::CreateFromInt32(rPoint.Y());
+                        aTmpBuf.append(static_cast<sal_Int32>(rPoint.X()))
+                            .append(',')
+                            .append(static_cast<sal_Int32>(rPoint.Y()));
                     }
                     for( sal_uInt16 j=1; j<nCount; j++ )
                     {
                         const Point& rPoint = aPoly[j];
-                        (((aCoords += ',')
-                              += ByteString::CreateFromInt32(rPoint.X())) += ',')
-                            += ByteString::CreateFromInt32(rPoint.Y());
+                        aTmpBuf.append(',')
+                            .append(static_cast<sal_Int32>(rPoint.X()))
+                            .append(',')
+                            .append(static_cast<sal_Int32>(rPoint.Y()));
                     }
+                    aCoords = aTmpBuf.makeStringAndClear();
                 }
                 break;
             default:


More information about the Libreoffice-commits mailing list