constness fixes
add missing const qualifications, and add "const cast" suppressions where unavoidable.
This commit is contained in:
parent
5c2e8d3e14
commit
def22db096
|
@ -649,7 +649,10 @@ static void
|
||||||
make_key( const char *info_stop, DBT *tkey, const char *name )
|
make_key( const char *info_stop, DBT *tkey, const char *name )
|
||||||
{
|
{
|
||||||
char *u = strpbrk( name, info_stop );
|
char *u = strpbrk( name, info_stop );
|
||||||
|
DIAG_PUSH
|
||||||
|
DIAG_DISABLE("-Wcast-qual") // C has no const_cast<> ...
|
||||||
tkey->data = (char *)name;
|
tkey->data = (char *)name;
|
||||||
|
DIAG_POP
|
||||||
tkey->size = u ? (size_t)(u - name) : strlen( name );
|
tkey->size = u ? (size_t)(u - name) : strlen( name );
|
||||||
}
|
}
|
||||||
#endif /* USE_DB */
|
#endif /* USE_DB */
|
||||||
|
@ -844,7 +847,7 @@ maildir_set_uid( maildir_store_t *ctx, const char *name, uint *uid )
|
||||||
static int
|
static int
|
||||||
maildir_compare( const void *l, const void *r )
|
maildir_compare( const void *l, const void *r )
|
||||||
{
|
{
|
||||||
msg_t *lm = (msg_t *)l, *rm = (msg_t *)r;
|
const msg_t *lm = (const msg_t *)l, *rm = (const msg_t *)r;
|
||||||
char *ldot, *rdot, *ldot2, *rdot2, *lseq, *rseq;
|
char *ldot, *rdot, *ldot2, *rdot2, *lseq, *rseq;
|
||||||
int ret, llen, rlen;
|
int ret, llen, rlen;
|
||||||
|
|
||||||
|
|
|
@ -248,8 +248,8 @@ is_inbox( const char *name )
|
||||||
static int
|
static int
|
||||||
cmp_box_names( const void *a, const void *b )
|
cmp_box_names( const void *a, const void *b )
|
||||||
{
|
{
|
||||||
const char *as = *(const char **)a;
|
const char *as = *(const char * const *)a;
|
||||||
const char *bs = *(const char **)b;
|
const char *bs = *(const char * const *)b;
|
||||||
int ai = is_inbox( as );
|
int ai = is_inbox( as );
|
||||||
int bi = is_inbox( bs );
|
int bi = is_inbox( bs );
|
||||||
int di = bi - ai;
|
int di = bi - ai;
|
||||||
|
@ -1087,14 +1087,14 @@ sync_listed_boxes( main_vars_t *mvars, box_ent_t *mbox )
|
||||||
if (!mvars->list) {
|
if (!mvars->list) {
|
||||||
nfasprintf( &mvars->names[M], "%s%s", mpfx, mbox->name );
|
nfasprintf( &mvars->names[M], "%s%s", mpfx, mbox->name );
|
||||||
nfasprintf( &mvars->names[S], "%s%s", spfx, mbox->name );
|
nfasprintf( &mvars->names[S], "%s%s", spfx, mbox->name );
|
||||||
sync_boxes( mvars->ctx, (const char **)mvars->names, mbox->present, mvars->chan, done_sync_2_dyn, mvars );
|
sync_boxes( mvars->ctx, (const char * const *)mvars->names, mbox->present, mvars->chan, done_sync_2_dyn, mvars );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
printf( "%s%s <=> %s%s\n", mpfx, mbox->name, spfx, mbox->name );
|
printf( "%s%s <=> %s%s\n", mpfx, mbox->name, spfx, mbox->name );
|
||||||
} else {
|
} else {
|
||||||
if (!mvars->list) {
|
if (!mvars->list) {
|
||||||
mvars->names[M] = mvars->names[S] = mbox->name;
|
mvars->names[M] = mvars->names[S] = mbox->name;
|
||||||
sync_boxes( mvars->ctx, (const char **)mvars->names, mbox->present, mvars->chan, done_sync, mvars );
|
sync_boxes( mvars->ctx, (const char * const *)mvars->names, mbox->present, mvars->chan, done_sync, mvars );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
puts( mbox->name );
|
puts( mbox->name );
|
||||||
|
|
|
@ -232,7 +232,10 @@ verify_cert_host( const server_conf_t *conf, conn_t *sock )
|
||||||
static int
|
static int
|
||||||
init_ssl_ctx( const server_conf_t *conf )
|
init_ssl_ctx( const server_conf_t *conf )
|
||||||
{
|
{
|
||||||
|
DIAG_PUSH
|
||||||
|
DIAG_DISABLE("-Wcast-qual") // C has no 'mutable' or const_cast<> ...
|
||||||
server_conf_t *mconf = (server_conf_t *)conf;
|
server_conf_t *mconf = (server_conf_t *)conf;
|
||||||
|
DIAG_POP
|
||||||
|
|
||||||
if (conf->SSLContext)
|
if (conf->SSLContext)
|
||||||
return conf->ssl_ctx_valid;
|
return conf->ssl_ctx_valid;
|
||||||
|
@ -320,7 +323,7 @@ socket_start_tls( conn_t *conn, void (*cb)( int ok, void *aux ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
init_wakeup( &conn->ssl_fake, ssl_fake_cb, conn );
|
init_wakeup( &conn->ssl_fake, ssl_fake_cb, conn );
|
||||||
if (!(conn->ssl = SSL_new( ((server_conf_t *)conn->conf)->SSLContext ))) {
|
if (!(conn->ssl = SSL_new( ((server_conf_t const *)conn->conf)->SSLContext ))) {
|
||||||
print_ssl_errors( "initializing SSL connection" );
|
print_ssl_errors( "initializing SSL connection" );
|
||||||
start_tls_p3( conn, 0 );
|
start_tls_p3( conn, 0 );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1002,7 +1002,7 @@ static void box_opened2( sync_vars_t *svars, int t );
|
||||||
static void load_box( sync_vars_t *svars, int t, uint minwuid, uint_array_t mexcs );
|
static void load_box( sync_vars_t *svars, int t, uint minwuid, uint_array_t mexcs );
|
||||||
|
|
||||||
void
|
void
|
||||||
sync_boxes( store_t *ctx[], const char *names[], int present[], channel_conf_t *chan,
|
sync_boxes( store_t *ctx[], const char * const names[], int present[], channel_conf_t *chan,
|
||||||
void (*cb)( int sts, void *aux ), void *aux )
|
void (*cb)( int sts, void *aux ), void *aux )
|
||||||
{
|
{
|
||||||
sync_vars_t *svars;
|
sync_vars_t *svars;
|
||||||
|
|
|
@ -80,7 +80,7 @@ extern const char *str_ms[2], *str_hl[2];
|
||||||
#define BOX_PRESENT 1
|
#define BOX_PRESENT 1
|
||||||
|
|
||||||
/* All passed pointers must stay alive until cb is called. */
|
/* All passed pointers must stay alive until cb is called. */
|
||||||
void sync_boxes( store_t *ctx[], const char *names[], int present[], channel_conf_t *chan,
|
void sync_boxes( store_t *ctx[], const char * const names[], int present[], channel_conf_t *chan,
|
||||||
void (*cb)( int sts, void *aux ), void *aux );
|
void (*cb)( int sts, void *aux ), void *aux );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -541,7 +541,7 @@ map_name( const char *arg, char **result, int reserve, const char *in, const cha
|
||||||
static int
|
static int
|
||||||
compare_uints( const void *l, const void *r )
|
compare_uints( const void *l, const void *r )
|
||||||
{
|
{
|
||||||
uint li = *(uint *)l, ri = *(uint *)r;
|
uint li = *(const uint *)l, ri = *(const uint *)r;
|
||||||
if (li != ri) // Can't subtract, the result might not fit into signed int.
|
if (li != ri) // Can't subtract, the result might not fit into signed int.
|
||||||
return li > ri ? 1 : -1;
|
return li > ri ? 1 : -1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user