diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-04-03 22:00:25 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-04-03 23:27:40 +0200 |
commit | baa6a3b90d7d888cc294c960f5b184718673b1dd (patch) | |
tree | 13ba2cdc20605dc6a8e8e6b5305e23c29eee5596 /sfx2 | |
parent | 56f0144b0a40048505de4bac81e25f2454e43704 (diff) |
prevent some unnecessary casting
Change-Id: I56b324cc8431347c25472f7ef3ac5871b226f5b1
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/bastyp/helper.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 26 | ||||
-rw-r--r-- | sfx2/source/inc/helper.hxx | 6 |
3 files changed, 15 insertions, 25 deletions
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index cc439db6c8ce..caa150641474 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -283,16 +283,15 @@ sal_Bool SfxContentHelper::IsHelpErrorDocument( const OUString& rURL ) // ----------------------------------------------------------------------- -sal_uIntPtr SfxContentHelper::GetSize( const String& rContent ) +sal_Int64 SfxContentHelper::GetSize( const String& rContent ) { - sal_uIntPtr nSize = 0; - sal_Int64 nTemp = 0; + sal_Int64 nSize = 0; INetURLObject aObj( rContent ); DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" ); try { ::ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); - aCnt.getPropertyValue( "Size" ) >>= nTemp; + aCnt.getPropertyValue( "Size" ) >>= nSize; } catch( const ucb::CommandAbortedException& ) { @@ -302,7 +301,6 @@ sal_uIntPtr SfxContentHelper::GetSize( const String& rContent ) { SAL_WARN( "sfx2.bastyp", "Any other exception" ); } - nSize = (sal_uInt32)nTemp; return nSize; } diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index b16b3f1eb0bf..86461460f2aa 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -113,18 +113,18 @@ const sal_uInt16 HI_ACTION = 4; static const char DOCUMENT_SIGNATURE_MENU_CMD[] = "Signature"; //------------------------------------------------------------------------ -String CreateSizeText( sal_uIntPtr nSize, sal_Bool bExtraBytes = sal_True, sal_Bool bSmartExtraBytes = sal_False ); -String CreateSizeText( sal_uIntPtr nSize, sal_Bool bExtraBytes, sal_Bool bSmartExtraBytes ) +namespace { + +String CreateSizeText( sal_Int64 nSize ) { String aUnitStr = rtl::OUString(' '); aUnitStr += SfxResId(STR_BYTES).toString(); - sal_uIntPtr nSize1 = nSize; - sal_uIntPtr nSize2 = nSize1; - sal_uIntPtr nMega = 1024 * 1024; - sal_uIntPtr nGiga = nMega * 1024; + sal_Int64 nSize1 = nSize; + sal_Int64 nSize2 = nSize1; + sal_Int64 nMega = 1024 * 1024; + sal_Int64 nGiga = nMega * 1024; double fSize = nSize; int nDec = 0; - sal_Bool bGB = sal_False; if ( nSize1 >= 10000 && nSize1 < nMega ) { @@ -147,7 +147,6 @@ String CreateSizeText( sal_uIntPtr nSize, sal_Bool bExtraBytes, sal_Bool bSmartE nSize1 /= nGiga; aUnitStr = ' '; aUnitStr += SfxResId(STR_GB).toString(); - bGB = sal_True; fSize /= nGiga; nDec = 3; } @@ -155,7 +154,7 @@ String CreateSizeText( sal_uIntPtr nSize, sal_Bool bExtraBytes, sal_Bool bSmartE const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData(); String aSizeStr( rLocaleWrapper.getNum( nSize1, 0 ) ); aSizeStr += aUnitStr; - if ( bExtraBytes && ( nSize1 < nSize2 ) ) + if ( nSize1 < nSize2 ) { aSizeStr = ::rtl::math::doubleToUString( fSize, rtl_math_StringFormat_F, nDec, @@ -168,14 +167,6 @@ String CreateSizeText( sal_uIntPtr nSize, sal_Bool bExtraBytes, sal_Bool bSmartE aSizeStr += SfxResId(STR_BYTES).toString(); aSizeStr += ')'; } - else if ( bGB && bSmartExtraBytes ) - { - nSize1 = nSize / nMega; - aSizeStr = " ("; - aSizeStr += rLocaleWrapper.getNum( nSize1, 0 ); - aSizeStr += aUnitStr; - aSizeStr += ')'; - } return aSizeStr; } @@ -197,6 +188,7 @@ String ConvertDateTime_Impl( const String& rName, return aStr; } +} //------------------------------------------------------------------------ SfxDocumentInfoItem::SfxDocumentInfoItem() diff --git a/sfx2/source/inc/helper.hxx b/sfx2/source/inc/helper.hxx index 6c008d42e12e..a228f2c9f93e 100644 --- a/sfx2/source/inc/helper.hxx +++ b/sfx2/source/inc/helper.hxx @@ -34,10 +34,10 @@ public: GetResultSet( const String& rURL ); static ::com::sun::star::uno::Sequence< ::rtl::OUString > GetHelpTreeViewContents( const String& rURL ); - static OUString GetActiveHelpString( const OUString& rURL ); - static sal_Bool IsHelpErrorDocument( const OUString& rURL ); + static OUString GetActiveHelpString( const OUString& rURL ); + static sal_Bool IsHelpErrorDocument( const OUString& rURL ); - static sal_uIntPtr GetSize( const String& rContent ); + static sal_Int64 GetSize( const String& rContent ); }; #endif // #ifndef _SFX_HELPER_HXX |