summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-09-25 16:34:36 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-10-23 11:53:16 +0200
commitd55648b7e5cd499196389ed9ba5c7badbf3522e5 (patch)
tree1a11bb08f1460888958507ba4c91f82286a2eb13 /sax
parentcc3ac382a2827a42d45f3fcb5e2149c163667ba0 (diff)
FastSerializer: check for valid output stream in one place is enough
Change-Id: Id89fb1f0444331c2858a9795ae81dcdb875d3d2b
Diffstat (limited to 'sax')
-rw-r--r--sax/source/tools/fastserializer.cxx19
-rw-r--r--sax/source/tools/fshelper.cxx1
2 files changed, 1 insertions, 19 deletions
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index d85bfefd700a..a6b5afda6bd4 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -72,9 +72,6 @@ namespace sax_fastparser {
void SAL_CALL FastSaxSerializer::startDocument( ) throw (SAXException, RuntimeException)
{
- assert(mxOutputStream.is()); // cannot do anything without that
- if (!mxOutputStream.is())
- return;
rtl::ByteSequence aXmlHeader((const sal_Int8*) "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", 56);
writeBytes(toUnoSequence(aXmlHeader));
}
@@ -112,9 +109,6 @@ namespace sax_fastparser {
void SAL_CALL FastSaxSerializer::endDocument( ) throw (SAXException, RuntimeException)
{
- if (!mxOutputStream.is())
- return;
-
maOutputStream.flush();
mxOutputStream->writeBytes(maOutputData);
}
@@ -151,9 +145,6 @@ namespace sax_fastparser {
void SAL_CALL FastSaxSerializer::startFastElement( ::sal_Int32 Element, const Reference< XFastAttributeList >& Attribs )
throw (SAXException, RuntimeException)
{
- if (!mxOutputStream.is())
- return;
-
if ( !maMarkStack.empty() )
maMarkStack.top()->setCurrentElement( Element );
@@ -172,9 +163,6 @@ namespace sax_fastparser {
void SAL_CALL FastSaxSerializer::endFastElement( ::sal_Int32 Element )
throw (SAXException, RuntimeException)
{
- if (!mxOutputStream.is())
- return;
-
#ifdef DBG_UTIL
assert(!m_DebugStartedElements.empty());
// Well-formedness constraint: Element Type Match
@@ -192,9 +180,6 @@ namespace sax_fastparser {
void SAL_CALL FastSaxSerializer::singleFastElement( ::sal_Int32 Element, const Reference< XFastAttributeList >& Attribs )
throw (SAXException, RuntimeException)
{
- if (!mxOutputStream.is())
- return;
-
if ( !maMarkStack.empty() )
maMarkStack.top()->setCurrentElement( Element );
@@ -209,9 +194,6 @@ namespace sax_fastparser {
void SAL_CALL FastSaxSerializer::characters( const OUString& aChars )
throw (SAXException, RuntimeException)
{
- if (!mxOutputStream.is())
- return;
-
write( aChars );
}
@@ -219,7 +201,6 @@ namespace sax_fastparser {
throw (::com::sun::star::uno::RuntimeException)
{
mxOutputStream = xOutputStream;
- assert(mxOutputStream.is()); // cannot do anything without that
}
void SAL_CALL FastSaxSerializer::setFastTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xFastTokenHandler )
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index c19bd4b8c359..c49c0da04bc9 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -35,6 +35,7 @@ FastSerializerHelper::FastSerializerHelper(const Reference< io::XOutputStream >&
mxTokenHandler = css::xml::sax::FastTokenHandler::create(xContext);
mpSerializer->setFastTokenHandler( mxTokenHandler );
+ assert(xOutputStream.is()); // cannot do anything without that
mpSerializer->setOutputStream( xOutputStream );
if( bWriteHeader )
mpSerializer->startDocument();