[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/source
Don Lewis
truckman at apache.org
Tue Jan 30 21:10:17 UTC 2018
sw/source/filter/ww8/ww8scan.cxx | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
New commits:
commit 399cb9a456bc7d0da10b3b61d17ebf4460f7fc3c
Author: Don Lewis <truckman at apache.org>
Date: Tue Jan 30 20:10:07 2018 +0000
Be slightly less tricky and change
do {
} while (!this);
to
do {
} while (0);
Computing !this must be done at runtime, whereas the intent is for
the loop to exit after the first iteration, which can be handled at
compile time when using a constant zero. Also, "this" should always
be non-NULL in valid c++ code, but if ever happened to be NULL, then
this code could loop forever.
While here, translate nearby comments.
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f2f1391592b3..679b735ebc9e 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -6197,12 +6197,12 @@ WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara)
if ( 20 > nRead ) break;
rSt >> ftcBi;
- // ggfs. den Rest ueberlesen
+ // ggfs. Check the rest
if( 20 < nRead )
rSt.SeekRel( nRead-20 );
}
- while( !this ); // Trick: obiger Block wird genau einmal durchlaufen
- // und kann vorzeitig per "break" verlassen werden.
+ while( 0 ); // Trick: The above block is run through exactly once
+ // and can be prematurely left by "break".
if( 0 != rSt.GetError() )
{
@@ -6255,19 +6255,19 @@ WW8_STD* WW8Style::Read1STDFixed( short& rSkip, short* pcbStd )
if( 8 > nRead ) break;
rSt >> pStd->bchUpe;
- // ab Ver8 sollten diese beiden Felder dazukommen:
+ // from Ver8 these two fields should be added
if(10 > nRead ) break;
rSt >> a16Bit;
pStd->fAutoRedef = a16Bit & 0x0001 ;
pStd->fHidden = ( a16Bit & 0x0002 ) >> 1;
- // man kann nie wissen: vorsichtshalber ueberlesen
- // wir eventuelle Fuellsel, die noch zum BASE-Part gehoeren...
+ // you never know: as a precaution, we read over any
+ // filler that still belongs to the BASE part...
if( 10 < nRead )
rSt.SeekRel( nRead-10 );
}
- while( !this ); // Trick: obiger Block wird genau einmal durchlaufen
- // und kann vorzeitig per "break" verlassen werden.
+ while( 0 ); // Trick: above block is run through exactly once and
+ // can be prematurely left by "break".
if( (0 != rSt.GetError()) || !nRead )
DELETEZ( pStd ); // per NULL den Error melden
More information about the Libreoffice-commits
mailing list