[Libreoffice-commits] .: 3 commits - sot/inc sot/source sw/source tools/inc tools/source uui/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed May 2 16:07:16 PDT 2012
sot/inc/sot/stg.hxx | 3 +++
sot/inc/sot/storage.hxx | 1 +
sot/source/sdstor/stg.cxx | 7 +++++++
sot/source/sdstor/storage.cxx | 7 +++++++
sot/source/sdstor/ucbstorage.cxx | 5 +++++
sw/source/core/inc/scriptinfo.hxx | 8 ++++----
sw/source/core/text/porlay.cxx | 22 +++++++++++-----------
tools/inc/tools/stream.hxx | 3 ++-
tools/source/stream/stream.cxx | 6 +++---
uui/source/iahndl-errorhandler.cxx | 2 +-
uui/source/iahndl-ssl.cxx | 6 +++---
uui/source/iahndl.cxx | 7 +++----
uui/source/iahndl.hxx | 20 +-------------------
13 files changed, 51 insertions(+), 46 deletions(-)
New commits:
commit d726281e9020ebaddfdf6659ecfe7a0454014dff
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu May 3 00:05:37 2012 +0100
Related: fdo#47644 compound storage backend is poor at knowing stream size
Change-Id: Ie4aa6939f9f37e04fda5425a6e28c5d846a9cb62
diff --git a/sot/inc/sot/stg.hxx b/sot/inc/sot/stg.hxx
index 225c89e..ab567f3 100644
--- a/sot/inc/sot/stg.hxx
+++ b/sot/inc/sot/stg.hxx
@@ -94,6 +94,7 @@ public:
virtual sal_Bool Commit() = 0;
virtual sal_Bool Revert() = 0;
virtual sal_Bool Equals( const BaseStorageStream& rStream ) const = 0;
+ virtual sal_Size remainingSize() = 0;
};
class BaseStorage : public StorageBase
@@ -178,6 +179,7 @@ public:
virtual sal_Bool ValidateMode( StreamMode ) const;
const SvStream* GetSvStream() const;
virtual sal_Bool Equals( const BaseStorageStream& rStream ) const;
+ virtual sal_Size remainingSize();
};
class UCBStorageStream;
@@ -270,6 +272,7 @@ public:
virtual sal_Bool Revert();
virtual sal_Bool Validate( sal_Bool=sal_False ) const;
virtual sal_Bool ValidateMode( StreamMode ) const;
+ virtual sal_Size remainingSize();
const SvStream* GetSvStream() const;
virtual sal_Bool Equals( const BaseStorageStream& rStream ) const;
sal_Bool SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue );
diff --git a/sot/inc/sot/storage.hxx b/sot/inc/sot/storage.hxx
index b77d6dd..925ae42 100644
--- a/sot/inc/sot/storage.hxx
+++ b/sot/inc/sot/storage.hxx
@@ -95,6 +95,7 @@ public:
sal_Bool GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue );
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
GetXInputStream() const;
+ virtual sal_Size remainingSize();
};
#ifndef SOT_DECL_SOTSTORAGESTREAM_DEFINED
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 27c95c8..4f4e991 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -234,6 +234,13 @@ sal_uLong StorageStream::Seek( sal_uLong n )
return n;
}
+sal_Size StorageStream::remainingSize()
+{
+ if( Validate() )
+ return pEntry->GetSize() - Tell();
+ return 0;
+}
+
void StorageStream::Flush()
{
// Flushing means committing, since streams are never transacted
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 1006b7c..67b270f 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -286,6 +286,13 @@ sal_uInt32 SotStorageStream::GetSize() const
return nSize;
}
+sal_Size SotStorageStream::remainingSize()
+{
+ if (pOwnStm)
+ return pOwnStm->remainingSize();
+ return SvStream::remainingSize();
+}
+
/*************************************************************************
|* SotStorageStream::CopyTo()
|*
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 0254ef2..2a1a000 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1554,6 +1554,11 @@ sal_Bool UCBStorageStream::GetProperty( const String& rName, ::com::sun::star::u
return sal_False;
}
+sal_Size UCBStorageStream::remainingSize()
+{
+ return pImp->GetSize() - Tell();
+}
+
UCBStorage::UCBStorage( SvStream& rStrm, sal_Bool bDirect )
{
String aURL = GetLinkedFile( rStrm );
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx
index dc4505a..d60f9e6 100644
--- a/tools/inc/tools/stream.hxx
+++ b/tools/inc/tools/stream.hxx
@@ -374,7 +374,7 @@ public:
sal_Size SeekRel( sal_sSize nPos );
sal_Size Tell() const { return nBufFilePos+nBufActualPos; }
//length between current (Tell()) pos and end of stream
- sal_Size remainingSize();
+ virtual sal_Size remainingSize();
void Flush();
sal_Bool IsEof() const { return bIsEof; }
// next Tell() <= nSize
@@ -789,6 +789,7 @@ public:
sal_Bool IsObjectMemoryOwner() { return bOwnsData; }
void SetResizeOffset( sal_Size nNewResize ) { nResize = nNewResize; }
sal_Size GetResizeOffset() const { return nResize; }
+ virtual sal_Size remainingSize() { return GetSize() - Tell(); }
};
// --------------------
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 96cabc2..c1f06a7 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1703,9 +1703,9 @@ sal_Size SvStream::Seek( sal_Size nFilePos )
return nBufFilePos + nBufActualPos;
}
-//probably not as inefficient as it looks seeing as STREAM_SEEK_TO_END in the
-//Seek backends is nomally special cased feel free to make this virtual and add
-//good implementations for SvFileStream etc
+//STREAM_SEEK_TO_END in the some of the Seek backends is special cased to be
+//efficient, in others e.g. SotStorageStream it's really horribly slow, and in
+//those this should be overridden
sal_Size SvStream::remainingSize()
{
sal_Size nCurr = Tell();
commit 80fdb3498c68f9e7f9bdd98674e762cb084fce57
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed May 2 22:45:52 2012 +0100
drop ensure for non-NULL pointer and use a ref
Change-Id: I492c576a9a04874538f07769f5ac40f84e2d4308
diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx
index f3abea7..aa89315 100644
--- a/uui/source/iahndl-errorhandler.cxx
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -185,7 +185,7 @@ UUIInteractionHelper::handleErrorHandlerRequest(
if (!xManager.get())
return;
ResId aResId(aId[eSource], *xManager.get());
- if (!ErrorResource(aResId).getString(nErrorCode, &aMessage))
+ if (!ErrorResource(aResId).getString(nErrorCode, aMessage))
return;
}
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
index 5bd3832..2b860ff 100644
--- a/uui/source/iahndl-ssl.cxx
+++ b/uui/source/iahndl-ssl.cxx
@@ -172,7 +172,7 @@ executeUnknownAuthDialog(
{
ResId aResId(RID_UUI_ERRHDL, *xManager.get());
if (ErrorResource(aResId).getString(
- ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED, &aMessage))
+ ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED, aMessage))
{
aMessage = UUIInteractionHelper::replaceMessageWithArguments(
aMessage, aArguments );
@@ -241,7 +241,7 @@ executeSSLWarnDialog(
ResId aResId(RID_UUI_ERRHDL, *xManager.get());
if (ErrorResource(aResId).getString(
ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + DESCRIPTION_1,
- &aMessage_1))
+ aMessage_1))
{
aMessage_1 = UUIInteractionHelper::replaceMessageWithArguments(
aMessage_1, aArguments_1 );
@@ -250,7 +250,7 @@ executeSSLWarnDialog(
rtl::OUString aTitle;
ErrorResource(aResId).getString(
- ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, &aTitle);
+ ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, aTitle);
xDialog->SetText( aTitle );
}
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 2406b40..8816ea9 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -1488,7 +1488,7 @@ UUIInteractionHelper::handleBrokenPackageRequest(
return;
ResId aResId( RID_UUI_ERRHDL, *xManager.get() );
- if ( !ErrorResource(aResId).getString(nErrorCode, &aMessage) )
+ if ( !ErrorResource(aResId).getString(nErrorCode, aMessage) )
return;
}
@@ -1545,17 +1545,16 @@ UUIInteractionHelper::handleBrokenPackageRequest(
//=========================================================================
bool
-ErrorResource::getString(ErrCode nErrorCode, rtl::OUString * pString)
+ErrorResource::getString(ErrCode nErrorCode, rtl::OUString &rString)
const SAL_THROW(())
{
- OSL_ENSURE(pString, "specification violation");
ResId aResId(static_cast< sal_uInt16 >(nErrorCode & ERRCODE_RES_MASK),
*m_pResMgr);
aResId.SetRT(RSC_STRING);
if (!IsAvailableRes(aResId))
return false;
aResId.SetAutoRelease(false);
- *pString = UniString(aResId);
+ rString = aResId.toString();
m_pResMgr->PopContext();
return true;
}
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index df1edde..3306e27 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -346,28 +346,10 @@ public:
inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
- bool getString(ErrCode nErrorCode, rtl::OUString * pString) const
+ bool getString(ErrCode nErrorCode, rtl::OUString &rString) const
SAL_THROW(());
};
-/*
-class InteractionRequest
-{
-public:
- InteractionRequest(
- com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionRequest > const & rRequest)
- : m_aRequest( rRequest ) {}
-
- virtual bool toString( rtl::OUString & rString ) = 0;
- virtual bool handle( rtl::OUString & rString ) = 0;
-
-private:
- com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionRequest > m_aRequest;
-};
-*/
-
#endif // UUI_IAHNDL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4312651dfc47a9bb6eff5c18862e67dded1cf385
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed May 2 22:40:44 2012 +0100
XubString->rtl::OUString
Change-Id: I21b785169788e20c8bb05c2fdc9333068f1c69ab
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index aa636fc..b58dbb2 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -291,7 +291,7 @@ public:
Start index of the text
@return Returns if the language is an Arabic language
*/
- static sal_Bool IsArabicText( const XubString& rTxt, xub_StrLen nStt, xub_StrLen nLen );
+ static bool IsArabicText( const rtl::OUString& rTxt, sal_Int32 nStt, sal_Int32 nLen );
/** Performes a thai justification on the kerning array
@@ -311,9 +311,9 @@ public:
The value which has to be added to the cells.
@return The number of extra spaces in the given range
*/
- static sal_uInt16 ThaiJustify( const XubString& rTxt, sal_Int32* pKernArray,
- sal_Int32* pScrArray, xub_StrLen nIdx,
- xub_StrLen nLen, xub_StrLen nNumberOfBlanks = 0,
+ static sal_Int32 ThaiJustify( const rtl::OUString& rTxt, sal_Int32* pKernArray,
+ sal_Int32* pScrArray, sal_Int32 nIdx,
+ sal_Int32 nLen, sal_Int32 nNumberOfBlanks = 0,
long nSpaceAdd = 0 );
static SwScriptInfo* GetScriptInfo( const SwTxtNode& rNode,
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 7f0e387..7d8bdee 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1851,7 +1851,7 @@ sal_uInt16 SwScriptInfo::KashidaJustify( sal_Int32* pKernArray,
* character has to be checked because a ctl portion only contains one
* script, see NewTxtPortion
*************************************************************************/
-sal_Bool SwScriptInfo::IsArabicText( const XubString& rTxt, xub_StrLen nStt, xub_StrLen nLen )
+bool SwScriptInfo::IsArabicText( const rtl::OUString& rTxt, sal_Int32 nStt, sal_Int32 nLen )
{
using namespace ::com::sun::star::i18n;
static ScriptTypeList typeList[] = {
@@ -1862,7 +1862,7 @@ sal_Bool SwScriptInfo::IsArabicText( const XubString& rTxt, xub_StrLen nStt, xub
// go forward if current position does not hold a regular character:
const CharClass& rCC = GetAppCharClass();
sal_Int32 nIdx = nStt;
- const xub_StrLen nEnd = nStt + nLen;
+ const sal_Int32 nEnd = nStt + nLen;
while ( nIdx < nEnd && !rCC.isLetterNumeric( rTxt, (xub_StrLen)nIdx ) )
{
++nIdx;
@@ -1880,11 +1880,11 @@ sal_Bool SwScriptInfo::IsArabicText( const XubString& rTxt, xub_StrLen nStt, xub
if( nIdx >= 0 )
{
- const xub_Unicode cCh = rTxt.GetChar( (xub_StrLen)nIdx );
+ const xub_Unicode cCh = rTxt[nIdx];
const sal_Int16 type = unicode::getUnicodeScriptType( cCh, typeList, UnicodeScript_kScriptCount );
return type == UnicodeScript_kArabic;
}
- return sal_False;
+ return false;
}
/*************************************************************************
@@ -2075,22 +2075,22 @@ bool SwScriptInfo::MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen* pKashidaPo
* SwScriptInfo::ThaiJustify()
*************************************************************************/
-sal_uInt16 SwScriptInfo::ThaiJustify( const XubString& rTxt, sal_Int32* pKernArray,
- sal_Int32* pScrArray, xub_StrLen nStt,
- xub_StrLen nLen, xub_StrLen nNumberOfBlanks,
+sal_Int32 SwScriptInfo::ThaiJustify( const rtl::OUString& rTxt, sal_Int32* pKernArray,
+ sal_Int32* pScrArray, sal_Int32 nStt,
+ sal_Int32 nLen, sal_Int32 nNumberOfBlanks,
long nSpaceAdd )
{
- OSL_ENSURE( nStt + nLen <= rTxt.Len(), "String in ThaiJustify too small" );
+ OSL_ENSURE( nStt + nLen <= rTxt.getLength(), "String in ThaiJustify too small" );
SwTwips nNumOfTwipsToDistribute = nSpaceAdd * nNumberOfBlanks /
SPACING_PRECISION_FACTOR;
long nSpaceSum = 0;
- sal_uInt16 nCnt = 0;
+ sal_Int32 nCnt = 0;
- for ( sal_uInt16 nI = 0; nI < nLen; ++nI )
+ for (sal_Int32 nI = 0; nI < nLen; ++nI)
{
- const xub_Unicode cCh = rTxt.GetChar( nStt + nI );
+ const xub_Unicode cCh = rTxt[nStt + nI];
// check if character is not above or below base
if ( ( 0xE34 > cCh || cCh > 0xE3A ) &&
More information about the Libreoffice-commits
mailing list