diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-22 10:02:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-11-22 13:33:46 +0100 |
commit | df2e78f1a8a1dc628eb26c8173ba1f6bae0ca6f4 (patch) | |
tree | 6aaf6d2f2613c3de773e3d3134b0d1354e0d0b12 | |
parent | 2161d04688be77112c281a1ada5263b963677c43 (diff) |
replace check of eof and GetError with good
Change-Id: I7d9f04262ab5420e9a14813fa1274bb9d01e3291
Reviewed-on: https://gerrit.libreoffice.org/45076
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | basic/source/classes/image.cxx | 2 | ||||
-rw-r--r-- | emfio/source/reader/wmfreader.cxx | 12 | ||||
-rw-r--r-- | filter/source/graphicfilter/ipbm/ipbm.cxx | 12 | ||||
-rw-r--r-- | filter/source/graphicfilter/ipict/ipict.cxx | 8 | ||||
-rw-r--r-- | lotuswordpro/source/filter/LotusWordProImportFilter.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/dbgui/scuiasciiopt.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/appl/xpackcreator.cxx | 2 | ||||
-rw-r--r-- | svtools/source/svrtf/svparser.cxx | 19 | ||||
-rw-r--r-- | sw/source/core/edit/edtox.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/laycache.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/index/cnttab.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/graphicfilter2.cxx | 13 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pngread.cxx | 2 |
14 files changed, 40 insertions, 49 deletions
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index a773acfb7d7c..6fc7a50b17d7 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -73,7 +73,7 @@ void SbiImage::Clear() bool SbiGood( SvStream const & r ) { - return !r.eof() && r.GetError() == ERRCODE_NONE; + return r.good(); } // Open Record diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 9f13b78db0c2..6599e54f8b17 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -1362,13 +1362,11 @@ namespace emfio mnCurrentAction++; mpInputStream->ReadUInt32(mnRecSize).ReadUInt16( nFunction ); - if( mpInputStream->GetError() - || (mnRecSize < 3 ) - || (mnRecSize == 3 - && nFunction == 0 - ) - || mpInputStream->eof() - ) + if ( + !mpInputStream->good() || + (mnRecSize < 3) || + (mnRecSize == 3 && nFunction == 0) + ) { if( mpInputStream->eof() ) mpInputStream->SetError( SVSTREAM_FILEFORMAT_ERROR ); diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx index ca63bb570b3e..3228b0bdc3ee 100644 --- a/filter/source/graphicfilter/ipbm/ipbm.cxx +++ b/filter/source/graphicfilter/ipbm/ipbm.cxx @@ -281,7 +281,7 @@ bool PBMReader::ImplReadBody() case 0 : while ( nHeight != mnHeight ) { - if ( mrPBM.eof() || mrPBM.GetError() ) + if (!mrPBM.good()) return false; if ( --nShift < 0 ) @@ -303,7 +303,7 @@ bool PBMReader::ImplReadBody() case 1 : while ( nHeight != mnHeight ) { - if ( mrPBM.eof() || mrPBM.GetError() ) + if (!mrPBM.good()) return false; mrPBM.ReadUChar( nDat ); @@ -321,7 +321,7 @@ bool PBMReader::ImplReadBody() case 2 : while ( nHeight != mnHeight ) { - if ( mrPBM.eof() || mrPBM.GetError() ) + if (!mrPBM.good()) return false; sal_uInt8 nR, nG, nB; @@ -346,7 +346,7 @@ bool PBMReader::ImplReadBody() case 0 : while ( !bFinished ) { - if ( mrPBM.eof() || mrPBM.GetError() ) + if (!mrPBM.good()) return false; mrPBM.ReadUChar( nDat ); @@ -405,7 +405,7 @@ bool PBMReader::ImplReadBody() continue; } - if ( mrPBM.eof() || mrPBM.GetError() ) + if (!mrPBM.good()) return false; mrPBM.ReadUChar( nDat ); @@ -478,7 +478,7 @@ bool PBMReader::ImplReadBody() continue; } - if ( mrPBM.eof() || mrPBM.GetError() ) + if (!mrPBM.good()) return false; mrPBM.ReadUChar( nDat ); diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index b5d88979f7c8..67292c76a46b 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -1213,7 +1213,7 @@ void PictReader::ReadHeader() // a small test to check if versionOp code exists after the bdbox ( with no extra NOP codes) pPict->Seek(nOffset+10); pPict->ReadBytes(sBuf, 2); - if (pPict->eof() || pPict->GetError()) break; + if (!pPict->good()) break; if (sBuf[0] == 0x11 || (sBuf[0] == 0x00 && sBuf[1] == 0x11)) ; // maybe ok else continue; } @@ -1231,7 +1231,7 @@ void PictReader::ReadHeader() if (st >= 3 && actualConfid != 20) continue; aBoundingRect=tools::Rectangle( x1,y1, x2, y2 ); - if (pPict->eof() || pPict->GetError()) continue; + if (!pPict->good()) continue; // read version pPict->ReadBytes(sBuf, 2); // version 1 file @@ -1250,7 +1250,7 @@ void PictReader::ReadHeader() } while ( sBuf[0] == 0x00 && numZero < 10); actualConfid -= (numZero-1); // extra nop are dubious - if (pPict->eof() || pPict->GetError()) continue; + if (!pPict->good()) continue; if (sBuf[0] != 0x11) continue; // not a version opcode // abnormal version 1 file if (sBuf[1] == 0x01 ) { @@ -1265,7 +1265,7 @@ void PictReader::ReadHeader() // 3 Bytes ignored : end of version arg 0x02FF (ie: 0xFF), HeaderOp : 0x0C00 pPict->SeekRel( 3 ); pPict->ReadInt16( nExtVer ).ReadInt16( nReserved ); - if (pPict->eof() || pPict->GetError()) continue; + if (!pPict->good()) continue; if ( nExtVer == -2 ) // extended version 2 picture { diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx index ef8c9cd42568..531e6e2c1dfe 100644 --- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx +++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx @@ -62,7 +62,7 @@ bool SAL_CALL LotusWordProImportFilter::importImpl( const Sequence< css::beans:: } SvFileStream inputStream( sURL, StreamMode::READ ); - if ( inputStream.eof() || ( inputStream.GetError() != ERRCODE_NONE ) ) + if (!inputStream.good()) return false; // An XML import service: what we push sax messages to.. diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 43418fc3aad2..ec3604fde5c7 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -530,9 +530,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText ) // need to work out some more line information do { - if (!Seek( mpRowPosArray[mnRowPosCount]) || - mpDatStream->GetError() != ERRCODE_NONE || - mpDatStream->eof()) + if (!Seek(mpRowPosArray[mnRowPosCount]) || !mpDatStream->good()) { bRet = false; break; @@ -541,9 +539,7 @@ bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText ) mcTextSep); mnStreamPos = mpDatStream->Tell(); mpRowPosArray[++mnRowPosCount] = mnStreamPos; - } while (nLine >= mnRowPosCount && - mpDatStream->GetError() == ERRCODE_NONE && - !mpDatStream->eof()); + } while (nLine >= mnRowPosCount && mpDatStream->good()); if (mpDatStream->eof() && mnStreamPos == mpRowPosArray[mnRowPosCount-1]) { diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index c862257a4f40..82f19dfd30ed 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -105,7 +105,7 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const OUString& aFolde if ( nRead < 32000 ) aSeq.realloc( nRead ); xTargetStream->writeBytes( aSeq ); - } while( !pTempStream->eof() && !pTempStream->GetError() && nRead ); + } while (pTempStream->good() && nRead); if ( pTempStream->GetError() ) throw io::IOException(); 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<T>::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<T>::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<T>::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<T>::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<T>::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<T>::GetNextChar() nLen < 10 ) { rInput.ReadChar( c1 ); - bErr = rInput.eof() || rInput.GetError(); + bErr = !rInput.good(); if( bErr ) break; diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 0e109d9d87d9..0af2a5d91ee4 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -320,7 +320,7 @@ void SwEditShell::ApplyAutoMark() SearchAlgorithms2::ABSOLUTE, '\\' ); - while( !rStrm.GetError() && !rStrm.eof() ) + while (rStrm.good()) { OString aRdLine; rStrm.ReadLine( aRdLine ); diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index b6dfe8daa4cf..435903bc70f0 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -1068,8 +1068,7 @@ bool SwLayCacheIoImpl::OpenRec( sal_uInt8 cType ) sal_uInt32 nVal(0); pStream->ReadUInt32( nVal ); sal_uInt8 cRecTyp = (sal_uInt8)nVal; - if( !nVal || cRecTyp != cType || - pStream->GetErrorCode() != ERRCODE_NONE || pStream->eof() ) + if (!nVal || cRecTyp != cType || !pStream->good()) { OSL_ENSURE( nVal, "OpenRec: Record-Header is 0" ); OSL_ENSURE( cRecTyp == cType, "OpenRec: Wrong Record Type" ); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index d99014941c60..ac3b7fc411d0 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -4095,7 +4095,7 @@ void SwEntryBrowseBox::ReadEntries(SvStream& rInStr) { AutoMarkEntry* pToInsert = nullptr; rtl_TextEncoding eTEnc = osl_getThreadTextEncoding(); - while( !rInStr.GetError() && !rInStr.eof() ) + while (rInStr.good()) { OUString sLine; rInStr.ReadByteStringLine( sLine, eTEnc ); diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index 2f846029bb9b..ae181f4269b6 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -221,14 +221,14 @@ sal_uInt8 ImpDetectJPG_GetNextMarker( SvStream& rStm ) do { rStm.ReadUChar( nByte ); - if ( rStm.eof() || rStm.GetError() ) // as 0 is not allowed as marker, - return 0; // we can use it as errorcode + if (!rStm.good()) // as 0 is not allowed as marker, + return 0; // we can use it as errorcode } while ( nByte != 0xff ); do { rStm.ReadUChar( nByte ); - if ( rStm.eof() || rStm.GetError() ) + if (!rStm.good()) return 0; } while( nByte == 0xff ); @@ -263,7 +263,7 @@ bool GraphicDescriptor::ImpDetectJPG( SvStream& rStm, bool bExtendedInfo ) bool bScanFailure = false; bool bScanFinished = false; - while( !bScanFailure && !bScanFinished && !rStm.eof() && !rStm.GetError() ) + while (!bScanFailure && !bScanFinished && rStm.good()) { sal_uInt8 nMarker = ImpDetectJPG_GetNextMarker( rStm ); switch( nMarker ) @@ -555,15 +555,14 @@ bool GraphicDescriptor::ImpDetectPNG( SvStream& rStm, bool bExtendedInfo ) rStm.ReadUInt32( nLen32 ); rStm.ReadUInt32( nTemp32 ); while( ( nTemp32 != 0x70485973 ) && ( nTemp32 != 0x49444154 ) - && !rStm.eof() && !rStm.GetError() ) + && rStm.good() ) { rStm.SeekRel( 4 + nLen32 ); rStm.ReadUInt32( nLen32 ); rStm.ReadUInt32( nTemp32 ); } - if ( nTemp32 == 0x70485973 - && !rStm.eof() && !rStm.GetError() ) + if (nTemp32 == 0x70485973 && rStm.good()) { sal_uLong nXRes; sal_uLong nYRes; diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 5ee08a2f21c7..a9772a2fd379 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1444,7 +1444,7 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) // reading which will create VDevs and other stuff, just to // read nothing. CAUTION: Eof is only true AFTER reading another // byte, a speciality of SvMemoryStream (!) - if (rIStm.GetError() || rIStm.eof()) + if (!rIStm.good()) return; if (NATIVE_FORMAT_50 == nTmp) diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index ff34bd129eb6..2458d0269e76 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -263,7 +263,7 @@ bool PNGReaderImpl::ReadNextChunk() // get the next chunk from the stream // unless we are at the end of the PNG stream - if( mrPNGStream.eof() || (mrPNGStream.GetError() != ERRCODE_NONE) ) + if (!mrPNGStream.good()) return false; if( !maChunkSeq.empty() && (maChunkSeq.back().nType == PNGCHUNK_IEND) ) return false; |