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

loplugin:constparams codemaker,idl,idlc

Change-Id: Ic72b7525cfbfbd3c5afb12fe9ea814176e6c8c9d
Reviewed-on: https://gerrit.libreoffice.org/40126Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 50985d9b
...@@ -345,7 +345,7 @@ FileStream &operator<<(FileStream& o, char const * s) { ...@@ -345,7 +345,7 @@ FileStream &operator<<(FileStream& o, char const * s) {
osl_writeFile(o.m_file, s, strlen(s), &writtenBytes); osl_writeFile(o.m_file, s, strlen(s), &writtenBytes);
return o; return o;
} }
FileStream &operator<<(FileStream& o, ::rtl::OString* s) { FileStream &operator<<(FileStream& o, ::rtl::OString const * s) {
sal_uInt64 writtenBytes; sal_uInt64 writtenBytes;
osl_writeFile(o.m_file, s->getStr(), s->getLength() * sizeof(sal_Char), &writtenBytes); osl_writeFile(o.m_file, s->getStr(), s->getLength() * sizeof(sal_Char), &writtenBytes);
return o; return o;
...@@ -356,7 +356,7 @@ FileStream &operator<<(FileStream& o, const ::rtl::OString& s) { ...@@ -356,7 +356,7 @@ FileStream &operator<<(FileStream& o, const ::rtl::OString& s) {
return o; return o;
} }
FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer* s) { FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer const * s) {
sal_uInt64 writtenBytes; sal_uInt64 writtenBytes;
osl_writeFile(o.m_file, s->getStr(), s->getLength() * sizeof(sal_Char), &writtenBytes); osl_writeFile(o.m_file, s->getStr(), s->getLength() * sizeof(sal_Char), &writtenBytes);
return o; return o;
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
operator bool() const { return bVal; } operator bool() const { return bVal; }
bool IsSet() const { return bSet; } bool IsSet() const { return bSet; }
bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); bool ReadSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm );
}; };
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
void setString(const OString& rStr) { m_aStr = rStr; } void setString(const OString& rStr) { m_aStr = rStr; }
const OString& getString() const { return m_aStr; } const OString& getString() const { return m_aStr; }
bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ); bool ReadSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm );
bool IsSet() const bool IsSet() const
{ {
return !m_aStr.isEmpty() || nValue != 0; return !m_aStr.isEmpty() || nValue != 0;
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
}; };
bool ReadStringSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm, OString& aString ); bool ReadStringSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm, OString& aString );
#endif // INCLUDED_IDL_INC_BASTYPE_HXX #endif // INCLUDED_IDL_INC_BASTYPE_HXX
......
...@@ -114,7 +114,7 @@ public: ...@@ -114,7 +114,7 @@ public:
void Write(const OString& rText); void Write(const OString& rText);
void WriteError( SvTokenStream & rInStm ); void WriteError( SvTokenStream & rInStm );
void SetError( const OString& rError, SvToken& rTok ); void SetError( const OString& rError, SvToken const & rTok );
void SetAndWriteError( SvTokenStream & rInStm, const OString& rError ); void SetAndWriteError( SvTokenStream & rInStm, const OString& rError );
void Push( SvMetaObject * pObj ); void Push( SvMetaObject * pObj );
sal_uInt32 GetUniqueId() { return ++nUniqueId; } sal_uInt32 GetUniqueId() { return ++nUniqueId; }
......
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
void SetHash( SvStringHashEntry * pHashP ) void SetHash( SvStringHashEntry * pHashP )
{ pHash = pHashP; nType = SVTOKENTYPE::HashId; } { pHash = pHashP; nType = SVTOKENTYPE::HashId; }
bool Is( SvStringHashEntry * pEntry ) const bool Is( SvStringHashEntry const * pEntry ) const
{ return IsIdentifierHash() && pHash == pEntry; } { return IsIdentifierHash() && pHash == pEntry; }
}; };
......
...@@ -56,15 +56,15 @@ public: ...@@ -56,15 +56,15 @@ public:
SvMetaClass* ReadKnownClass(); SvMetaClass* ReadKnownClass();
SvMetaType* ReadKnownType(); SvMetaType* ReadKnownType();
void Read(char cChar); void Read(char cChar);
bool ReadIfBoolAttribute( SvBOOL&, SvStringHashEntry* pName); bool ReadIfBoolAttribute( SvBOOL&, SvStringHashEntry const * pName);
bool ReadIfIdAttribute( SvIdentifier& rIdentifier, SvStringHashEntry* pName ); bool ReadIfIdAttribute( SvIdentifier& rIdentifier, SvStringHashEntry const * pName );
bool ReadIf(char cChar); bool ReadIf(char cChar);
void ReadDelimiter(); void ReadDelimiter();
bool ReadIfDelimiter(); bool ReadIfDelimiter();
OString ReadIdentifier(); OString ReadIdentifier();
OString ReadString(); OString ReadString();
void Read(SvStringHashEntry*); void Read(SvStringHashEntry const *);
bool ReadIf(SvStringHashEntry*); bool ReadIf(SvStringHashEntry const *);
}; };
#endif // INCLUDED_IDL_INC_PARSER_HXX #endif // INCLUDED_IDL_INC_PARSER_HXX
......
...@@ -55,7 +55,7 @@ class SvMetaType : public SvMetaReference ...@@ -55,7 +55,7 @@ class SvMetaType : public SvMetaReference
MetaTypeType nType; MetaTypeType nType;
bool bIsItem; bool bIsItem;
void WriteSfxItem( const OString& rItemName, SvIdlDataBase & rBase, void WriteSfxItem( const OString& rItemName, SvIdlDataBase const & rBase,
SvStream & rOutStm ); SvStream & rOutStm );
protected: protected:
bool ReadHeaderSvIdl( SvTokenStream & rInStm ); bool ReadHeaderSvIdl( SvTokenStream & rInStm );
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <database.hxx> #include <database.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
bool SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) bool SvBOOL::ReadSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm )
{ {
sal_uInt32 nTokPos = rInStm.Tell(); sal_uInt32 nTokPos = rInStm.Tell();
SvToken& rTok = rInStm.GetToken_Next(); SvToken& rTok = rInStm.GetToken_Next();
...@@ -49,7 +49,7 @@ bool SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) ...@@ -49,7 +49,7 @@ bool SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
return false; return false;
} }
bool SvIdentifier::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) bool SvIdentifier::ReadSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm )
{ {
sal_uInt32 nTokPos = rInStm.Tell(); sal_uInt32 nTokPos = rInStm.Tell();
SvToken& rTok = rInStm.GetToken_Next(); SvToken& rTok = rInStm.GetToken_Next();
...@@ -94,7 +94,7 @@ void SvIdentifier::ReadSvIdl( SvIdlDataBase & rBase, ...@@ -94,7 +94,7 @@ void SvIdentifier::ReadSvIdl( SvIdlDataBase & rBase,
rInStm.Seek( nTokPos ); rInStm.Seek( nTokPos );
} }
bool ReadStringSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm, OString& aRetString ) bool ReadStringSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm, OString& aRetString )
{ {
sal_uInt32 nTokPos = rInStm.Tell(); sal_uInt32 nTokPos = rInStm.Tell();
SvToken& rTok = rInStm.GetToken_Next(); SvToken& rTok = rInStm.GetToken_Next();
......
...@@ -348,7 +348,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList) ...@@ -348,7 +348,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList)
} }
static OString MakeSlotName( SvStringHashEntry * pEntry ) static OString MakeSlotName( SvStringHashEntry const * pEntry )
{ {
return "SfxSlotMode::" + pEntry->GetName().toAsciiUpperCase(); return "SfxSlotMode::" + pEntry->GetName().toAsciiUpperCase();
}; };
......
...@@ -218,7 +218,7 @@ sal_uLong SvMetaType::MakeSfx( OStringBuffer& rAttrArray ) ...@@ -218,7 +218,7 @@ sal_uLong SvMetaType::MakeSfx( OStringBuffer& rAttrArray )
} }
void SvMetaType::WriteSfxItem( void SvMetaType::WriteSfxItem(
const OString& rItemName, SvIdlDataBase& rBase, SvStream& rOutStm ) const OString& rItemName, SvIdlDataBase const & rBase, SvStream& rOutStm )
{ {
WriteStars( rOutStm ); WriteStars( rOutStm );
OString aVarName = " a" + rItemName + "_Impl"; OString aVarName = " a" + rItemName + "_Impl";
......
...@@ -85,7 +85,7 @@ SvRefMemberList<SvMetaType *>& SvIdlDataBase::GetTypeList() ...@@ -85,7 +85,7 @@ SvRefMemberList<SvMetaType *>& SvIdlDataBase::GetTypeList()
return aTypeList; return aTypeList;
} }
void SvIdlDataBase::SetError( const OString& rError, SvToken& rTok ) void SvIdlDataBase::SetError( const OString& rError, SvToken const & rTok )
{ {
if( rTok.GetLine() > 10000 ) if( rTok.GetLine() > 10000 )
aError.SetText( "line count overflow" ); aError.SetText( "line count overflow" );
......
...@@ -476,7 +476,7 @@ SvMetaType * SvIdlParser::ReadKnownType() ...@@ -476,7 +476,7 @@ SvMetaType * SvIdlParser::ReadKnownType()
throw SvParseException( rInStm, "wrong typedef: "); throw SvParseException( rInStm, "wrong typedef: ");
} }
bool SvIdlParser::ReadIfBoolAttribute( SvBOOL& rBool, SvStringHashEntry * pName ) bool SvIdlParser::ReadIfBoolAttribute( SvBOOL& rBool, SvStringHashEntry const * pName )
{ {
sal_uInt32 nTokPos = rInStm.Tell(); sal_uInt32 nTokPos = rInStm.Tell();
SvToken& rTok = rInStm.GetToken_Next(); SvToken& rTok = rInStm.GetToken_Next();
...@@ -499,7 +499,7 @@ bool SvIdlParser::ReadIfBoolAttribute( SvBOOL& rBool, SvStringHashEntry * pName ...@@ -499,7 +499,7 @@ bool SvIdlParser::ReadIfBoolAttribute( SvBOOL& rBool, SvStringHashEntry * pName
return false; return false;
} }
bool SvIdlParser::ReadIfIdAttribute( SvIdentifier& rIdentifier, SvStringHashEntry * pName ) bool SvIdlParser::ReadIfIdAttribute( SvIdentifier& rIdentifier, SvStringHashEntry const * pName )
{ {
sal_uInt32 nTokPos = rInStm.Tell(); sal_uInt32 nTokPos = rInStm.Tell();
SvToken& rTok = rInStm.GetToken_Next(); SvToken& rTok = rInStm.GetToken_Next();
...@@ -572,14 +572,14 @@ bool SvIdlParser::ReadIf(char cChar) ...@@ -572,14 +572,14 @@ bool SvIdlParser::ReadIf(char cChar)
return false; return false;
} }
void SvIdlParser::Read(SvStringHashEntry* entry) void SvIdlParser::Read(SvStringHashEntry const * entry)
{ {
if( !rInStm.GetToken().Is(entry) ) if( !rInStm.GetToken().Is(entry) )
throw SvParseException("expected " + entry->GetName(), rInStm.GetToken()); throw SvParseException("expected " + entry->GetName(), rInStm.GetToken());
rInStm.GetToken_Next(); rInStm.GetToken_Next();
} }
bool SvIdlParser::ReadIf(SvStringHashEntry* entry) bool SvIdlParser::ReadIf(SvStringHashEntry const * entry)
{ {
if( rInStm.GetToken().Is(entry) ) if( rInStm.GetToken().Is(entry) )
{ {
......
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
// Look up a predefined type by its ExprType // Look up a predefined type by its ExprType
AstDeclaration* lookupPrimitiveType(ExprType type); AstDeclaration* lookupPrimitiveType(ExprType type);
AstDeclaration* lookupForAdd(AstDeclaration* pDecl); AstDeclaration* lookupForAdd(AstDeclaration const * pDecl);
protected: protected:
AstDeclaration const * getLast() const AstDeclaration const * getLast() const
......
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
static void error1(ErrorCode e, AstDeclaration const * d); static void error1(ErrorCode e, AstDeclaration const * d);
static void error2( static void error2(
ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2); ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2);
static void error3(ErrorCode e, AstDeclaration* d1, AstDeclaration* d2, AstDeclaration* d3); static void error3(ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2, AstDeclaration const * d3);
// Warning // Warning
static void warning0(WarningCode e, const sal_Char* warningmsg); static void warning0(WarningCode e, const sal_Char* warningmsg);
...@@ -100,13 +100,13 @@ public: ...@@ -100,13 +100,13 @@ public:
// Report a type error // Report a type error
static void noTypeError(AstDeclaration const * pDecl); static void noTypeError(AstDeclaration const * pDecl);
static void inheritanceError(NodeType nodeType, const OString* name, AstDeclaration* pDecl); static void inheritanceError(NodeType nodeType, const OString* name, AstDeclaration const * pDecl);
static void flagError(ErrorCode e, sal_uInt32 flag); static void flagError(ErrorCode e, sal_uInt32 flag);
static void forwardLookupError(const AstDeclaration* pForward, const OString& name); static void forwardLookupError(const AstDeclaration* pForward, const OString& name);
static void constantExpected(AstDeclaration* pDecl, const OString& name); static void constantExpected(AstDeclaration const * pDecl, const OString& name);
static void evalError(AstExpression* pExpr); static void evalError(AstExpression* pExpr);
......
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
{ return m_typeParameters; } { return m_typeParameters; }
private: private:
void initializeInherits(OString* pinherits); void initializeInherits(OString const * pinherits);
NodeType m_nodeType; NodeType m_nodeType;
OString* m_pName; OString* m_pName;
......
...@@ -319,7 +319,7 @@ AstDeclaration* AstScope::lookupPrimitiveType(ExprType type) ...@@ -319,7 +319,7 @@ AstDeclaration* AstScope::lookupPrimitiveType(ExprType type)
return nullptr; return nullptr;
} }
AstDeclaration* AstScope::lookupForAdd(AstDeclaration* pDecl) AstDeclaration* AstScope::lookupForAdd(AstDeclaration const * pDecl)
{ {
if ( !pDecl ) if ( !pDecl )
return nullptr; return nullptr;
......
...@@ -444,7 +444,7 @@ void ErrorHandler::error2( ...@@ -444,7 +444,7 @@ void ErrorHandler::error2(
idlc()->incErrorCount(); idlc()->incErrorCount();
} }
void ErrorHandler::error3(ErrorCode e, AstDeclaration* d1, AstDeclaration* d2, AstDeclaration* d3) void ErrorHandler::error3(ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2, AstDeclaration const * d3)
{ {
errorHeader(e); errorHeader(e);
fprintf(stderr, "'%s', '%s', '%s'\n", d1->getScopedName().getStr(), fprintf(stderr, "'%s', '%s', '%s'\n", d1->getScopedName().getStr(),
...@@ -528,11 +528,11 @@ char const * nodeTypeName(NodeType nodeType) { ...@@ -528,11 +528,11 @@ char const * nodeTypeName(NodeType nodeType) {
} }
void ErrorHandler::inheritanceError(NodeType nodeType, const OString* name, AstDeclaration* pDecl) void ErrorHandler::inheritanceError(NodeType nodeType, const OString* name, AstDeclaration const * pDecl)
{ {
if ( nodeType == NT_interface && if ( nodeType == NT_interface &&
(pDecl->getNodeType() == NT_interface) && (pDecl->getNodeType() == NT_interface) &&
!(static_cast<AstInterface*>(pDecl)->isDefined()) ) !(static_cast<AstInterface const *>(pDecl)->isDefined()) )
{ {
errorHeader(ErrorCode::CannotInheritFromForward); errorHeader(ErrorCode::CannotInheritFromForward);
fprintf(stderr, "interface '%s' cannot inherit from forward declared interface '%s'\n", fprintf(stderr, "interface '%s' cannot inherit from forward declared interface '%s'\n",
...@@ -556,7 +556,7 @@ void ErrorHandler::forwardLookupError(const AstDeclaration* pForward, ...@@ -556,7 +556,7 @@ void ErrorHandler::forwardLookupError(const AstDeclaration* pForward,
idlc()->incErrorCount(); idlc()->incErrorCount();
} }
void ErrorHandler::constantExpected(AstDeclaration* pDecl, void ErrorHandler::constantExpected(AstDeclaration const * pDecl,
const OString& name) const OString& name)
{ {
errorHeader(ErrorCode::ExpectedConstant); errorHeader(ErrorCode::ExpectedConstant);
......
...@@ -70,7 +70,7 @@ FeInheritanceHeader::FeInheritanceHeader( ...@@ -70,7 +70,7 @@ FeInheritanceHeader::FeInheritanceHeader(
initializeInherits(pInherits); initializeInherits(pInherits);
} }
void FeInheritanceHeader::initializeInherits(OString* pInherits) void FeInheritanceHeader::initializeInherits(OString const * pInherits)
{ {
if ( pInherits ) if ( pInherits )
{ {
......
...@@ -66,7 +66,7 @@ using ::rtl::OStringBuffer; ...@@ -66,7 +66,7 @@ using ::rtl::OStringBuffer;
extern int yylex(void); extern int yylex(void);
void yyerror(char const *); void yyerror(char const *);
void checkIdentifier(::rtl::OString* id) void checkIdentifier(::rtl::OString const * id)
{ {
static short check = 0; static short check = 0;
if (check == 0) { if (check == 0) {
......
...@@ -55,9 +55,9 @@ public: ...@@ -55,9 +55,9 @@ public:
// friend functions // friend functions
friend FileStream &operator<<(FileStream& o, sal_uInt32 i); friend FileStream &operator<<(FileStream& o, sal_uInt32 i);
friend FileStream &operator<<(FileStream& o, char const * s); friend FileStream &operator<<(FileStream& o, char const * s);
friend FileStream &operator<<(FileStream& o, ::rtl::OString* s); friend FileStream &operator<<(FileStream& o, ::rtl::OString const * s);
friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s); friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s);
friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer* s); friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer const * s);
friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s); friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s);
friend FileStream & operator <<(FileStream & out, rtl::OUString const & s); friend FileStream & operator <<(FileStream & out, rtl::OUString const & s);
......
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