mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-28 18:49:34 -05:00
Add const, to fix "cast away from const" warnings
This commit is contained in:
parent
2d99e86fc1
commit
fa4c4448c4
5 changed files with 14 additions and 13 deletions
|
|
@ -92,13 +92,14 @@ static const struct ldaperror ldap_errlist[] = {
|
|||
{-1, 0 }
|
||||
};
|
||||
|
||||
static struct ldaperror *ldap_int_error( int err )
|
||||
static const struct ldaperror *
|
||||
ldap_int_error( int err )
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; ldap_errlist[i].e_code != -1; i++ ) {
|
||||
if ( err == ldap_errlist[i].e_code )
|
||||
return (struct ldaperror *) &ldap_errlist[i];
|
||||
return &ldap_errlist[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
@ -107,7 +108,7 @@ static struct ldaperror *ldap_int_error( int err )
|
|||
char *
|
||||
ldap_err2string( int err )
|
||||
{
|
||||
struct ldaperror *e;
|
||||
const struct ldaperror *e;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_err2string\n", 0, 0, 0 );
|
||||
|
||||
|
|
@ -121,7 +122,7 @@ void
|
|||
ldap_perror( LDAP *ld, LDAP_CONST char *str )
|
||||
{
|
||||
const char *s;
|
||||
struct ldaperror *e;
|
||||
const struct ldaperror *e;
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_perror\n", 0, 0, 0 );
|
||||
|
||||
assert( ld != NULL );
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ ldap_set_option(
|
|||
|
||||
case LDAP_OPT_TIMEOUT: {
|
||||
const struct timeval *tv =
|
||||
(struct timeval *) invalue;
|
||||
(const struct timeval *) invalue;
|
||||
|
||||
if ( lo->ldo_tm_api != NULL ) {
|
||||
LDAP_FREE( lo->ldo_tm_api );
|
||||
|
|
@ -395,7 +395,7 @@ ldap_set_option(
|
|||
|
||||
case LDAP_OPT_NETWORK_TIMEOUT: {
|
||||
const struct timeval *tv =
|
||||
(struct timeval *) invalue;
|
||||
(const struct timeval *) invalue;
|
||||
|
||||
if ( lo->ldo_tm_net != NULL ) {
|
||||
LDAP_FREE( lo->ldo_tm_net );
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ ldap_int_timeval_dup( struct timeval **dest, const struct timeval *src )
|
|||
return 1;
|
||||
}
|
||||
|
||||
SAFEMEMCPY( (char *) new, (char *) src, sizeof(struct timeval));
|
||||
SAFEMEMCPY( (char *) new, (const char *) src, sizeof(struct timeval));
|
||||
|
||||
*dest = new;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -86,13 +86,13 @@ skip_url_prefix(
|
|||
* return non-zero if this looks like a LDAP URL; zero if not
|
||||
* if non-zero returned, *urlp will be moved past "ldap://" part of URL
|
||||
*/
|
||||
char* p;
|
||||
const char *p;
|
||||
|
||||
if ( url == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
p = (char *) url;
|
||||
p = url;
|
||||
|
||||
/* skip leading '<' (if any) */
|
||||
if ( *p == '<' ) {
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ ldif_sput(
|
|||
LDAP_CONST char *val,
|
||||
ber_len_t vlen )
|
||||
{
|
||||
unsigned char *byte, *stop;
|
||||
const unsigned char *byte, *stop;
|
||||
unsigned char buf[3];
|
||||
unsigned long bits;
|
||||
char *save;
|
||||
|
|
@ -391,7 +391,7 @@ ldif_sput(
|
|||
return;
|
||||
}
|
||||
|
||||
stop = (unsigned char *) (val + vlen);
|
||||
stop = (const unsigned char *) (val + vlen);
|
||||
|
||||
if ( type == LDIF_PUT_VALUE
|
||||
&& isgraph( val[0] ) && val[0] != ':' && val[0] != '<'
|
||||
|
|
@ -401,7 +401,7 @@ ldif_sput(
|
|||
) {
|
||||
int b64 = 0;
|
||||
|
||||
for ( byte = (unsigned char *) val; byte < stop;
|
||||
for ( byte = (const unsigned char *) val; byte < stop;
|
||||
byte++, len++ )
|
||||
{
|
||||
if ( !isascii( *byte ) || !isprint( *byte ) ) {
|
||||
|
|
@ -428,7 +428,7 @@ ldif_sput(
|
|||
len = savelen + 2;
|
||||
|
||||
/* convert to base 64 (3 bytes => 4 base 64 digits) */
|
||||
for ( byte = (unsigned char *) val;
|
||||
for ( byte = (const unsigned char *) val;
|
||||
byte < stop - 2;
|
||||
byte += 3 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue