summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-10-24 13:57:23 +0200
committerMichael Stahl <mstahl@redhat.com>2014-10-24 13:58:48 +0200
commit95c798409acf491cd43530215ade8f403ad96579 (patch)
tree882078678d5d39cba0ab27033ea43ed25c8f523b /package
parent6e9d99332c241cf20204d9dfb772bc0168bfc460 (diff)
package: OInputCompStream::m_xStream is never null
... as proven by the un-checked dereference in the dispose() method called from the dtor; simplify based on that and assert in ctor. Change-Id: Id369b80bd89fa59d99b209796c33acb39cbb10f3
Diffstat (limited to 'package')
-rw-r--r--package/source/xstor/ocompinstream.cxx31
-rw-r--r--package/source/xstor/oseekinstream.cxx14
2 files changed, 6 insertions, 39 deletions
diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx
index bf6b186d9838..dad94aa0ee82 100644
--- a/package/source/xstor/ocompinstream.cxx
+++ b/package/source/xstor/ocompinstream.cxx
@@ -43,7 +43,7 @@ OInputCompStream::OInputCompStream( OWriteStream_Impl& aImpl,
if ( !m_pImpl->m_rMutexRef.Is() )
throw uno::RuntimeException(); // just a disaster
- OSL_ENSURE( xStream.is(), "No stream is provided!\n" );
+ assert(m_xStream.is());
}
OInputCompStream::OInputCompStream( uno::Reference < io::XInputStream > xStream,
@@ -57,7 +57,7 @@ OInputCompStream::OInputCompStream( uno::Reference < io::XInputStream > xStream,
, m_bDisposed( false )
, m_nStorageType( nStorageType )
{
- OSL_ENSURE( xStream.is(), "No stream is provided!\n" );
+ assert(m_xStream.is());
}
OInputCompStream::~OInputCompStream()
@@ -119,12 +119,6 @@ sal_Int32 SAL_CALL OInputCompStream::readBytes( uno::Sequence< sal_Int8 >& aData
throw lang::DisposedException();
}
- if ( !m_xStream.is() )
- {
- SAL_INFO("package.xstor", "No stream!");
- throw uno::RuntimeException();
- }
-
return m_xStream->readBytes( aData, nBytesToRead );
}
@@ -141,12 +135,6 @@ sal_Int32 SAL_CALL OInputCompStream::readSomeBytes( uno::Sequence< sal_Int8 >& a
throw lang::DisposedException();
}
- if ( !m_xStream.is() )
- {
- SAL_INFO("package.xstor", "No stream!");
- throw uno::RuntimeException();
- }
-
return m_xStream->readSomeBytes( aData, nMaxBytesToRead );
}
@@ -164,12 +152,6 @@ void SAL_CALL OInputCompStream::skipBytes( sal_Int32 nBytesToSkip )
throw lang::DisposedException();
}
- if ( !m_xStream.is() )
- {
- SAL_INFO("package.xstor", "No stream!");
- throw uno::RuntimeException();
- }
-
m_xStream->skipBytes( nBytesToSkip );
}
@@ -186,12 +168,6 @@ sal_Int32 SAL_CALL OInputCompStream::available( )
throw lang::DisposedException();
}
- if ( !m_xStream.is() )
- {
- SAL_INFO("package.xstor", "No stream!");
- throw uno::RuntimeException();
- }
-
return m_xStream->available();
}
@@ -214,9 +190,6 @@ uno::Reference< io::XInputStream > SAL_CALL OInputCompStream::getInputStream()
throw lang::DisposedException();
}
- if ( !m_xStream.is() )
- return uno::Reference< io::XInputStream >();
-
return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY );
}
diff --git a/package/source/xstor/oseekinstream.cxx b/package/source/xstor/oseekinstream.cxx
index cf5db722a906..bdd7f6004d06 100644
--- a/package/source/xstor/oseekinstream.cxx
+++ b/package/source/xstor/oseekinstream.cxx
@@ -32,11 +32,8 @@ OInputSeekStream::OInputSeekStream( OWriteStream_Impl& pImpl,
sal_Int32 nStorageType )
: OInputCompStream( pImpl, xStream, aProps, nStorageType )
{
- if ( m_xStream.is() )
- {
- m_xSeekable = uno::Reference< io::XSeekable >( m_xStream, uno::UNO_QUERY );
- OSL_ENSURE( m_xSeekable.is(), "No seeking support!\n" );
- }
+ m_xSeekable = uno::Reference< io::XSeekable >( m_xStream, uno::UNO_QUERY );
+ OSL_ENSURE( m_xSeekable.is(), "No seeking support!\n" );
}
OInputSeekStream::OInputSeekStream( uno::Reference < io::XInputStream > xStream,
@@ -44,11 +41,8 @@ OInputSeekStream::OInputSeekStream( uno::Reference < io::XInputStream > xStream,
sal_Int32 nStorageType )
: OInputCompStream( xStream, aProps, nStorageType )
{
- if ( m_xStream.is() )
- {
- m_xSeekable = uno::Reference< io::XSeekable >( m_xStream, uno::UNO_QUERY );
- OSL_ENSURE( m_xSeekable.is(), "No seeking support!\n" );
- }
+ m_xSeekable = uno::Reference< io::XSeekable >( m_xStream, uno::UNO_QUERY );
+ OSL_ENSURE( m_xSeekable.is(), "No seeking support!\n" );
}
OInputSeekStream::~OInputSeekStream()