diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-17 15:06:51 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-17 15:20:47 +0200 |
commit | d881bde066a891c921feafe0a06c568e6c3efb0f (patch) | |
tree | 9b4ecea4a349c9039c91e8a317fe1fda149d1895 /sw | |
parent | 9b77b33a2dbdbb3e44a51742f0bcb7dcdea4db52 (diff) |
loplugin:implicitboolconversion clean-up
Change-Id: I049b2eec5b2201f4056bb6e7b9b97e7763e5e214
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/inc/rtf.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 34 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8struc.hxx | 3 |
11 files changed, 54 insertions, 50 deletions
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 2fed3d868b2e..420318f3e9c8 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -387,7 +387,7 @@ static void lcl_CopyCol( _FndBox & rFndBox, _CpyPara *const pCpyPara) const _FndBoxes& rFndBxs = rFndBox.GetUpper()->GetBoxes(); if( 8 > pCpyPara->nDelBorderFlag - ? pCpyPara->nDelBorderFlag + ? pCpyPara->nDelBorderFlag != 0 : &rFndBox == &rFndBxs[rFndBxs.size() - 1] ) { const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox(); diff --git a/sw/source/filter/inc/rtf.hxx b/sw/source/filter/inc/rtf.hxx index 73adefe04b26..ec655d720436 100644 --- a/sw/source/filter/inc/rtf.hxx +++ b/sw/source/filter/inc/rtf.hxx @@ -25,7 +25,7 @@ class RTFSurround { union { struct { - sal_uInt8 nGoldCut : 1; + sal_uInt8 nGoldCut : 1; // should ideally be bool sal_uInt8 nOrder : 4; sal_uInt8 nJunk : 3; } Flags; @@ -35,7 +35,7 @@ public: RTFSurround( sal_uInt8 nValue ) { Value.nVal = nValue; } RTFSurround( bool bGoldCut, sal_uInt8 nOrder ) { - Value.Flags.nGoldCut = bGoldCut; + Value.Flags.nGoldCut = sal_uInt8(bGoldCut); Value.Flags.nOrder = nOrder; Value.Flags.nJunk = 0; } diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index e2e2421d5b1f..1a35a6521234 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -330,7 +330,7 @@ public: void WriteFontTable( const RtfAttributeOutput& rAttrOutput ); /// If true, all fonts are loaded before processing the document. - sal_uInt8 bLoadAllFonts: 1; + bool bLoadAllFonts: 1; }; class DrawObj @@ -436,12 +436,12 @@ struct MSWordSaveData const sw::Frame* pOldFlyFmt; const SwPageDesc* pOldPageDesc; - sal_uInt8 bOldWriteAll : 1; ///< WW8Export only - sal_uInt8 bOldOutTable : 1; - sal_uInt8 bOldIsInTable: 1; - sal_uInt8 bOldFlyFrmAttrs : 1; - sal_uInt8 bOldStartTOX : 1; - sal_uInt8 bOldInWriteTOX : 1; + bool bOldWriteAll : 1; ///< WW8Export only + bool bOldOutTable : 1; + bool bOldIsInTable: 1; + bool bOldFlyFrmAttrs : 1; + bool bOldStartTOX : 1; + bool bOldInWriteTOX : 1; // bOutPageDesc muss nicht gesichert werden, da es nur nicht waehrend der // Ausgabe von Spezial-Texten veraendert wird. }; @@ -947,7 +947,7 @@ public: WW8_WrPlcFtnEdn *pEdn; ///< Endnotes - structure to remember them, and output WW8_WrPlcSepx* pSepx; ///< Sections/headers/footers - sal_uInt8 bWrtWW8 : 1; ///< Write WW95 (false) or WW97 (true) file format + bool bWrtWW8 : 1; ///< Write WW95 (false) or WW97 (true) file format bool m_bDot; ///< Template or document. protected: diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index a9ba08af0279..7199c68a1d0f 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -166,7 +166,7 @@ bool WW8Export::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich case RES_CHRATR_CTL_LANGUAGE: case RES_CHRATR_CTL_POSTURE: case RES_CHRATR_CTL_WEIGHT: - if (bWrtWW8 == 0) + if (!bWrtWW8) bRet = false; default: break; @@ -177,7 +177,7 @@ bool WW8Export::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich //Complex is ok in ww8, but for ww6 there is only //one font, one fontsize, one fontsize (weight/posture) //and only one language - if ( bWrtWW8 == 0 ) + if ( !bWrtWW8 ) { switch ( nWhich ) { @@ -217,7 +217,7 @@ bool WW8Export::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich case RES_CHRATR_CTL_LANGUAGE: case RES_CHRATR_CTL_POSTURE: case RES_CHRATR_CTL_WEIGHT: - if ( bWrtWW8 == 0 ) + if ( !bWrtWW8 ) bRet = false; default: break; @@ -3173,7 +3173,7 @@ void WW8AttributeOutput::ParaSnapToGrid( const SvxParaGridItem& rGrid ) return; m_rWW8Export.InsUInt16( NS_sprm::LN_PFUsePgsuSettings ); - m_rWW8Export.pO->push_back( rGrid.GetValue() ); + m_rWW8Export.pO->push_back( rGrid.GetValue() ? 1 : 0 ); } void WW8AttributeOutput::ParaVerticalAlign( const SvxParaVertAlignItem& rAlign ) @@ -4870,12 +4870,12 @@ void WW8AttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDir m_rWW8Export.InsUInt16( NS_sprm::LN_STextFlow ); m_rWW8Export.InsUInt16( nTextFlow ); m_rWW8Export.InsUInt16( NS_sprm::LN_SFBiDi ); - m_rWW8Export.pO->push_back( bBiDi ); + m_rWW8Export.pO->push_back( bBiDi ? 1 : 0 ); } else if ( !m_rWW8Export.bOutFlyFrmAttrs ) //paragraph/style { m_rWW8Export.InsUInt16( NS_sprm::LN_PFBiDi ); - m_rWW8Export.pO->push_back( bBiDi ); + m_rWW8Export.pO->push_back( bBiDi ? 1 : 0 ); } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ab30ceea3be5..77f578ea32b7 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2613,12 +2613,12 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp) sal_uInt8 nCellLevel = 0; if (bVer67) - nCellLevel = 0 != pPlcxMan->HasParaSprm(24); + nCellLevel = int(0 != pPlcxMan->HasParaSprm(24)); else { - nCellLevel = 0 != pPlcxMan->HasParaSprm(0x2416); + nCellLevel = int(0 != pPlcxMan->HasParaSprm(0x2416)); if (!nCellLevel) - nCellLevel = 0 != pPlcxMan->HasParaSprm(0x244B); + nCellLevel = int(0 != pPlcxMan->HasParaSprm(0x244B)); } do { diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index ff1b50702d0f..852dee7889d1 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -1157,8 +1157,8 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS) if( i < nColsToRead ) { // TC from file ? sal_uInt8 aBits1 = pTc->aBits1Ver6; - pAktTC->bFirstMerged = ( ( aBits1 & 0x01 ) != 0 ); - pAktTC->bMerged = ( ( aBits1 & 0x02 ) != 0 ); + pAktTC->bFirstMerged = sal_uInt8( ( aBits1 & 0x01 ) != 0 ); + pAktTC->bMerged = sal_uInt8( ( aBits1 & 0x02 ) != 0 ); pAktTC->rgbrc[ WW8_TOP ] = WW8_BRC( pTc->rgbrcVer6[ WW8_TOP ] ); pAktTC->rgbrc[ WW8_LEFT ] @@ -1187,13 +1187,13 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS) for (int k = 0; k < nColsToRead; ++k, ++pAktTC, ++pTc ) { sal_uInt16 aBits1 = SVBT16ToShort( pTc->aBits1Ver8 ); - pAktTC->bFirstMerged = ( ( aBits1 & 0x0001 ) != 0 ); - pAktTC->bMerged = ( ( aBits1 & 0x0002 ) != 0 ); - pAktTC->bVertical = ( ( aBits1 & 0x0004 ) != 0 ); - pAktTC->bBackward = ( ( aBits1 & 0x0008 ) != 0 ); - pAktTC->bRotateFont = ( ( aBits1 & 0x0010 ) != 0 ); - pAktTC->bVertMerge = ( ( aBits1 & 0x0020 ) != 0 ); - pAktTC->bVertRestart = ( ( aBits1 & 0x0040 ) != 0 ); + pAktTC->bFirstMerged = sal_uInt8( ( aBits1 & 0x0001 ) != 0 ); + pAktTC->bMerged = sal_uInt8( ( aBits1 & 0x0002 ) != 0 ); + pAktTC->bVertical = sal_uInt8( ( aBits1 & 0x0004 ) != 0 ); + pAktTC->bBackward = sal_uInt8( ( aBits1 & 0x0008 ) != 0 ); + pAktTC->bRotateFont = sal_uInt8( ( aBits1 & 0x0010 ) != 0 ); + pAktTC->bVertMerge = sal_uInt8( ( aBits1 & 0x0020 ) != 0 ); + pAktTC->bVertRestart = sal_uInt8( ( aBits1 & 0x0040 ) != 0 ); pAktTC->nVertAlign = ( ( aBits1 & 0x0180 ) >> 7 ); // note: in aBits1 there are 7 bits unused, // followed by another 16 unused bits diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index f085e7feec19..9f7415f11c42 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -332,8 +332,8 @@ struct WW8LST // nur DIE Eintraege, die WIR benoetigen! // nIStDNil if no style linked sal_uInt32 nIdLst; // Unique List ID sal_uInt32 nTplC; // Unique template code - Was ist das bloss? - sal_uInt8 bSimpleList:1; // Flag: Liste hat nur EINEN Level - sal_uInt8 bRestartHdn:1; // WW6-Kompatibilitaets-Flag: + bool bSimpleList:1; // Flag: Liste hat nur EINEN Level + bool bRestartHdn:1; // WW6-Kompatibilitaets-Flag: // true if the list should start numbering over }; // at the beginning of each section @@ -380,11 +380,11 @@ struct WW8LFOLVL // dieses Byte ist _absichtlich_ nicht in das folgende Byte hineingepackt !! // (siehe Kommentar unten bei struct WW8LFOInfo) - sal_uInt8 bStartAt :1; // true if the start-at value is overridden - sal_uInt8 bFormat :1; // true if the formatting is overridden + bool bStartAt :1; // true if the start-at value is overridden + bool bFormat :1; // true if the formatting is overridden WW8LFOLVL() : - nStartAt(1), nLevel(0), bStartAt(1), bFormat(0) {} + nStartAt(1), nLevel(0), bStartAt(true), bFormat(false) {} }; // in den ListenInfos zu speichernde Daten @@ -398,13 +398,13 @@ struct WW8LSTInfo // sortiert nach nIdLst (in WW8 verwendete Listen-Id) SwNumRule* pNumRule; // Zeiger auf entsprechende Listenvorlage im Writer sal_uInt32 nIdLst; // WW8Id dieser Liste - sal_uInt8 bSimpleList:1;// Flag, ob diese NumRule nur einen Level verwendet - sal_uInt8 bUsedInDoc :1;// Flag, ob diese NumRule im Doc verwendet wird, + bool bSimpleList:1;// Flag, ob diese NumRule nur einen Level verwendet + bool bUsedInDoc :1;// Flag, ob diese NumRule im Doc verwendet wird, // oder beim Reader-Ende geloescht werden sollte WW8LSTInfo(SwNumRule* pNumRule_, WW8LST& aLST) : pNumRule(pNumRule_), nIdLst(aLST.nIdLst), - bSimpleList(aLST.bSimpleList), bUsedInDoc(0) + bSimpleList(aLST.bSimpleList), bUsedInDoc(false) { memcpy( aIdSty, aLST.aIdSty, sizeof( aIdSty )); memset(&aItemSet, 0, sizeof( aItemSet )); @@ -429,12 +429,12 @@ struct WW8LFOInfo // unsortiert, d.h. Reihenfolge genau wie im WW8 Stream // Byte mit hineinpacken, doch waere das eine ziemliche Fehlerquelle, // an dem Tag, wo MS ihr Listenformat auf mehr als 15 Level aufbohren. - sal_uInt8 bOverride :1;// Flag, ob die NumRule nicht in maLSTInfos steht, + bool bOverride :1;// Flag, ob die NumRule nicht in maLSTInfos steht, // sondern fuer pLFOInfos NEU angelegt wurde - sal_uInt8 bSimpleList:1;// Flag, ob diese NumRule nur einen Level verwendet - sal_uInt8 bUsedInDoc :1;// Flag, ob diese NumRule im Doc verwendet wird, + bool bSimpleList:1;// Flag, ob diese NumRule nur einen Level verwendet + bool bUsedInDoc :1;// Flag, ob diese NumRule im Doc verwendet wird, // oder beim Reader-Ende geloescht werden sollte - sal_uInt8 bLSTbUIDSet :1;// Flag, ob bUsedInDoc in maLSTInfos gesetzt wurde, + bool bLSTbUIDSet :1;// Flag, ob bUsedInDoc in maLSTInfos gesetzt wurde, // und nicht nochmals gesetzt zu werden braucht WW8LFOInfo(const WW8LFO& rLFO); }; @@ -447,8 +447,8 @@ WW8LFOInfo::WW8LFOInfo(const WW8LFO& rLFO) , nLfoLvl(rLFO.nLfoLvl) , bOverride(rLFO.nLfoLvl ? true : false) , bSimpleList(rLFO.bSimpleList) - , bUsedInDoc(0) - , bLSTbUIDSet(0) + , bUsedInDoc(false) + , bLSTbUIDSet(false) { } @@ -518,9 +518,9 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, rSt.ReadUChar( aBits1 ); if( 0 != rSt.GetError() ) return false; aLVL.nAlign = (aBits1 & 0x03); - if( aBits1 & 0x10 ) aLVL.bV6Prev = true; - if( aBits1 & 0x20 ) aLVL.bV6PrSp = true; - if( aBits1 & 0x40 ) aLVL.bV6 = true; + if( aBits1 & 0x10 ) aLVL.bV6Prev = sal_uInt8(true); + if( aBits1 & 0x20 ) aLVL.bV6PrSp = sal_uInt8(true); + if( aBits1 & 0x40 ) aLVL.bV6 = sal_uInt8(true); bool bLVLOkB = true; sal_uInt8 nLevelB = 0; for(nLevelB = 0; nLevelB < nMaxLevel; ++nLevelB) diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index b63e639a3a91..d107eba7d69c 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -886,7 +886,7 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/) // Has a table page aNewSection.maSep.fTitlePage = - (0 != ReadBSprm( pSep, pIds[1], 0 )); + sal_uInt8(0 != ReadBSprm( pSep, pIds[1], 0 )); // sprmSNfcPgn aNewSection.maSep.nfcPgn = ReadBSprm( pSep, pIds[2], 0 ); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 11c117b8fa83..703bcf2f4f3a 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1843,7 +1843,8 @@ static bool WW8GetFieldPara(WW8PLCFspecial& rPLCF, WW8FieldDesc& rF) void* pData; sal_uLong nOldIdx = rPLCF.GetIdx(); - rF.nLen = rF.nId = rF.nOpt = rF.bCodeNest = rF.bResNest = false; + rF.nLen = rF.nId = rF.nOpt = 0; + rF.bCodeNest = rF.bResNest = false; if( !rPLCF.Get( rF.nSCode, pData ) ) // end of PLCFspecial? goto Err; diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 819e3482b5d9..80c8dcc28964 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -605,8 +605,8 @@ private: WW8PLCFx_PCD* pPcd; WW8PLCFpcd_Iter *pPieceIter; WW8_CP nAttrStart, nAttrEnd; - sal_uInt8 bLineEnd : 1; - sal_uInt8 bComplex : 1; + bool bLineEnd : 1; + bool bComplex : 1; WW8PLCFx_Cp_FKP(const WW8PLCFx_Cp_FKP&) SAL_DELETED_FUNCTION; WW8PLCFx_Cp_FKP& operator=(const WW8PLCFx_Cp_FKP&) SAL_DELETED_FUNCTION; diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index 79d96b2be441..fbfbf653ba26 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -534,6 +534,9 @@ struct WW8_TBD struct WW8_TCell // hiermit wird weitergearbeitet (entspricht weitestgehend dem Ver8-Format) { + // The single-bit fields should ideally be bool, but probably need to keep + // them as sal_uInt8 to make them combine with the following two-bit + // nVertAlign: sal_uInt8 bFirstMerged : 1;// 0001 set to 1 when cell is first cell of a range of cells that have been merged. sal_uInt8 bMerged : 1;// 0002 set to 1 when cell has been merged with preceding cell. sal_uInt8 bVertical : 1;// set to 1 when cell has vertical text flow |