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)
{
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)))
);
}
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)))
);
}
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)))
);
}
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)))
);
}
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)))
);
}
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)));
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)));
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));
}
/*
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)));
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)
{
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)));
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)));
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
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;
}
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;
}
/*
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;
}
/*
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;
}
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
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;
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 { \
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;
}
{
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,
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;
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
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;
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;
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);
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);
{
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);
}
static int
compare_rows(const void *a, const void *b)
{
- HeapTuple ha = *(HeapTuple *) a;
- HeapTuple hb = *(HeapTuple *) b;
+ HeapTuple ha = *(const HeapTuple *) a;
+ HeapTuple hb = *(const HeapTuple *) b;
BlockNumber ba = ItemPointerGetBlockNumber(&ha->t_self);
OffsetNumber oa = ItemPointerGetOffsetNumber(&ha->t_self);
BlockNumber bb = ItemPointerGetBlockNumber(&hb->t_self);
static int
compare_scalars(const void *a, const void *b, void *arg)
{
- Datum da = ((ScalarItem *) a)->value;
- int ta = ((ScalarItem *) a)->tupno;
- Datum db = ((ScalarItem *) b)->value;
- int tb = ((ScalarItem *) b)->tupno;
+ Datum da = ((const ScalarItem *) a)->value;
+ int ta = ((const ScalarItem *) a)->tupno;
+ Datum db = ((const ScalarItem *) b)->value;
+ int tb = ((const ScalarItem *) b)->tupno;
CompareScalarsContext *cxt = (CompareScalarsContext *) arg;
int32 compare;
static int
compare_mcvs(const void *a, const void *b)
{
- int da = ((ScalarMCVItem *) a)->first;
- int db = ((ScalarMCVItem *) b)->first;
+ int da = ((const ScalarMCVItem *) a)->first;
+ int db = ((const ScalarMCVItem *) b)->first;
return da - db;
}
static void SendCopyBegin(CopyState cstate);
static void ReceiveCopyBegin(CopyState cstate);
static void SendCopyEnd(CopyState cstate);
-static void CopySendData(CopyState cstate, void *databuf, int datasize);
+static void CopySendData(CopyState cstate, const void *databuf, int datasize);
static void CopySendString(CopyState cstate, const char *str);
static void CopySendChar(CopyState cstate, char c);
static void CopySendEndOfRow(CopyState cstate);
*----------
*/
static void
-CopySendData(CopyState cstate, void *databuf, int datasize)
+CopySendData(CopyState cstate, const void *databuf, int datasize)
{
- appendBinaryStringInfo(cstate->fe_msgbuf, (char *) databuf, datasize);
+ appendBinaryStringInfo(cstate->fe_msgbuf, databuf, datasize);
}
static void
int32 tmp;
/* Signature */
- CopySendData(cstate, (char *) BinarySignature, 11);
+ CopySendData(cstate, BinarySignature, 11);
/* Flags field */
tmp = 0;
if (cstate->oids)
const struct sockaddr_storage * netmask)
{
if (addr->ss_family == AF_INET)
- return range_sockaddr_AF_INET((struct sockaddr_in *) addr,
- (struct sockaddr_in *) netaddr,
- (struct sockaddr_in *) netmask);
+ return range_sockaddr_AF_INET((const struct sockaddr_in *) addr,
+ (const struct sockaddr_in *) netaddr,
+ (const struct sockaddr_in *) netmask);
#ifdef HAVE_IPV6
else if (addr->ss_family == AF_INET6)
- return range_sockaddr_AF_INET6((struct sockaddr_in6 *) addr,
- (struct sockaddr_in6 *) netaddr,
- (struct sockaddr_in6 *) netmask);
+ return range_sockaddr_AF_INET6((const struct sockaddr_in6 *) addr,
+ (const struct sockaddr_in6 *) netaddr,
+ (const struct sockaddr_in6 *) netmask);
#endif
else
return 0;
* when it is no longer needed.
*/
static uint8 *
-createPaddedCopyWithLength(uint8 *b, uint32 *l)
+createPaddedCopyWithLength(const uint8 *b, uint32 *l)
{
uint8 *ret;
uint32 q;
}
static int
-calculateDigestFromBuffer(uint8 *b, uint32 len, uint8 sum[16])
+calculateDigestFromBuffer(const uint8 *b, uint32 len, uint8 sum[16])
{
register uint32 i,
j,
{
uint8 sum[16];
- if (!calculateDigestFromBuffer((uint8 *) buff, len, sum))
+ if (!calculateDigestFromBuffer(buff, len, sum))
return false;
bytesToHex(sum, hexsum);
bool
pg_md5_binary(const void *buff, size_t len, void *outbuf)
{
- if (!calculateDigestFromBuffer((uint8 *) buff, len, outbuf))
+ if (!calculateDigestFromBuffer(buff, len, outbuf))
return false;
return true;
}
* As above, given a simple (unqualified) operator name
*/
A_Expr *
-makeSimpleA_Expr(A_Expr_Kind kind, const char *name,
+makeSimpleA_Expr(A_Expr_Kind kind, char *name,
Node *lexpr, Node *rexpr, int location)
{
A_Expr *a = makeNode(A_Expr);
static int
tbm_comparator(const void *left, const void *right)
{
- BlockNumber l = (*((const PagetableEntry **) left))->blockno;
- BlockNumber r = (*((const PagetableEntry **) right))->blockno;
+ BlockNumber l = (*((PagetableEntry * const *) left))->blockno;
+ BlockNumber r = (*((PagetableEntry * const *) right))->blockno;
if (l < r)
return -1;
static int
db_comparator(const void *a, const void *b)
{
- if (((avl_dbase *) a)->adl_score == ((avl_dbase *) b)->adl_score)
+ if (((const avl_dbase *) a)->adl_score == ((const avl_dbase *) b)->adl_score)
return 0;
else
- return (((avl_dbase *) a)->adl_score < ((avl_dbase *) b)->adl_score) ? 1 : -1;
+ return (((const avl_dbase *) a)->adl_score < ((const avl_dbase *) b)->adl_score) ? 1 : -1;
}
/*
* anytime.
*/
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
- (void *) locktag,
+ (const void *) locktag,
hashcode,
HASH_ENTER_NULL,
&found);
Assert(FastPathTag(locktag) && FastPathWeakMode(lockmode));
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
- (void *) locktag,
+ (const void *) locktag,
locallock->hashcode,
HASH_FIND,
&found);
LWLockAcquire(partitionLock, LW_SHARED);
lock = (LOCK *) hash_search_with_hash_value(LockMethodLockHash,
- (void *) locktag,
+ (const void *) locktag,
hashcode,
HASH_FIND,
NULL);
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);
}
}
static int
-cmpLexeme(TheLexeme *a, TheLexeme *b)
+cmpLexeme(const TheLexeme *a, const TheLexeme *b)
{
if (a->lexeme == NULL)
{
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)
#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 = "";
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 *
SPNodeData *StopLow,
*StopHigh,
*StopMiddle;
- uint8 *ptr = (uint8 *) word;
+ const uint8 *ptr = (const uint8 *) word;
flag &= FF_DICTFLAGMASK;
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;
static int
comparestr(const void *a, const void *b)
{
- return strcmp(*(char **) a, *(char **) b);
+ return strcmp(*(char * const *) a, *(char * const *) b);
}
/*
static int
compareint(const void *va, const void *vb)
{
- int4 a = *((int4 *) va);
- int4 b = *((int4 *) vb);
+ int4 a = *((const int4 *) va);
+ int4 b = *((const int4 *) vb);
if (a == b)
return 0;
static int
comparecost(const void *va, const void *vb)
{
- SPLITCOST *a = (SPLITCOST *) va;
- SPLITCOST *b = (SPLITCOST *) vb;
+ const SPLITCOST *a = (const SPLITCOST *) va;
+ const SPLITCOST *b = (const SPLITCOST *) vb;
if (a->cost == b->cost)
return 0;
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;
}
#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
compareQueryOperand(const void *a, const void *b, void *arg)
{
char *operand = (char *) arg;
- QueryOperand *qa = (*(QueryOperand **) a);
- QueryOperand *qb = (*(QueryOperand **) b);
+ QueryOperand *qa = (*(QueryOperand * const *) a);
+ QueryOperand *qb = (*(QueryOperand * const *) b);
return tsCompareString(operand + qa->distance, qa->length,
operand + qb->distance, qb->length,
static int
compareDocR(const void *va, const void *vb)
{
- DocRepresentation *a = (DocRepresentation *) va;
- DocRepresentation *b = (DocRepresentation *) vb;
+ const DocRepresentation *a = (const DocRepresentation *) va;
+ const DocRepresentation *b = (const DocRepresentation *) vb;
if (a->pos == b->pos)
return 0;
static xmltype *
xmlBuffer_to_xmltype(xmlBufferPtr buf)
{
- return (xmltype *) cstring_to_text_with_len((char *) xmlBufferContent(buf),
+ return (xmltype *) cstring_to_text_with_len((const char *) xmlBufferContent(buf),
xmlBufferLength(buf));
}
#endif
print_xml_decl(StringInfo buf, const xmlChar *version,
pg_enc encoding, int standalone)
{
- if ((version && strcmp((char *) version, PG_XML_DEFAULT_VERSION) != 0)
+ if ((version && strcmp((const char *) version, PG_XML_DEFAULT_VERSION) != 0)
|| (encoding && encoding != PG_UTF8)
|| standalone != -1)
{
uint32 v1,
v2;
- v1 = *(uint32 *) p1;
- v2 = ((pg_utf_to_local *) p2)->utf;
+ v1 = *(const uint32 *) p1;
+ v2 = ((const pg_utf_to_local *) p2)->utf;
return (v1 > v2) ? 1 : ((v1 == v2) ? 0 : -1);
}
uint32 v1,
v2;
- v1 = *(uint32 *) p1;
- v2 = ((pg_local_to_utf *) p2)->code;
+ v1 = *(const uint32 *) p1;
+ v2 = ((const pg_local_to_utf *) p2)->code;
return (v1 > v2) ? 1 : ((v1 == v2) ? 0 : -1);
}
d1,
d2;
- s1 = *(uint32 *) p1;
- s2 = *((uint32 *) p1 + 1);
- d1 = ((pg_utf_to_local_combined *) p2)->utf1;
- d2 = ((pg_utf_to_local_combined *) p2)->utf2;
+ s1 = *(const uint32 *) p1;
+ s2 = *((const uint32 *) p1 + 1);
+ d1 = ((const pg_utf_to_local_combined *) p2)->utf1;
+ d2 = ((const pg_utf_to_local_combined *) p2)->utf2;
return (s1 > d1 || (s1 == d1 && s2 > d2)) ? 1 : ((s1 == d1 && s2 == d2) ? 0 : -1);
}
uint32 v1,
v2;
- v1 = *(uint32 *) p1;
- v2 = ((pg_local_to_utf_combined *) p2)->code;
+ v1 = *(const uint32 *) p1;
+ v2 = ((const pg_local_to_utf_combined *) p2)->code;
return (v1 > v2) ? 1 : ((v1 == v2) ? 0 : -1);
}
static int
DOCatalogIdCompare(const void *p1, const void *p2)
{
- DumpableObject *obj1 = *(DumpableObject **) p1;
- DumpableObject *obj2 = *(DumpableObject **) p2;
+ const DumpableObject *obj1 = *(DumpableObject * const *) p1;
+ const DumpableObject *obj2 = *(DumpableObject * const *) p2;
int cmpval;
/*
}
else if (AH->gzOut)
{
- res = GZWRITE((void *) ptr, size, nmemb, AH->OF);
+ res = GZWRITE(ptr, size, nmemb, AH->OF);
if (res != (nmemb * size))
die_horribly(AH, modulename, "could not write to output file: %s\n", strerror(errno));
return res;
return ExecuteSqlCommandBuf(AH, (const char *) ptr, size * nmemb);
else
{
- res = fwrite((void *) ptr, size, nmemb, AH->OF);
+ res = fwrite(ptr, size, nmemb, AH->OF);
if (res != nmemb)
die_horribly(AH, modulename, "could not write to output file: %s\n",
strerror(errno));
{
lclTocEntry *tctx = (lclTocEntry *) AH->currToc->formatData;
- GZWRITE((void *) data, 1, dLen, tctx->FH);
+ GZWRITE(data, 1, dLen, tctx->FH);
return dLen;
}
size_t res;
if (th->zFH != NULL)
- res = GZWRITE((void *) buf, 1, len, th->zFH);
+ res = GZWRITE(buf, 1, len, th->zFH);
else
res = fwrite(buf, 1, len, th->nFH);
{
lclTocEntry *tctx = (lclTocEntry *) AH->currToc->formatData;
- dLen = tarWrite((void *) data, dLen, tctx->TH);
+ dLen = tarWrite(data, dLen, tctx->TH);
return dLen;
}
lclContext *ctx = (lclContext *) AH->formatData;
size_t res;
- res = tarWrite((void *) buf, len, ctx->FH);
+ res = tarWrite(buf, len, ctx->FH);
ctx->filePos += res;
return res;
}
static int
DOTypeNameCompare(const void *p1, const void *p2)
{
- DumpableObject *obj1 = *(DumpableObject **) p1;
- DumpableObject *obj2 = *(DumpableObject **) p2;
+ DumpableObject *obj1 = *(DumpableObject * const *) p1;
+ DumpableObject *obj2 = *(DumpableObject * const *) p2;
int cmpval;
/* Sort by type */
/* To have a stable sort order, break ties for some object types */
if (obj1->objType == DO_FUNC || obj1->objType == DO_AGG)
{
- FuncInfo *fobj1 = *(FuncInfo **) p1;
- FuncInfo *fobj2 = *(FuncInfo **) p2;
+ FuncInfo *fobj1 = *(FuncInfo * const *) p1;
+ FuncInfo *fobj2 = *(FuncInfo * const *) p2;
cmpval = fobj1->nargs - fobj2->nargs;
if (cmpval != 0)
static int
DOTypeOidCompare(const void *p1, const void *p2)
{
- DumpableObject *obj1 = *(DumpableObject **) p1;
- DumpableObject *obj2 = *(DumpableObject **) p2;
+ DumpableObject *obj1 = *(DumpableObject * const *) p1;
+ DumpableObject *obj2 = *(DumpableObject * const *) p2;
int cmpval;
cmpval = oldObjectTypePriority[obj1->objType] -
* This MUST be kept in sync with pg_wcsformat!
*/
void
-pg_wcssize(unsigned char *pwcs, size_t len, int encoding,
+pg_wcssize(const unsigned char *pwcs, size_t len, int encoding,
int *result_width, int *result_height, int *result_format_size)
{
int w,
* This MUST be kept in sync with pg_wcssize!
*/
void
-pg_wcsformat(unsigned char *pwcs, size_t len, int encoding,
+pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding,
struct lineptr * lines, int count)
{
int w,
extern unsigned char *mbvalidate(unsigned char *pwcs, int encoding);
extern int pg_wcswidth(const unsigned char *pwcs, size_t len, int encoding);
-extern void pg_wcsformat(unsigned char *pwcs, size_t len, int encoding, struct lineptr * lines, int count);
-extern void pg_wcssize(unsigned char *pwcs, size_t len, int encoding,
+extern void pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding, struct lineptr * lines, int count);
+extern void pg_wcssize(const unsigned char *pwcs, size_t len, int encoding,
int *width, int *height, int *format_size);
#endif /* MBPRINT_H */
nl_lines,
bytes_required;
- pg_wcssize((unsigned char *) cont->headers[i], strlen(cont->headers[i]),
+ pg_wcssize((const unsigned char *) cont->headers[i], strlen(cont->headers[i]),
encoding, &width, &nl_lines, &bytes_required);
if (width > max_width[i])
max_width[i] = width;
nl_lines,
bytes_required;
- pg_wcssize((unsigned char *) *ptr, strlen(*ptr), encoding,
+ pg_wcssize((const unsigned char *) *ptr, strlen(*ptr), encoding,
&width, &nl_lines, &bytes_required);
if (width > max_width[i % col_count])
nl_lines,
bytes_required;
- pg_wcssize((unsigned char *) *ptr, strlen(*ptr), encoding,
+ pg_wcssize((const unsigned char *) *ptr, strlen(*ptr), encoding,
&width, &nl_lines, &bytes_required);
/*
int width,
height;
- pg_wcssize((unsigned char *) cont->title, strlen(cont->title),
+ pg_wcssize((const unsigned char *) cont->title, strlen(cont->title),
encoding, &width, &height, NULL);
if (width >= width_total)
/* Aligned */
PRINT_RULE_TOP, format, fout);
for (i = 0; i < col_count; i++)
- pg_wcsformat((unsigned char *) cont->headers[i],
+ pg_wcsformat((const unsigned char *) cont->headers[i],
strlen(cont->headers[i]), encoding,
col_lineptrs[i], max_nl_lines[i]);
*/
for (j = 0; j < col_count; j++)
{
- pg_wcsformat((unsigned char *) ptr[j], strlen(ptr[j]), encoding,
+ pg_wcsformat((const unsigned char *) ptr[j], strlen(ptr[j]), encoding,
col_lineptrs[j], max_nl_lines[j]);
curr_nl_line[j] = 0;
}
height,
fs;
- pg_wcssize((unsigned char *) cont->headers[i], strlen(cont->headers[i]),
+ pg_wcssize((const unsigned char *) cont->headers[i], strlen(cont->headers[i]),
encoding, &width, &height, &fs);
if (width > hwidth)
hwidth = width;
height,
fs;
- pg_wcssize((unsigned char *) *ptr, strlen(*ptr), encoding,
+ pg_wcssize((const unsigned char *) *ptr, strlen(*ptr), encoding,
&width, &height, &fs);
if (width > dwidth)
dwidth = width;
}
/* Format the header */
- pg_wcsformat((unsigned char *) cont->headers[i % cont->ncolumns],
+ pg_wcsformat((const unsigned char *) cont->headers[i % cont->ncolumns],
strlen(cont->headers[i % cont->ncolumns]),
encoding, hlineptr, hheight);
/* Format the data */
- pg_wcsformat((unsigned char *) *ptr, strlen(*ptr), encoding,
+ pg_wcsformat((const unsigned char *) *ptr, strlen(*ptr), encoding,
dlineptr, dheight);
line_count = 0;
extern A_Expr *makeA_Expr(A_Expr_Kind kind, List *name,
Node *lexpr, Node *rexpr, int location);
-extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, const char *name,
+extern A_Expr *makeSimpleA_Expr(A_Expr_Kind kind, char *name,
Node *lexpr, Node *rexpr, int location);
extern Var *makeVar(Index varno,
switch (vartype)
{
case ECPGt_short:
- *target = *(short *) var;
+ *target = *(const short *) var;
break;
case ECPGt_int:
- *target = *(int *) var;
+ *target = *(const int *) var;
break;
case ECPGt_long:
- *target = *(long *) var;
+ *target = *(const long *) var;
break;
case ECPGt_unsigned_short:
- *target = *(unsigned short *) var;
+ *target = *(const unsigned short *) var;
break;
case ECPGt_unsigned_int:
- *target = *(unsigned int *) var;
+ *target = *(const unsigned int *) var;
break;
case ECPGt_unsigned_long:
- *target = *(unsigned long *) var;
+ *target = *(const unsigned long *) var;
break;
#ifdef HAVE_LONG_LONG_INT
case ECPGt_long_long:
- *target = *(long long int *) var;
+ *target = *(const long long int *) var;
break;
case ECPGt_unsigned_long_long:
- *target = *(unsigned long long int *) var;
+ *target = *(const unsigned long long int *) var;
break;
#endif /* HAVE_LONG_LONG_INT */
case ECPGt_float:
- *target = *(float *) var;
+ *target = *(const float *) var;
break;
case ECPGt_double:
- *target = *(double *) var;
+ *target = *(const double *) var;
break;
default:
ecpg_raise(lineno, ECPG_VAR_NOT_NUMERIC, ECPG_SQLSTATE_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION, NULL);
default:
/* Not implemented yet */
- ecpg_raise(lineno, ECPG_UNSUPPORTED, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, (char *) ecpg_type_name(var->type));
+ ecpg_raise(lineno, ECPG_UNSUPPORTED, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, ecpg_type_name(var->type));
return false;
break;
}
ECPGdo_descriptor(int line, const char *connection,
const char *descriptor, const char *query)
{
- return ECPGdo(line, ECPG_COMPAT_PGSQL, true, connection, '\0', 0, (char *) query, ECPGt_EOIT,
+ return ECPGdo(line, ECPG_COMPAT_PGSQL, true, connection, '\0', 0, query, ECPGt_EOIT,
ECPGt_descriptor, descriptor, 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}