Kaydet (Commit) 98864543 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:singlevalfields

Change-Id: I346f236e28cb0bd064a7d757b187e5e64544700f
Reviewed-on: https://gerrit.libreoffice.org/49086Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ac713259
......@@ -31,7 +31,7 @@ Note that the actual process may involve a fair amount of undoing, hand editing,
to get it to work :-)
@TODO we don't spot fields that have been zero-initialised via calloc or rtl_allocateZeroMemory or memset
@TODO calls to lambdas (see FIXME near CXXOperatorCallExpr)
@TODO calls to lambdas where a reference to the field is taken
*/
......@@ -310,12 +310,6 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr )
child = parent;
parent = getParentStmt(parent);
}
else if (isa<CXXOperatorCallExpr>(parent))
{
// FIXME need to handle this properly
bPotentiallyAssignedTo = true;
break;
}
else if (isa<CallExpr>(parent))
{
checkCallExpr(child, dyn_cast<CallExpr>(parent), assignValue, bPotentiallyAssignedTo);
......
......@@ -4,7 +4,7 @@ chart2/source/model/main/DataPoint.hxx:107
chart2/source/view/inc/GL3DRenderer.hxx:161
chart::opengl3D::TextInfoBatch batchNum
512
include/basic/sbxvar.hxx:67
include/basic/sbxvar.hxx:70
SbxValues::(anonymous) pData
0
include/editeng/charsetcoloritem.hxx:35
......@@ -25,18 +25,6 @@ include/svtools/svparser.hxx:74
include/svtools/svparser.hxx:75
SvParser::TokenStackType bTokenHasValue
0
include/tools/multisel.hxx:41
MultiSelection bInverseCur
0
include/unotools/textsearch.hxx:104
utl::SearchParam m_bWordOnly
0
include/unotools/textsearch.hxx:105
utl::SearchParam m_bSrchInSel
0
include/unotools/textsearch.hxx:110
utl::SearchParam nTransliterationFlags
0
include/vcl/filter/pdfdocument.hxx:173
vcl::filter::PDFNameElement m_nLength
0
......@@ -61,10 +49,10 @@ include/vcl/pdfwriter.hxx:559
libreofficekit/source/gtk/lokdocview.cxx:84
LOKDocViewPrivateImpl m_bIsLoading
0
opencl/source/opencl_device.cxx:53
opencl/source/opencl_device.cxx:54
(anonymous namespace)::LibreOfficeDeviceEvaluationIO inputSize
15360
opencl/source/opencl_device.cxx:54
opencl/source/opencl_device.cxx:55
(anonymous namespace)::LibreOfficeDeviceEvaluationIO outputSize
15360
pyuno/source/module/pyuno_impl.hxx:312
......@@ -79,6 +67,12 @@ sc/inc/compiler.hxx:108
sc/qa/unit/ucalc.hxx:41
Test::RangeNameDef mnIndex
1
sc/source/filter/inc/xcl97rec.hxx:272
ExcBof8_Base nLowestBiffVer
6
sc/source/filter/inc/xechart.hxx:859
XclExpChDropBar mnBarDist
100
sd/inc/sdpptwrp.hxx:42
SdPPTFilter pBas
0
......@@ -106,10 +100,10 @@ soltools/mkdepend/def.h:130
soltools/mkdepend/def.h:132
inclist i_searched
1
stoc/source/inspect/introspection.cxx:1533
stoc/source/inspect/introspection.cxx:1530
(anonymous namespace)::Cache::Data hits
1
sw/inc/hints.hxx:195
sw/inc/hints.hxx:189
SwAttrSetChg m_bDelSet
0
sw/inc/pagepreviewlayout.hxx:49
......@@ -118,9 +112,9 @@ sw/inc/pagepreviewlayout.hxx:49
sw/source/core/inc/frmtool.hxx:260
SwBorderAttrs m_bBorderDist
1
sw/source/core/inc/swfont.hxx:170
SwFont m_bURL
0
sw/source/core/inc/UndoNumbering.hxx:33
SwUndoInsNum nSttSet
18446744073709551615
sw/source/core/inc/UndoSort.hxx:38
SwSortUndoElement::(anonymous union)::(anonymous) nKenn
4294967295
......@@ -133,9 +127,12 @@ sw/source/filter/html/htmlcss1.cxx:78
sw/source/filter/html/htmlcss1.cxx:79
SwCSS1ItemIds nFormatKeep
109
sw/source/filter/html/svxcss1.hxx:199
sw/source/filter/html/svxcss1.hxx:200
SvxCSS1Parser nMinFixLineSpace
141
sw/source/filter/html/svxcss1.hxx:203
SvxCSS1Parser nScriptFlags
7
sw/source/filter/inc/rtf.hxx:30
RTFSurround::(anonymous union)::(anonymous) nJunk
0
......@@ -178,10 +175,49 @@ vcl/source/filter/jpeg/transupp.h:131
vcl/source/font/font.cxx:539
(anonymous namespace)::WeightSearchEntry weight
5
vcl/source/gdi/pdfwriter_impl.hxx:705
vcl/source/gdi/dibtools.cxx:49
(anonymous namespace)::CIEXYZ aXyzX
0
vcl/source/gdi/dibtools.cxx:50
(anonymous namespace)::CIEXYZ aXyzY
0
vcl/source/gdi/dibtools.cxx:51
(anonymous namespace)::CIEXYZ aXyzZ
0
vcl/source/gdi/dibtools.cxx:104
(anonymous namespace)::DIBV5Header nV5RedMask
0
vcl/source/gdi/dibtools.cxx:105
(anonymous namespace)::DIBV5Header nV5GreenMask
0
vcl/source/gdi/dibtools.cxx:106
(anonymous namespace)::DIBV5Header nV5BlueMask
0
vcl/source/gdi/dibtools.cxx:107
(anonymous namespace)::DIBV5Header nV5AlphaMask
0
vcl/source/gdi/dibtools.cxx:110
(anonymous namespace)::DIBV5Header nV5GammaRed
0
vcl/source/gdi/dibtools.cxx:111
(anonymous namespace)::DIBV5Header nV5GammaGreen
0
vcl/source/gdi/dibtools.cxx:112
(anonymous namespace)::DIBV5Header nV5GammaBlue
0
vcl/source/gdi/dibtools.cxx:114
(anonymous namespace)::DIBV5Header nV5ProfileData
0
vcl/source/gdi/dibtools.cxx:115
(anonymous namespace)::DIBV5Header nV5ProfileSize
0
vcl/source/gdi/dibtools.cxx:116
(anonymous namespace)::DIBV5Header nV5Reserved
0
vcl/source/gdi/pdfwriter_impl.hxx:698
vcl::PDFWriterImpl m_nInheritedPageWidth
595
vcl/source/gdi/pdfwriter_impl.hxx:706
vcl/source/gdi/pdfwriter_impl.hxx:699
vcl::PDFWriterImpl m_nInheritedPageHeight
842
writerfilter/source/dmapper/GraphicImport.cxx:223
......
......@@ -2374,8 +2374,7 @@ void XclExpChLegend::WriteBody( XclExpStream& rStrm )
XclExpChDropBar::XclExpChDropBar( const XclExpChRoot& rRoot, XclChObjectType eObjType ) :
XclExpChGroupBase( rRoot, EXC_CHFRBLOCK_TYPE_DROPBAR, EXC_ID_CHDROPBAR, 2 ),
meObjType( eObjType ),
mnBarDist( 100 )
meObjType( eObjType )
{
}
......@@ -2394,7 +2393,7 @@ void XclExpChDropBar::WriteSubRecords( XclExpStream& rStrm )
void XclExpChDropBar::WriteBody( XclExpStream& rStrm )
{
rStrm << mnBarDist;
rStrm << sal_uInt16(100); // Distance between bars (CHDROPBAR record).
}
XclExpChTypeGroup::XclExpChTypeGroup( const XclExpChRoot& rRoot, sal_uInt16 nGroupIdx ) :
......
......@@ -269,8 +269,6 @@ private:
class ExcBof8_Base : public ExcBof_Base
{
protected:
sal_uInt32 nLowestBiffVer; // sfo
virtual void SaveCont( XclExpStream& rStrm ) override;
public:
......
......@@ -856,7 +856,6 @@ private:
private:
XclChObjectType meObjType; /// Type of the dropbar.
sal_uInt16 mnBarDist; /// Distance between bars (CHDROPBAR record).
};
typedef std::shared_ptr< XclExpChDropBar > XclExpChDropBarRef;
......
......@@ -1008,7 +1008,6 @@ ExcBof8_Base::ExcBof8_Base()
nVers = 0x0600;
nRupBuild = 0x0dbb;
nRupYear = 0x07cc;
nLowestBiffVer = 0x00000006; // Biff8
}
void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& rShape, SCTAB nTab )
{
......@@ -1204,7 +1203,8 @@ void ExcBof8_Base::SaveCont( XclExpStream& rStrm )
{
rStrm.DisableEncryption();
rStrm << nVers << nDocType << nRupBuild << nRupYear
<< sal_uInt32(0)/*nFileHistory*/ << nLowestBiffVer;
<< sal_uInt32(0)/*nFileHistory*/
<< sal_uInt32(0x06) /*nLowestBiffVer = Biff8*/;
}
sal_uInt16 ExcBof8_Base::GetNum() const
......
......@@ -30,7 +30,6 @@ class SwUndoInsNum : public SwUndo, private SwUndRng
{
SwNumRule aNumRule;
SwHistory* pHistory;
sal_uLong nSttSet;
SwNumRule* pOldNumRule;
OUString sReplaceRule;
sal_uInt16 nLRSavePos;
......
......@@ -33,7 +33,7 @@ SwUndoInsNum::SwUndoInsNum( const SwNumRule& rOldRule,
const SwDoc* pDoc,
SwUndoId nUndoId)
: SwUndo( nUndoId, pDoc ),
aNumRule( rNewRule ), pHistory( nullptr ), nSttSet( ULONG_MAX ),
aNumRule( rNewRule ), pHistory( nullptr ),
pOldNumRule( new SwNumRule( rOldRule )), nLRSavePos( 0 )
{
}
......@@ -41,7 +41,7 @@ SwUndoInsNum::SwUndoInsNum( const SwNumRule& rOldRule,
SwUndoInsNum::SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule )
: SwUndo( SwUndoId::INSNUM, rPam.GetDoc() ), SwUndRng( rPam ),
aNumRule( rRule ), pHistory( nullptr ),
nSttSet( ULONG_MAX ), pOldNumRule( nullptr ), nLRSavePos( 0 )
pOldNumRule( nullptr ), nLRSavePos( 0 )
{
}
......@@ -49,7 +49,7 @@ SwUndoInsNum::SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
const OUString& rReplaceRule )
: SwUndo( SwUndoId::INSNUM, rPos.nNode.GetNode().GetDoc() ),
aNumRule( rRule ), pHistory( nullptr ),
nSttSet( ULONG_MAX ), pOldNumRule( nullptr ),
pOldNumRule( nullptr ),
sReplaceRule( rReplaceRule ), nLRSavePos( 0 )
{
// No selection!
......@@ -82,13 +82,6 @@ void SwUndoInsNum::UndoImpl(::sw::UndoRedoContext & rContext)
if( pHistory )
{
SwTextNode* pNd;
if( ULONG_MAX != nSttSet &&
nullptr != ( pNd = rDoc.GetNodes()[ nSttSet ]->GetTextNode() ))
pNd->SetListRestart( true );
else
pNd = nullptr;
if( nLRSavePos )
{
// Update immediately so that potential "old" LRSpaces will be valid again.
......
......@@ -724,7 +724,6 @@ SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, const OUString& rBaseURL,
pPropInfo( nullptr ),
nMinFixLineSpace( MM50/2 ),
eDfltEnc( RTL_TEXTENCODING_DONTKNOW ),
nScriptFlags( Css1ScriptFlags::AllMask ),
bIgnoreFontFamily( false )
{
// also initialize item IDs
......@@ -1059,18 +1058,11 @@ static void ParseCSS1_font_size( const CSS1Expression *pExpr,
{
SvxFontHeightItem aFontHeight( nHeight, nPropHeight,
aItemIds.nFontHeight );
if( rParser.IsSetWesternProps() )
rItemSet.Put( aFontHeight );
if( rParser.IsSetCJKProps() )
{
aFontHeight.SetWhich( aItemIds.nFontHeightCJK );
rItemSet.Put( aFontHeight );
}
if( rParser.IsSetCTLProps() )
{
aFontHeight.SetWhich( aItemIds.nFontHeightCTL );
rItemSet.Put( aFontHeight );
}
rItemSet.Put( aFontHeight );
aFontHeight.SetWhich( aItemIds.nFontHeightCJK );
rItemSet.Put( aFontHeight );
aFontHeight.SetWhich( aItemIds.nFontHeightCTL );
rItemSet.Put( aFontHeight );
}
}
......@@ -1135,25 +1127,18 @@ static void ParseCSS1_font_family( const CSS1Expression *pExpr,
{
SvxFontItem aFont( FAMILY_DONTKNOW, aName, OUString(), PITCH_DONTKNOW,
eEnc, aItemIds.nFont );
if( rParser.IsSetWesternProps() )
rItemSet.Put( aFont );
if( rParser.IsSetCJKProps() )
{
aFont.SetWhich( aItemIds.nFontCJK );
rItemSet.Put( aFont );
}
if( rParser.IsSetCTLProps() )
{
aFont.SetWhich( aItemIds.nFontCTL );
rItemSet.Put( aFont );
}
rItemSet.Put( aFont );
aFont.SetWhich( aItemIds.nFontCJK );
rItemSet.Put( aFont );
aFont.SetWhich( aItemIds.nFontCTL );
rItemSet.Put( aFont );
}
}
static void ParseCSS1_font_weight( const CSS1Expression *pExpr,
SfxItemSet &rItemSet,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& rParser )
const SvxCSS1Parser& /*rParser*/ )
{
OSL_ENSURE( pExpr, "no expression" );
......@@ -1167,18 +1152,11 @@ static void ParseCSS1_font_weight( const CSS1Expression *pExpr,
nWeight ) )
{
SvxWeightItem aWeight( static_cast<FontWeight>(nWeight), aItemIds.nWeight );
if( rParser.IsSetWesternProps() )
rItemSet.Put( aWeight );
if( rParser.IsSetCJKProps() )
{
aWeight.SetWhich( aItemIds.nWeightCJK );
rItemSet.Put( aWeight );
}
if( rParser.IsSetCTLProps() )
{
aWeight.SetWhich( aItemIds.nWeightCTL );
rItemSet.Put( aWeight );
}
rItemSet.Put( aWeight );
aWeight.SetWhich( aItemIds.nWeightCJK );
rItemSet.Put( aWeight );
aWeight.SetWhich( aItemIds.nWeightCTL );
rItemSet.Put( aWeight );
}
}
break;
......@@ -1187,18 +1165,11 @@ static void ParseCSS1_font_weight( const CSS1Expression *pExpr,
sal_uInt16 nWeight = static_cast<sal_uInt16>(pExpr->GetNumber());
SvxWeightItem aWeight( nWeight>400 ? WEIGHT_BOLD : WEIGHT_NORMAL,
aItemIds.nWeight );
if( rParser.IsSetWesternProps() )
rItemSet.Put( aWeight );
if( rParser.IsSetCJKProps() )
{
aWeight.SetWhich( aItemIds.nWeightCJK );
rItemSet.Put( aWeight );
}
if( rParser.IsSetCTLProps() )
{
aWeight.SetWhich( aItemIds.nWeightCTL );
rItemSet.Put( aWeight );
}
rItemSet.Put( aWeight );
aWeight.SetWhich( aItemIds.nWeightCJK );
rItemSet.Put( aWeight );
aWeight.SetWhich( aItemIds.nWeightCTL );
rItemSet.Put( aWeight );
}
break;
......@@ -1210,7 +1181,7 @@ static void ParseCSS1_font_weight( const CSS1Expression *pExpr,
static void ParseCSS1_font_style( const CSS1Expression *pExpr,
SfxItemSet &rItemSet,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& rParser )
const SvxCSS1Parser& /*rParser*/ )
{
OSL_ENSURE( pExpr, "no expression" );
......@@ -1258,18 +1229,11 @@ static void ParseCSS1_font_style( const CSS1Expression *pExpr,
if( bPosture )
{
SvxPostureItem aPosture( eItalic, aItemIds.nPosture );
if( rParser.IsSetWesternProps() )
rItemSet.Put( aPosture );
if( rParser.IsSetCJKProps() )
{
aPosture.SetWhich( aItemIds.nPostureCJK );
rItemSet.Put( aPosture );
}
if( rParser.IsSetCTLProps() )
{
aPosture.SetWhich( aItemIds.nPostureCTL );
rItemSet.Put( aPosture );
}
rItemSet.Put( aPosture );
aPosture.SetWhich( aItemIds.nPostureCJK );
rItemSet.Put( aPosture );
aPosture.SetWhich( aItemIds.nPostureCTL );
rItemSet.Put( aPosture );
}
if( bCaseMap )
......@@ -1785,34 +1749,20 @@ static void ParseCSS1_font( const CSS1Expression *pExpr,
// Since "font" resets all values for which nothing is specified,
// we do it here.
SvxPostureItem aPosture( eItalic, aItemIds.nPosture );
if( rParser.IsSetWesternProps() )
rItemSet.Put( aPosture );
if( rParser.IsSetCJKProps() )
{
aPosture.SetWhich( aItemIds.nPostureCJK );
rItemSet.Put( aPosture );
}
if( rParser.IsSetCTLProps() )
{
aPosture.SetWhich( aItemIds.nPostureCTL );
rItemSet.Put( aPosture );
}
rItemSet.Put( aPosture );
aPosture.SetWhich( aItemIds.nPostureCJK );
rItemSet.Put( aPosture );
aPosture.SetWhich( aItemIds.nPostureCTL );
rItemSet.Put( aPosture );
rItemSet.Put( SvxCaseMapItem( eCaseMap, aItemIds.nCaseMap ) );
SvxWeightItem aWeight( eWeight, aItemIds.nWeight );
if( rParser.IsSetWesternProps() )
rItemSet.Put( aWeight );
if( rParser.IsSetCJKProps() )
{
aWeight.SetWhich( aItemIds.nWeightCJK );
rItemSet.Put( aWeight );
}
if( rParser.IsSetCTLProps() )
{
aWeight.SetWhich( aItemIds.nWeightCTL );
rItemSet.Put( aWeight );
}
rItemSet.Put( aWeight );
aWeight.SetWhich( aItemIds.nWeightCJK );
rItemSet.Put( aWeight );
aWeight.SetWhich( aItemIds.nWeightCTL );
rItemSet.Put( aWeight );
// font-size
CSS1Expression aExpr( pExpr->GetType(), pExpr->GetString(),
......@@ -3122,7 +3072,7 @@ static void ParseCSS1_orphans( const CSS1Expression *pExpr,
static void ParseCSS1_so_language( const CSS1Expression *pExpr,
SfxItemSet &rItemSet,
SvxCSS1PropertyInfo& /*rPropInfo*/,
const SvxCSS1Parser& rParser )
const SvxCSS1Parser& /*rParser*/ )
{
if( CSS1_IDENT == pExpr->GetType() ||
CSS1_STRING == pExpr->GetType() )
......@@ -3131,18 +3081,11 @@ static void ParseCSS1_so_language( const CSS1Expression *pExpr,
if( LANGUAGE_DONTKNOW != eLang )
{
SvxLanguageItem aLang( eLang, aItemIds.nLanguage );
if( rParser.IsSetWesternProps() )
rItemSet.Put( aLang );
if( rParser.IsSetCJKProps() )
{
aLang.SetWhich( aItemIds.nLanguageCJK );
rItemSet.Put( aLang );
}
if( rParser.IsSetCTLProps() )
{
aLang.SetWhich( aItemIds.nLanguageCTL );
rItemSet.Put( aLang );
}
rItemSet.Put( aLang );
aLang.SetWhich( aItemIds.nLanguageCJK );
rItemSet.Put( aLang );
aLang.SetWhich( aItemIds.nLanguageCTL );
rItemSet.Put( aLang );
}
}
}
......
......@@ -200,7 +200,6 @@ class SvxCSS1Parser : public CSS1Parser
sal_uInt16 nMinFixLineSpace; // minimum spacing for fixed line spacing
rtl_TextEncoding eDfltEnc;
Css1ScriptFlags nScriptFlags;
bool bIgnoreFontFamily;
......@@ -302,10 +301,6 @@ public:
virtual void SetDfltEncoding( rtl_TextEncoding eEnc );
rtl_TextEncoding GetDfltEncoding() const { return eDfltEnc; }
bool IsSetWesternProps() const { return bool(nScriptFlags & Css1ScriptFlags::Western); }
bool IsSetCJKProps() const { return bool(nScriptFlags & Css1ScriptFlags::CJK); }
bool IsSetCTLProps() const { return bool(nScriptFlags & Css1ScriptFlags::CTL); }
const OUString& GetBaseURL() const { return sBaseURL;}
};
......
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