[Libreoffice-commits] core.git: basic/source include/basic

Valentin Kettner vakevk+libreoffice at gmail.com
Fri Mar 28 12:13:37 PDT 2014


 basic/source/basmgr/basmgr.cxx    |    2 -
 basic/source/comp/codegen.cxx     |    2 -
 basic/source/runtime/inputbox.cxx |    2 -
 basic/source/runtime/iosys.cxx    |   48 +++++++++++++++++++-------------------
 basic/source/runtime/methods.cxx  |    4 +--
 basic/source/runtime/stdobj.cxx   |    2 -
 basic/source/sbx/sbxcoll.cxx      |    2 -
 basic/source/sbx/sbxdec.cxx       |    2 -
 basic/source/sbx/sbxobj.cxx       |    2 -
 basic/source/uno/dlgcont.cxx      |    3 --
 basic/source/uno/namecont.cxx     |   21 +++++-----------
 basic/source/uno/scriptcont.cxx   |    3 --
 include/basic/basmgr.hxx          |    8 +++---
 13 files changed, 46 insertions(+), 55 deletions(-)

New commits:
commit 061130bd6d60c648991afb83bc0befb48a68f34e
Author: Valentin Kettner <vakevk+libreoffice at gmail.com>
Date:   Mon Mar 17 17:18:08 2014 +0100

    fdo#75280 Started cleaning up of sal_uIntPtr usage.
    
    Converted wrong usage of sal_uIntPtr to appropriate other types in basic
    module.
    
    The bug is not fully fixed with this since many other occurences of sal_uIntPtr remain.
    
    Update due to code review comments:
    Fixed forgetting to change some declarations in iosys.cxx.
    Cleaned up the one remaining sal_uIntPtr in iosys.cxx
    Fixed adding a sal_uInt64 to a Date (uses long now instead) in methods.cxx
    Fixed the VarDecFromUI4 call in sbxdec.cxx from sal_uLong to ULONG .
    
    Conflicts:
    	basic/source/runtime/iosys.cxx
    
    Change-Id: Ia6460be04967deb68b92eb62d945da8814fae605

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 9413b79..180e1c8 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -357,7 +357,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const container::Cont
     }
 }
 
-BasicError::BasicError( sal_uIntPtr nId, sal_uInt16 nR, const OUString& rErrStr ) :
+BasicError::BasicError( sal_uInt64 nId, sal_uInt16 nR, const OUString& rErrStr ) :
     aErrStr( rErrStr )
 {
     nErrorId    = nId;
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 029175b..70fdc55 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -287,7 +287,7 @@ void SbiCodeGen::Save()
                     // The parameter:
                     SbxInfo* pInfo = pMeth->GetInfo();
                     OUString aHelpFile, aComment;
-                    sal_uIntPtr nHelpId = 0;
+                    sal_uInt32 nHelpId = 0;
                     if( pInfo )
                     {
                         // Rescue the additional data
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index e574e4e..152d625 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -148,7 +148,7 @@ RTLFUNC(InputBox)
     (void)pBasic;
     (void)bWrite;
 
-    sal_uIntPtr nArgCount = rPar.Count();
+    sal_uInt32 nArgCount = rPar.Count();
     if ( nArgCount < 2 )
         StarBASIC::Error( SbERR_BAD_ARGUMENT );
     else
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index dd486a9..e5f868f1 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -313,11 +313,11 @@ class OslStream : public SvStream
 public:
                         OslStream( const OUString& rName, short nStrmMode );
                        ~OslStream();
-    virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ) SAL_OVERRIDE;
-    virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ) SAL_OVERRIDE;
-    virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ) SAL_OVERRIDE;
+    virtual sal_uInt64 GetData( void* pData, sal_uInt64 nSize ) SAL_OVERRIDE;
+    virtual sal_uInt64 PutData( const void* pData, sal_uInt64 nSize ) SAL_OVERRIDE;
+    virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) SAL_OVERRIDE;
     virtual void        FlushData() SAL_OVERRIDE;
-    virtual void        SetSize( sal_uIntPtr nSize ) SAL_OVERRIDE;
+    virtual void        SetSize( sal_uInt64 nSize) SAL_OVERRIDE;
 };
 
 OslStream::OslStream( const OUString& rName, short nStrmMode )
@@ -357,21 +357,21 @@ OslStream::~OslStream()
     maFile.close();
 }
 
-sal_uIntPtr OslStream::GetData( void* pData, sal_uIntPtr nSize )
+sal_uInt64 OslStream::GetData( void* pData, sal_uInt64 nSize )
 {
     sal_uInt64 nBytesRead = nSize;
     maFile.read( pData, nBytesRead, nBytesRead );
-    return (sal_uIntPtr)nBytesRead;
+    return nBytesRead;
 }
 
-sal_uIntPtr OslStream::PutData( const void* pData, sal_uIntPtr nSize )
+sal_uInt64 OslStream::PutData( const void* pData, sal_uInt64 nSize )
 {
     sal_uInt64 nBytesWritten;
-    maFile.write( pData, (sal_uInt64)nSize, nBytesWritten );
-    return (sal_uIntPtr)nBytesWritten;
+    maFile.write( pData, nSize, nBytesWritten );
+    return nBytesWritten;
 }
 
-sal_uIntPtr OslStream::SeekPos( sal_uIntPtr nPos )
+sal_uInt64 OslStream::SeekPos( sal_uInt64 nPos )
 {
     ::osl::FileBase::RC rc = ::osl::FileBase::E_None;
     if( nPos == STREAM_SEEK_TO_END )
@@ -385,16 +385,16 @@ sal_uIntPtr OslStream::SeekPos( sal_uIntPtr nPos )
     OSL_VERIFY(rc == ::osl::FileBase::E_None);
     sal_uInt64 nRealPos(0);
     maFile.getPos( nRealPos );
-    return sal::static_int_cast<sal_uIntPtr>(nRealPos);
+    return nRealPos;
 }
 
 void OslStream::FlushData()
 {
 }
 
-void OslStream::SetSize( sal_uIntPtr nSize )
+void OslStream::SetSize( sal_uInt64 nSize )
 {
-    maFile.setSize( (sal_uInt64)nSize );
+    maFile.setSize( nSize );
 }
 
 
@@ -407,11 +407,11 @@ public:
                         UCBStream( Reference< XInputStream > & xIS );
                         UCBStream( Reference< XStream > & xS );
                        ~UCBStream();
-    virtual sal_uIntPtr GetData( void* pData, sal_uIntPtr nSize ) SAL_OVERRIDE;
-    virtual sal_uIntPtr PutData( const void* pData, sal_uIntPtr nSize ) SAL_OVERRIDE;
-    virtual sal_uIntPtr SeekPos( sal_uIntPtr nPos ) SAL_OVERRIDE;
+    virtual sal_uInt64 GetData( void* pData, sal_uInt64 nSize ) SAL_OVERRIDE;
+    virtual sal_uInt64 PutData( const void* pData, sal_uInt64 nSize ) SAL_OVERRIDE;
+    virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) SAL_OVERRIDE;
     virtual void        FlushData() SAL_OVERRIDE;
-    virtual void        SetSize( sal_uIntPtr nSize ) SAL_OVERRIDE;
+    virtual void        SetSize( sal_uInt64 nSize ) SAL_OVERRIDE;
 };
 
 UCBStream::UCBStream( Reference< XInputStream > & rStm )
@@ -450,7 +450,7 @@ UCBStream::~UCBStream()
     }
 }
 
-sal_uIntPtr UCBStream::GetData( void* pData, sal_uIntPtr nSize )
+sal_uInt64 UCBStream::GetData( void* pData, sal_uInt64 nSize )
 {
     try
     {
@@ -481,7 +481,7 @@ sal_uIntPtr UCBStream::GetData( void* pData, sal_uIntPtr nSize )
     return 0;
 }
 
-sal_uIntPtr UCBStream::PutData( const void* pData, sal_uIntPtr nSize )
+sal_uInt64 UCBStream::PutData( const void* pData, sal_uInt64 nSize )
 {
     try
     {
@@ -504,13 +504,13 @@ sal_uIntPtr UCBStream::PutData( const void* pData, sal_uIntPtr nSize )
     return 0;
 }
 
-sal_uIntPtr UCBStream::SeekPos( sal_uIntPtr nPos )
+sal_uInt64 UCBStream::SeekPos( sal_uInt64 nPos )
 {
     try
     {
         if( xSeek.is() )
         {
-            sal_uIntPtr nLen = sal::static_int_cast<sal_uIntPtr>( xSeek->getLength() );
+            sal_uInt64 nLen = static_cast<sal_uInt64>( xSeek->getLength() );
             if( nPos > nLen )
             {
                 nPos = nLen;
@@ -550,7 +550,7 @@ void UCBStream::FlushData()
     }
 }
 
-void    UCBStream::SetSize( sal_uIntPtr nSize )
+void    UCBStream::SetSize( sal_uInt64 nSize )
 {
     (void)nSize;
 
@@ -687,10 +687,10 @@ void SbiStream::ExpandFile()
 {
     if ( nExpandOnWriteTo )
     {
-        sal_uIntPtr nCur = pStrm->Seek(STREAM_SEEK_TO_END);
+        sal_uInt64 nCur = pStrm->Seek(STREAM_SEEK_TO_END);
         if( nCur < nExpandOnWriteTo )
         {
-            sal_uIntPtr nDiff = nExpandOnWriteTo - nCur;
+            sal_uInt64 nDiff = nExpandOnWriteTo - nCur;
             char c = 0;
             while( nDiff-- )
             {
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index b35d8d6..75449462 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1828,12 +1828,12 @@ sal_Int16 implGetDateDay( double aDate )
     if ( aDate >= 0.0 )
     {
         aDate = floor( aDate );
-        aRefDate += (sal_uIntPtr)aDate;
+        aRefDate += static_cast<long>(aDate);
     }
     else
     {
         aDate = ceil( aDate );
-        aRefDate -= (sal_uIntPtr)(-1.0 * aDate);
+        aRefDate -= static_cast<long>(-1.0 * aDate);
     }
 
     sal_Int16 nRet = (sal_Int16)( aRefDate.GetDay() );
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 5e46c9b..47df365 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -828,7 +828,7 @@ void SbiStdObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
     {
         SbxVariable* pVar = pHint->GetVar();
         SbxArray* pPar_ = pVar->GetParameters();
-        sal_uIntPtr t = pHint->GetId();
+        sal_uLong t = pHint->GetId();
         sal_uInt16 nCallId = (sal_uInt16) pVar->GetUserData();
         if( nCallId )
         {
diff --git a/basic/source/sbx/sbxcoll.cxx b/basic/source/sbx/sbxcoll.cxx
index a474919..3d473a3 100644
--- a/basic/source/sbx/sbxcoll.cxx
+++ b/basic/source/sbx/sbxcoll.cxx
@@ -120,7 +120,7 @@ void SbxCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
     const SbxHint* p = PTR_CAST(SbxHint,&rHint);
     if( p )
     {
-        sal_uIntPtr nId = p->GetId();
+        sal_uLong nId = p->GetId();
         bool bRead  = ( nId == SBX_HINT_DATAWANTED );
         bool bWrite = ( nId == SBX_HINT_DATACHANGED );
         SbxVariable* pVar = p->GetVar();
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index c9fd347..59f5e01 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -167,7 +167,7 @@ void SbxDecimal::setUShort( sal_uInt16 val )
 
 void SbxDecimal::setULong( sal_uInt32 val )
 {
-    VarDecFromUI4( (sal_uIntPtr)val, &maDec );
+    VarDecFromUI4( static_cast<ULONG>(val), &maDec );
 }
 
 bool SbxDecimal::setSingle( float val )
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index e1894a2..e2fd6f2 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -140,7 +140,7 @@ void SbxObject::SFX_NOTIFY( SfxBroadcaster&, const TypeId&,
     const SbxHint* p = PTR_CAST(SbxHint,&rHint);
     if( p )
     {
-        sal_uIntPtr nId = p->GetId();
+        sal_uLong nId = p->GetId();
         bool bRead  = ( nId == SBX_HINT_DATAWANTED );
         bool bWrite = ( nId == SBX_HINT_DATACHANGED );
         SbxVariable* pVar = p->GetVar();
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 532310e..79662a7 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -325,8 +325,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
     {
         OSL_FAIL( "Parsing error\n" );
         SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFile );
-        sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-        ErrorHandler::HandleError( nErrorCode );
+        ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
         return aRetAny;
     }
 
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 6376b9d..35fa717 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1532,8 +1532,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
                         throw;
                     }
                     SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aElementPath );
-                    sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-                    ErrorHandler::HandleError( nErrorCode );
+                    ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
                 }
             }
         }
@@ -1645,8 +1644,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
                 throw;
             }
             SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aLibInfoPath );
-            sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-            ErrorHandler::HandleError( nErrorCode );
+            ErrorHandler::HandleError(  ERRCODE_IO_GENERAL );
         }
     }
     if( !xOut.is() )
@@ -1715,8 +1713,7 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile(  SfxLibrary* pLib,
             if( !GbMigrationSuppressErrors )
             {
                 SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aLibInfoPath );
-                sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-                ErrorHandler::HandleError( nErrorCode );
+                ErrorHandler::HandleError(  ERRCODE_IO_GENERAL );
             }
         }
     }
@@ -1739,8 +1736,7 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile(  SfxLibrary* pLib,
     {
         SAL_WARN("basic", "Parsing error");
         SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aLibInfoPath );
-        sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-        ErrorHandler::HandleError( nErrorCode );
+        ErrorHandler::HandleError(  ERRCODE_IO_GENERAL );
         return false;
     }
 
@@ -2072,8 +2068,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
         }
         catch(const uno::Exception& )
         {
-            sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-            ErrorHandler::HandleError( nErrorCode );
+            ErrorHandler::HandleError(  ERRCODE_IO_GENERAL );
         }
     }
     else
@@ -2096,8 +2091,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
         {
             xOut.clear();
             SfxErrorContext aEc( ERRCTX_SFX_SAVEDOC, aLibInfoPath );
-            sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-            ErrorHandler::HandleError( nErrorCode );
+            ErrorHandler::HandleError(  ERRCODE_IO_GENERAL );
         }
 
     }
@@ -2128,8 +2122,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
     catch(const uno::Exception& )
     {
         SAL_WARN("basic", "Problem during storing of libraries!");
-        sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-        ErrorHandler::HandleError( nErrorCode );
+        ErrorHandler::HandleError(  ERRCODE_IO_GENERAL );
     }
 }
 
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index aa59796..e37e4cf 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -271,8 +271,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
     catch(const Exception& )
     {
         SfxErrorContext aEc( ERRCTX_SFX_LOADBASIC, aFile );
-        sal_uIntPtr nErrorCode = ERRCODE_IO_GENERAL;
-        ErrorHandler::HandleError( nErrorCode );
+        ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
     }
 
     aRetAny <<= aMod.aCode;
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
index 9a55f5d..01d90e7 100644
--- a/include/basic/basmgr.hxx
+++ b/include/basic/basmgr.hxx
@@ -46,19 +46,19 @@ class SotStorage;
 class BASIC_DLLPUBLIC BasicError
 {
 private:
-    sal_uIntPtr nErrorId;
+    sal_uInt64 nErrorId;
     sal_uInt16  nReason;
     OUString  aErrStr;
 
 public:
             BasicError( const BasicError& rErr );
-            BasicError( sal_uIntPtr nId, sal_uInt16 nR, const OUString& rErrStr );
+            BasicError( sal_uInt64 nId, sal_uInt16 nR, const OUString& rErrStr );
 
-    sal_uIntPtr GetErrorId() const                  { return nErrorId; }
+    sal_uInt64 GetErrorId() const                  { return nErrorId; }
     sal_uInt16  GetReason() const                   { return nReason; }
     OUString    GetErrorStr()                       { return aErrStr; }
 
-    void    SetErrorId( sal_uIntPtr n )             { nErrorId = n; }
+    void    SetErrorId( sal_uInt64 n )             { nErrorId = n; }
     void    SetReason( sal_uInt16 n )               { nReason = n; }
     void    SetErrorStr( const OUString& rStr)      { aErrStr = rStr; }
 };


More information about the Libreoffice-commits mailing list