1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +03:00

Remove many -Wcast-qual warnings

This addresses only those cases that are easy to fix by adding or
moving a const qualifier or removing an unnecessary cast.  There are
many more complicated cases remaining.
This commit is contained in:
Peter Eisentraut
2011-09-11 21:54:32 +03:00
parent 02bca4f351
commit 1b81c2fe6e
55 changed files with 219 additions and 218 deletions

View File

@@ -83,7 +83,7 @@ findwrd(char *in, char **end, uint16 *flags)
static int
compareSyn(const void *a, const void *b)
{
return strcmp(((Syn *) a)->in, ((Syn *) b)->in);
return strcmp(((const Syn *) a)->in, ((const Syn *) b)->in);
}

View File

@@ -348,7 +348,7 @@ cmpLexemeInfo(LexemeInfo *a, LexemeInfo *b)
}
static int
cmpLexeme(TheLexeme *a, TheLexeme *b)
cmpLexeme(const TheLexeme *a, const TheLexeme *b)
{
if (a->lexeme == NULL)
{
@@ -366,14 +366,14 @@ cmpLexeme(TheLexeme *a, TheLexeme *b)
static int
cmpLexemeQ(const void *a, const void *b)
{
return cmpLexeme((TheLexeme *) a, (TheLexeme *) b);
return cmpLexeme((const TheLexeme *) a, (const TheLexeme *) b);
}
static int
cmpTheLexeme(const void *a, const void *b)
{
TheLexeme *la = (TheLexeme *) a;
TheLexeme *lb = (TheLexeme *) b;
const TheLexeme *la = (const TheLexeme *) a;
const TheLexeme *lb = (const TheLexeme *) b;
int res;
if ((res = cmpLexeme(la, lb)) != 0)

View File

@@ -140,7 +140,7 @@ lowerstr_ctx(IspellDict *Conf, const char *src)
#define MAXNORMLEN 256
#define STRNCMP(s,p) strncmp( (s), (p), strlen(p) )
#define GETWCHAR(W,L,N,T) ( ((uint8*)(W))[ ((T)==FF_PREFIX) ? (N) : ( (L) - 1 - (N) ) ] )
#define GETWCHAR(W,L,N,T) ( ((const uint8*)(W))[ ((T)==FF_PREFIX) ? (N) : ( (L) - 1 - (N) ) ] )
#define GETCHAR(A,N,T) GETWCHAR( (A)->repl, (A)->replen, N, T )
static char *VoidString = "";
@@ -148,12 +148,12 @@ static char *VoidString = "";
static int
cmpspell(const void *s1, const void *s2)
{
return (strcmp((*(const SPELL **) s1)->word, (*(const SPELL **) s2)->word));
return (strcmp((*(SPELL * const *) s1)->word, (*(SPELL * const *) s2)->word));
}
static int
cmpspellaffix(const void *s1, const void *s2)
{
return (strncmp((*(const SPELL **) s1)->p.flag, (*(const SPELL **) s2)->p.flag, MAXFLAGLEN));
return (strncmp((*(SPELL * const *) s1)->p.flag, (*(SPELL * const *) s2)->p.flag, MAXFLAGLEN));
}
static char *
@@ -332,7 +332,7 @@ FindWord(IspellDict *Conf, const char *word, int affixflag, int flag)
SPNodeData *StopLow,
*StopHigh,
*StopMiddle;
uint8 *ptr = (uint8 *) word;
const uint8 *ptr = (const uint8 *) word;
flag &= FF_DICTFLAGMASK;

View File

@@ -33,16 +33,16 @@ compareWORD(const void *a, const void *b)
int res;
res = tsCompareString(
((ParsedWord *) a)->word, ((ParsedWord *) a)->len,
((ParsedWord *) b)->word, ((ParsedWord *) b)->len,
((const ParsedWord *) a)->word, ((const ParsedWord *) a)->len,
((const ParsedWord *) b)->word, ((const ParsedWord *) b)->len,
false);
if (res == 0)
{
if (((ParsedWord *) a)->pos.pos == ((ParsedWord *) b)->pos.pos)
if (((const ParsedWord *) a)->pos.pos == ((const ParsedWord *) b)->pos.pos)
return 0;
res = (((ParsedWord *) a)->pos.pos > ((ParsedWord *) b)->pos.pos) ? 1 : -1;
res = (((const ParsedWord *) a)->pos.pos > ((const ParsedWord *) b)->pos.pos) ? 1 : -1;
}
return res;

View File

@@ -62,7 +62,7 @@ get_tsearch_config_filename(const char *basename,
static int
comparestr(const void *a, const void *b)
{
return strcmp(*(char **) a, *(char **) b);
return strcmp(*(char * const *) a, *(char * const *) b);
}
/*