Skip to content

Commit

Permalink
loplugin:constfields in oox
Browse files Browse the repository at this point in the history
Change-Id: I1e110d193ebfa30ab1ab0d85bfb6dc409e341439
Reviewed-on: https://gerrit.libreoffice.org/61728
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
  • Loading branch information
Noel Grandin committed Oct 15, 2018
1 parent fb1d3b5 commit a84e3df
Show file tree
Hide file tree
Showing 63 changed files with 157 additions and 162 deletions.
2 changes: 2 additions & 0 deletions compilerplugins/clang/staticconstfield.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ bool StaticConstField::TraverseConstructorInitializer(CXXCtorInitializer* init)
// unusual case where a user constructor sets a field to one value, and a copy constructor sets it to a different value
if (fn == SRCDIR "/sw/source/core/attr/hints.cxx")
return true;
if (fn == SRCDIR "/oox/source/core/contexthandler2.cxx")
return true;

report(DiagnosticsEngine::Warning, "field can be static const", init->getSourceLocation())
<< init->getSourceRange();
Expand Down
2 changes: 1 addition & 1 deletion include/oox/core/contexthandler2.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private:
typedef std::shared_ptr< ContextStack > ContextStackRef;

ContextStackRef mxContextStack; ///< Stack of all processed elements.
size_t mnRootStackSize; ///< Stack size on construction time.
size_t const mnRootStackSize; ///< Stack size on construction time.

protected:
bool mbEnableTrimSpace; ///< True = trim whitespace in characters().
Expand Down
2 changes: 1 addition & 1 deletion include/oox/core/filterdetect.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private:
typedef ::std::vector< sal_Int32 > ContextVector;

OUString& mrFilterName;
OUString maFileName;
OUString const maFileName;
ContextVector maContextStack;
OUString maTargetPath;
css::uno::Reference< css::uno::XComponentContext > mxContext;
Expand Down
2 changes: 1 addition & 1 deletion include/oox/core/fragmenthandler.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct FragmentBaseData
const OUString maFragmentPath;
css::uno::Reference< css::xml::sax::XLocator >
mxLocator;
RelationsRef mxRelations;
RelationsRef const mxRelations;

explicit FragmentBaseData(
XmlFilterBase& rFilter,
Expand Down
2 changes: 1 addition & 1 deletion include/oox/core/relations.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public:

private:
::std::map< OUString, Relation > maMap;
OUString maFragmentPath;
OUString const maFragmentPath;
};


Expand Down
18 changes: 9 additions & 9 deletions include/oox/crypto/AgileEngine.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ struct OOX_DLLPUBLIC AgileEncryptionInfo

struct OOX_DLLPUBLIC AgileEncryptionParameters
{
sal_Int32 spinCount;
sal_Int32 saltSize;
sal_Int32 keyBits;
sal_Int32 hashSize;
sal_Int32 blockSize;

OUString cipherAlgorithm;
OUString cipherChaining;
OUString hashAlgorithm;
sal_Int32 const spinCount;
sal_Int32 const saltSize;
sal_Int32 const keyBits;
sal_Int32 const hashSize;
sal_Int32 const blockSize;

OUString const cipherAlgorithm;
OUString const cipherChaining;
OUString const hashAlgorithm;
};

enum class AgileEncryptionPreset
Expand Down
2 changes: 1 addition & 1 deletion include/oox/crypto/CryptTools.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public:

class OOX_DLLPUBLIC CryptoHash : public Crypto
{
sal_Int32 mnHashSize;
sal_Int32 const mnHashSize;
public:
CryptoHash(std::vector<sal_uInt8>& rKey, CryptoHashType eType);
bool update(std::vector<sal_uInt8>& rInput, sal_uInt32 nInputLength = 0);
Expand Down
2 changes: 1 addition & 1 deletion include/oox/crypto/DocumentEncryption.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class OOX_DLLPUBLIC DocumentEncryption
private:
css::uno::Reference< css::io::XStream > mxDocumentStream;
oox::ole::OleStorage& mrOleStorage;
OUString maPassword;
OUString const maPassword;

Standard2007Engine mEngine;

Expand Down
4 changes: 2 additions & 2 deletions include/oox/drawingml/graphicshapecontext.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public:
virtual void onEndElement() override;

private:
bool mbEmbedShapesInChart;
::oox::core::ContextHandler2Helper* mpParent;
bool const mbEmbedShapesInChart;
::oox::core::ContextHandler2Helper* const mpParent;
};


Expand Down
2 changes: 1 addition & 1 deletion include/oox/drawingml/shape.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap;
struct ChartShapeInfo
{
OUString maFragmentPath; ///< Path to related XML stream, e.g. for charts.
bool mbEmbedShapes; ///< True = load chart shapes into chart, false = load into parent drawpage.
bool const mbEmbedShapes; ///< True = load chart shapes into chart, false = load into parent drawpage.

explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( bEmbedShapes ) {}
};
Expand Down
10 changes: 5 additions & 5 deletions include/oox/drawingml/shapepropertymap.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ typedef o3tl::enumarray<ShapeProperty, sal_Int32> ShapePropertyIds;
struct OOX_DLLPUBLIC ShapePropertyInfo
{
const ShapePropertyIds& mrPropertyIds;
bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
bool mbNamedFillBitmap; /// True = use named fill bitmap instead of explicit fill bitmap.
bool const mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
bool const mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
bool const mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
bool const mbNamedFillBitmap; /// True = use named fill bitmap instead of explicit fill bitmap.

static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods).

Expand Down Expand Up @@ -154,7 +154,7 @@ private:

private:
ModelObjectHelper& mrModelObjHelper;
ShapePropertyInfo maShapePropInfo;
ShapePropertyInfo const maShapePropInfo;
};


Expand Down
8 changes: 4 additions & 4 deletions include/oox/dump/dumperbase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,8 @@ private:
typedef ::std::map< OUString, NameListRef > NameListMap;

css::uno::Reference< css::uno::XComponentContext > mxContext;
StorageRef mxRootStrg;
OUString maSysFileName;
StorageRef const mxRootStrg;
OUString const maSysFileName;
ConfigFileSet maConfigFiles;
ConfigDataMap maConfigData;
NameListMap maNameLists;
Expand Down Expand Up @@ -1184,8 +1184,8 @@ private:
private:
struct PreferredItem
{
OUString maName;
bool mbStorage;
OUString const maName;
bool const mbStorage;

explicit PreferredItem( const OUString& rName, bool bStorage ) :
maName( rName ), mbStorage( bStorage ) {}
Expand Down
22 changes: 11 additions & 11 deletions include/oox/dump/oledumper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ private:
bool dumpComCtlComplex();

protected:
sal_uInt32 mnDataId5;
sal_uInt32 mnDataId6;
sal_uInt16 mnVersion;
bool mbCommonPart;
bool mbComplexPart;
sal_uInt32 const mnDataId5;
sal_uInt32 const mnDataId6;
sal_uInt16 const mnVersion;
bool const mbCommonPart;
bool const mbComplexPart;
};


Expand Down Expand Up @@ -350,9 +350,9 @@ private:
{
enum LargePropertyType { PROPTYPE_POS, PROPTYPE_SIZE, PROPTYPE_GUID, PROPTYPE_STRING, PROPTYPE_STRINGARRAY };

LargePropertyType mePropType;
OUString maItemName;
sal_uInt32 mnDataSize;
LargePropertyType const mePropType;
OUString const maItemName;
sal_uInt32 const mnDataSize;
OUString* mpItemValue;
explicit LargeProperty( LargePropertyType ePropType, const String& rItemName, sal_uInt32 nDataSize, OUString* pItemValue = nullptr ) :
mePropType( ePropType ), maItemName( rItemName ), mnDataSize( nDataSize ), mpItemValue( pItemValue ) {}
Expand All @@ -361,8 +361,8 @@ private:

struct StreamProperty
{
OUString maItemName;
sal_uInt16 mnData;
OUString const maItemName;
sal_uInt16 const mnData;
explicit StreamProperty( const String& rItemName, sal_uInt16 nData ) :
maItemName( rItemName ), mnData( nData ) {}
};
Expand Down Expand Up @@ -761,7 +761,7 @@ protected:

private:
VbaSharedData& mrVbaData;
sal_Int32 mnStrmOffset;
sal_Int32 const mnStrmOffset;
};


Expand Down
8 changes: 4 additions & 4 deletions include/oox/export/chartexport.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ enum AxesType
};

struct AxisIdPair{
AxesType nAxisType;
sal_Int32 nAxisId;
sal_Int32 nCrossAx;
AxesType const nAxisType;
sal_Int32 const nAxisId;
sal_Int32 const nCrossAx;

AxisIdPair(AxesType nType, sal_Int32 nId, sal_Int32 nAx)
: nAxisType(nType)
Expand All @@ -96,7 +96,7 @@ public:
typedef ::std::vector< AxisIdPair > AxisVector;

private:
sal_Int32 mnXmlNamespace;
sal_Int32 const mnXmlNamespace;
sal_Int32 mnSeriesCount;
css::uno::Reference< css::frame::XModel > mxChartModel;
css::uno::Reference< css::chart::XDiagram > mxDiagram;
Expand Down
2 changes: 1 addition & 1 deletion include/oox/export/drawingml.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private:
static std::map<OUString, OUString> maWdpCache;

/// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
DocumentType meDocumentType;
DocumentType const meDocumentType;
/// Parent exporter, used for text callback.
DMLTextExport* mpTextExport;

Expand Down
2 changes: 1 addition & 1 deletion include/oox/helper/binaryinputstream.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ private:

private:
BinaryInputStream* mpInStrm;
sal_Int64 mnStartPos;
sal_Int64 const mnStartPos;
sal_Int64 mnRelPos;
sal_Int64 mnSize;
};
Expand Down
2 changes: 1 addition & 1 deletion include/oox/helper/modelobjecthelper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private:
mxModelFactory; ///< Factory to create the container.
mutable css::uno::Reference< css::container::XNameContainer >
mxContainer; ///< Container for the objects.
OUString maServiceName; ///< Service name to create the container.
OUString const maServiceName; ///< Service name to create the container.
sal_Int32 mnIndex; ///< Index to create unique identifiers.
};

Expand Down
8 changes: 4 additions & 4 deletions include/oox/helper/storagebase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ private:
mxInStream; ///< Cached base input stream (to keep it alive).
css::uno::Reference< css::io::XStream >
mxOutStream; ///< Cached base output stream (to keep it alive).
OUString maParentPath; ///< Full path of parent storage.
OUString maStorageName; ///< Name of this storage, if it is a substorage.
bool mbBaseStreamAccess; ///< True = access base streams with empty stream name.
bool mbReadOnly; ///< True = storage opened read-only (based on input stream).
OUString const maParentPath; ///< Full path of parent storage.
OUString const maStorageName; ///< Name of this storage, if it is a substorage.
bool const mbBaseStreamAccess; ///< True = access base streams with empty stream name.
bool const mbReadOnly; ///< True = storage opened read-only (based on input stream).
};


Expand Down
6 changes: 3 additions & 3 deletions include/oox/ole/axbinaryreader.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public:
private:
BinaryInputStream* mpInStrm; ///< The wrapped input stream.
sal_Int64 mnStrmPos; ///< Tracks relative position in the stream.
sal_Int64 mnStrmSize; ///< Size of the wrapped stream data.
sal_Int64 const mnStrmSize; ///< Size of the wrapped stream data.
};


Expand Down Expand Up @@ -182,7 +182,7 @@ private:
struct StringProperty : public ComplexProperty
{
OUString& mrValue;
sal_uInt32 mnSize;
sal_uInt32 const mnSize;

explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
mrValue( rValue ), mnSize( nSize ) {}
Expand All @@ -193,7 +193,7 @@ private:
struct ArrayStringProperty : public ComplexProperty
{
AxArrayString& mrArray;
sal_uInt32 mnSize;
sal_uInt32 const mnSize;
explicit ArrayStringProperty( AxArrayString& rArray, sal_uInt32 nSize ) :
mrArray( rArray ), mnSize( nSize ) {}
virtual bool readProperty( AxAlignedInputStream& rInStrm ) override;
Expand Down
8 changes: 4 additions & 4 deletions include/oox/ole/axbinarywriter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public:
private:
BinaryOutputStream* mpOutStrm; ///< The wrapped input stream.
sal_Int64 mnStrmPos; ///< Tracks relative position in the stream.
sal_Int64 mnStrmSize; ///< Size of the wrapped stream data.
sal_Int64 mnWrappedBeginPos; ///< starting pos or wrapped stream
sal_Int64 const mnStrmSize; ///< Size of the wrapped stream data.
sal_Int64 const mnWrappedBeginPos; ///< starting pos or wrapped stream
};

/** A pair of integer values as a property. */
Expand Down Expand Up @@ -130,7 +130,7 @@ private:
struct StringProperty : public ComplexProperty
{
OUString& mrValue;
sal_uInt32 mnSize;
sal_uInt32 const mnSize;

explicit StringProperty( OUString& rValue, sal_uInt32 nSize ) :
mrValue( rValue ), mnSize( nSize ) {}
Expand All @@ -154,7 +154,7 @@ private:
sal_Int64 mnPropFlags; ///< Flags specifying existing properties.
sal_Int64 mnNextProp; ///< Next property to read.
bool mbValid; ///< True = stream still valid.
bool mb64BitPropFlags;
bool const mb64BitPropFlags;
};


Expand Down
14 changes: 6 additions & 8 deletions include/oox/ole/axcontrol.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private:
const GraphicHelper& mrGraphicHelper;
mutable PropertySet maAddressConverter;
mutable PropertySet maRangeConverter;
bool mbDefaultColorBgr;
bool const mbDefaultColorBgr;
};


Expand Down Expand Up @@ -422,10 +422,8 @@ protected:
const sal_uInt16 mnVersion; ///< Current version of the ComCtl control model.

private:
sal_uInt32 mnDataPartId5; ///< Identifier for version 5.0 control data.
sal_uInt32 mnDataPartId6; ///< Identifier for version 6.0 control data.
bool mbCommonPart; ///< True = the COMCTL_COMMONDATA part exists.
bool mbComplexPart; ///< True = the COMCTL_COMPLEXDATA part exists.
sal_uInt32 const mnDataPartId5; ///< Identifier for version 5.0 control data.
sal_uInt32 const mnDataPartId6; ///< Identifier for version 6.0 control data.
};


Expand Down Expand Up @@ -500,7 +498,7 @@ public: // direct access needed for legacy VML drawing controls
AxFontData maFontData; ///< The font settings.

private:
bool mbSupportsAlign; ///< True = UNO model supports Align property.
bool const mbSupportsAlign; ///< True = UNO model supports Align property.
};


Expand Down Expand Up @@ -830,7 +828,7 @@ public: // direct access needed for legacy VML drawing controls
sal_Int32 mnPicAlign; ///< Anchor position of the picture.
sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom.
bool mbPicTiling; ///< True = picture is repeated.
bool mbFontSupport; ///< True = control supports the font property.
bool const mbFontSupport; ///< True = control supports the font property.
};


Expand Down Expand Up @@ -982,7 +980,7 @@ private:
createXForm();

private:
ControlConverter maControlConv;
ControlConverter const maControlConv;
css::uno::Reference< css::lang::XMultiServiceFactory > mxModelFactory;
css::uno::Reference< css::form::XFormsSupplier > mxFormsSupp;
css::uno::Reference< css::container::XIndexContainer > mxFormIC;
Expand Down
4 changes: 2 additions & 2 deletions include/oox/ole/olehelper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class OOX_DLLPUBLIC OleFormCtrlExportHelper final
{
std::unique_ptr<::oox::ole::EmbeddedControl> mpControl;
::oox::ole::ControlModelBase* mpModel;
::oox::GraphicHelper maGrfHelper;
::oox::GraphicHelper const maGrfHelper;
css::uno::Reference< css::frame::XModel > mxDocModel;
css::uno::Reference< css::awt::XControlModel > mxControlModel;

Expand Down Expand Up @@ -175,7 +175,7 @@ class OOX_DLLPUBLIC MSConvertOCXControls : public SvxMSConvertOCXControls
{
protected:
css::uno::Reference< css::uno::XComponentContext > mxCtx;
::oox::GraphicHelper maGrfHelper;
::oox::GraphicHelper const maGrfHelper;

bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
css::uno::Reference< css::form::XFormComponent > & rxFormComp,
Expand Down
2 changes: 1 addition & 1 deletion include/oox/ole/vbacontrol.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public:
private:
css::uno::Reference< css::uno::XComponentContext > mxContext;
css::uno::Reference< css::frame::XModel > mxDocModel;
ControlConverter maConverter;
ControlConverter const maConverter;
};


Expand Down
Loading

0 comments on commit a84e3df

Please sign in to comment.