Kaydet (Commit) baa6a3b9 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

prevent some unnecessary casting

Change-Id: I56b324cc8431347c25472f7ef3ac5871b226f5b1
üst 56f0144b
......@@ -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;
}
......
......@@ -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()
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment