constify use of invalue in <ber/ldap>_set_option()

This commit is contained in:
Hallvard Furuseth 1999-07-13 05:17:50 +00:00
parent 2cc187ffbf
commit 96e8fafb51
2 changed files with 20 additions and 19 deletions

View File

@ -76,7 +76,8 @@ ber_set_option(
&& ( option == LBER_OPT_MEMORY_FNS )
&& ( invalue != NULL ))
{
BerMemoryFunctions *f = (BerMemoryFunctions *) invalue;
const BerMemoryFunctions *f =
(const BerMemoryFunctions *) invalue;
/* make sure all functions are provided */
if(!( f->bmf_malloc && f->bmf_calloc
@ -107,7 +108,7 @@ ber_set_option(
if(item == NULL) {
if(option == LBER_OPT_BER_DEBUG) {
ber_int_debug = * (int *) invalue;
ber_int_debug = * (const int *) invalue;
return LBER_OPT_SUCCESS;
} else if(option == LBER_OPT_LOG_PRINT_FN) {
@ -124,12 +125,12 @@ ber_set_option(
switch(option) {
case LBER_OPT_BER_OPTIONS:
assert( BER_VALID( ber ) );
ber->ber_options = * (int *) invalue;
ber->ber_options = * (const int *) invalue;
return LBER_OPT_SUCCESS;
case LBER_OPT_BER_DEBUG:
assert( BER_VALID( ber ) );
ber->ber_debug = * (int *) invalue;
ber->ber_debug = * (const int *) invalue;
return LBER_OPT_SUCCESS;
default:

View File

@ -330,19 +330,19 @@ ldap_set_option(
break;
case LDAP_OPT_DEREF:
lo->ldo_deref = * (int *) invalue;
lo->ldo_deref = * (const int *) invalue;
return LDAP_OPT_SUCCESS;
case LDAP_OPT_SIZELIMIT:
lo->ldo_sizelimit = * (int *) invalue;
lo->ldo_sizelimit = * (const int *) invalue;
return LDAP_OPT_SUCCESS;
case LDAP_OPT_TIMELIMIT:
lo->ldo_timelimit = * (int *) invalue;
lo->ldo_timelimit = * (const int *) invalue;
return LDAP_OPT_SUCCESS;
case LDAP_OPT_PROTOCOL_VERSION: {
int vers = * (int *) invalue;
int vers = * (const int *) invalue;
if (vers < LDAP_VERSION_MIN || vers > LDAP_VERSION_MAX) {
/* not supported */
break;
@ -351,7 +351,8 @@ ldap_set_option(
} return LDAP_OPT_SUCCESS;
case LDAP_OPT_SERVER_CONTROLS: {
LDAPControl **controls = (LDAPControl **) invalue;
LDAPControl *const *controls =
(LDAPControl *const *) invalue;
ldap_controls_free( lo->ldo_sctrls );
@ -360,8 +361,7 @@ ldap_set_option(
return LDAP_OPT_SUCCESS;
}
lo->ldo_sctrls =
ldap_controls_dup( (LDAPControl **) invalue );
lo->ldo_sctrls = ldap_controls_dup( controls );
if(lo->ldo_sctrls == NULL) {
/* memory allocation error ? */
@ -370,7 +370,8 @@ ldap_set_option(
} return LDAP_OPT_SUCCESS;
case LDAP_OPT_CLIENT_CONTROLS: {
LDAPControl **controls = (LDAPControl **) invalue;
LDAPControl *const *controls =
(LDAPControl *const *) invalue;
ldap_controls_free( lo->ldo_cctrls );
@ -379,8 +380,7 @@ ldap_set_option(
return LDAP_OPT_SUCCESS;
}
lo->ldo_cctrls =
ldap_controls_dup( (LDAPControl **) invalue );
lo->ldo_cctrls = ldap_controls_dup( controls );
if(lo->ldo_cctrls == NULL) {
/* memory allocation error ? */
@ -389,7 +389,7 @@ ldap_set_option(
} return LDAP_OPT_SUCCESS;
case LDAP_OPT_HOST_NAME: {
char* host = (char *) invalue;
const char *host = (const char *) invalue;
if(lo->ldo_defhost != NULL) {
LDAP_FREE(lo->ldo_defhost);
@ -419,7 +419,7 @@ ldap_set_option(
} return LDAP_OPT_SUCCESS;
case LDAP_OPT_ERROR_NUMBER: {
int err = * (int *) invalue;
int err = * (const int *) invalue;
if(ld == NULL) {
/* need a struct ldap */
@ -430,7 +430,7 @@ ldap_set_option(
} return LDAP_OPT_SUCCESS;
case LDAP_OPT_ERROR_STRING: {
char* err = (char *) invalue;
const char *err = (const char *) invalue;
if(ld == NULL) {
/* need a struct ldap */
@ -445,7 +445,7 @@ ldap_set_option(
} return LDAP_OPT_SUCCESS;
case LDAP_OPT_MATCHED_DN: {
char* err = (char *) invalue;
const char *err = (const char *) invalue;
if(ld == NULL) {
/* need a struct ldap */
@ -464,7 +464,7 @@ ldap_set_option(
break;
case LDAP_OPT_DEBUG_LEVEL:
lo->ldo_debug = * (int *) invalue;
lo->ldo_debug = * (const int *) invalue;
return LDAP_OPT_SUCCESS;
default: