[Libreoffice-commits] core.git: 10 commits - basic/source editeng/source include/basic include/vcl svtools/source vcl/source

Matteo Casalin matteo.casalin at yahoo.com
Sun Jul 19 08:13:35 PDT 2015


 basic/source/classes/sbxmod.cxx     |    2 -
 basic/source/runtime/methods.cxx    |   10 +++---
 basic/source/runtime/stdobj.cxx     |   16 ++++-----
 basic/source/runtime/stdobj1.cxx    |    6 +--
 basic/source/sbx/sbxvalue.cxx       |    8 ++--
 basic/source/sbx/sbxvar.cxx         |   13 +++-----
 editeng/source/editeng/edtspell.cxx |    6 +--
 editeng/source/editeng/edtspell.hxx |    6 +--
 include/basic/sbmeth.hxx            |    2 -
 include/basic/sbx.hxx               |    4 +-
 include/basic/sbxvar.hxx            |   10 +++---
 include/vcl/syswin.hxx              |   58 ++++++++++++++++++++----------------
 svtools/source/control/inettbc.cxx  |    3 -
 vcl/source/filter/wmf/wmfwr.cxx     |   28 +++++++----------
 vcl/source/filter/wmf/wmfwr.hxx     |    6 +--
 vcl/source/window/dockwin.cxx       |    2 -
 vcl/source/window/syswin.cxx        |   18 +++++------
 17 files changed, 100 insertions(+), 98 deletions(-)

New commits:
commit c5ca63a0bb23bcc06b1ae70f169d965476bc251b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jul 19 17:09:48 2015 +0200

    sal_uInt16 to sal_Int32/size_t
    
    Change-Id: Icb8765339412bedf1e424a766bc99274ab96ceab

diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index 90d8cf4..4ba31d7 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -284,7 +284,7 @@ void WrongList::TextDeleted( size_t nPos, size_t nLength )
     size_t nEndPos = nPos + nLength;
     if (IsValid())
     {
-        sal_uInt16 nNewInvalidStart = nPos ? nPos - 1 : 0;
+        const size_t nNewInvalidStart = nPos ? nPos - 1 : 0;
         mnInvalidStart = nNewInvalidStart;
         mnInvalidEnd = nNewInvalidStart + 1;
     }
@@ -546,7 +546,7 @@ bool WrongList::DbgIsBuggy() const
 
 
 EdtAutoCorrDoc::EdtAutoCorrDoc(
-    EditEngine* pE, ContentNode* pN, sal_uInt16 nCrsr, sal_Unicode cIns) :
+    EditEngine* pE, ContentNode* pN, sal_Int32 nCrsr, sal_Unicode cIns) :
     mpEditEngine(pE),
     pCurNode(pN),
     nCursor(nCrsr),
@@ -593,7 +593,7 @@ bool EdtAutoCorrDoc::Replace(sal_Int32 nPos, const OUString& rTxt)
 bool EdtAutoCorrDoc::ReplaceRange(sal_Int32 nPos, sal_Int32 nSourceLength, const OUString& rTxt)
 {
     // Actually a Replace introduce => corresponds to UNDO
-    sal_uInt16 nEnd = nPos+nSourceLength;
+    sal_Int32 nEnd = nPos+nSourceLength;
     if ( nEnd > pCurNode->Len() )
         nEnd = pCurNode->Len();
 
diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx
index 4048e97..c669431 100644
--- a/editeng/source/editeng/edtspell.hxx
+++ b/editeng/source/editeng/edtspell.hxx
@@ -123,7 +123,7 @@ class EdtAutoCorrDoc : public SvxAutoCorrDoc
 {
     EditEngine* mpEditEngine;
     ContentNode*    pCurNode;
-    sal_uInt16          nCursor;
+    sal_Int32       nCursor;
 
     bool            bAllowUndoAction;
     bool            bUndoAction;
@@ -132,7 +132,7 @@ protected:
     void            ImplStartUndoAction();
 
 public:
-    EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_uInt16 nCrsr, sal_Unicode cIns);
+    EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_Int32 nCrsr, sal_Unicode cIns);
     virtual ~EdtAutoCorrDoc();
 
     virtual bool    Delete( sal_Int32 nStt, sal_Int32 nEnd ) SAL_OVERRIDE;
@@ -150,7 +150,7 @@ public:
 
     virtual LanguageType GetLanguage( sal_Int32 nPos, bool bPrevPara = false ) const SAL_OVERRIDE;
 
-    sal_uInt16          GetCursor() const { return nCursor; }
+    sal_Int32       GetCursor() const { return nCursor; }
 
 };
 
commit 40c34e62624f89b6e994e5e202c3bcf250544d86
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jul 19 12:24:28 2015 +0200

    Fix indentation
    
    Change-Id: I5cff1cda3c6882e751b88a4a4d1aacbec8942578

diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index e19168c..b8deec8 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -714,12 +714,12 @@ SbiStdObject::SbiStdObject( const OUString& r, StarBASIC* pb ) : SbxObject( r )
     // do we have to initialize the hashcodes?
     Methods* p = aMethods;
     if( !p->nHash )
-      while( p->nArgs != -1 )
-    {
-        OUString aName_ = OUString::createFromAscii( p->pName );
-        p->nHash = SbxVariable::MakeHashCode( aName_ );
-        p += ( p->nArgs & _ARGSMASK ) + 1;
-    }
+        while( p->nArgs != -1 )
+        {
+            OUString aName_ = OUString::createFromAscii( p->pName );
+            p->nHash = SbxVariable::MakeHashCode( aName_ );
+            p += ( p->nArgs & _ARGSMASK ) + 1;
+        }
 
     // #i92642: Remove default properties
     Remove( OUString("Name"), SbxCLASS_DONTCARE );
commit f7a2795c881c2eba95aa09f21881f842281ae819
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Jul 18 08:49:43 2015 +0200

    sal_uIntPtr to sal_uInt32, for consistency
    
    Change-Id: Ib78dce61e8fb8c8e3bf8c7a2b02966100a4db0e8

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 8c99af4..db0d7ce 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2116,7 +2116,7 @@ ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
 
 
 // #100883 Own Broadcast for SbMethod
-void SbMethod::Broadcast( sal_uIntPtr nHintId )
+void SbMethod::Broadcast( sal_uInt32 nHintId )
 {
     if( pCst && !IsSet( SBX_NO_BROADCAST ) )
     {
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 05700d6..e19168c 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -825,11 +825,11 @@ void SbiStdObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
         SbxVariable* pVar = pHint->GetVar();
         SbxArray* pPar_ = pVar->GetParameters();
         sal_uLong t = pHint->GetId();
-        sal_uInt16 nCallId = (sal_uInt16) pVar->GetUserData();
+        const sal_uInt16 nCallId = static_cast<sal_uInt16>(pVar->GetUserData());
         if( nCallId )
         {
             if( t == SBX_HINT_INFOWANTED )
-                pVar->SetInfo( GetInfo( (short) pVar->GetUserData() ) );
+                pVar->SetInfo( GetInfo( static_cast<short>(pVar->GetUserData()) ) );
             else
             {
                 bool bWrite = false;
diff --git a/basic/source/runtime/stdobj1.cxx b/basic/source/runtime/stdobj1.cxx
index 1042265..e82db36 100644
--- a/basic/source/runtime/stdobj1.cxx
+++ b/basic/source/runtime/stdobj1.cxx
@@ -155,7 +155,7 @@ void SbStdPicture::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 
         SbxVariable* pVar   = pHint->GetVar();
         SbxArray*    pPar_  = pVar->GetParameters();
-        sal_uInt16       nWhich = (sal_uInt16)pVar->GetUserData();
+        const sal_uInt32 nWhich = pVar->GetUserData();
         bool         bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
 
         // Propteries
@@ -280,7 +280,7 @@ void SbStdFont::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 
         SbxVariable* pVar   = pHint->GetVar();
         SbxArray*    pPar_  = pVar->GetParameters();
-        sal_uInt16       nWhich = (sal_uInt16)pVar->GetUserData();
+        const sal_uInt32 nWhich = pVar->GetUserData();
         bool         bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
 
         // Propteries
@@ -448,7 +448,7 @@ void SbStdClipboard::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 
         SbxVariable* pVar   = pHint->GetVar();
         SbxArray*    pPar_  = pVar->GetParameters();
-        sal_uInt16       nWhich = (sal_uInt16)pVar->GetUserData();
+        const sal_uInt32 nWhich = pVar->GetUserData();
         bool         bWrite = pHint->GetId() == SBX_HINT_DATACHANGED;
 
         // Methods
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 5323d87..3132b73 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -195,7 +195,7 @@ void SbxValue::Clear()
                     SAL_INFO("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
                     SbxVariable *pThisVar = PTR_CAST(SbxVariable, this);
                     bool bParentProp = pThisVar && 5345 ==
-                    ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) );
+                        static_cast<sal_uInt16>(pThisVar->GetUserData());
                     if ( !bParentProp )
                         aData.pObj->ReleaseRef();
                 }
@@ -220,7 +220,7 @@ void SbxValue::Clear()
 
 // Dummy
 
-void SbxValue::Broadcast( sal_uIntPtr )
+void SbxValue::Broadcast( sal_uInt32 )
 {}
 
 //////////////////////////// Readout data
@@ -541,7 +541,7 @@ bool SbxValue::Put( const SbxValues& rVal )
                             SAL_INFO("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
                             SbxVariable *pThisVar = PTR_CAST(SbxVariable, this);
                             bool bParentProp = pThisVar && 5345 ==
-                                    ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) );
+                                static_cast<sal_uInt16>(pThisVar->GetUserData());
                             if ( !bParentProp )
                                 p->aData.pObj->AddFirstRef();
                         }
@@ -804,7 +804,7 @@ bool SbxValue::SetType( SbxDataType t )
                         SAL_WARN("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
                         SbxVariable *pThisVar = PTR_CAST(SbxVariable, this);
                         sal_uInt16 nSlotId = pThisVar
-                                    ? ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) )
+                                    ? static_cast<sal_uInt16>(pThisVar->GetUserData())
                                     : 0;
                         DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName() == "Parent",
                                     "SID_PARENTOBJECT is not named 'Parent'" );
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index fc0a8bf..ff0a0cb 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -144,7 +144,7 @@ SbxArray* SbxVariable::GetParameters() const
 // Perhaps some day one could cut the parameter 0.
 // then the copying will be dropped ...
 
-void SbxVariable::Broadcast( sal_uIntPtr nHintId )
+void SbxVariable::Broadcast( sal_uInt32 nHintId )
 {
     if( pCst && !IsSet( SBX_NO_BROADCAST ) )
     {
@@ -668,7 +668,7 @@ SbxAlias::~SbxAlias()
     }
 }
 
-void SbxAlias::Broadcast( sal_uIntPtr nHt )
+void SbxAlias::Broadcast( sal_uInt32 nHt )
 {
     if( xAlias.Is() )
     {
diff --git a/include/basic/sbmeth.hxx b/include/basic/sbmeth.hxx
index 2f0aab7..b8db3e4 100644
--- a/include/basic/sbmeth.hxx
+++ b/include/basic/sbmeth.hxx
@@ -63,7 +63,7 @@ public:
 
     // Interface to execute a method from the applications
     ErrCode         Call( SbxValue* pRet = NULL,  SbxVariable* pCaller = NULL );
-    virtual void    Broadcast( sal_uIntPtr nHintId ) SAL_OVERRIDE;
+    virtual void    Broadcast( sal_uInt32 nHintId ) SAL_OVERRIDE;
 };
 
 typedef tools::SvRef<SbMethod> SbMethodRef;
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
index a4e9723..fc9f366 100644
--- a/include/basic/sbx.hxx
+++ b/include/basic/sbx.hxx
@@ -95,7 +95,7 @@ class BASIC_DLLPUBLIC SbxHint : public SfxSimpleHint
 {
     SbxVariable* pVar;
 public:
-    SbxHint( sal_uIntPtr n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {}
+    SbxHint( sal_uInt32 n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {}
     SbxVariable* GetVar() const { return pVar; }
 };
 
@@ -104,7 +104,7 @@ class BASIC_DLLPUBLIC SbxAlias : public SbxVariable, public SfxListener
 {
     SbxVariableRef xAlias;
     virtual ~SbxAlias();
-    virtual void Broadcast( sal_uIntPtr ) SAL_OVERRIDE;
+    virtual void Broadcast( sal_uInt32 ) SAL_OVERRIDE;
     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
 public:
     SbxAlias( const SbxAlias& );
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index 9a69c8e..b989551 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -97,7 +97,7 @@ protected:
     OUString aPic;  // Picture-String
     OUString aToolString;  // tool string copy
 
-    virtual void Broadcast( sal_uIntPtr );      // Broadcast-Call
+    virtual void Broadcast( sal_uInt32 );      // Broadcast-Call
     virtual ~SbxValue();
     virtual bool LoadData( SvStream&, sal_uInt16 ) SAL_OVERRIDE;
     virtual bool StoreData( SvStream& ) const SAL_OVERRIDE;
@@ -285,7 +285,7 @@ class BASIC_DLLPUBLIC SbxVariable : public SbxValue
 
 protected:
     SbxInfoRef  pInfo;              // Probably called information
-    sal_uIntPtr nUserData;          // User data for Call()
+    sal_uInt32 nUserData;           // User data for Call()
     SbxObject* pParent;             // Currently attached object
     virtual ~SbxVariable();
     virtual bool LoadData( SvStream&, sal_uInt16 ) SAL_OVERRIDE;
@@ -306,8 +306,8 @@ public:
 
     virtual void SetModified( bool ) SAL_OVERRIDE;
 
-    sal_uIntPtr GetUserData() const        { return nUserData; }
-    void SetUserData( sal_uIntPtr n ) { nUserData = n;    }
+    sal_uInt32 GetUserData() const { return nUserData; }
+    void SetUserData( sal_uInt32 n ) { nUserData = n; }
 
     virtual SbxDataType  GetType()  const SAL_OVERRIDE;
     virtual SbxClassType GetClass() const SAL_OVERRIDE;
@@ -322,7 +322,7 @@ public:
     // Due to data reduction and better DLL-hierarchy currently via casting
     SfxBroadcaster& GetBroadcaster();
     bool IsBroadcaster() const { return pCst != NULL; }
-    virtual void Broadcast( sal_uIntPtr nHintId ) SAL_OVERRIDE;
+    virtual void Broadcast( sal_uInt32 nHintId ) SAL_OVERRIDE;
 
     inline const SbxObject* GetParent() const { return pParent; }
     SbxObject* GetParent() { return pParent;}
commit c1edceb2f3c9ce8065db3f0a7635e0276cb8434e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Jul 17 06:56:01 2015 +0200

    sal_uInt16 to sal_Int32 with some cleanup
    
    Change-Id: Ib6e42702dd1ce29645215114b26286f05ccc1332

diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 2ea23d8..fc0a8bf 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -322,20 +322,19 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
     return aToolString;
 }
 
-// Create a simple hashcode: the first six characters were evaluated.
+// Create a simple hashcode: the first six characters are evaluated.
 
 sal_uInt16 SbxVariable::MakeHashCode( const OUString& rName )
 {
     sal_uInt16 n = 0;
-    sal_Int32 i = 0;
-    sal_uInt16 nLen = rName.getLength();
+    sal_Int32 nLen = rName.getLength();
     if( nLen > 6 )
     {
         nLen = 6;
     }
-     while( nLen-- )
+    for( sal_Int32 i=0; i<nLen; ++i )
     {
-        sal_uInt8 c = (sal_uInt8)rName[i++];
+        sal_uInt8 c = static_cast<sal_uInt8>(rName[i]);
         // If we have a commen sigen break!!
         if( c >= 0x80 )
         {
commit c11223393c559e1182d5da2ab007151c2e7a5730
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Jul 15 09:11:03 2015 +0200

    Prefer member initializers to (cascaded) assignments
    
    Change-Id: Ic480981313c79f5edde8284e316b4c10a51ddf68

diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index c7d816d..e2b3884 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -82,11 +82,19 @@ private:
     sal_uInt32          mnState;
 
 public:
-                WindowStateData()
-                {
-                    mnValidMask = mnX = mnY = mnWidth = mnHeight = mnState = 0;
-                    mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0;
-                }
+    WindowStateData()
+        : mnValidMask(0)
+        , mnX(0)
+        , mnY(0)
+        , mnWidth(0)
+        , mnHeight(0)
+        , mnMaximizedX(0)
+        , mnMaximizedY(0)
+        , mnMaximizedWidth(0)
+        , mnMaximizedHeight(0)
+        , mnState(0)
+    {
+    }
 
     void        SetMask( sal_uInt32 nValidMask ) { mnValidMask = nValidMask; }
     sal_uInt32  GetMask() const { return mnValidMask; }
commit f0d6fa07cc17c6942644196671b7c94d522d4e14
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Jul 15 08:47:14 2015 +0200

    Use sal_uInt32 consistently for WindowStateData::SetMask and related
    
    Change-Id: I722828785a861065a69a1d83bc6e40517b164102

diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index 94ecbad..c7d816d 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -46,26 +46,26 @@ class VclContainer;
 // - WindowStateData -
 
 
-#define WINDOWSTATE_MASK_X                  ((sal_uLong)0x00000001)
-#define WINDOWSTATE_MASK_Y                  ((sal_uLong)0x00000002)
-#define WINDOWSTATE_MASK_WIDTH              ((sal_uLong)0x00000004)
-#define WINDOWSTATE_MASK_HEIGHT             ((sal_uLong)0x00000008)
-#define WINDOWSTATE_MASK_STATE              ((sal_uLong)0x00000010)
-#define WINDOWSTATE_MASK_MINIMIZED          ((sal_uLong)0x00000020)
-#define WINDOWSTATE_MASK_MAXIMIZED_X        ((sal_uLong)0x00000100)
-#define WINDOWSTATE_MASK_MAXIMIZED_Y        ((sal_uLong)0x00000200)
-#define WINDOWSTATE_MASK_MAXIMIZED_WIDTH    ((sal_uLong)0x00000400)
-#define WINDOWSTATE_MASK_MAXIMIZED_HEIGHT   ((sal_uLong)0x00000800)
+#define WINDOWSTATE_MASK_X                  ((sal_uInt32)0x00000001)
+#define WINDOWSTATE_MASK_Y                  ((sal_uInt32)0x00000002)
+#define WINDOWSTATE_MASK_WIDTH              ((sal_uInt32)0x00000004)
+#define WINDOWSTATE_MASK_HEIGHT             ((sal_uInt32)0x00000008)
+#define WINDOWSTATE_MASK_STATE              ((sal_uInt32)0x00000010)
+#define WINDOWSTATE_MASK_MINIMIZED          ((sal_uInt32)0x00000020)
+#define WINDOWSTATE_MASK_MAXIMIZED_X        ((sal_uInt32)0x00000100)
+#define WINDOWSTATE_MASK_MAXIMIZED_Y        ((sal_uInt32)0x00000200)
+#define WINDOWSTATE_MASK_MAXIMIZED_WIDTH    ((sal_uInt32)0x00000400)
+#define WINDOWSTATE_MASK_MAXIMIZED_HEIGHT   ((sal_uInt32)0x00000800)
 #define WINDOWSTATE_MASK_POS  (WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y)
 #define WINDOWSTATE_MASK_ALL  (WINDOWSTATE_MASK_X | WINDOWSTATE_MASK_Y | WINDOWSTATE_MASK_WIDTH | WINDOWSTATE_MASK_HEIGHT | WINDOWSTATE_MASK_MAXIMIZED_X | WINDOWSTATE_MASK_MAXIMIZED_Y | WINDOWSTATE_MASK_MAXIMIZED_WIDTH | WINDOWSTATE_MASK_MAXIMIZED_HEIGHT | WINDOWSTATE_MASK_STATE | WINDOWSTATE_MASK_MINIMIZED)
 
-#define WINDOWSTATE_STATE_NORMAL         ((sal_uLong)0x00000001)
-#define WINDOWSTATE_STATE_MINIMIZED      ((sal_uLong)0x00000002)
-#define WINDOWSTATE_STATE_MAXIMIZED      ((sal_uLong)0x00000004)
-#define WINDOWSTATE_STATE_ROLLUP         ((sal_uLong)0x00000008)
-#define WINDOWSTATE_STATE_MAXIMIZED_HORZ ((sal_uLong)0x00000010)
-#define WINDOWSTATE_STATE_MAXIMIZED_VERT ((sal_uLong)0x00000020)
-#define WINDOWSTATE_STATE_SYSTEMMASK     ((sal_uLong)0x0000FFFF)
+#define WINDOWSTATE_STATE_NORMAL         ((sal_uInt32)0x00000001)
+#define WINDOWSTATE_STATE_MINIMIZED      ((sal_uInt32)0x00000002)
+#define WINDOWSTATE_STATE_MAXIMIZED      ((sal_uInt32)0x00000004)
+#define WINDOWSTATE_STATE_ROLLUP         ((sal_uInt32)0x00000008)
+#define WINDOWSTATE_STATE_MAXIMIZED_HORZ ((sal_uInt32)0x00000010)
+#define WINDOWSTATE_STATE_MAXIMIZED_VERT ((sal_uInt32)0x00000020)
+#define WINDOWSTATE_STATE_SYSTEMMASK     ((sal_uInt32)0x0000FFFF)
 
 class VCL_PLUGIN_PUBLIC WindowStateData
 {
@@ -88,7 +88,7 @@ public:
                     mnMaximizedX = mnMaximizedY = mnMaximizedWidth = mnMaximizedHeight = 0;
                 }
 
-    void        SetMask( sal_uLong nValidMask ) { mnValidMask = nValidMask; }
+    void        SetMask( sal_uInt32 nValidMask ) { mnValidMask = nValidMask; }
     sal_uInt32  GetMask() const { return mnValidMask; }
 
     void         SetX( int nX ) { mnX = nX; }
@@ -223,7 +223,7 @@ public:
     const Size&     GetMaxOutputSizePixel() const;
 
     void            SetWindowState(const OString& rStr);
-    OString         GetWindowState(sal_uLong nMask = WINDOWSTATE_MASK_ALL) const;
+    OString         GetWindowState(sal_uInt32 nMask = WINDOWSTATE_MASK_ALL) const;
 
     void            SetMenuBar(MenuBar* pMenuBar, const css::uno::Reference<css::frame::XFrame>& rFrame = css::uno::Reference<css::frame::XFrame>());
     MenuBar*        GetMenuBar() const { return mpMenuBar; }
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 82faffb..953da10 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -381,7 +381,7 @@ void DockingWindow::ImplLoadRes( const ResId& rResId )
 {
     Window::ImplLoadRes( rResId );
 
-    sal_uLong  nMask = ReadLongRes();
+    const sal_uInt32 nMask = ReadLongRes();
 
     if ( (RSC_DOCKINGWINDOW_XYMAPMODE | RSC_DOCKINGWINDOW_X |
           RSC_DOCKINGWINDOW_Y) & nMask )
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 2ec48b3..2f95022 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -435,7 +435,7 @@ const Size& SystemWindow::GetMaxOutputSizePixel() const
 static void ImplWindowStateFromStr(WindowStateData& rData,
     const OString& rStr)
 {
-    sal_uLong       nValidMask  = 0;
+    sal_uInt32 nValidMask = 0;
     sal_Int32 nIndex      = 0;
     OString aTokenStr;
 
@@ -548,7 +548,7 @@ static void ImplWindowStateFromStr(WindowStateData& rData,
 
 static OString ImplWindowStateToStr(const WindowStateData& rData)
 {
-    sal_uLong nValidMask = rData.GetMask();
+    const sal_uInt32 nValidMask = rData.GetMask();
     if ( !nValidMask )
         return OString();
 
@@ -647,7 +647,7 @@ void SystemWindow::ImplMoveToScreen( long& io_rX, long& io_rY, long i_nWidth, lo
 
 void SystemWindow::SetWindowStateData( const WindowStateData& rData )
 {
-    sal_uLong nValidMask = rData.GetMask();
+    const sal_uInt32 nValidMask = rData.GetMask();
     if ( !nValidMask )
         return;
 
@@ -660,7 +660,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData )
 
     if ( pWindow->mpWindowImpl->mbFrame )
     {
-        sal_uLong           nState      = rData.GetState();
+        const sal_uInt32 nState     = rData.GetState();
         SalFrameState   aState;
         aState.mnMask               = rData.GetMask();
         aState.mnX                  = rData.GetX();
@@ -789,7 +789,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData )
         // 91625 - ignore Minimize
         if ( nValidMask & WINDOWSTATE_MASK_STATE )
         {
-            sal_uLong nState = rData.GetState();
+            const sal_uInt32 nState = rData.GetState();
             if ( nState & WINDOWSTATE_STATE_ROLLUP )
                 RollUp();
             else
@@ -800,7 +800,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData )
 
 void SystemWindow::GetWindowStateData( WindowStateData& rData ) const
 {
-    sal_uLong nValidMask = rData.GetMask();
+    sal_uInt32 nValidMask = rData.GetMask();
     if ( !nValidMask )
         return;
 
@@ -862,12 +862,12 @@ void SystemWindow::GetWindowStateData( WindowStateData& rData ) const
     {
         Point   aPos = GetPosPixel();
         Size    aSize = GetSizePixel();
-        sal_uLong   nState = 0;
+        sal_uInt32 nState = 0;
 
         if ( IsRollUp() )
         {
             aSize.Height() += maOrgSize.Height();
-            nState |= WINDOWSTATE_STATE_ROLLUP;
+            nState = WINDOWSTATE_STATE_ROLLUP;
         }
 
         if ( nValidMask & WINDOWSTATE_MASK_X )
@@ -893,7 +893,7 @@ void SystemWindow::SetWindowState(const OString& rStr)
     SetWindowStateData( aData );
 }
 
-OString SystemWindow::GetWindowState( sal_uLong nMask ) const
+OString SystemWindow::GetWindowState( sal_uInt32 nMask ) const
 {
     WindowStateData aData;
     aData.SetMask( nMask );
commit 903baa666b64e0576f35242970f3abe80723fbc1
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Tue Jul 14 22:45:40 2015 +0200

    Use more proper integer types
    
    Change-Id: If86163ddeff91571419a37becbbe75f98e681d7d

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 15f8bfe..1785790 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2050,7 +2050,7 @@ RTLFUNC(CDateFromIso)
     if ( rPar.Count() == 2 )
     {
         OUString aStr = rPar.Get(1)->GetOUString();
-        sal_Int16 iMonthStart = aStr.getLength() - 4;
+        const sal_Int32 iMonthStart = aStr.getLength() - 4;
         OUString aYearStr  = aStr.copy( 0, iMonthStart );
         OUString aMonthStr = aStr.copy( iMonthStart, 2 );
         OUString aDayStr   = aStr.copy( iMonthStart+2, 2 );
@@ -3836,9 +3836,9 @@ OUString getBasicTypeName( SbxDataType eType )
         "Decimal",          // SbxDECIMAL
     };
 
-    int nPos = ((int)eType) & 0x0FFF;
-    sal_uInt16 nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* );
-    if ( nPos < 0 || nPos >= nTypeNameCount )
+    size_t nPos = static_cast<size_t>(eType) & 0x0FFF;
+    const size_t nTypeNameCount = SAL_N_ELEMENTS( pTypeNames );
+    if ( nPos >= nTypeNameCount )
     {
         nPos = nTypeNameCount - 1;
     }
@@ -3989,7 +3989,7 @@ RTLFUNC(DDEInitiate)
     }
     else
     {
-        rPar.Get(0)->PutInteger( (int)nChannel );
+        rPar.Get(0)->PutInteger( static_cast<sal_Int16>(nChannel) );
     }
 }
 
commit c3a06bcac6536ccfcc49949492c98bfd82c68b52
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Jul 11 20:09:24 2015 +0200

    Use isEmpty()
    
    Change-Id: If26e7ca01d5f1f4fe5e98a2523660eb3c3783bc4

diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 7579687..3f152dd 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -562,8 +562,7 @@ void SvtMatchContext_Impl::doExecute()
     aURLs.clear();
 
     // check for input
-    sal_uInt16 nTextLen = aText.getLength();
-    if ( !nTextLen )
+    if ( aText.isEmpty() )
         return;
 
     if( aText.indexOf( '*' ) != -1 || aText.indexOf( '?' ) != -1 )
commit 3863005bb596d4b3ad67b43da33d7c1c98f2e239
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Jul 11 15:09:12 2015 +0200

    Fix some downcast warnings and reduce scope of variables
    
    Change-Id: Ica5f5947f37207c9dd2e51b7903fad52dd4836fd

diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index cae380f..623f0cd 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -613,31 +613,30 @@ void WMFWriter::WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, c
 
 void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly)
 {
-    sal_uInt16 nSize,i;
-
     Polygon aSimplePoly;
     if ( rPoly.HasFlags() )
         rPoly.AdaptiveSubdivide( aSimplePoly );
     else
         aSimplePoly = rPoly;
-    nSize = aSimplePoly.GetSize();
-    WriteRecordHeader(((sal_uLong)nSize)*2+4,W_META_POLYGON);
+    const sal_uInt16 nSize = aSimplePoly.GetSize();
+    WriteRecordHeader(static_cast<sal_uInt32>(nSize)*2+4,W_META_POLYGON);
     pWMF->WriteUInt16( nSize );
-    for (i=0; i<nSize; i++) WritePointXY(aSimplePoly.GetPoint(i));
+    for (sal_uInt16 i=0; i<nSize; ++i)
+        WritePointXY(aSimplePoly.GetPoint(i));
 }
 
 void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly)
 {
-    sal_uInt16 nSize,i;
     Polygon aSimplePoly;
     if ( rPoly.HasFlags() )
         rPoly.AdaptiveSubdivide( aSimplePoly );
     else
         aSimplePoly = rPoly;
-    nSize=aSimplePoly.GetSize();
-    WriteRecordHeader(((sal_uLong)nSize)*2+4,W_META_POLYLINE);
+    const sal_uInt16 nSize = aSimplePoly.GetSize();
+    WriteRecordHeader(static_cast<sal_uInt32>(nSize)*2+4,W_META_POLYLINE);
     pWMF->WriteUInt16( nSize );
-    for (i=0; i<nSize; i++) WritePointXY(aSimplePoly.GetPoint(i));
+    for (sal_uInt16 i=0; i<nSize; ++i)
+        WritePointXY(aSimplePoly.GetPoint(i));
 }
 
 void WMFWriter::WMFRecord_PolyPolygon(const tools::PolyPolygon & rPolyPoly)
@@ -1198,20 +1197,17 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
                     const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction *>(pMA);
                     OUString aTemp = pA->GetText().copy( pA->GetIndex(), std::min<sal_Int32>(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
 
-                    sal_uInt16 nLen,i;
-                    sal_Int32 nNormSize;
-
                     pVirDev->SetFont( aSrcFont );
-                    nLen = aTemp.getLength();
+                    const sal_Int32 nLen = aTemp.getLength();
                     std::unique_ptr<long[]> pDXAry(nLen ? new long[ nLen ] : NULL);
-                    nNormSize = pVirDev->GetTextArray( aTemp, pDXAry.get() );
+                    const sal_Int32 nNormSize = pVirDev->GetTextArray( aTemp, pDXAry.get() );
                     if (nLen && nNormSize == 0)
                     {
                         OSL_FAIL("Impossible div by 0 action: MetaStretchTextAction!");
                     }
                     else
                     {
-                        for ( i = 0; i < ( nLen - 1 ); i++ )
+                        for ( sal_Int32 i = 0; i < ( nLen - 1 ); i++ )
                             pDXAry[ i ] = pDXAry[ i ] * (sal_Int32)pA->GetWidth() / nNormSize;
                         if ( ( nLen <= 1 ) || ( (sal_Int32)pA->GetWidth() == nNormSize ) )
                             pDXAry.reset();
commit 9f7dad6b1e7b25b2e681a9a60afb07f3faa584df
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Jul 11 14:53:16 2015 +0200

    sal_uInt16 suffices here, and suppresses a downcast warning
    
    Change-Id: I480a816e39d188ef135f51d71ab8eb70c7aacc59

diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 096c84a..cae380f 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -730,7 +730,7 @@ void WMFWriter::WMFRecord_SetROP2(RasterOp eROP)
     pWMF->WriteUInt16( nROP2 );
 }
 
-void WMFWriter::WMFRecord_SetTextAlign(FontAlign eFontAlign, sal_uInt32 eHorTextAlign)
+void WMFWriter::WMFRecord_SetTextAlign(FontAlign eFontAlign, sal_uInt16 eHorTextAlign)
 {
     sal_uInt16 nAlign;
 
diff --git a/vcl/source/filter/wmf/wmfwr.hxx b/vcl/source/filter/wmf/wmfwr.hxx
index c017eb5..1acbc4e 100644
--- a/vcl/source/filter/wmf/wmfwr.hxx
+++ b/vcl/source/filter/wmf/wmfwr.hxx
@@ -79,7 +79,7 @@ private:
     vcl::Region    aSrcClipRegion;
     WMFWriterAttrStackMember * pAttrStack;
 
-    sal_uInt32    eSrcHorTextAlign;
+    sal_uInt16    eSrcHorTextAlign;
 
     // actual attribute in destination metafile:
     Color     aDstLineColor;
@@ -90,7 +90,7 @@ private:
     FontAlign eDstTextAlign;
     vcl::Font aDstFont;
 
-    sal_uInt32    eDstHorTextAlign;
+    sal_uInt16    eDstHorTextAlign;
 
     bool      bDstIsClipping; // ???: not taken into account at the moment
     vcl::Region    aDstClipRegion; // ???: not taken into account at the moment
@@ -164,7 +164,7 @@ private:
     void WMFRecord_SetStretchBltMode();
     void WMFRecord_SetPixel(const Point & rPoint, const Color & rColor);
     void WMFRecord_SetROP2(RasterOp eROP);
-    void WMFRecord_SetTextAlign(FontAlign eFontAlign, sal_uInt32 eHorTextAlign);
+    void WMFRecord_SetTextAlign(FontAlign eFontAlign, sal_uInt16 eHorTextAlign);
     void WMFRecord_SetTextColor(const Color & rColor);
     void WMFRecord_SetWindowExt(const Size & rSize);
     void WMFRecord_SetWindowOrg(const Point & rPoint);


More information about the Libreoffice-commits mailing list