Kaydet (Commit) 469780c7 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

fdo#54744: Fix broken logic of string comparison

d1cc0071 "sal_Bool to bool, String to OUString,
in SfxMedium." changed

  !aLogicName.CompareToAscii( "private:stream", 14 ) == COMPARE_EQUAL     // (a)

where that suspicious ! made it effectively behave as

  aLogicName.CompareToAscii( "private:stream", 14 ) != COMPARE_EQUAL      // (b)

to

  (aLogicName.compareToAscii("private:stream", 14) == 0)                  // (c)

where (c) corresponds to (a), but the intended behavior was apparently (b):
Exporting to hybrid PDF now causes the embedded ODF stream (which is saved to a
private:stream URL) to be empty, as (c) is erroneously satisfied now, causing
the following lines to erroneously clear SID_OUTPUTSTREAM.

Change-Id: Ia2c1a69db7b4da07bfe01f52c3f6759301358a84
üst 6cb080ff
...@@ -2464,7 +2464,7 @@ void SfxMedium::Init_Impl() ...@@ -2464,7 +2464,7 @@ void SfxMedium::Init_Impl()
SFX_ITEMSET_ARG( pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false); SFX_ITEMSET_ARG( pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
if( pOutStreamItem if( pOutStreamItem
&& ( !( pOutStreamItem->GetValue() >>= rOutStream ) && ( !( pOutStreamItem->GetValue() >>= rOutStream )
|| (pImp->m_aLogicName.compareToAscii("private:stream", 14) == 0)) ) || (pImp->m_aLogicName.compareToAscii("private:stream", 14) != 0)) )
{ {
pImp->m_pSet->ClearItem( SID_OUTPUTSTREAM ); pImp->m_pSet->ClearItem( SID_OUTPUTSTREAM );
OSL_FAIL( "Unexpected Output stream parameter!\n" ); OSL_FAIL( "Unexpected Output stream parameter!\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment