[Libreoffice-commits] .: 7 commits - svtools/source vcl/inc vcl/unx

Caolán McNamara caolan at kemper.freedesktop.org
Mon Dec 13 12:38:36 PST 2010


 svtools/source/control/tabbar.cxx                |    5 
 svtools/source/filter.vcl/wmf/emfwr.cxx          |  157 +++++++++++------------
 svtools/source/filter.vcl/wmf/emfwr.hxx          |    6 
 svtools/source/filter.vcl/wmf/wmf.cxx            |    4 
 svtools/source/filter.vcl/wmf/wmfwr.cxx          |    4 
 vcl/inc/vcl/printerinfomanager.hxx               |    3 
 vcl/unx/source/desktopdetect/desktopdetector.cxx |   39 +++--
 vcl/unx/source/fontmanager/fontconfig.cxx        |   10 +
 vcl/unx/source/fontmanager/fontmanager.cxx       |   11 -
 vcl/unx/source/printer/printerinfomanager.cxx    |   20 +-
 10 files changed, 140 insertions(+), 119 deletions(-)

New commits:
commit 591a23968df87c1c86fb16167a453e553dc20ae3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 13 20:16:57 2010 +0000

    referenced after use still

diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index 17a845c..bb4c114 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -154,7 +154,10 @@ public:
     { return m_pFcInit(); }
 
     void FcFini()
-    { if (m_pFcFini) m_pFcFini(); }
+    {
+        //To-Do: get non-headless mode smoketest to pass
+        //if (m_pFcFini) m_pFcFini();
+    }
     
     int FcGetVersion()
     { return m_pFcGetVersion(); }
commit 0fc7f9ec1c25dc18e8f610178b51b5a4e5702e22
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 13 14:36:24 2010 +0000

    release fontconfig on exit

diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index abb8a6b..17a845c 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -99,6 +99,7 @@ class FontCfgWrapper
 
     int             m_nFcVersion;
     FcBool          (*m_pFcInit)();
+    void            (*m_pFcFini)();
     int             (*m_pFcGetVersion)();
     FcConfig*		(*m_pFcConfigGetCurrent)();
     FcObjectSet*	(*m_pFcObjectSetVaBuild)(const char*,va_list);
@@ -151,6 +152,9 @@ public:
     
     FcBool FcInit()
     { return m_pFcInit(); }
+
+    void FcFini()
+    { if (m_pFcFini) m_pFcFini(); }
     
     int FcGetVersion()
     { return m_pFcGetVersion(); }
@@ -286,6 +290,8 @@ FontCfgWrapper::FontCfgWrapper()
 
     m_pFcInit = (FcBool(*)())
         loadSymbol( "FcInit" );
+    m_pFcFini = (void(*)())
+        loadSymbol( "FcFini" );
     m_pFcGetVersion = (int(*)())
         loadSymbol( "FcGetVersion" );
     m_pFcConfigGetCurrent = (FcConfig *(*)())
@@ -465,6 +471,7 @@ FontCfgWrapper::~FontCfgWrapper()
 {
     if( m_pOutlineSet )
         FcFontSetDestroy( m_pOutlineSet );
+    FcFini();
     if( m_pLib )
         osl_unloadModule( (oslModule)m_pLib );
 }
commit 86950e016d966c1bde6539ee1870af10510b19b8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 13 14:36:09 2010 +0000

    release fontinfo on exit

diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index eef7888..c226a99 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -1167,13 +1167,14 @@ OString PrintFontManager::s_aEmptyOString;
  */
 PrintFontManager& PrintFontManager::get()
 {
-    static PrintFontManager* theManager = NULL;
-    if( ! theManager )
+    static PrintFontManager* pManager = NULL;
+    if( ! pManager )
     {
-        theManager = new PrintFontManager();
-        theManager->initialize();
+        static PrintFontManager theManager;
+        pManager = &theManager;
+        pManager->initialize();
     }
-    return *theManager;
+    return *pManager;
 }
 
 // -------------------------------------------------------------------------
commit 57c83f1b43cdad8d1c004cc81d797e80253183e8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 13 14:35:47 2010 +0000

    release printinfo on exit

diff --git a/vcl/inc/vcl/printerinfomanager.hxx b/vcl/inc/vcl/printerinfomanager.hxx
index 1d271d1..9fe7c29 100644
--- a/vcl/inc/vcl/printerinfomanager.hxx
+++ b/vcl/inc/vcl/printerinfomanager.hxx
@@ -140,7 +140,6 @@ protected:
     bool                              m_bDisableCUPS;
 
     PrinterInfoManager( Type eType = Default );
-    virtual ~PrinterInfoManager();
 
     virtual void initialize();
 
@@ -235,6 +234,8 @@ public:
     
     // gets m_bDisableCUPS, initialized from printer config
     bool isCUPSDisabled() const;
+
+    virtual ~PrinterInfoManager();
 };
     
 } // namespace
diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx
index 9aa1b7e..d1c48f2 100644
--- a/vcl/unx/source/printer/printerinfomanager.cxx
+++ b/vcl/unx/source/printer/printerinfomanager.cxx
@@ -51,6 +51,8 @@
 #include "osl/mutex.hxx"
 #include "osl/process.h"
 
+#include <boost/scoped_ptr.hpp>
+
 // filename of configuration files
 #define PRINT_FILENAME  "psprint.conf"
 // the group of the global defaults
@@ -94,19 +96,17 @@ namespace psp
 
 PrinterInfoManager& PrinterInfoManager::get()
 {
-    static PrinterInfoManager* pManager = NULL;
+    static boost::scoped_ptr<PrinterInfoManager> pManager;
     
-    if( ! pManager )
+    if (!pManager)
     {
-        pManager = CUPSManager::tryLoadCUPS();
-        if( ! pManager )
-            pManager = new PrinterInfoManager();
-        
-        if( pManager )
-            pManager->initialize();
-        #if OSL_DEBUG_LEVEL > 1
+        pManager.reset(CUPSManager::tryLoadCUPS());
+        if (!pManager)
+            pManager.reset(new PrinterInfoManager());
+        pManager->initialize();
+#       if OSL_DEBUG_LEVEL > 1
         fprintf( stderr, "PrinterInfoManager::get create Manager of type %d\n", pManager->getType() );
-        #endif
+#       endif
     }
     
     return *pManager;
commit d9e50ee760868af1659eea89ebf7af53cadee29a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 13 14:31:50 2010 +0000

    tidy this up and just use references

diff --git a/svtools/source/filter.vcl/wmf/emfwr.cxx b/svtools/source/filter.vcl/wmf/emfwr.cxx
index ab59f1b..d7db029 100644
--- a/svtools/source/filter.vcl/wmf/emfwr.cxx
+++ b/svtools/source/filter.vcl/wmf/emfwr.cxx
@@ -169,9 +169,9 @@
 // - EMFWriter -
 // -------------
 
-BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfigItem* pFilterConfigItem )
+BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConfigItem )
 {
-    const ULONG nHeaderPos = rOStm.Tell();
+    const ULONG nHeaderPos = m_rStm.Tell();
 
     mpHandlesUsed = new BOOL[ MAXHANDLES ];
     memset( mpHandlesUsed, 0, MAXHANDLES * sizeof( BOOL ) );
@@ -179,7 +179,6 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfig
     mnLineHandle = mnFillHandle = mnTextHandle = HANDLE_INVALID;
     mbRecordOpen = FALSE;
     
-    mpStm = &rOStm;
     maVDev.EnableOutput( FALSE );
     maVDev.SetMapMode( rMtf.GetPrefMapMode() );
     mpFilterConfigItem = pFilterConfigItem;
@@ -192,51 +191,51 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfig
     
     // seek over header
     // use [MS-EMF 2.2.11] HeaderExtension2 Object, otherwise resulting EMF cannot be converted with GetWinMetaFileBits()
-    rOStm.SeekRel( 108 ); 
+    m_rStm.SeekRel( 108 );
 
     // write initial values
 
     // set 100th mm map mode in EMF
     ImplBeginRecord( WIN_EMR_SETMAPMODE );
-    (*mpStm) << (INT32) MM_ANISOTROPIC;
+    m_rStm << (INT32) MM_ANISOTROPIC;
     ImplEndRecord();
 
     ImplBeginRecord( WIN_EMR_SETVIEWPORTEXTEX );
-    (*mpStm) << (INT32) maVDev.ImplGetDPIX() << (INT32) maVDev.ImplGetDPIY();
+    m_rStm << (INT32) maVDev.ImplGetDPIX() << (INT32) maVDev.ImplGetDPIY();
     ImplEndRecord();
 
     ImplBeginRecord( WIN_EMR_SETWINDOWEXTEX );
-    (*mpStm) << (INT32) 2540 << (INT32) 2540;
+    m_rStm << (INT32) 2540 << (INT32) 2540;
     ImplEndRecord();
 
     ImplBeginRecord( WIN_EMR_SETVIEWPORTORGEX );
-    (*mpStm) << (INT32) 0 << (INT32) 0;
+    m_rStm << (INT32) 0 << (INT32) 0;
     ImplEndRecord();
 
     ImplBeginRecord( WIN_EMR_SETWINDOWORGEX );
-    (*mpStm) << (INT32) 0 << (INT32) 0;
+    m_rStm << (INT32) 0 << (INT32) 0;
     ImplEndRecord();
 
     ImplWriteRasterOp( ROP_OVERPAINT );
 
     ImplBeginRecord( WIN_EMR_SETBKMODE );
-    (*mpStm) << (UINT32) 1; // TRANSPARENT
+    m_rStm << (UINT32) 1; // TRANSPARENT
     ImplEndRecord();
 
     // write emf data
     ImplWrite( rMtf );
 
     ImplBeginRecord( WIN_EMR_EOF );
-    (*mpStm)<< (sal_uInt32)0		// nPalEntries
+    m_rStm<< (sal_uInt32)0		// nPalEntries
             << (sal_uInt32)0x10		// offPalEntries
             << (sal_uInt32)0x14;	// nSizeLast
     ImplEndRecord();
 
 
     // write header
-    const ULONG nEndPos = mpStm->Tell(); mpStm->Seek( nHeaderPos );
+    const ULONG nEndPos = m_rStm.Tell(); m_rStm.Seek( nHeaderPos );
     
-    (*mpStm) << (UINT32) 0x00000001 << (UINT32) 108	//use [MS-EMF 2.2.11] HeaderExtension2 Object
+    m_rStm << (UINT32) 0x00000001 << (UINT32) 108	//use [MS-EMF 2.2.11] HeaderExtension2 Object
              << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizePix.Width() - 1 ) << (INT32) ( aMtfSizePix.Height() - 1 )
              << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizeLog.Width() - 1 ) << (INT32) ( aMtfSizeLog.Height() - 1 )
              << (UINT32) 0x464d4520 << (UINT32) 0x10000 << (UINT32) ( nEndPos - nHeaderPos )
@@ -246,10 +245,10 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfig
              << (UINT32) 0 << (UINT32) 0 << (UINT32) 0
              << (INT32) (  aMtfSizeLog.Width() * 10 ) << (INT32) ( aMtfSizeLog.Height() * 10 ); //use [MS-EMF 2.2.11] HeaderExtension2 Object
 
-    mpStm->Seek( nEndPos );
+    m_rStm.Seek( nEndPos );
     delete[] mpHandlesUsed; 
 
-    return( mpStm->GetError() == ERRCODE_NONE );
+    return( m_rStm.GetError() == ERRCODE_NONE );
 }
 
 // -----------------------------------------------------------------------------
@@ -290,10 +289,10 @@ void EMFWriter::ImplBeginRecord( sal_uInt32 nType )
     if( !mbRecordOpen )
     {
         mbRecordOpen = TRUE;
-        mnRecordPos = mpStm->Tell();
+        mnRecordPos = m_rStm.Tell();
 
-        (*mpStm) << nType;
-        mpStm->SeekRel( 4 );
+        m_rStm << nType;
+        m_rStm.SeekRel( 4 );
     }
 }
 
@@ -305,16 +304,16 @@ void EMFWriter::ImplEndRecord()
 
     if( mbRecordOpen )
     {
-        sal_Int32 nFillBytes, nActPos = mpStm->Tell();
-        mpStm->Seek( mnRecordPos + 4 );
+        sal_Int32 nFillBytes, nActPos = m_rStm.Tell();
+        m_rStm.Seek( mnRecordPos + 4 );
         nFillBytes = nActPos - mnRecordPos;
         nFillBytes += 3;	// each record has to be dword aligned
         nFillBytes ^= 3;
         nFillBytes &= 3;
-        *mpStm << (sal_uInt32)( ( nActPos - mnRecordPos ) + nFillBytes );
-        mpStm->Seek( nActPos );
+        m_rStm << (sal_uInt32)( ( nActPos - mnRecordPos ) + nFillBytes );
+        m_rStm.Seek( nActPos );
         while( nFillBytes-- )
-            *mpStm << (sal_uInt8)0;
+            m_rStm << (sal_uInt8)0;
         mnRecordCount++;
         mbRecordOpen = FALSE;
     }
@@ -337,12 +336,12 @@ BOOL EMFWriter::ImplPrepareHandleSelect( sal_uInt32& rHandle, ULONG nSelectType
 
         // select stock object first
         ImplBeginRecord( WIN_EMR_SELECTOBJECT );
-        ( *mpStm ) << nStockObject;
+        m_rStm << nStockObject;
         ImplEndRecord();
         
         // destroy handle of created object
         ImplBeginRecord( WIN_EMR_DELETEOBJECT );
-        ( *mpStm ) << rHandle;
+        m_rStm << rHandle;
         ImplEndRecord();
 
         // mark handle as free 
@@ -364,12 +363,12 @@ void EMFWriter::ImplCheckLineAttr()
         sal_uInt32 nWidth = 0, nHeight = 0;
 
         ImplBeginRecord( WIN_EMR_CREATEPEN );
-        (*mpStm) << mnLineHandle << nStyle << nWidth << nHeight;
+        m_rStm << mnLineHandle << nStyle << nWidth << nHeight;
         ImplWriteColor( maVDev.GetLineColor() );
         ImplEndRecord();
 
         ImplBeginRecord( WIN_EMR_SELECTOBJECT );
-        (*mpStm) << mnLineHandle;
+        m_rStm << mnLineHandle;
         ImplEndRecord();
     }
 }
@@ -384,13 +383,13 @@ void EMFWriter::ImplCheckFillAttr()
         sal_uInt32 nPatternStyle = 0;
 
         ImplBeginRecord( WIN_EMR_CREATEBRUSHINDIRECT );
-        (*mpStm) << mnFillHandle << nStyle;
+        m_rStm << mnFillHandle << nStyle;
         ImplWriteColor( maVDev.GetFillColor() );
-        (*mpStm) << nPatternStyle;
+        m_rStm << nPatternStyle;
         ImplEndRecord();
 
         ImplBeginRecord( WIN_EMR_SELECTOBJECT );
-        (*mpStm) << mnFillHandle;
+        m_rStm << mnFillHandle;
         ImplEndRecord();
     }
 }
@@ -408,10 +407,10 @@ void EMFWriter::ImplCheckTextAttr()
         sal_uInt8		nPitchAndFamily;
 
         ImplBeginRecord( WIN_EMR_EXTCREATEFONTINDIRECTW );
-        (*mpStm) << mnTextHandle;
+        m_rStm << mnTextHandle;
         ImplWriteExtent( -rFont.GetSize().Height() );
         ImplWriteExtent( rFont.GetSize().Width() );
-        (*mpStm) << (INT32) rFont.GetOrientation() << (INT32) rFont.GetOrientation();
+        m_rStm << (INT32) rFont.GetOrientation() << (INT32) rFont.GetOrientation();
 
         switch( rFont.GetWeight() ) 
         {
@@ -428,12 +427,12 @@ void EMFWriter::ImplCheckTextAttr()
             default:				nWeight = 0; break;
         }
         
-        (*mpStm) << nWeight;
-        (*mpStm) << (BYTE) ( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 );
-        (*mpStm) << (BYTE) ( ( UNDERLINE_NONE == rFont.GetUnderline() ) ? 0 : 1 );
-        (*mpStm) << (BYTE) ( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 );
-        (*mpStm) << (BYTE) ( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 );
-        (*mpStm) << (BYTE) 0 << (BYTE) 0 << (BYTE) 0;
+        m_rStm << nWeight;
+        m_rStm << (BYTE) ( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 );
+        m_rStm << (BYTE) ( ( UNDERLINE_NONE == rFont.GetUnderline() ) ? 0 : 1 );
+        m_rStm << (BYTE) ( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 );
+        m_rStm << (BYTE) ( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 );
+        m_rStm << (BYTE) 0 << (BYTE) 0 << (BYTE) 0;
 
         switch( rFont.GetPitch() ) 
         {
@@ -452,33 +451,33 @@ void EMFWriter::ImplCheckTextAttr()
             default: break;
         }
 
-        (*mpStm) << nPitchAndFamily;
+        m_rStm << nPitchAndFamily;
 
         for( i = 0; i < 32; i++ )
-            (*mpStm) << (sal_Unicode) ( ( i < aFontName.Len() ) ? aFontName.GetChar( i ) : 0 );
+            m_rStm << (sal_Unicode) ( ( i < aFontName.Len() ) ? aFontName.GetChar( i ) : 0 );
 
         // dummy elfFullName
         for( i = 0; i < 64; i++ )
-            (*mpStm) << (sal_Unicode) 0;
+            m_rStm << (sal_Unicode) 0;
 
         // dummy elfStyle
         for( i = 0; i < 32; i++ )
-            (*mpStm) << (sal_Unicode) 0;
+            m_rStm << (sal_Unicode) 0;
 
         // dummy elfVersion, elfStyleSize, elfMatch, elfReserved
-        (*mpStm) << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 ;
+        m_rStm << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 ;
 
         // dummy elfVendorId
-        (*mpStm) << (UINT32) 0;
+        m_rStm << (UINT32) 0;
 
         // dummy elfCulture
-        (*mpStm) << (UINT32) 0;
+        m_rStm << (UINT32) 0;
 
         // dummy elfPanose
-        (*mpStm) << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0;
+        m_rStm << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0;
 
         // fill record to get a record size divideable by 4
-        (*mpStm) << (UINT16) 0;
+        m_rStm << (UINT16) 0;
 
         ImplEndRecord();
 
@@ -494,7 +493,7 @@ void EMFWriter::ImplCheckTextAttr()
         nTextAlign |= mnHorTextAlign;
 
         ImplBeginRecord( WIN_EMR_SETTEXTALIGN );
-        (*mpStm) << nTextAlign;
+        m_rStm << nTextAlign;
         ImplEndRecord();
 
         // Text color
@@ -503,7 +502,7 @@ void EMFWriter::ImplCheckTextAttr()
         ImplEndRecord();
 
         ImplBeginRecord( WIN_EMR_SELECTOBJECT );
-        (*mpStm) << mnTextHandle;
+        m_rStm << mnTextHandle;
         ImplEndRecord();
     }
 }
@@ -517,7 +516,7 @@ void EMFWriter::ImplWriteColor( const Color& rColor )
     nCol |= ( (UINT32) rColor.GetGreen() ) << 8;
     nCol |= ( (UINT32) rColor.GetBlue() ) << 16;
 
-    (*mpStm) << nCol;
+    m_rStm << nCol;
 }
 
 // -----------------------------------------------------------------------------
@@ -534,7 +533,7 @@ void EMFWriter::ImplWriteRasterOp( RasterOp eRop )
     }
 
     ImplBeginRecord( WIN_EMR_SETROP2 );
-    (*mpStm) << nROP2;
+    m_rStm << nROP2;
     ImplEndRecord();
 }
 
@@ -543,7 +542,7 @@ void EMFWriter::ImplWriteRasterOp( RasterOp eRop )
 void EMFWriter::ImplWriteExtent( long nExtent )
 {
     nExtent = maVDev.LogicToLogic( Size( nExtent, 0 ), maVDev.GetMapMode(), maDestMapMode ).Width();
-    (*mpStm) << (INT32) nExtent;
+    m_rStm << (INT32) nExtent;
 }
 
 // -----------------------------------------------------------------------------
@@ -551,7 +550,7 @@ void EMFWriter::ImplWriteExtent( long nExtent )
 void EMFWriter::ImplWritePoint( const Point& rPoint )
 {
     const Point aPoint( maVDev.LogicToLogic( rPoint, maVDev.GetMapMode(), maDestMapMode ));
-     (*mpStm) << (INT32) aPoint.X() << (INT32) aPoint.Y();
+     m_rStm << (INT32) aPoint.X() << (INT32) aPoint.Y();
 }
 
 // -----------------------------------------------------------------------------
@@ -559,7 +558,7 @@ void EMFWriter::ImplWritePoint( const Point& rPoint )
 void EMFWriter::ImplWriteSize( const Size& rSize)
 {
     const Size aSize( maVDev.LogicToLogic( rSize, maVDev.GetMapMode(), maDestMapMode ));
-     (*mpStm) << (INT32) aSize.Width() << (INT32) aSize.Height();
+     m_rStm << (INT32) aSize.Width() << (INT32) aSize.Height();
 }
 
 // -----------------------------------------------------------------------------
@@ -567,7 +566,7 @@ void EMFWriter::ImplWriteSize( const Size& rSize)
 void EMFWriter::ImplWriteRect( const Rectangle& rRect )
 {
     const Rectangle aRect( maVDev.LogicToLogic ( rRect, maVDev.GetMapMode(), maDestMapMode ));
-     (*mpStm) << aRect.Left() << aRect.Top() << aRect.Right() << aRect.Bottom();
+     m_rStm << aRect.Left() << aRect.Top() << aRect.Right() << aRect.Bottom();
 }
 
 // -----------------------------------------------------------------------------
@@ -587,7 +586,7 @@ void EMFWriter::ImplWritePolygonRecord( const Polygon& rPoly, BOOL bClose )
 
             ImplBeginRecord( bClose ? WIN_EMR_POLYGON : WIN_EMR_POLYLINE );
             ImplWriteRect( rPoly.GetBoundRect() );
-            (*mpStm) << (UINT32) rPoly.GetSize();
+            m_rStm << (UINT32) rPoly.GetSize();
 
             for( USHORT i = 0; i < rPoly.GetSize(); i++ )
                 ImplWritePoint( rPoly[ i ] );
@@ -629,10 +628,10 @@ void EMFWriter::ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly )
 
                     ImplBeginRecord( WIN_EMR_POLYPOLYGON );
                     ImplWriteRect( rPolyPoly.GetBoundRect() );
-                    (*mpStm) << (sal_uInt32)nPolyCount << nTotalPoints;
+                    m_rStm << (sal_uInt32)nPolyCount << nTotalPoints;
 
                     for( i = 0; i < nPolyCount; i++ )
-                        (*mpStm) << (sal_uInt32)rPolyPoly[ i ].GetSize();
+                        m_rStm << (sal_uInt32)rPolyPoly[ i ].GetSize();
 
                     for( i = 0; i < nPolyCount; i++ )
                     {
@@ -688,7 +687,7 @@ void EMFWriter::ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClosed )
                 for ( o = 0; o < nBezPoints; o++ )
                     aNewPoly[ o + 1 ] = rPoly[ n + o ];
                 ImplWriteRect( aNewPoly.GetBoundRect() );
-                (*mpStm) << (sal_uInt32)nBezPoints;
+                m_rStm << (sal_uInt32)nBezPoints;
                 for( o = 1; o < aNewPoly.GetSize(); o++ )
                     ImplWritePoint( aNewPoly[ o ] );
                 ImplEndRecord();
@@ -708,7 +707,7 @@ void EMFWriter::ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClosed )
                     for ( o = 1; o <= nPoints; o++ )
                         aNewPoly[ o ] = rPoly[ n - 1 + o ];
                     ImplWriteRect( aNewPoly.GetBoundRect() );
-                    (*mpStm) << (sal_uInt32)( nPoints );
+                    m_rStm << (sal_uInt32)( nPoints );
                     for( o = 1; o < aNewPoly.GetSize(); o++ )
                         ImplWritePoint( aNewPoly[ o ] );
                     ImplEndRecord();
@@ -748,13 +747,13 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt,
         ImplBeginRecord( WIN_EMR_STRETCHDIBITS );
         ImplWriteRect( Rectangle( rPt, rSz ) );
         ImplWritePoint( rPt );
-        (*mpStm) << (INT32) 0 << (INT32) 0 << (INT32) aBmpSizePixel.Width() << (INT32) aBmpSizePixel.Height();
+        m_rStm << (INT32) 0 << (INT32) 0 << (INT32) aBmpSizePixel.Width() << (INT32) aBmpSizePixel.Height();
         
         // write offset positions and sizes later
-        const ULONG nOffPos = mpStm->Tell();
-        mpStm->SeekRel( 16 );
+        const ULONG nOffPos = m_rStm.Tell();
+        m_rStm.SeekRel( 16 );
 
-        (*mpStm) << (UINT32) 0 << ( ( ROP_XOR == maVDev.GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
+        m_rStm << (UINT32) 0 << ( ( ROP_XOR == maVDev.GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
         ImplWriteSize( rSz );
 
         rBmp.Write( aMemStm, TRUE, FALSE );
@@ -773,13 +772,13 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt,
         nPalCount = ( nBitCount <= 8 ) ? ( nColsUsed ? nColsUsed : ( 1 << (UINT32) nBitCount ) ) : 
                                          ( ( 3 == nCompression ) ? 12 : 0 );
 
-        mpStm->Write( aMemStm.GetData(), nDIBSize );
+        m_rStm.Write( aMemStm.GetData(), nDIBSize );
 
-        const ULONG nEndPos = mpStm->Tell();
-        mpStm->Seek( nOffPos );
-        (*mpStm) << (UINT32) 80 << (UINT32)( nHeaderSize + ( nPalCount << 2 ) );
-        (*mpStm) << (UINT32)( 80 + ( nHeaderSize + ( nPalCount << 2 ) ) ) << nImageSize;
-        mpStm->Seek( nEndPos );
+        const ULONG nEndPos = m_rStm.Tell();
+        m_rStm.Seek( nOffPos );
+        m_rStm << (UINT32) 80 << (UINT32)( nHeaderSize + ( nPalCount << 2 ) );
+        m_rStm << (UINT32)( 80 + ( nHeaderSize + ( nPalCount << 2 ) ) ) << nImageSize;
+        m_rStm.Seek( nEndPos );
 
         ImplEndRecord();
     }
@@ -828,20 +827,20 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, cons
         ImplBeginRecord( WIN_EMR_EXTTEXTOUTW );
 
         ImplWriteRect( Rectangle( rPos, Size( nNormWidth, maVDev.GetTextHeight() ) ) );
-        (*mpStm) << (UINT32)1;
-        (*mpStm) << (INT32) 0 << (INT32) 0;
+        m_rStm << (UINT32)1;
+        m_rStm << (INT32) 0 << (INT32) 0;
         ImplWritePoint( rPos );
-        (*mpStm) << (UINT32) nLen << (UINT32) 76 << (UINT32) 2;
-        (*mpStm) << (INT32) 0 << (INT32) 0 << (INT32) 0 << (INT32) 0;
-        (*mpStm) << (UINT32) ( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) );
+        m_rStm << (UINT32) nLen << (UINT32) 76 << (UINT32) 2;
+        m_rStm << (INT32) 0 << (INT32) 0 << (INT32) 0 << (INT32) 0;
+        m_rStm << (UINT32) ( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) );
 
         // write text
         for( i = 0; i < nLen; i++ )
-            (*mpStm) << (sal_Unicode)rText.GetChar( i );
+            m_rStm << (sal_Unicode)rText.GetChar( i );
 
         // padding word
         if( nLen & 1 )
-            (*mpStm) << (UINT16) 0;
+            m_rStm << (UINT16) 0;
 
         // write DX array
         ImplWriteExtent( pDX[ 0 ] );
@@ -1176,7 +1175,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
 
                         maVDev.Pop();
                         ImplBeginRecord( WIN_EMR_RESTOREDC );
-                        (*mpStm) << (INT32) -1;
+                        m_rStm << (INT32) -1;
                         ImplEndRecord();
                         break;
                     }
@@ -1366,7 +1365,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
                 ( (MetaAction*) pAction )->Execute( &maVDev );
                 
                 ImplBeginRecord( WIN_EMR_RESTOREDC );
-                (*mpStm) << (INT32) -1;
+                m_rStm << (INT32) -1;
                 ImplEndRecord();
                 
                 ImplWriteRasterOp( maVDev.GetRasterOp() );
diff --git a/svtools/source/filter.vcl/wmf/emfwr.hxx b/svtools/source/filter.vcl/wmf/emfwr.hxx
index 1fc77da..a5f88df 100644
--- a/svtools/source/filter.vcl/wmf/emfwr.hxx
+++ b/svtools/source/filter.vcl/wmf/emfwr.hxx
@@ -50,7 +50,7 @@ private:
     VirtualDevice		maVDev;
     MapMode				maDestMapMode;
     FilterConfigItem*	mpFilterConfigItem;
-    SvStream*			mpStm;
+    SvStream& m_rStm;
     BOOL*				mpHandlesUsed;
     ULONG				mnHandleCount;
     ULONG				mnLastPercent;
@@ -93,9 +93,9 @@ private:
 
 public:
 
-                        EMFWriter() {}
+    EMFWriter(SvStream &rStream) : m_rStm(rStream) {}
 
-    BOOL				WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfigItem* pConfigItem = NULL );
+    BOOL WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pConfigItem = NULL );
 };
 
 #endif // _EMFWR_HXX
diff --git a/svtools/source/filter.vcl/wmf/wmf.cxx b/svtools/source/filter.vcl/wmf/wmf.cxx
index 095cbfd..56f0fa4 100644
--- a/svtools/source/filter.vcl/wmf/wmf.cxx
+++ b/svtools/source/filter.vcl/wmf/wmf.cxx
@@ -96,8 +96,8 @@ BOOL ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream
 BOOL ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream,
                               FilterConfigItem* pConfigItem )
 {
-    EMFWriter aEMFWriter;
-    return aEMFWriter.WriteEMF( rMTF, rTargetStream, pConfigItem );
+    EMFWriter aEMFWriter(rTargetStream);
+    return aEMFWriter.WriteEMF( rMTF, pConfigItem );
 }
 
 // -----------------------------------------------------------------------------
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx
index 1d21f53..d5c926d 100644
--- a/svtools/source/filter.vcl/wmf/wmfwr.cxx
+++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx
@@ -2014,10 +2014,10 @@ USHORT WMFWriter::CalcSaveTargetMapMode(MapMode& rMapMode,
 
 void WMFWriter::WriteEmbeddedEMF( const GDIMetaFile& rMTF )
 {
-    EMFWriter aEMFWriter;
     SvMemoryStream aStream;
+    EMFWriter aEMFWriter(aStream);
     
-    if( aEMFWriter.WriteEMF( rMTF, aStream ) )
+    if( aEMFWriter.WriteEMF( rMTF ) )
     {
         sal_Size nTotalSize = aStream.Tell();
         if( nTotalSize > SAL_MAX_UINT32 )
commit a41d3142f5070e9cb917c4818a546714fb5f10ca
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 13 14:22:05 2010 +0000

    cppcheck: init member variable

diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 7b95121..5e61f67 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -163,8 +163,9 @@ private:
 
 // -----------------------------------------------------------------------
 
-ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle ) :
-    Window( pParent, nWinStyle & WB_3DLOOK )
+ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle )
+    : Window( pParent, nWinStyle & WB_3DLOOK )
+    , mnStartWidth(0)
 {
     SetPointer( Pointer( POINTER_HSIZEBAR ) );
     SetSizePixel( Size( 7, 0 ) );
commit aaac7ce464c11ed05f91570c4f0463017ba6dd10
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 13 10:56:43 2010 +0000

    check for env variable of headless plugin in desktop detect

diff --git a/vcl/unx/source/desktopdetect/desktopdetector.cxx b/vcl/unx/source/desktopdetect/desktopdetector.cxx
index 20468e7..41ebaff 100644
--- a/vcl/unx/source/desktopdetect/desktopdetector.cxx
+++ b/vcl/unx/source/desktopdetect/desktopdetector.cxx
@@ -42,6 +42,7 @@
 #include "osl/thread.h"
 
 #include <unistd.h>
+#include <string.h>
 
 using namespace rtl;
 
@@ -279,23 +280,31 @@ VCL_DLLPUBLIC rtl::OUString get_desktop_environment()
     {
         // get display to connect to
         const char* pDisplayStr = getenv( "DISPLAY" );
-        int nParams = osl_getCommandArgCount();
-        OUString aParam;
-        OString aBParm;
-        for( int i = 0; i < nParams; i++ )
+
+        const char* pUsePlugin = getenv( "SAL_USE_VCLPLUGIN" );
+
+        if (pUsePlugin && (strcmp(pUsePlugin, "svp") == 0))
+            pDisplayStr = NULL;
+        else
         {
-            osl_getCommandArg( i, &aParam.pData );
-            if( aParam.equalsAscii( "-headless" ) )
-            {
-                pDisplayStr = NULL;
-                break;
-            }
-            if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) )
+            int nParams = osl_getCommandArgCount();
+            OUString aParam;
+            OString aBParm;
+            for( int i = 0; i < nParams; i++ )
             {
-                osl_getCommandArg( i+1, &aParam.pData );
-                aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() );
-                pDisplayStr = aBParm.getStr();
-                break;
+                osl_getCommandArg( i, &aParam.pData );
+                if( aParam.equalsAscii( "-headless" ) )
+                {
+                    pDisplayStr = NULL;
+                    break;
+                }
+                if( i < nParams-1 && (aParam.equalsAscii( "-display" ) || aParam.equalsAscii( "--display" )) )
+                {
+                    osl_getCommandArg( i+1, &aParam.pData );
+                    aBParm = OUStringToOString( aParam, osl_getThreadTextEncoding() );
+                    pDisplayStr = aBParm.getStr();
+                    break;
+                }
             }
         }
     


More information about the Libreoffice-commits mailing list