loplugin:constparams in soltools and various

Change-Id: I5e8e4a9a31aa7c3ff54cc7ce137d08770ea297e1
Reviewed-on: https://gerrit.libreoffice.org/40279
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-07-21 11:52:04 +02:00
parent 7a7cba91a6
commit ec340697d6
24 changed files with 57 additions and 51 deletions

View File

@@ -108,6 +108,11 @@ bool ConstParams::VisitFunctionDecl(FunctionDecl * functionDecl)
|| name == "file_write" || name == "file_write"
|| name == "SalMainPipeExchangeSignal_impl" || name == "SalMainPipeExchangeSignal_impl"
|| name.startswith("SbRtl_") || name.startswith("SbRtl_")
|| name == "my_if_errors"
|| name == "my_eval_defined"
|| name == "my_eval_variable"
// #ifdef win32
|| name == "convert_slashes"
// UNO component entry points // UNO component entry points
|| name.endswith("component_getFactory") || name.endswith("component_getFactory")
// in Scheduler::, wants to loop until a reference to a bool becomes true // in Scheduler::, wants to loop until a reference to a bool becomes true

View File

@@ -163,7 +163,7 @@ bool recursivelyFindType(
} }
static inline void * queryDeepNoXInterface( static inline void * queryDeepNoXInterface(
typelib_TypeDescriptionReference * pDemandedTDR, class_data * cd, void * that ) typelib_TypeDescriptionReference const * pDemandedTDR, class_data * cd, void * that )
{ {
type_entry * pEntries = getTypeEntries( cd ); type_entry * pEntries = getTypeEntries( cd );
sal_Int32 nTypes = cd->m_nTypes; sal_Int32 nTypes = cd->m_nTypes;

View File

@@ -756,7 +756,7 @@ void cppuhelper::ServiceManager::addSingletonContextEntries(
void cppuhelper::ServiceManager::loadImplementation( void cppuhelper::ServiceManager::loadImplementation(
css::uno::Reference< css::uno::XComponentContext > const & context, css::uno::Reference< css::uno::XComponentContext > const & context,
std::shared_ptr< Data::Implementation > & implementation) std::shared_ptr< Data::Implementation > const & implementation)
{ {
assert(implementation.get() != nullptr); assert(implementation.get() != nullptr);
{ {

View File

@@ -218,7 +218,7 @@ public:
void loadImplementation( void loadImplementation(
css::uno::Reference< css::uno::XComponentContext > const & context, css::uno::Reference< css::uno::XComponentContext > const & context,
std::shared_ptr< Data::Implementation > & implementation); std::shared_ptr< Data::Implementation > const & implementation);
private: private:
virtual ~ServiceManager() override; virtual ~ServiceManager() override;

View File

@@ -88,7 +88,7 @@ pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars p
return pOldFunc; return pOldFunc;
} }
void SAL_CALL RefreshToolbars( css::uno::Reference< css::frame::XFrame >& rFrame ) void SAL_CALL RefreshToolbars( css::uno::Reference< css::frame::XFrame > const & rFrame )
{ {
pfunc_getRefreshToolbars pCallback = nullptr; pfunc_getRefreshToolbars pCallback = nullptr;
{ {

View File

@@ -70,7 +70,7 @@ FWE_DLLPUBLIC svt::StatusbarController* SAL_CALL CreateStatusBarController(
FWE_DLLPUBLIC pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pRefreshToolbarsFunc ); FWE_DLLPUBLIC pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pRefreshToolbarsFunc );
FWE_DLLPUBLIC void SAL_CALL RefreshToolbars( FWE_DLLPUBLIC void SAL_CALL RefreshToolbars(
css::uno::Reference< css::frame::XFrame >& rFrame ); css::uno::Reference< css::frame::XFrame > const & rFrame );
FWE_DLLPUBLIC pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow ); FWE_DLLPUBLIC pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow );
FWE_DLLPUBLIC void SAL_CALL CreateDockingWindow( FWE_DLLPUBLIC void SAL_CALL CreateDockingWindow(

View File

@@ -428,7 +428,7 @@ void handleDirectory(
osl::Directory::remove(sPoUrl); osl::Directory::remove(sPoUrl);
} }
void handleProjects(char * sSourceRoot, char const * sDestRoot) void handleProjects(char const * sSourceRoot, char const * sDestRoot)
{ {
OUString root16; OUString root16;
if (!rtl_convertStringToUString( if (!rtl_convertStringToUString(

View File

@@ -58,8 +58,8 @@ OString Win_AddLongPathPrefix( const OString &rPathName )
#ifdef SYSTEM_DICTS #ifdef SYSTEM_DICTS
// find old style dictionaries in system directories // find old style dictionaries in system directories
void GetOldStyleDicsInDir( void GetOldStyleDicsInDir(
OUString& aSystemDir, OUString& aFormatName, OUString const & aSystemDir, OUString const & aFormatName,
OUString& aSystemSuffix, OUString& aSystemPrefix, OUString const & aSystemSuffix, OUString const & aSystemPrefix,
std::set< OUString >& aDicLangInUse, std::set< OUString >& aDicLangInUse,
std::vector< SvtLinguConfigDictionaryEntry >& aRes ) std::vector< SvtLinguConfigDictionaryEntry >& aRes )
{ {

View File

@@ -38,7 +38,7 @@
RTTI identity by comparing string addresses rather than string content). RTTI identity by comparing string addresses rather than string content).
*/ */
static void * load(void * address, char const * symbol) { static void * load(void const * address, char const * symbol) {
Dl_info dl_info; Dl_info dl_info;
char * slash; char * slash;
size_t len; size_t len;

View File

@@ -37,7 +37,7 @@ public:
void SAL_CALL registerTimer(salhelper::Timer* pTimer); void SAL_CALL registerTimer(salhelper::Timer* pTimer);
/// unregister timer /// unregister timer
void SAL_CALL unregisterTimer(salhelper::Timer* pTimer); void SAL_CALL unregisterTimer(salhelper::Timer const * pTimer);
/// lookup timer /// lookup timer
bool SAL_CALL lookupTimer(const salhelper::Timer* pTimer); bool SAL_CALL lookupTimer(const salhelper::Timer* pTimer);
@@ -292,7 +292,7 @@ void TimerManager::registerTimer(Timer* pTimer)
} }
} }
void TimerManager::unregisterTimer(Timer* pTimer) void TimerManager::unregisterTimer(Timer const * pTimer)
{ {
if (!pTimer) if (!pTimer)
return; return;

View File

@@ -503,6 +503,7 @@ void SfxDocTplService_Impl::readFolderList()
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
static_assert( SAL_N_ELEMENTS(TEMPLATE_SHORT_NAMES_ARY) == SAL_N_ELEMENTS(TEMPLATE_LONG_NAMES_ARY), "mismatch array lengths" );
const size_t nCount = std::min(SAL_N_ELEMENTS(TEMPLATE_SHORT_NAMES_ARY), SAL_N_ELEMENTS(TEMPLATE_LONG_NAMES_ARY)); const size_t nCount = std::min(SAL_N_ELEMENTS(TEMPLATE_SHORT_NAMES_ARY), SAL_N_ELEMENTS(TEMPLATE_LONG_NAMES_ARY));
for (size_t i = 0; i < nCount; ++i) for (size_t i = 0; i < nCount; ++i)
{ {

View File

@@ -353,7 +353,7 @@ struct hash
c ^= b; c -= rot(b,24); \ c ^= b; c -= rot(b,24); \
} }
static unsigned int hash_compute( struct hash* hash, const char* key, int length) static unsigned int hash_compute( struct hash const * hash, const char* key, int length)
{ {
unsigned int a; unsigned int a;
unsigned int b; unsigned int b;
@@ -509,7 +509,7 @@ unsigned int i;
} }
} }
static inline int compare_key(struct hash* hash, const char* a, const char* b, int len, int* cost) static inline int compare_key(struct hash const * hash, const char* a, const char* b, int len, int const * cost)
{ {
#ifdef HASH_STAT #ifdef HASH_STAT
*cost += 1; *cost += 1;

View File

@@ -179,7 +179,7 @@ void
* Generate a pragma import/include directive * Generate a pragma import/include directive
*/ */
void void
genimport(char *fname, int angled, char *iname, int import) genimport(char const *fname, int angled, char const *iname, int import)
{ {
static Token ta = {UNCLASS, 0, 0, NULL, 0}; static Token ta = {UNCLASS, 0, 0, NULL, 0};
static Tokenrow tr = {&ta, &ta, &ta + 1, 1}; static Tokenrow tr = {&ta, &ta, &ta + 1, 1};

View File

@@ -645,7 +645,7 @@ int
* if fd==-1 and str, then from the string. * if fd==-1 and str, then from the string.
*/ */
Source * Source *
setsource(char *name, int path, int fd, char *str, int wrap) setsource(char *name, int path, int fd, char const *str, int wrap)
{ {
Source *s = new(Source); Source *s = new(Source);
size_t len; size_t len;

View File

@@ -624,7 +624,7 @@ void
* corresponding index in the argname array. Return -1 if not found. * corresponding index in the argname array. Return -1 if not found.
*/ */
int int
lookuparg(Nlist * mac, Token * tp) lookuparg(Nlist * mac, Token const * tp)
{ {
Token *ap; Token *ap;

View File

@@ -83,7 +83,7 @@ mvl_add( MacroValidatorList * inout_pValidators,
void void
mvl_check( MacroValidatorList * inout_pValidators, mvl_check( MacroValidatorList * inout_pValidators,
Token * inout_pTokenToCheck) Token const * inout_pTokenToCheck)
{ {
MacroValidator * pV; /* Running pointer */ MacroValidator * pV; /* Running pointer */
MacroValidator * pCheckedOnes; /* Here new list is built. */ MacroValidator * pCheckedOnes; /* Here new list is built. */

View File

@@ -251,7 +251,7 @@ int
* Canonical whitespace is assured on each side. * Canonical whitespace is assured on each side.
*/ */
void void
insertrow(Tokenrow * dtr, int ntok, Tokenrow * str) insertrow(Tokenrow * dtr, int ntok, Tokenrow const * str)
{ {
int nrtok = (int)rowlen(str); int nrtok = (int)rowlen(str);
@@ -289,7 +289,7 @@ void
* Not strictly conforming. * Not strictly conforming.
*/ */
void void
movetokenrow(Tokenrow * dtr, Tokenrow * str) movetokenrow(Tokenrow * dtr, Tokenrow const * str)
{ {
size_t nby; size_t nby;
@@ -325,7 +325,7 @@ void
* the space for the contents. Return the destination. * the space for the contents. Return the destination.
*/ */
Tokenrow * Tokenrow *
copytokenrow(Tokenrow * dtr, Tokenrow * str) copytokenrow(Tokenrow * dtr, Tokenrow const * str)
{ {
int len = (int)rowlen(str); int len = (int)rowlen(str);
@@ -543,7 +543,7 @@ char *
* Null terminated. * Null terminated.
*/ */
uchar * uchar *
newstring(uchar * s, size_t l, size_t o) newstring(uchar const * s, size_t l, size_t o)
{ {
uchar *ns = (uchar *) domalloc(l + o + 1); uchar *ns = (uchar *) domalloc(l + o + 1);

View File

@@ -172,7 +172,7 @@ void mvl_add(
void mvl_check( void mvl_check(
MacroValidatorList * MacroValidatorList *
inout_pValidators, inout_pValidators,
Token * inout_pTokenToCheck); Token const * inout_pTokenToCheck);
void tokenrow_zeroTokenIdentifiers(Tokenrow* trp); void tokenrow_zeroTokenIdentifiers(Tokenrow* trp);
@@ -181,7 +181,7 @@ void fixlex(void);
void setup(int, char **); void setup(int, char **);
int gettokens(Tokenrow *, int); int gettokens(Tokenrow *, int);
int comparetokens(Tokenrow *, Tokenrow *); int comparetokens(Tokenrow *, Tokenrow *);
Source *setsource(char *, int, int, char *, int); Source *setsource(char *, int, int, char const *, int);
void unsetsource(void); void unsetsource(void);
void puttokens(Tokenrow *); void puttokens(Tokenrow *);
void process(Tokenrow *); void process(Tokenrow *);
@@ -203,25 +203,25 @@ int gatherargs(Tokenrow *, Tokenrow **, int *);
void substargs(Nlist *, Tokenrow *, Tokenrow **); void substargs(Nlist *, Tokenrow *, Tokenrow **);
void expandrow(Tokenrow *, char *); void expandrow(Tokenrow *, char *);
void maketokenrow(int, Tokenrow *); void maketokenrow(int, Tokenrow *);
Tokenrow *copytokenrow(Tokenrow *, Tokenrow *); Tokenrow *copytokenrow(Tokenrow *, Tokenrow const *);
Token *growtokenrow(Tokenrow *); Token *growtokenrow(Tokenrow *);
Tokenrow *normtokenrow(Tokenrow *); Tokenrow *normtokenrow(Tokenrow *);
void adjustrow(Tokenrow *, int); void adjustrow(Tokenrow *, int);
void movetokenrow(Tokenrow *, Tokenrow *); void movetokenrow(Tokenrow *, Tokenrow const *);
void insertrow(Tokenrow *, int, Tokenrow *); void insertrow(Tokenrow *, int, Tokenrow const *);
void peektokens(Tokenrow *, char *); void peektokens(Tokenrow *, char *);
void doconcat(Tokenrow *); void doconcat(Tokenrow *);
Tokenrow *stringify(Tokenrow *); Tokenrow *stringify(Tokenrow *);
int lookuparg(Nlist *, Token *); int lookuparg(Nlist *, Token const *);
long eval(Tokenrow *, int); long eval(Tokenrow *, int);
void genline(void); void genline(void);
void genimport(char *, int, char *, int); void genimport(char const *, int, char const *, int);
void genwrap(int); void genwrap(int);
void setempty(Tokenrow *); void setempty(Tokenrow *);
void makespace(Tokenrow *, Token *); void makespace(Tokenrow *, Token *);
char *outnum(char *, int); char *outnum(char *, int);
int digit(int); int digit(int);
uchar *newstring(uchar *, size_t, size_t); uchar *newstring(uchar const *, size_t, size_t);
#define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp) #define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp)

View File

@@ -194,7 +194,7 @@ my_eval_variable (IfParser *ip, const char *var, size_t len)
} }
int cppsetup(char *line) int cppsetup(char const *line)
{ {
IfParser ip; IfParser ip;
int val = 0; int val = 0;

View File

@@ -151,18 +151,18 @@ char *malloc();
char *realloc(); char *realloc();
#endif #endif
char *copy(char *); char *copy(char const *);
char *base_name(char *); char *base_name(char *);
char *get_line(struct filepointer *); char *get_line(struct filepointer *);
char *isdefined(char *); char *isdefined(char *);
struct filepointer *getfile(char *); struct filepointer *getfile(char *);
struct inclist *newinclude(char *newfile, struct inclist *newinclude(char const *newfile,
char *incstring); char const *incstring);
struct inclist *inc_path(char *, char *, boolean, struct inclist *inc_path(char *, char *, boolean,
struct IncludesCollection *); struct IncludesCollection *);
void define( char *def, struct symhash **symbols ); void define( char *def, struct symhash **symbols );
void hash_define(char *name, char * val, struct symhash **symbols); void hash_define(char *name, char const * val, struct symhash **symbols);
struct symhash *hash_copy( struct symhash *symbols ); struct symhash *hash_copy( struct symhash *symbols );
void hash_free( struct symhash *symbols ); void hash_free( struct symhash *symbols );
void freefile( struct filepointer * fp ); void freefile( struct filepointer * fp );
@@ -171,19 +171,19 @@ int find_includes(struct filepointer *filep, struct inclist *file,
struct IncludesCollection* incCollection, struct symhash *symbols); struct IncludesCollection* incCollection, struct symhash *symbols);
void included_by(struct inclist *ip, void included_by(struct inclist *ip,
struct inclist * newfile); struct inclist * newfile);
int cppsetup(char *line); int cppsetup(char const *line);
void add_include(struct filepointer *filep, struct inclist *file, void add_include(struct filepointer *filep, struct inclist *file,
struct inclist *file_red, char *include, boolean dot, boolean failOK, struct inclist *file_red, char *include, boolean dot, boolean failOK,
struct IncludesCollection* incCollection, struct symhash *symbols); struct IncludesCollection* incCollection, struct symhash *symbols);
int match(char *str, char **list); int match(char const *str, char **list);
void recursive_pr_include(struct inclist *head, char *file, void recursive_pr_include(struct inclist *head, char *file,
char *base); char *base);
void recursive_pr_dummy(struct inclist *head, char *file); void recursive_pr_dummy(struct inclist *head, char *file);
void inc_clean(void); void inc_clean(void);
void fatalerr(char *, ...); void fatalerr(char *, ...);
void warning(char *, ...); void warning(char const *, ...);
void warning1(char *, ...); void warning1(char const *, ...);
void convert_slashes(char *); void convert_slashes(char *);
char *append_slash(char *); char *append_slash(char *);

View File

@@ -32,8 +32,8 @@ in this Software without prior written authorization from the X Consortium.
#include <string.h> #include <string.h>
void remove_dotdot( char * ); void remove_dotdot( char * );
int isdot( char * ); int isdot( char const * );
int isdotdot( char * ); int isdotdot( char const * );
int issymbolic(char * dir, char * component); int issymbolic(char * dir, char * component);
int exists_path(struct IncludesCollection*, char*); int exists_path(struct IncludesCollection*, char*);
@@ -223,14 +223,14 @@ void remove_dotdot(char *path)
strcpy(path, newpath); strcpy(path, newpath);
} }
int isdot(char *p) int isdot(char const *p)
{ {
if(p && p[0] == '.' && p[1] == '\0') if(p && p[0] == '.' && p[1] == '\0')
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
int isdotdot(char *p) int isdotdot(char const *p)
{ {
if(p && p[0] == '.' && p[1] == '.' && p[2] == '\0') if(p && p[0] == '.' && p[1] == '.' && p[2] == '\0')
return TRUE; return TRUE;
@@ -263,7 +263,7 @@ int issymbolic(char *dir, char *component)
/* /*
* Add an include file to the list of those included by 'file'. * Add an include file to the list of those included by 'file'.
*/ */
struct inclist *newinclude(char *newfile, char *incstring) struct inclist *newinclude(char const *newfile, char const *incstring)
{ {
struct inclist *ip; struct inclist *ip;

View File

@@ -525,7 +525,7 @@ void freefile(struct filepointer *fp)
free(fp); free(fp);
} }
char *copy(char *str) char *copy(char const *str)
{ {
char *p = (char *)malloc(strlen(str) + 1); char *p = (char *)malloc(strlen(str) + 1);
@@ -533,7 +533,7 @@ char *copy(char *str)
return p; return p;
} }
int match(char *str, char **list) int match(char const *str, char **list)
{ {
int i; int i;
@@ -670,7 +670,7 @@ void fatalerr(char *msg, ...)
exit (1); exit (1);
} }
void warning(char *msg, ...) void warning(char const *msg, ...)
{ {
#ifdef DEBUG_MKDEPEND #ifdef DEBUG_MKDEPEND
va_list args; va_list args;
@@ -683,7 +683,7 @@ void warning(char *msg, ...)
#endif /* DEBUG_MKDEPEND */ #endif /* DEBUG_MKDEPEND */
} }
void warning1(char *msg, ...) void warning1(char const *msg, ...)
{ {
#ifdef DEBUG_MKDEPEND #ifdef DEBUG_MKDEPEND
va_list args; va_list args;

View File

@@ -36,7 +36,7 @@ int gobble( struct filepointer *filep, struct inclist *file,
struct inclist *file_red, struct symhash *symbols ); struct inclist *file_red, struct symhash *symbols );
int deftype ( char *line, struct inclist *file, int deftype ( char *line, struct inclist *file,
int parse_it, struct symhash *symbols); int parse_it, struct symhash *symbols);
int zero_value(char *exp, struct symhash *symbols); int zero_value(char const *exp, struct symhash *symbols);
extern struct symhash *maininclist; extern struct symhash *maininclist;
@@ -370,7 +370,7 @@ char * isdefined( char *symbol )
/* /*
* Return type based on if the #if expression evaluates to 0 * Return type based on if the #if expression evaluates to 0
*/ */
int zero_value(char *exp, struct symhash *symbols) int zero_value(char const *exp, struct symhash *symbols)
{ {
global_symbols = symbols; /* HACK! see above */ global_symbols = symbols; /* HACK! see above */
if (cppsetup(exp)) if (cppsetup(exp))
@@ -466,7 +466,7 @@ void hash_free( struct symhash *symbols )
free( symbols->s_pairs ); free( symbols->s_pairs );
} }
void hash_define( char *name, char *val, struct symhash **symbols ) void hash_define( char *name, char const *val, struct symhash **symbols )
{ {
int hashval; int hashval;
struct pair *it; struct pair *it;

View File

@@ -73,7 +73,7 @@ void add_include(struct filepointer *filep, struct inclist *file, struct inclist
} }
} }
void pr_dummy(struct inclist *ip) void pr_dummy(struct inclist const *ip)
{ {
fwrite(ip->i_file, strlen(ip->i_file), 1, stdout); fwrite(ip->i_file, strlen(ip->i_file), 1, stdout);
fwrite(" :\n\n", 4, 1, stdout); fwrite(" :\n\n", 4, 1, stdout);