From df2e78f1a8a1dc628eb26c8173ba1f6bae0ca6f4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 22 Nov 2017 10:02:51 +0000 Subject: replace check of eof and GetError with good MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7d9f04262ab5420e9a14813fa1274bb9d01e3291 Reviewed-on: https://gerrit.libreoffice.org/45076 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- svtools/source/svrtf/svparser.cxx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'svtools/source') diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index a83cf8e85da4..021fa7255f77 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -193,14 +193,14 @@ sal_uInt32 SvParser::GetNextChar() bool bSeekBack = true; rInput.ReadUChar( c1 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( !bErr ) { if( 0xff == c1 || 0xfe == c1 ) { unsigned char c2; rInput.ReadUChar( c2 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( !bErr ) { if( 0xfe == c1 && 0xff == c2 ) @@ -221,14 +221,14 @@ sal_uInt32 SvParser::GetNextChar() { unsigned char c2; rInput.ReadUChar( c2 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( !bErr ) { if( ( 0xef == c1 && 0xbb == c2 ) || ( 0xbb == c1 && 0xef == c2 ) ) { unsigned char c3(0); rInput.ReadUChar( c3 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( !bErr && ( 0xbf == c3 ) ) { SetSrcEncoding(RTL_TEXTENCODING_UTF8); @@ -252,13 +252,12 @@ sal_uInt32 SvParser::GetNextChar() unsigned char c1, c2; rInput.ReadUChar( c1 ).ReadUChar( c2 ); - if( 2 == rInput.Tell() && - !(rInput.eof() || rInput.GetError()) && + if( 2 == rInput.Tell() && rInput.good() && ( (bUCS2BSrcEnc && 0xfe == c1 && 0xff == c2) || (!bUCS2BSrcEnc && 0xff == c1 && 0xfe == c2) ) ) rInput.ReadUChar( c1 ).ReadUChar( c2 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( !bErr ) { if( bUCS2BSrcEnc ) @@ -279,7 +278,7 @@ sal_uInt32 SvParser::GetNextChar() { sal_Char c1; // signed, that's the text converter expects rInput.ReadChar( c1 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( !bErr ) { if ( @@ -315,7 +314,7 @@ sal_uInt32 SvParser::GetNextChar() while( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOOSMALL) != 0 ) { rInput.ReadChar( c1 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( bErr ) break; @@ -361,7 +360,7 @@ sal_uInt32 SvParser::GetNextChar() nLen < 10 ) { rInput.ReadChar( c1 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( bErr ) break; -- cgit