summaryrefslogtreecommitdiff
path: root/package/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-02-09 15:57:25 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-02-11 07:09:11 +0100
commitb143e7642f93e83f4f3c4df56c3e1e8e64e36ce0 (patch)
treecb2c90dfc8dd0d1dff5103a8c12a1d926058a129 /package/source
parent2ded5f80b43f91fc1bcd8fbc17bafb0758de3f70 (diff)
tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: Ib9ad5b874a210ef3862c668158fcc5d18eeab363 Reviewed-on: https://gerrit.libreoffice.org/67579 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'package/source')
-rw-r--r--package/source/xstor/xstorage.cxx92
1 files changed, 43 insertions, 49 deletions
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index a7cdc1de4d9e..a07d06cbaa20 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -1674,69 +1674,63 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain
if ( m_nRelInfoStatus == RELINFO_BROKEN || m_nRelInfoStatus == RELINFO_CHANGED_BROKEN )
throw io::IOException( THROW_WHERE );
- if ( m_nRelInfoStatus == RELINFO_CHANGED
- || m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ
- || m_nRelInfoStatus == RELINFO_CHANGED_STREAM )
+ if (m_nRelInfoStatus == RELINFO_CHANGED)
{
- if ( m_nRelInfoStatus == RELINFO_CHANGED )
+ if (m_aRelInfo.getLength())
{
- if ( m_aRelInfo.getLength() )
- {
- CreateRelStorage();
+ CreateRelStorage();
- uno::Reference< io::XStream > xRelsStream =
- m_xRelStorage->openStreamElement( ".rels" ,
- embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE );
+ uno::Reference<io::XStream> xRelsStream = m_xRelStorage->openStreamElement(
+ ".rels", embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE);
- uno::Reference< io::XOutputStream > xOutStream = xRelsStream->getOutputStream();
- if ( !xOutStream.is() )
- throw uno::RuntimeException( THROW_WHERE );
+ uno::Reference<io::XOutputStream> xOutStream = xRelsStream->getOutputStream();
+ if (!xOutStream.is())
+ throw uno::RuntimeException(THROW_WHERE);
- ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aRelInfo, m_xContext );
+ ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence(xOutStream, m_aRelInfo,
+ m_xContext);
- // set the mediatype
- uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
- xPropSet->setPropertyValue(
- "MediaType",
- uno::makeAny( OUString( "application/vnd.openxmlformats-package.relationships+xml" ) ) );
+ // set the mediatype
+ uno::Reference<beans::XPropertySet> xPropSet(xRelsStream, uno::UNO_QUERY_THROW);
+ xPropSet->setPropertyValue(
+ "MediaType", uno::makeAny(OUString(
+ "application/vnd.openxmlformats-package.relationships+xml")));
- m_nRelInfoStatus = RELINFO_READ;
- }
- else if ( m_xRelStorage.is() )
- RemoveStreamRelInfo( OUString() ); // remove own rel info
+ m_nRelInfoStatus = RELINFO_READ;
}
- else if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ
- || m_nRelInfoStatus == RELINFO_CHANGED_STREAM )
- {
- CreateRelStorage();
+ else if (m_xRelStorage.is())
+ RemoveStreamRelInfo(OUString()); // remove own rel info
+ }
+ else if (m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ
+ || m_nRelInfoStatus == RELINFO_CHANGED_STREAM)
+ {
+ CreateRelStorage();
- uno::Reference< io::XStream > xRelsStream =
- m_xRelStorage->openStreamElement( ".rels",
- embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE );
+ uno::Reference<io::XStream> xRelsStream = m_xRelStorage->openStreamElement(
+ ".rels", embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE);
- uno::Reference< io::XOutputStream > xOutputStream = xRelsStream->getOutputStream();
- if ( !xOutputStream.is() )
- throw uno::RuntimeException( THROW_WHERE );
+ uno::Reference<io::XOutputStream> xOutputStream = xRelsStream->getOutputStream();
+ if (!xOutputStream.is())
+ throw uno::RuntimeException(THROW_WHERE);
- uno::Reference< io::XSeekable > xSeek( m_xNewRelInfoStream, uno::UNO_QUERY_THROW );
- xSeek->seek( 0 );
- ::comphelper::OStorageHelper::CopyInputToOutput( m_xNewRelInfoStream, xOutputStream );
+ uno::Reference<io::XSeekable> xSeek(m_xNewRelInfoStream, uno::UNO_QUERY_THROW);
+ xSeek->seek(0);
+ ::comphelper::OStorageHelper::CopyInputToOutput(m_xNewRelInfoStream, xOutputStream);
- // set the mediatype
- uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
- xPropSet->setPropertyValue(
- "MediaType",
- uno::makeAny( OUString( "application/vnd.openxmlformats-package.relationships+xml" ) ) );
+ // set the mediatype
+ uno::Reference<beans::XPropertySet> xPropSet(xRelsStream, uno::UNO_QUERY_THROW);
+ xPropSet->setPropertyValue(
+ "MediaType",
+ uno::makeAny(OUString("application/vnd.openxmlformats-package.relationships+xml")));
- m_xNewRelInfoStream.clear();
- if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM )
- {
- m_aRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >();
- m_nRelInfoStatus = RELINFO_NO_INIT;
- }
- else
- m_nRelInfoStatus = RELINFO_READ;
+ m_xNewRelInfoStream.clear();
+ if (m_nRelInfoStatus == RELINFO_CHANGED_STREAM)
+ {
+ m_aRelInfo = uno::Sequence<uno::Sequence<beans::StringPair>>();
+ m_nRelInfoStatus = RELINFO_NO_INIT;
}
+ else
+ m_nRelInfoStatus = RELINFO_READ;
}
if ( m_xRelStorage.is() )