static int
compare_val_int4(const void *a, const void *b)
{
- int32 key = *(int32 *) a;
+ int32 key = *(const int32 *) a;
int32 value = DatumGetInt32(*(const Datum *) b);
if (key < value)
HeapTupleHeaderGetOidOld(const HeapTupleHeaderData *tup)
{
if (tup->t_infomask & HEAP_HASOID_OLD)
- return *((Oid *) ((char *) (tup) + (tup)->t_hoff - sizeof(Oid)));
+ return *((const Oid *) ((const char *) (tup) + (tup)->t_hoff - sizeof(Oid)));
else
return InvalidOid;
}
elog(ERROR, "could not initialize %s context: %s", "MD5",
pg_cryptohash_error(ctx));
if (pg_cryptohash_update(ctx, ns, sizeof(uu)) < 0 ||
- pg_cryptohash_update(ctx, (unsigned char *) ptr, len) < 0)
+ pg_cryptohash_update(ctx, (const unsigned char *) ptr, len) < 0)
elog(ERROR, "could not update %s context: %s", "MD5",
pg_cryptohash_error(ctx));
/* we assume sizeof MD5 result is 16, same as UUID size */
elog(ERROR, "could not initialize %s context: %s", "SHA1",
pg_cryptohash_error(ctx));
if (pg_cryptohash_update(ctx, ns, sizeof(uu)) < 0 ||
- pg_cryptohash_update(ctx, (unsigned char *) ptr, len) < 0)
+ pg_cryptohash_update(ctx, (const unsigned char *) ptr, len) < 0)
elog(ERROR, "could not update %s context: %s", "SHA1",
pg_cryptohash_error(ctx));
if (pg_cryptohash_final(ctx, sha1result, sizeof(sha1result)) < 0)
result = (struct varlena *) palloc(VARDATA_COMPRESSED_GET_EXTSIZE(value) + VARHDRSZ);
/* decompress the data */
- rawsize = pglz_decompress((char *) value + VARHDRSZ_COMPRESSED,
+ rawsize = pglz_decompress((const char *) value + VARHDRSZ_COMPRESSED,
VARSIZE(value) - VARHDRSZ_COMPRESSED,
VARDATA(result),
VARDATA_COMPRESSED_GET_EXTSIZE(value), true);
result = (struct varlena *) palloc(slicelength + VARHDRSZ);
/* decompress the data */
- rawsize = pglz_decompress((char *) value + VARHDRSZ_COMPRESSED,
+ rawsize = pglz_decompress((const char *) value + VARHDRSZ_COMPRESSED,
VARSIZE(value) - VARHDRSZ_COMPRESSED,
VARDATA(result),
slicelength, false);
result = (struct varlena *) palloc(VARDATA_COMPRESSED_GET_EXTSIZE(value) + VARHDRSZ);
/* decompress the data */
- rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESSED,
+ rawsize = LZ4_decompress_safe((const char *) value + VARHDRSZ_COMPRESSED,
VARDATA(result),
VARSIZE(value) - VARHDRSZ_COMPRESSED,
VARDATA_COMPRESSED_GET_EXTSIZE(value));
result = (struct varlena *) palloc(slicelength + VARHDRSZ);
/* decompress the data */
- rawsize = LZ4_decompress_safe_partial((char *) value + VARHDRSZ_COMPRESSED,
+ rawsize = LZ4_decompress_safe_partial((const char *) value + VARHDRSZ_COMPRESSED,
VARDATA(result),
VARSIZE(value) - VARHDRSZ_COMPRESSED,
slicelength,
static inline int
_bt_blk_cmp(const void *arg1, const void *arg2)
{
- BlockNumber b1 = *((BlockNumber *) arg1);
- BlockNumber b2 = *((BlockNumber *) arg2);
+ BlockNumber b1 = *((const BlockNumber *) arg1);
+ BlockNumber b2 = *((const BlockNumber *) arg2);
return pg_cmp_u32(b1, b2);
}
static int
x_cmp(const void *a, const void *b, void *arg)
{
- Point *pa = *(Point **) a;
- Point *pb = *(Point **) b;
+ Point *pa = *(Point *const *) a;
+ Point *pb = *(Point *const *) b;
if (pa->x == pb->x)
return 0;
static int
y_cmp(const void *a, const void *b, void *arg)
{
- Point *pa = *(Point **) a;
- Point *pb = *(Point **) b;
+ Point *pa = *(Point *const *) a;
+ Point *pb = *(Point *const *) b;
if (pa->y == pb->y)
return 0;
if (regbuf->flags & REGBUF_STANDARD)
{
/* Assume we can omit data between pd_lower and pd_upper */
- uint16 lower = ((PageHeader) page)->pd_lower;
- uint16 upper = ((PageHeader) page)->pd_upper;
+ uint16 lower = ((const PageHeaderData *) page)->pd_lower;
+ uint16 upper = ((const PageHeaderData *) page)->pd_upper;
if (lower >= SizeOfPageHeaderData &&
upper > lower &&
Assert(manifest != NULL);
if (manifest->still_checksumming)
{
- if (pg_cryptohash_update(manifest->manifest_ctx, (uint8 *) s, len) < 0)
+ if (pg_cryptohash_update(manifest->manifest_ctx, (const uint8 *) s, len) < 0)
elog(ERROR, "failed to update checksum of backup manifest: %s",
pg_cryptohash_error(manifest->manifest_ctx));
}
_tarWriteHeader(sink, filename, NULL, &statbuf, false);
- if (pg_checksum_update(&checksum_ctx, (uint8 *) content, len) < 0)
+ if (pg_checksum_update(&checksum_ctx, (const uint8 *) content, len) < 0)
elog(ERROR, "could not update checksum of file \"%s\"",
filename);
static uint32
hash_string_pointer(const char *s)
{
- unsigned char *ss = (unsigned char *) s;
+ const unsigned char *ss = (const unsigned char *) s;
return hash_bytes(ss, strlen(s));
}
static int
compare_block_numbers(const void *a, const void *b)
{
- BlockNumber aa = *(BlockNumber *) a;
- BlockNumber bb = *(BlockNumber *) b;
+ BlockNumber aa = *(const BlockNumber *) a;
+ BlockNumber bb = *(const BlockNumber *) b;
return pg_cmp_u32(aa, bb);
}
reorderqueue_cmp(const pairingheap_node *a, const pairingheap_node *b,
void *arg)
{
- ReorderTuple *rta = (ReorderTuple *) a;
- ReorderTuple *rtb = (ReorderTuple *) b;
+ const ReorderTuple *rta = (const ReorderTuple *) a;
+ const ReorderTuple *rtb = (const ReorderTuple *) b;
IndexScanState *node = (IndexScanState *) arg;
/* exchange argument order to invert the sort order */
ctx = pg_cryptohash_create(hash_type);
if (pg_cryptohash_init(ctx) < 0 ||
- pg_cryptohash_update(ctx, (uint8 *) username, strlen(username)) < 0 ||
- pg_cryptohash_update(ctx, (uint8 *) mock_auth_nonce, MOCK_AUTH_NONCE_LEN) < 0 ||
+ pg_cryptohash_update(ctx, (const uint8 *) username, strlen(username)) < 0 ||
+ pg_cryptohash_update(ctx, (const uint8 *) mock_auth_nonce, MOCK_AUTH_NONCE_LEN) < 0 ||
pg_cryptohash_final(ctx, sha_digest, key_length) < 0)
{
pg_cryptohash_free(ctx);
case PASSWORD_TYPE_MD5:
encrypted_password = palloc(MD5_PASSWD_LEN + 1);
- if (!pg_md5_encrypt(password, (uint8 *) role, strlen(role),
+ if (!pg_md5_encrypt(password, (const uint8 *) role, strlen(role),
encrypted_password, &errstr))
elog(ERROR, "password encryption failed: %s", errstr);
break;
case PASSWORD_TYPE_MD5:
if (!pg_md5_encrypt(client_pass,
- (uint8 *) role,
+ (const uint8 *) role,
strlen(role),
crypt_client_pass,
&errstr))
break;
case T_JsonExpr:
{
- const JsonExpr *jsexpr = (JsonExpr *) expr;
+ const JsonExpr *jsexpr = (const JsonExpr *) expr;
coll = jsexpr->collation;
}
break;
case T_JsonBehavior:
{
- const JsonBehavior *behavior = (JsonBehavior *) expr;
+ const JsonBehavior *behavior = (const JsonBehavior *) expr;
if (behavior->expr)
coll = exprCollation(behavior->expr);
}
break;
case T_JsonBehavior:
- loc = exprLocation(((JsonBehavior *) expr)->expr);
+ loc = exprLocation(((const JsonBehavior *) expr)->expr);
break;
case T_NullTest:
{
_outList(str, obj);
/* nodeRead does not want to see { } around these! */
else if (IsA(obj, Integer))
- _outInteger(str, (Integer *) obj);
+ _outInteger(str, (const Integer *) obj);
else if (IsA(obj, Float))
- _outFloat(str, (Float *) obj);
+ _outFloat(str, (const Float *) obj);
else if (IsA(obj, Boolean))
- _outBoolean(str, (Boolean *) obj);
+ _outBoolean(str, (const Boolean *) obj);
else if (IsA(obj, String))
- _outString(str, (String *) obj);
+ _outString(str, (const String *) obj);
else if (IsA(obj, BitString))
- _outBitString(str, (BitString *) obj);
+ _outBitString(str, (const BitString *) obj);
else if (IsA(obj, Bitmapset))
- outBitmapset(str, (Bitmapset *) obj);
+ outBitmapset(str, (const Bitmapset *) obj);
else
{
appendStringInfoChar(str, '{');
tbm_shared_comparator(const void *left, const void *right, void *arg)
{
PagetableEntry *base = (PagetableEntry *) arg;
- PagetableEntry *lpage = &base[*(int *) left];
- PagetableEntry *rpage = &base[*(int *) right];
+ PagetableEntry *lpage = &base[*(const int *) left];
+ PagetableEntry *rpage = &base[*(const int *) right];
if (lpage->blockno < rpage->blockno)
return -1;
int
compare_scalars_simple(const void *a, const void *b, void *arg)
{
- return compare_datums_simple(*(Datum *) a,
- *(Datum *) b,
+ return compare_datums_simple(*(const Datum *) a,
+ *(const Datum *) b,
(SortSupport) arg);
}
*/
pg_memory_barrier();
memcpy(&mq->mq_ring[mq->mq_ring_offset + offset],
- (char *) data + sent, sendnow);
+ (const char *) data + sent, sendnow);
sent += sendnow;
/*
while (StopLow < StopHigh)
{
StopMiddle = StopLow + ((StopHigh - StopLow) >> 1);
- if (StopMiddle->val == ((uint8 *) (word))[level])
+ if (StopMiddle->val == ((const uint8 *) (word))[level])
break;
- else if (StopMiddle->val < ((uint8 *) (word))[level])
+ else if (StopMiddle->val < ((const uint8 *) (word))[level])
StopLow = StopMiddle + 1;
else
StopHigh = StopMiddle;
static int
compareDoubles(const void *a, const void *b)
{
- float8 x = *(float8 *) a;
- float8 y = *(float8 *) b;
+ float8 x = *(const float8 *) a;
+ float8 y = *(const float8 *) b;
if (x == y)
return 0;
static uint32
json_unique_hash(const void *key, Size keysize)
{
- const JsonUniqueHashEntry *entry = (JsonUniqueHashEntry *) key;
+ const JsonUniqueHashEntry *entry = (const JsonUniqueHashEntry *) key;
uint32 hash = hash_bytes_uint32(entry->object_id);
hash ^= hash_bytes((const unsigned char *) entry->key, entry->key_len);
while (wbstate->offset < wbstate->len &&
wbstate->str[wbstate->offset] != '\0')
{
- char32_t u = utf8_to_unicode((unsigned char *) wbstate->str +
+ char32_t u = utf8_to_unicode((const unsigned char *) wbstate->str +
wbstate->offset);
bool curr_alnum = pg_u_isalnum(u, wbstate->posix);
typalign = typcache->rngelemtype->typalign;
/* initialize data pointer just after the range OID */
- ptr = (char *) (range + 1);
+ ptr = (const char *) (range + 1);
/* fetch lower bound, if any */
if (RANGE_HAS_LBOUND(flags))
range_get_flags(const RangeType *range)
{
/* fetch the flag byte from datum's last byte */
- return *((char *) range + VARSIZE(range) - 1);
+ return *((const char *) range + VARSIZE(range) - 1);
}
/*
int
range_compare(const void *key1, const void *key2, void *arg)
{
- RangeType *r1 = *(RangeType **) key1;
- RangeType *r2 = *(RangeType **) key2;
+ RangeType *r1 = *(RangeType *const *) key1;
+ RangeType *r2 = *(RangeType *const *) key2;
TypeCacheEntry *typcache = (TypeCacheEntry *) arg;
RangeBound lower1;
RangeBound upper1;
static int
common_entry_cmp(const void *i1, const void *i2)
{
- double delta1 = ((CommonEntry *) i1)->delta;
- double delta2 = ((CommonEntry *) i2)->delta;
+ double delta1 = ((const CommonEntry *) i1)->delta;
+ double delta2 = ((const CommonEntry *) i2)->delta;
if (delta1 < delta2)
return -1;
return -1;
}
- inbuf = ((char *) inbuf) + chunk;
+ inbuf = ((const char *) inbuf) + chunk;
}
/* Our caller keeps track of the uncompressed size. */
static int
final_filemap_cmp(const void *a, const void *b)
{
- file_entry_t *fa = *((file_entry_t **) a);
- file_entry_t *fb = *((file_entry_t **) b);
+ file_entry_t *fa = *((file_entry_t *const *) a);
+ file_entry_t *fb = *((file_entry_t *const *) b);
if (fa->action > fb->action)
return 1;
mystreamer->checksum_bytes += len;
/* Feed these bytes to the checksum calculation. */
- if (pg_checksum_update(checksum_ctx, (uint8 *) data, len) < 0)
+ if (pg_checksum_update(checksum_ctx, (const uint8 *) data, len) < 0)
{
report_backup_error(mystreamer->context,
"could not update checksum of file \"%s\"",
static int
compare_block_numbers(const void *a, const void *b)
{
- BlockNumber aa = *(BlockNumber *) a;
- BlockNumber bb = *(BlockNumber *) b;
+ BlockNumber aa = *(const BlockNumber *) a;
+ BlockNumber bb = *(const BlockNumber *) b;
return pg_cmp_u32(aa, bb);
}
*/
/* First iteration */
- if (pg_hmac_init(hmac_ctx, (uint8 *) password, password_len) < 0 ||
+ if (pg_hmac_init(hmac_ctx, (const uint8 *) password, password_len) < 0 ||
pg_hmac_update(hmac_ctx, salt, saltlen) < 0 ||
pg_hmac_update(hmac_ctx, (uint8 *) &one, sizeof(uint32)) < 0 ||
pg_hmac_final(hmac_ctx, Ui_prev, key_length) < 0)
CHECK_FOR_INTERRUPTS();
#endif
- if (pg_hmac_init(hmac_ctx, (uint8 *) password, password_len) < 0 ||
+ if (pg_hmac_init(hmac_ctx, (const uint8 *) password, password_len) < 0 ||
pg_hmac_update(hmac_ctx, (uint8 *) Ui_prev, key_length) < 0 ||
pg_hmac_final(hmac_ctx, Ui, key_length) < 0)
{
while (wbstate->offset < wbstate->len &&
wbstate->str[wbstate->offset] != '\0')
{
- char32_t u = utf8_to_unicode((unsigned char *) wbstate->str +
+ char32_t u = utf8_to_unicode((const unsigned char *) wbstate->str +
wbstate->offset);
bool curr_alnum = pg_u_isalnum(u, wbstate->posix);
while ((srclen < 0 || srcoff < srclen) && src[srcoff] != '\0')
{
- char32_t u1 = utf8_to_unicode((unsigned char *) src + srcoff);
+ char32_t u1 = utf8_to_unicode((const unsigned char *) src + srcoff);
int u1len = unicode_utf8len(u1);
char32_t simple = 0;
const char32_t *special = NULL;
if (conditions == 0)
return true;
else if (conditions == PG_U_FINAL_SIGMA)
- return check_final_sigma((unsigned char *) str, len, offset);
+ return check_final_sigma((const unsigned char *) str, len, offset);
/* no other conditions supported */
Assert(false);
: \
( \
AssertMacro((attlen) == -2), \
- (cur_offset) + (strlen((char *) (attptr)) + 1) \
+ (cur_offset) + (strlen((const char *) (attptr)) + 1) \
)) \
)
*/
for (;;)
{
- uint64 chunk = *(uint64 *) str;
+ uint64 chunk = *(const uint64 *) str;
zero_byte_low = haszero64(chunk);
if (zero_byte_low)
*/
for (; p < aligned_end; p += sizeof(size_t))
{
- if (*(size_t *) p != 0)
+ if (*(const size_t *) p != 0)
return false;
}
*/
for (; p < aligned_end - (sizeof(size_t) * 7); p += sizeof(size_t) * 8)
{
- if ((((size_t *) p)[0] != 0) | (((size_t *) p)[1] != 0) |
- (((size_t *) p)[2] != 0) | (((size_t *) p)[3] != 0) |
- (((size_t *) p)[4] != 0) | (((size_t *) p)[5] != 0) |
- (((size_t *) p)[6] != 0) | (((size_t *) p)[7] != 0))
+ if ((((const size_t *) p)[0] != 0) | (((const size_t *) p)[1] != 0) |
+ (((const size_t *) p)[2] != 0) | (((const size_t *) p)[3] != 0) |
+ (((const size_t *) p)[4] != 0) | (((const size_t *) p)[5] != 0) |
+ (((const size_t *) p)[6] != 0) | (((const size_t *) p)[7] != 0))
return false;
}
*/
for (; p < aligned_end; p += sizeof(size_t))
{
- if (*(size_t *) p != 0)
+ if (*(const size_t *) p != 0)
return false;
}
#ifdef WORDS_BIGENDIAN
#define VARATT_IS_4B(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x00)
+ ((((const varattrib_1b *) (PTR))->va_header & 0x80) == 0x00)
#define VARATT_IS_4B_U(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x00)
+ ((((const varattrib_1b *) (PTR))->va_header & 0xC0) == 0x00)
#define VARATT_IS_4B_C(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0xC0) == 0x40)
+ ((((const varattrib_1b *) (PTR))->va_header & 0xC0) == 0x40)
#define VARATT_IS_1B(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0x80) == 0x80)
+ ((((const varattrib_1b *) (PTR))->va_header & 0x80) == 0x80)
#define VARATT_IS_1B_E(PTR) \
- ((((varattrib_1b *) (PTR))->va_header) == 0x80)
+ ((((const varattrib_1b *) (PTR))->va_header) == 0x80)
#define VARATT_NOT_PAD_BYTE(PTR) \
- (*((uint8 *) (PTR)) != 0)
+ (*((const uint8 *) (PTR)) != 0)
/* VARSIZE_4B() should only be used on known-aligned data */
#define VARSIZE_4B(PTR) \
- (((varattrib_4b *) (PTR))->va_4byte.va_header & 0x3FFFFFFF)
+ (((const varattrib_4b *) (PTR))->va_4byte.va_header & 0x3FFFFFFF)
#define VARSIZE_1B(PTR) \
- (((varattrib_1b *) (PTR))->va_header & 0x7F)
+ (((const varattrib_1b *) (PTR))->va_header & 0x7F)
#define VARTAG_1B_E(PTR) \
- ((vartag_external) ((varattrib_1b_e *) (PTR))->va_tag)
+ ((vartag_external) ((const varattrib_1b_e *) (PTR))->va_tag)
#define SET_VARSIZE_4B(PTR,len) \
(((varattrib_4b *) (PTR))->va_4byte.va_header = (len) & 0x3FFFFFFF)
#else /* !WORDS_BIGENDIAN */
#define VARATT_IS_4B(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x00)
+ ((((const varattrib_1b *) (PTR))->va_header & 0x01) == 0x00)
#define VARATT_IS_4B_U(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x00)
+ ((((const varattrib_1b *) (PTR))->va_header & 0x03) == 0x00)
#define VARATT_IS_4B_C(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0x03) == 0x02)
+ ((((const varattrib_1b *) (PTR))->va_header & 0x03) == 0x02)
#define VARATT_IS_1B(PTR) \
- ((((varattrib_1b *) (PTR))->va_header & 0x01) == 0x01)
+ ((((const varattrib_1b *) (PTR))->va_header & 0x01) == 0x01)
#define VARATT_IS_1B_E(PTR) \
- ((((varattrib_1b *) (PTR))->va_header) == 0x01)
+ ((((const varattrib_1b *) (PTR))->va_header) == 0x01)
#define VARATT_NOT_PAD_BYTE(PTR) \
- (*((uint8 *) (PTR)) != 0)
+ (*((const uint8 *) (PTR)) != 0)
/* VARSIZE_4B() should only be used on known-aligned data */
#define VARSIZE_4B(PTR) \
- ((((varattrib_4b *) (PTR))->va_4byte.va_header >> 2) & 0x3FFFFFFF)
+ ((((const varattrib_4b *) (PTR))->va_4byte.va_header >> 2) & 0x3FFFFFFF)
#define VARSIZE_1B(PTR) \
- ((((varattrib_1b *) (PTR))->va_header >> 1) & 0x7F)
+ ((((const varattrib_1b *) (PTR))->va_header >> 1) & 0x7F)
#define VARTAG_1B_E(PTR) \
- ((vartag_external) ((varattrib_1b_e *) (PTR))->va_tag)
+ ((vartag_external) ((const varattrib_1b_e *) (PTR))->va_tag)
#define SET_VARSIZE_4B(PTR,len) \
(((varattrib_4b *) (PTR))->va_4byte.va_header = (((uint32) (len)) << 2))
static inline Size
VARDATA_COMPRESSED_GET_EXTSIZE(const void *PTR)
{
- return ((varattrib_4b *) PTR)->va_compressed.va_tcinfo & VARLENA_EXTSIZE_MASK;
+ return ((const varattrib_4b *) PTR)->va_compressed.va_tcinfo & VARLENA_EXTSIZE_MASK;
}
/* Compression method of a compressed-in-line varlena datum */
static inline uint32
VARDATA_COMPRESSED_GET_COMPRESS_METHOD(const void *PTR)
{
- return ((varattrib_4b *) PTR)->va_compressed.va_tcinfo >> VARLENA_EXTSIZE_BITS;
+ return ((const varattrib_4b *) PTR)->va_compressed.va_tcinfo >> VARLENA_EXTSIZE_BITS;
}
/* Same for external Datums; but note argument is a struct varatt_external */
strlen(state->server_first_message)) < 0 ||
pg_hmac_update(ctx, (uint8 *) ",", 1) < 0 ||
pg_hmac_update(ctx,
- (uint8 *) client_final_message_without_proof,
+ (const uint8 *) client_final_message_without_proof,
strlen(client_final_message_without_proof)) < 0 ||
pg_hmac_final(ctx, ClientSignature, state->key_length) < 0)
{
if (!crypt_pwd)
return NULL;
- if (!pg_md5_encrypt(passwd, (uint8 *) user, strlen(user), crypt_pwd, &errstr))
+ if (!pg_md5_encrypt(passwd, (const uint8 *) user, strlen(user), crypt_pwd, &errstr))
{
free(crypt_pwd);
return NULL;
{
const char *errstr = NULL;
- if (!pg_md5_encrypt(passwd, (uint8 *) user, strlen(user), crypt_pwd, &errstr))
+ if (!pg_md5_encrypt(passwd, (const uint8 *) user, strlen(user), crypt_pwd, &errstr))
{
libpq_append_conn_error(conn, "could not encrypt password: %s", errstr);
free(crypt_pwd);
if (!PointerIsAligned(p, uint32) &&
p + 2 <= pend)
{
- crc = __crc32ch(crc, *(uint16 *) p);
+ crc = __crc32ch(crc, *(const uint16 *) p);
p += 2;
}
if (!PointerIsAligned(p, uint64) &&
p + 4 <= pend)
{
- crc = __crc32cw(crc, *(uint32 *) p);
+ crc = __crc32cw(crc, *(const uint32 *) p);
p += 4;
}
/* Process eight bytes at a time, as far as we can. */
while (p + 8 <= pend)
{
- crc = __crc32cd(crc, *(uint64 *) p);
+ crc = __crc32cd(crc, *(const uint64 *) p);
p += 8;
}
/* Process remaining 0-7 bytes. */
if (p + 4 <= pend)
{
- crc = __crc32cw(crc, *(uint32 *) p);
+ crc = __crc32cw(crc, *(const uint32 *) p);
p += 4;
}
if (p + 2 <= pend)
{
- crc = __crc32ch(crc, *(uint16 *) p);
+ crc = __crc32ch(crc, *(const uint16 *) p);
p += 2;
}
if (p < pend)
*/
for (; bytes >= sizeof(uint64); bytes -= sizeof(uint64))
{
- popcnt += pg_popcount64(*((uint64 *) buf));
+ popcnt += pg_popcount64(*((const uint64 *) buf));
buf += sizeof(uint64);
}
*/
for (; bytes >= sizeof(uint64); bytes -= sizeof(uint64))
{
- popcnt += pg_popcount64(*((uint64 *) buf) & mask64);
+ popcnt += pg_popcount64(*((const uint64 *) buf) & mask64);
buf += sizeof(uint64);
}
static int
step_qsort_cmp(const void *a, const void *b)
{
- Step *stepa = *((Step **) a);
- Step *stepb = *((Step **) b);
+ Step *stepa = *((Step *const *) a);
+ Step *stepb = *((Step *const *) b);
return strcmp(stepa->name, stepb->name);
}
static int
step_bsearch_cmp(const void *a, const void *b)
{
- char *stepname = (char *) a;
- Step *step = *((Step **) b);
+ const char *stepname = (const char *) a;
+ Step *step = *((Step *const *) b);
return strcmp(stepname, step->name);
}
"SELECT generate_series(42, $1)",
1,
NULL,
- (const char **) param,
+ (const char *const *) param,
NULL,
NULL,
0) != 1)
OffsetNumber loff,
roff;
- lblk = ItemPointerGetBlockNumber((ItemPointer) left);
- rblk = ItemPointerGetBlockNumber((ItemPointer) right);
+ lblk = ItemPointerGetBlockNumber((const ItemPointerData *) left);
+ rblk = ItemPointerGetBlockNumber((const ItemPointerData *) right);
if (lblk < rblk)
return -1;
if (lblk > rblk)
return 1;
- loff = ItemPointerGetOffsetNumber((ItemPointer) left);
- roff = ItemPointerGetOffsetNumber((ItemPointer) right);
+ loff = ItemPointerGetOffsetNumber((const ItemPointerData *) left);
+ roff = ItemPointerGetOffsetNumber((const ItemPointerData *) right);
if (loff < roff)
return -1;