Examples of errors detected by the V1013 diagnostic
V1013. Suspicious subexpression in a sequence of similar comparisons.
LibreOffice
V1013 Suspicious subexpression f1.Pitch == f2.CharSet in a sequence of similar comparisons. xmldlg_export.cxx 1251
inline bool equalFont( Style const & style1, Style const & style2 )
{
awt::FontDescriptor const & f1 = style1._descr;
awt::FontDescriptor const & f2 = style2._descr;
return (
f1.Name == f2.Name &&
f1.Height == f2.Height &&
f1.Width == f2.Width &&
f1.StyleName == f2.StyleName &&
f1.Family == f2.Family &&
f1.CharSet == f2.CharSet && // <=
f1.Pitch == f2.CharSet && // <=
f1.CharacterWidth == f2.CharacterWidth &&
f1.Weight == f2.Weight &&
f1.Slant == f2.Slant &&
f1.Underline == f2.Underline &&
f1.Strikeout == f2.Strikeout &&
f1.Orientation == f2.Orientation &&
bool(f1.Kerning) == bool(f2.Kerning) &&
bool(f1.WordLineMode) == bool(f2.WordLineMode) &&
f1.Type == f2.Type &&
style1._fontRelief == style2._fontRelief &&
style1._fontEmphasisMark == style2._fontEmphasisMark
);
}