fix SequenceOutputStream constness
Change-Id: I6e1039c077602b2cb42702cb4131f9503ef533c2
This commit is contained in:
@@ -196,7 +196,7 @@ public:
|
|||||||
|
|
||||||
/** Imports the raw binary data from the specified stream.
|
/** Imports the raw binary data from the specified stream.
|
||||||
@return True, if the data could be imported from the stream. */
|
@return True, if the data could be imported from the stream. */
|
||||||
bool importBinaryData( StreamDataSequence const & orDataSeq, const OUString& rStreamName );
|
bool importBinaryData( StreamDataSequence & orDataSeq, const OUString& rStreamName );
|
||||||
|
|
||||||
// com.sun.star.lang.XServiceInfo interface -------------------------------
|
// com.sun.star.lang.XServiceInfo interface -------------------------------
|
||||||
|
|
||||||
|
@@ -175,7 +175,7 @@ private:
|
|||||||
construction, the stream points to the beginning of the passed data
|
construction, the stream points to the beginning of the passed data
|
||||||
sequence. The data sequence is expanded automatically while writing to it.
|
sequence. The data sequence is expanded automatically while writing to it.
|
||||||
*/
|
*/
|
||||||
class OOX_DLLPUBLIC SequenceOutputStream : public SequenceSeekableStream, public BinaryOutputStream
|
class OOX_DLLPUBLIC SequenceOutputStream : public BinaryOutputStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Constructs the wrapper object for the passed data sequence.
|
/** Constructs the wrapper object for the passed data sequence.
|
||||||
@@ -185,13 +185,26 @@ public:
|
|||||||
wrapper. The data sequence MUST NOT be changed from outside as long
|
wrapper. The data sequence MUST NOT be changed from outside as long
|
||||||
as this stream wrapper is used to write to it.
|
as this stream wrapper is used to write to it.
|
||||||
*/
|
*/
|
||||||
explicit SequenceOutputStream( StreamDataSequence const & rData );
|
explicit SequenceOutputStream( StreamDataSequence & rData );
|
||||||
|
|
||||||
/** Writes the passed data sequence. */
|
/** Writes the passed data sequence. */
|
||||||
virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) override;
|
virtual void writeData( const StreamDataSequence& rData, size_t nAtomSize = 1 ) override;
|
||||||
|
|
||||||
/** Write nBytes bytes from the (preallocated!) buffer pMem. */
|
/** Write nBytes bytes from the (preallocated!) buffer pMem. */
|
||||||
virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
|
virtual void writeMemory( const void* pMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) override;
|
||||||
|
|
||||||
|
/** Returns the size of the wrapped data sequence. */
|
||||||
|
virtual sal_Int64 size() const override;
|
||||||
|
/** Returns the current stream position. */
|
||||||
|
virtual sal_Int64 tell() const override;
|
||||||
|
/** Seeks the stream to the passed position. */
|
||||||
|
virtual void seek( sal_Int64 nPos ) override;
|
||||||
|
/** Releases the reference to the data sequence. */
|
||||||
|
virtual void close() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
StreamDataSequence* mpData; ///< Wrapped data sequence.
|
||||||
|
sal_Int32 mnPos; ///< Current position in the sequence.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -379,7 +379,7 @@ VbaProject& FilterBase::getVbaProject() const
|
|||||||
return *mxImpl->mxVbaProject;
|
return *mxImpl->mxVbaProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilterBase::importBinaryData( StreamDataSequence const & orDataSeq, const OUString& rStreamName )
|
bool FilterBase::importBinaryData( StreamDataSequence & orDataSeq, const OUString& rStreamName )
|
||||||
{
|
{
|
||||||
OSL_ENSURE( !rStreamName.isEmpty(), "FilterBase::importBinaryData - empty stream name" );
|
OSL_ENSURE( !rStreamName.isEmpty(), "FilterBase::importBinaryData - empty stream name" );
|
||||||
if( rStreamName.isEmpty() )
|
if( rStreamName.isEmpty() )
|
||||||
|
@@ -130,9 +130,10 @@ void BinaryOutputStream::writeCompressedUnicodeArray( const OUString& rString, b
|
|||||||
writeUnicodeArray( rString );
|
writeUnicodeArray( rString );
|
||||||
}
|
}
|
||||||
|
|
||||||
SequenceOutputStream::SequenceOutputStream( StreamDataSequence const & rData ) :
|
SequenceOutputStream::SequenceOutputStream( StreamDataSequence & rData ) :
|
||||||
BinaryStreamBase( true ),
|
BinaryStreamBase( true ),
|
||||||
SequenceSeekableStream( rData )
|
mpData( &rData ),
|
||||||
|
mnPos( 0 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,12 +148,38 @@ void SequenceOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes, size
|
|||||||
if( mpData && (nBytes > 0) )
|
if( mpData && (nBytes > 0) )
|
||||||
{
|
{
|
||||||
if( mpData->getLength() - mnPos < nBytes )
|
if( mpData->getLength() - mnPos < nBytes )
|
||||||
const_cast< StreamDataSequence* >( mpData )->realloc( mnPos + nBytes );
|
mpData->realloc( mnPos + nBytes );
|
||||||
memcpy( const_cast< StreamDataSequence* >( mpData )->getArray() + mnPos, pMem, static_cast< size_t >( nBytes ) );
|
memcpy( mpData->getArray() + mnPos, pMem, static_cast< size_t >( nBytes ) );
|
||||||
mnPos += nBytes;
|
mnPos += nBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sal_Int64 SequenceOutputStream::size() const
|
||||||
|
{
|
||||||
|
return mpData ? mpData->getLength() : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sal_Int64 SequenceOutputStream::tell() const
|
||||||
|
{
|
||||||
|
return mpData ? mnPos : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SequenceOutputStream::seek( sal_Int64 nPos )
|
||||||
|
{
|
||||||
|
if( mpData )
|
||||||
|
{
|
||||||
|
mnPos = getLimitedValue< sal_Int32, sal_Int64 >( nPos, 0, mpData->getLength() );
|
||||||
|
mbEof = mnPos != nPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SequenceOutputStream::close()
|
||||||
|
{
|
||||||
|
mpData = nullptr;
|
||||||
|
mbEof = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace oox
|
} // namespace oox
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -176,7 +176,7 @@ private:
|
|||||||
void importControl( SequenceInputStream& rStrm );
|
void importControl( SequenceInputStream& rStrm );
|
||||||
|
|
||||||
/** Imports the binary data of an embedded OLE object from the fragment with the passed ID. */
|
/** Imports the binary data of an embedded OLE object from the fragment with the passed ID. */
|
||||||
void importEmbeddedOleData( const StreamDataSequence& orEmbeddedData, const OUString& rRelId );
|
void importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const OUString& rRelId );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xls
|
} // namespace xls
|
||||||
|
@@ -895,7 +895,7 @@ void WorksheetFragment::importControl( SequenceInputStream& rStrm )
|
|||||||
getVmlDrawing().registerControl( aInfo );
|
getVmlDrawing().registerControl( aInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorksheetFragment::importEmbeddedOleData( const StreamDataSequence& orEmbeddedData, const OUString& rRelId )
|
void WorksheetFragment::importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const OUString& rRelId )
|
||||||
{
|
{
|
||||||
OUString aFragmentPath = getFragmentPathFromRelId( rRelId );
|
OUString aFragmentPath = getFragmentPathFromRelId( rRelId );
|
||||||
if( !aFragmentPath.isEmpty() )
|
if( !aFragmentPath.isEmpty() )
|
||||||
|
Reference in New Issue
Block a user