mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +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:
@ -35,34 +35,34 @@ Datum gbt_cash_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_cashgt(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) > *((Cash *) b));
|
||||
return (*((const Cash *) a) > *((const Cash *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_cashge(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) >= *((Cash *) b));
|
||||
return (*((const Cash *) a) >= *((const Cash *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_casheq(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) == *((Cash *) b));
|
||||
return (*((const Cash *) a) == *((const Cash *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_cashle(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) <= *((Cash *) b));
|
||||
return (*((const Cash *) a) <= *((const Cash *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_cashlt(const void *a, const void *b)
|
||||
{
|
||||
return (*((Cash *) a) < *((Cash *) b));
|
||||
return (*((const Cash *) a) < *((const Cash *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_cashkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
cashKEY *ia = (cashKEY *) (((Nsrt *) a)->t);
|
||||
cashKEY *ib = (cashKEY *) (((Nsrt *) b)->t);
|
||||
cashKEY *ia = (cashKEY *) (((const Nsrt *) a)->t);
|
||||
cashKEY *ib = (cashKEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ static bool
|
||||
gbt_dategt(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_gt, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_gt, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ static bool
|
||||
gbt_datege(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_ge, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_ge, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ static bool
|
||||
gbt_dateeq(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_eq, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_eq, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ static bool
|
||||
gbt_datele(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_le, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_le, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ static bool
|
||||
gbt_datelt(const void *a, const void *b)
|
||||
{
|
||||
return DatumGetBool(
|
||||
DirectFunctionCall2(date_lt, DateADTGetDatum(*((DateADT *) a)), DateADTGetDatum(*((DateADT *) b)))
|
||||
DirectFunctionCall2(date_lt, DateADTGetDatum(*((const DateADT *) a)), DateADTGetDatum(*((const DateADT *) b)))
|
||||
);
|
||||
}
|
||||
|
||||
@ -77,8 +77,8 @@ gbt_datelt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_datekey_cmp(const void *a, const void *b)
|
||||
{
|
||||
dateKEY *ia = (dateKEY *) (((Nsrt *) a)->t);
|
||||
dateKEY *ib = (dateKEY *) (((Nsrt *) b)->t);
|
||||
dateKEY *ia = (dateKEY *) (((const Nsrt *) a)->t);
|
||||
dateKEY *ib = (dateKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(date_cmp, DateADTGetDatum(ia->lower), DateADTGetDatum(ib->lower)));
|
||||
|
@ -34,34 +34,34 @@ Datum gbt_float4_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_float4gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) > *((float4 *) b));
|
||||
return (*((const float4 *) a) > *((const float4 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float4ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) >= *((float4 *) b));
|
||||
return (*((const float4 *) a) >= *((const float4 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float4eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) == *((float4 *) b));
|
||||
return (*((const float4 *) a) == *((const float4 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float4le(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) <= *((float4 *) b));
|
||||
return (*((const float4 *) a) <= *((const float4 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float4lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((float4 *) a) < *((float4 *) b));
|
||||
return (*((const float4 *) a) < *((const float4 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_float4key_cmp(const void *a, const void *b)
|
||||
{
|
||||
float4KEY *ia = (float4KEY *) (((Nsrt *) a)->t);
|
||||
float4KEY *ib = (float4KEY *) (((Nsrt *) b)->t);
|
||||
float4KEY *ia = (float4KEY *) (((const Nsrt *) a)->t);
|
||||
float4KEY *ib = (float4KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -35,34 +35,34 @@ Datum gbt_float8_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_float8gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) > *((float8 *) b));
|
||||
return (*((const float8 *) a) > *((const float8 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float8ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) >= *((float8 *) b));
|
||||
return (*((const float8 *) a) >= *((const float8 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float8eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) == *((float8 *) b));
|
||||
return (*((const float8 *) a) == *((const float8 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float8le(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) <= *((float8 *) b));
|
||||
return (*((const float8 *) a) <= *((const float8 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_float8lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((float8 *) a) < *((float8 *) b));
|
||||
return (*((const float8 *) a) < *((const float8 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_float8key_cmp(const void *a, const void *b)
|
||||
{
|
||||
float8KEY *ia = (float8KEY *) (((Nsrt *) a)->t);
|
||||
float8KEY *ib = (float8KEY *) (((Nsrt *) b)->t);
|
||||
float8KEY *ia = (float8KEY *) (((const Nsrt *) a)->t);
|
||||
float8KEY *ib = (float8KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -36,34 +36,34 @@ Datum gbt_inet_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_inetgt(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) > *((double *) b));
|
||||
return (*((const double *) a) > *((const double *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_inetge(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) >= *((double *) b));
|
||||
return (*((const double *) a) >= *((const double *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_ineteq(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) == *((double *) b));
|
||||
return (*((const double *) a) == *((const double *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_inetle(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) <= *((double *) b));
|
||||
return (*((const double *) a) <= *((const double *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_inetlt(const void *a, const void *b)
|
||||
{
|
||||
return (*((double *) a) < *((double *) b));
|
||||
return (*((const double *) a) < *((const double *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_inetkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
inetKEY *ia = (inetKEY *) (((Nsrt *) a)->t);
|
||||
inetKEY *ib = (inetKEY *) (((Nsrt *) b)->t);
|
||||
inetKEY *ia = (inetKEY *) (((const Nsrt *) a)->t);
|
||||
inetKEY *ib = (inetKEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -34,34 +34,34 @@ Datum gbt_int2_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_int2gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) > *((int16 *) b));
|
||||
return (*((const int16 *) a) > *((const int16 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int2ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) >= *((int16 *) b));
|
||||
return (*((const int16 *) a) >= *((const int16 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int2eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) == *((int16 *) b));
|
||||
return (*((const int16 *) a) == *((const int16 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int2le(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) <= *((int16 *) b));
|
||||
return (*((const int16 *) a) <= *((const int16 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int2lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int16 *) a) < *((int16 *) b));
|
||||
return (*((const int16 *) a) < *((const int16 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_int2key_cmp(const void *a, const void *b)
|
||||
{
|
||||
int16KEY *ia = (int16KEY *) (((Nsrt *) a)->t);
|
||||
int16KEY *ib = (int16KEY *) (((Nsrt *) b)->t);
|
||||
int16KEY *ia = (int16KEY *) (((const Nsrt *) a)->t);
|
||||
int16KEY *ib = (int16KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -35,34 +35,34 @@ Datum gbt_int4_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_int4gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) > *((int32 *) b));
|
||||
return (*((const int32 *) a) > *((const int32 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int4ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) >= *((int32 *) b));
|
||||
return (*((const int32 *) a) >= *((const int32 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int4eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) == *((int32 *) b));
|
||||
return (*((const int32 *) a) == *((const int32 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int4le(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) <= *((int32 *) b));
|
||||
return (*((const int32 *) a) <= *((const int32 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int4lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int32 *) a) < *((int32 *) b));
|
||||
return (*((const int32 *) a) < *((const int32 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_int4key_cmp(const void *a, const void *b)
|
||||
{
|
||||
int32KEY *ia = (int32KEY *) (((Nsrt *) a)->t);
|
||||
int32KEY *ib = (int32KEY *) (((Nsrt *) b)->t);
|
||||
int32KEY *ia = (int32KEY *) (((const Nsrt *) a)->t);
|
||||
int32KEY *ib = (int32KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -35,34 +35,34 @@ Datum gbt_int8_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_int8gt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) > *((int64 *) b));
|
||||
return (*((const int64 *) a) > *((const int64 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int8ge(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) >= *((int64 *) b));
|
||||
return (*((const int64 *) a) >= *((const int64 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int8eq(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) == *((int64 *) b));
|
||||
return (*((const int64 *) a) == *((const int64 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int8le(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) <= *((int64 *) b));
|
||||
return (*((const int64 *) a) <= *((const int64 *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_int8lt(const void *a, const void *b)
|
||||
{
|
||||
return (*((int64 *) a) < *((int64 *) b));
|
||||
return (*((const int64 *) a) < *((const int64 *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_int8key_cmp(const void *a, const void *b)
|
||||
{
|
||||
int64KEY *ia = (int64KEY *) (((Nsrt *) a)->t);
|
||||
int64KEY *ib = (int64KEY *) (((Nsrt *) b)->t);
|
||||
int64KEY *ia = (int64KEY *) (((const Nsrt *) a)->t);
|
||||
int64KEY *ib = (int64KEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -69,8 +69,8 @@ gbt_intvlt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_intvkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
intvKEY *ia = (intvKEY *) (((Nsrt *) a)->t);
|
||||
intvKEY *ib = (intvKEY *) (((Nsrt *) b)->t);
|
||||
intvKEY *ia = (intvKEY *) (((const Nsrt *) a)->t);
|
||||
intvKEY *ib = (intvKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(interval_cmp, IntervalPGetDatum(&ia->lower), IntervalPGetDatum(&ib->lower)));
|
||||
@ -90,7 +90,7 @@ intr2num(const Interval *i)
|
||||
static float8
|
||||
gbt_intv_dist(const void *a, const void *b)
|
||||
{
|
||||
return (float8) Abs(intr2num((Interval *) a) - intr2num((Interval *) b));
|
||||
return (float8) Abs(intr2num((const Interval *) a) - intr2num((const Interval *) b));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -65,8 +65,8 @@ gbt_macadlt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_macadkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
macKEY *ia = (macKEY *) (((Nsrt *) a)->t);
|
||||
macKEY *ib = (macKEY *) (((Nsrt *) b)->t);
|
||||
macKEY *ia = (macKEY *) (((const Nsrt *) a)->t);
|
||||
macKEY *ib = (macKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(macaddr_cmp, MacaddrPGetDatum(&ia->lower), MacaddrPGetDatum(&ib->lower)));
|
||||
|
@ -35,34 +35,34 @@ Datum gbt_oid_same(PG_FUNCTION_ARGS);
|
||||
static bool
|
||||
gbt_oidgt(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) > *((Oid *) b));
|
||||
return (*((const Oid *) a) > *((const Oid *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_oidge(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) >= *((Oid *) b));
|
||||
return (*((const Oid *) a) >= *((const Oid *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_oideq(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) == *((Oid *) b));
|
||||
return (*((const Oid *) a) == *((const Oid *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_oidle(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) <= *((Oid *) b));
|
||||
return (*((const Oid *) a) <= *((const Oid *) b));
|
||||
}
|
||||
static bool
|
||||
gbt_oidlt(const void *a, const void *b)
|
||||
{
|
||||
return (*((Oid *) a) < *((Oid *) b));
|
||||
return (*((const Oid *) a) < *((const Oid *) b));
|
||||
}
|
||||
|
||||
static int
|
||||
gbt_oidkey_cmp(const void *a, const void *b)
|
||||
{
|
||||
oidKEY *ia = (oidKEY *) (((Nsrt *) a)->t);
|
||||
oidKEY *ib = (oidKEY *) (((Nsrt *) b)->t);
|
||||
oidKEY *ia = (oidKEY *) (((const Nsrt *) a)->t);
|
||||
oidKEY *ib = (oidKEY *) (((const Nsrt *) b)->t);
|
||||
|
||||
if (ia->lower == ib->lower)
|
||||
{
|
||||
|
@ -105,8 +105,8 @@ gbt_timelt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_timekey_cmp(const void *a, const void *b)
|
||||
{
|
||||
timeKEY *ia = (timeKEY *) (((Nsrt *) a)->t);
|
||||
timeKEY *ib = (timeKEY *) (((Nsrt *) b)->t);
|
||||
timeKEY *ia = (timeKEY *) (((const Nsrt *) a)->t);
|
||||
timeKEY *ib = (timeKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(time_cmp, TimeADTGetDatumFast(ia->lower), TimeADTGetDatumFast(ib->lower)));
|
||||
|
@ -106,8 +106,8 @@ gbt_tslt(const void *a, const void *b)
|
||||
static int
|
||||
gbt_tskey_cmp(const void *a, const void *b)
|
||||
{
|
||||
tsKEY *ia = (tsKEY *) (((Nsrt *) a)->t);
|
||||
tsKEY *ib = (tsKEY *) (((Nsrt *) b)->t);
|
||||
tsKEY *ia = (tsKEY *) (((const Nsrt *) a)->t);
|
||||
tsKEY *ib = (tsKEY *) (((const Nsrt *) b)->t);
|
||||
int res;
|
||||
|
||||
res = DatumGetInt32(DirectFunctionCall2(timestamp_cmp, TimestampGetDatumFast(ia->lower), TimestampGetDatumFast(ib->lower)));
|
||||
|
@ -69,7 +69,7 @@ find_word(char *in, char **end)
|
||||
static int
|
||||
compare_syn(const void *a, const void *b)
|
||||
{
|
||||
return strcmp(((Syn *) a)->key, ((Syn *) b)->key);
|
||||
return strcmp(((const Syn *) a)->key, ((const Syn *) b)->key);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -322,7 +322,7 @@ typedef struct
|
||||
static int
|
||||
comparecost(const void *a, const void *b)
|
||||
{
|
||||
return ((SPLITCOST *) a)->cost - ((SPLITCOST *) b)->cost;
|
||||
return ((const SPLITCOST *) a)->cost - ((const SPLITCOST *) b)->cost;
|
||||
}
|
||||
|
||||
|
||||
|
@ -276,24 +276,25 @@ parse_hstore(HSParser *state)
|
||||
static int
|
||||
comparePairs(const void *a, const void *b)
|
||||
{
|
||||
if (((Pairs *) a)->keylen == ((Pairs *) b)->keylen)
|
||||
const Pairs *pa = a;
|
||||
const Pairs *pb = b;
|
||||
|
||||
if (pa->keylen == pb->keylen)
|
||||
{
|
||||
int res = memcmp(((Pairs *) a)->key,
|
||||
((Pairs *) b)->key,
|
||||
((Pairs *) a)->keylen);
|
||||
int res = memcmp(pa->key, pb->key, pa->keylen);
|
||||
|
||||
if (res)
|
||||
return res;
|
||||
|
||||
/* guarantee that needfree will be later */
|
||||
if (((Pairs *) b)->needfree == ((Pairs *) a)->needfree)
|
||||
if (pb->needfree == pa->needfree)
|
||||
return 0;
|
||||
else if (((Pairs *) a)->needfree)
|
||||
else if (pa->needfree)
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
return (((Pairs *) a)->keylen > ((Pairs *) b)->keylen) ? 1 : -1;
|
||||
return (pa->keylen > pb->keylen) ? 1 : -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -357,10 +357,10 @@ typedef struct
|
||||
static int
|
||||
comparecost(const void *a, const void *b)
|
||||
{
|
||||
if (((SPLITCOST *) a)->cost == ((SPLITCOST *) b)->cost)
|
||||
if (((const SPLITCOST *) a)->cost == ((const SPLITCOST *) b)->cost)
|
||||
return 0;
|
||||
else
|
||||
return (((SPLITCOST *) a)->cost > ((SPLITCOST *) b)->cost) ? 1 : -1;
|
||||
return (((const SPLITCOST *) a)->cost > ((const SPLITCOST *) b)->cost) ? 1 : -1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -388,15 +388,15 @@ int_to_intset(int32 n)
|
||||
int
|
||||
compASC(const void *a, const void *b)
|
||||
{
|
||||
if (*(int4 *) a == *(int4 *) b)
|
||||
if (*(const int4 *) a == *(const int4 *) b)
|
||||
return 0;
|
||||
return (*(int4 *) a > *(int4 *) b) ? 1 : -1;
|
||||
return (*(const int4 *) a > *(const int4 *) b) ? 1 : -1;
|
||||
}
|
||||
|
||||
int
|
||||
compDESC(const void *a, const void *b)
|
||||
{
|
||||
if (*(int4 *) a == *(int4 *) b)
|
||||
if (*(const int4 *) a == *(const int4 *) b)
|
||||
return 0;
|
||||
return (*(int4 *) a < *(int4 *) b) ? 1 : -1;
|
||||
return (*(const int4 *) a < *(const int4 *) b) ? 1 : -1;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ typedef struct
|
||||
static int
|
||||
comparecost(const void *a, const void *b)
|
||||
{
|
||||
return ((SPLITCOST *) a)->cost - ((SPLITCOST *) b)->cost;
|
||||
return ((const SPLITCOST *) a)->cost - ((const SPLITCOST *) b)->cost;
|
||||
}
|
||||
|
||||
Datum
|
||||
|
@ -973,8 +973,8 @@ entry_alloc(pgssHashKey *key)
|
||||
static int
|
||||
entry_cmp(const void *lhs, const void *rhs)
|
||||
{
|
||||
double l_usage = (*(const pgssEntry **) lhs)->counters.usage;
|
||||
double r_usage = (*(const pgssEntry **) rhs)->counters.usage;
|
||||
double l_usage = (*(pgssEntry * const *) lhs)->counters.usage;
|
||||
double r_usage = (*(pgssEntry * const *) rhs)->counters.usage;
|
||||
|
||||
if (l_usage < r_usage)
|
||||
return -1;
|
||||
|
@ -33,7 +33,7 @@
|
||||
typedef char trgm[3];
|
||||
|
||||
#define CMPCHAR(a,b) ( ((a)==(b)) ? 0 : ( ((a)<(b)) ? -1 : 1 ) )
|
||||
#define CMPPCHAR(a,b,i) CMPCHAR( *(((char*)(a))+i), *(((char*)(b))+i) )
|
||||
#define CMPPCHAR(a,b,i) CMPCHAR( *(((const char*)(a))+i), *(((const char*)(b))+i) )
|
||||
#define CMPTRGM(a,b) ( CMPPCHAR(a,b,0) ? CMPPCHAR(a,b,0) : ( CMPPCHAR(a,b,1) ? CMPPCHAR(a,b,1) : CMPPCHAR(a,b,2) ) )
|
||||
|
||||
#define CPTRGM(a,b) do { \
|
||||
|
@ -594,10 +594,10 @@ typedef struct
|
||||
static int
|
||||
comparecost(const void *a, const void *b)
|
||||
{
|
||||
if (((SPLITCOST *) a)->cost == ((SPLITCOST *) b)->cost)
|
||||
if (((const SPLITCOST *) a)->cost == ((const SPLITCOST *) b)->cost)
|
||||
return 0;
|
||||
else
|
||||
return (((SPLITCOST *) a)->cost > ((SPLITCOST *) b)->cost) ? 1 : -1;
|
||||
return (((const SPLITCOST *) a)->cost > ((const SPLITCOST *) b)->cost) ? 1 : -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -371,7 +371,7 @@ BF_decode(BF_word *dst, const char *src, int size)
|
||||
{
|
||||
unsigned char *dptr = (unsigned char *) dst;
|
||||
unsigned char *end = dptr + size;
|
||||
unsigned char *sptr = (unsigned char *) src;
|
||||
const unsigned char *sptr = (const unsigned char *) src;
|
||||
unsigned int tmp,
|
||||
c1,
|
||||
c2,
|
||||
@ -401,8 +401,8 @@ BF_decode(BF_word *dst, const char *src, int size)
|
||||
static void
|
||||
BF_encode(char *dst, const BF_word *src, int size)
|
||||
{
|
||||
unsigned char *sptr = (unsigned char *) src;
|
||||
unsigned char *end = sptr + size;
|
||||
const unsigned char *sptr = (const unsigned char *) src;
|
||||
const unsigned char *end = sptr + size;
|
||||
unsigned char *dptr = (unsigned char *) dst;
|
||||
unsigned int c1,
|
||||
c2;
|
||||
|
@ -407,8 +407,8 @@ des_setkey(const char *key)
|
||||
if (!des_initialised)
|
||||
des_init();
|
||||
|
||||
rawkey0 = ntohl(*(uint32 *) key);
|
||||
rawkey1 = ntohl(*(uint32 *) (key + 4));
|
||||
rawkey0 = ntohl(*(const uint32 *) key);
|
||||
rawkey1 = ntohl(*(const uint32 *) (key + 4));
|
||||
|
||||
if ((rawkey0 | rawkey1)
|
||||
&& rawkey0 == old_rawkey0
|
||||
|
@ -123,8 +123,8 @@ static unsigned char BF_itoa64[64 + 1] =
|
||||
static void
|
||||
BF_encode(char *dst, const BF_word *src, int size)
|
||||
{
|
||||
unsigned char *sptr = (unsigned char *) src;
|
||||
unsigned char *end = sptr + size;
|
||||
const unsigned char *sptr = (const unsigned char *) src;
|
||||
const unsigned char *end = sptr + size;
|
||||
unsigned char *dptr = (unsigned char *) dst;
|
||||
unsigned int c1,
|
||||
c2;
|
||||
@ -180,7 +180,7 @@ _crypt_gensalt_blowfish_rn(unsigned long count,
|
||||
output[5] = '0' + count % 10;
|
||||
output[6] = '$';
|
||||
|
||||
BF_encode(&output[7], (BF_word *) input, 16);
|
||||
BF_encode(&output[7], (const BF_word *) input, 16);
|
||||
output[7 + 22] = '\0';
|
||||
|
||||
return output;
|
||||
|
@ -72,18 +72,18 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
|
||||
err = px_find_digest("md5", &ctx1);
|
||||
|
||||
/* The password first, since that is what is most unknown */
|
||||
px_md_update(ctx, (uint8 *) pw, strlen(pw));
|
||||
px_md_update(ctx, (const uint8 *) pw, strlen(pw));
|
||||
|
||||
/* Then our magic string */
|
||||
px_md_update(ctx, (uint8 *) magic, strlen(magic));
|
||||
|
||||
/* Then the raw salt */
|
||||
px_md_update(ctx, (uint8 *) sp, sl);
|
||||
px_md_update(ctx, (const uint8 *) sp, sl);
|
||||
|
||||
/* Then just as many characters of the MD5(pw,salt,pw) */
|
||||
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
|
||||
px_md_update(ctx1, (uint8 *) sp, sl);
|
||||
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
|
||||
px_md_update(ctx1, (const uint8 *) pw, strlen(pw));
|
||||
px_md_update(ctx1, (const uint8 *) sp, sl);
|
||||
px_md_update(ctx1, (const uint8 *) pw, strlen(pw));
|
||||
px_md_finish(ctx1, final);
|
||||
for (pl = strlen(pw); pl > 0; pl -= MD5_SIZE)
|
||||
px_md_update(ctx, final, pl > MD5_SIZE ? MD5_SIZE : pl);
|
||||
@ -96,7 +96,7 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
|
||||
if (i & 1)
|
||||
px_md_update(ctx, final, 1);
|
||||
else
|
||||
px_md_update(ctx, (uint8 *) pw, 1);
|
||||
px_md_update(ctx, (const uint8 *) pw, 1);
|
||||
|
||||
/* Now make the output string */
|
||||
strcpy(passwd, magic);
|
||||
@ -114,20 +114,20 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
|
||||
{
|
||||
px_md_reset(ctx1);
|
||||
if (i & 1)
|
||||
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
|
||||
px_md_update(ctx1, (const uint8 *) pw, strlen(pw));
|
||||
else
|
||||
px_md_update(ctx1, final, MD5_SIZE);
|
||||
|
||||
if (i % 3)
|
||||
px_md_update(ctx1, (uint8 *) sp, sl);
|
||||
px_md_update(ctx1, (const uint8 *) sp, sl);
|
||||
|
||||
if (i % 7)
|
||||
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
|
||||
px_md_update(ctx1, (const uint8 *) pw, strlen(pw));
|
||||
|
||||
if (i & 1)
|
||||
px_md_update(ctx1, final, MD5_SIZE);
|
||||
else
|
||||
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
|
||||
px_md_update(ctx1, (const uint8 *) pw, strlen(pw));
|
||||
px_md_finish(ctx1, final);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user