[Libreoffice-commits] .: 2 commits - filter/inc filter/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Dec 15 05:25:25 PST 2010
filter/inc/filter/msfilter/mstoolbar.hxx | 2 +-
filter/source/msfilter/mstoolbar.cxx | 11 ++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
New commits:
commit 549054984c759b47422a8ca1aed0ea7e07f60882
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 15 11:46:24 2010 +0000
tweak signature to avoid casting
diff --git a/filter/inc/filter/msfilter/mstoolbar.hxx b/filter/inc/filter/msfilter/mstoolbar.hxx
index 1e52336..4da10ab 100644
--- a/filter/inc/filter/msfilter/mstoolbar.hxx
+++ b/filter/inc/filter/msfilter/mstoolbar.hxx
@@ -74,7 +74,7 @@ protected:
public:
TBBase() : nOffSet( 0 ) {}
virtual ~TBBase(){}
- rtl::OUString readUnicodeString( SvStream* pS, sal_Int32 nChars );
+ rtl::OUString readUnicodeString( SvStream* pS, sal_Size nChars );
virtual bool Read(SvStream *pS) = 0;
virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index daee39b..3ddeb9e 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -186,7 +186,7 @@ TBBase::indent_printf( FILE* fp, const char* format, ... )
va_end( ap );
}
-rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Int32 nChars )
+rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Size nChars )
{
sal_Size nBufSize = nChars * 2;
boost::scoped_array< sal_uInt8 > pArray( new sal_uInt8[ nBufSize ] );
@@ -394,7 +394,7 @@ WString::Read( SvStream *pS )
nOffSet = pS->Tell();
sal_Int8 nChars = 0;
*pS >> nChars;
- sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
+ sString = readUnicodeString( pS, nChars );
return true;
}
commit 544f97cefe4a36f26ff352bbf163977bc5f07077
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Dec 15 11:42:07 2010 +0000
protect against short read
diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
index 81b73e5..daee39b 100644
--- a/filter/source/msfilter/mstoolbar.cxx
+++ b/filter/source/msfilter/mstoolbar.cxx
@@ -188,10 +188,11 @@ TBBase::indent_printf( FILE* fp, const char* format, ... )
rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Int32 nChars )
{
- sal_Int32 nBufSize = nChars * 2;
+ sal_Size nBufSize = nChars * 2;
boost::scoped_array< sal_uInt8 > pArray( new sal_uInt8[ nBufSize ] );
- pS->Read( pArray.get(), nBufSize );
- return svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pArray.get() ), nBufSize );
+ sal_Size nReadSize = pS->Read( pArray.get(), nBufSize );
+ OSL_ASSERT(nReadSize == nBufSize);
+ return svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pArray.get() ), nReadSize );
}
TBCHeader::TBCHeader() : bSignature( 0x3 )
More information about the Libreoffice-commits
mailing list