Fix assignment of <char/int>* to unsigned <char/int>* and vice versa.

This commit is contained in:
Hallvard Furuseth 2003-05-02 13:29:28 +00:00
parent c5d60fc043
commit 5ee9264465
11 changed files with 39 additions and 38 deletions

View File

@ -150,7 +150,7 @@ main( int argc, char **argv )
/* it's base64 encoded. */
bvalue.bv_val = malloc( strlen( &sep[1] ));
bvalue.bv_len = lutil_b64_pton( &sep[1],
bvalue.bv_val, strlen( &sep[1] ));
(unsigned char *) bvalue.bv_val, strlen( &sep[1] ));
if (bvalue.bv_len == (ber_len_t)-1) {
fprintf(stderr, _("base64 decode error\n"));

View File

@ -1600,7 +1600,8 @@ static void print_ctrls(
b64->bv_val = ber_memalloc( b64->bv_len + 1 );
b64->bv_len = lutil_b64_ntop(
ctrls[i]->ldctl_value.bv_val, ctrls[i]->ldctl_value.bv_len,
(unsigned char *) ctrls[i]->ldctl_value.bv_val,
ctrls[i]->ldctl_value.bv_len,
b64->bv_val, b64->bv_len );
}

View File

@ -128,7 +128,7 @@ ber_skip_tag( BerElement *ber, ber_len_t *len )
return LBER_DEFAULT;
}
if( (unsigned) ber_read( ber, netlen, noctets ) != noctets ) {
if( (unsigned) ber_read( ber, (char *) netlen, noctets ) != noctets ) {
return LBER_DEFAULT;
}

View File

@ -83,7 +83,7 @@ ber_put_tag(
}
rc = ber_write( ber,
&nettag[sizeof(ber_tag_t) - taglen],
(char *) &nettag[sizeof(ber_tag_t) - taglen],
taglen, nosos );
return rc;
@ -165,7 +165,7 @@ ber_put_len( BerElement *ber, ber_len_t len, int nosos )
/* write the length itself */
rc = ber_write( ber,
&netlen[sizeof(ber_len_t)-i],
(char *) &netlen[sizeof(ber_len_t)-i],
i, nosos );
return rc == i ? i+1 : -1;
@ -230,7 +230,7 @@ ber_put_int_or_enum(
}
rc = ber_write( ber,
&netnum[sizeof(ber_int_t) - i],
(char *) &netnum[sizeof(ber_int_t) - i],
i, 0 );
/* length of tag + length + contents */
@ -569,7 +569,7 @@ ber_put_seqorset( BerElement *ber )
/* the length itself */
rc = ber_write( ber,
&netlen[sizeof(ber_len_t) - (FOUR_BYTE_LEN-1)],
(char *) &netlen[sizeof(ber_len_t) - (FOUR_BYTE_LEN-1)],
FOUR_BYTE_LEN-1, 1 );
if( rc != FOUR_BYTE_LEN - 1 ) {

View File

@ -211,8 +211,8 @@ sb_sasl_drop_packet ( Sockbuf_Buf *sec_buf_in, unsigned max, int debuglevel )
sec_buf_in->buf_end, len );
if ( len >= 4 ) {
sec_buf_in->buf_end = sb_sasl_pkt_length( sec_buf_in->buf_base,
max, debuglevel);
sec_buf_in->buf_end = sb_sasl_pkt_length(
(unsigned char *) sec_buf_in->buf_base, max, debuglevel);
}
else {
sec_buf_in->buf_end = 0;
@ -260,7 +260,7 @@ sb_sasl_read( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
}
/* The new packet always starts at p->sec_buf_in.buf_base */
ret = sb_sasl_pkt_length( p->sec_buf_in.buf_base,
ret = sb_sasl_pkt_length( (unsigned char *) p->sec_buf_in.buf_base,
*p->sasl_maxbuf, sbiod->sbiod_sb->sb_debug );
/* Grow the packet buffer if neccessary */

View File

@ -29,7 +29,7 @@
/* parsing/printing routines */
static int str2strval( const char *str, ber_len_t stoplen, struct berval *val,
const char **next, unsigned flags, unsigned *retFlags, void *ctx );
const char **next, unsigned flags, int *retFlags, void *ctx );
static int DCE2strval( const char *str, struct berval *val,
const char **next, unsigned flags, void *ctx );
static int IA52strval( const char *str, struct berval *val,
@ -1439,7 +1439,7 @@ return_result:;
* '\' + HEXPAIR(p) -> unhex(p)
*/
static int
str2strval( const char *str, ber_len_t stoplen, struct berval *val, const char **next, unsigned flags, unsigned *retFlags, void *ctx )
str2strval( const char *str, ber_len_t stoplen, struct berval *val, const char **next, unsigned flags, int *retFlags, void *ctx )
{
const char *p, *end, *startPos, *endPos = NULL;
ber_len_t len, escapes;
@ -3459,7 +3459,7 @@ get_oid: newAVA->la_attr.bv_val = oidptr;
}
}
}
Val.bv_val = str->data;
Val.bv_val = (char *) str->data;
Val.bv_len = str->length;
switch( str->type ) {
case V_ASN1_UNIVERSALSTRING:

View File

@ -234,7 +234,7 @@ ldap_pvt_tls_init_def_ctx( void )
}
SSL_CTX_set_session_id_context( tls_def_ctx,
"OpenLDAP", sizeof("OpenLDAP")-1 );
(const unsigned char *) "OpenLDAP", sizeof("OpenLDAP")-1 );
if ( tls_opt_ciphersuite &&
!SSL_CTX_set_cipher_list( tls_def_ctx, ciphersuite ) )
@ -1037,7 +1037,7 @@ ldap_pvt_tls_check_hostname( LDAP *ld, void *s, const char *name_in )
if (gn->type == GEN_DNS) {
if (ntype != IS_DNS) continue;
sn = ASN1_STRING_data(gn->d.ia5);
sn = (char *) ASN1_STRING_data(gn->d.ia5);
sl = ASN1_STRING_length(gn->d.ia5);
/* Is this an exact match? */
@ -1061,7 +1061,7 @@ ldap_pvt_tls_check_hostname( LDAP *ld, void *s, const char *name_in )
} else if (gn->type == GEN_IPADD) {
if (ntype == IS_DNS) continue;
sn = ASN1_STRING_data(gn->d.ia5);
sn = (char *) ASN1_STRING_data(gn->d.ia5);
sl = ASN1_STRING_length(gn->d.ia5);
#ifdef LDAP_PF_INET6

View File

@ -135,7 +135,7 @@ int ldap_utf8_charlen2( const char * p )
/* conv UTF-8 to UCS-4, useful for comparisons */
ldap_ucs4_t ldap_x_utf8_to_ucs4( const char * p )
{
const unsigned char *c = p;
const unsigned char *c = (const unsigned char *) p;
ldap_ucs4_t ch;
int len, i;
static unsigned char mask[] = {
@ -163,7 +163,7 @@ ldap_ucs4_t ldap_x_utf8_to_ucs4( const char * p )
int ldap_x_ucs4_to_utf8( ldap_ucs4_t c, char *buf )
{
int len=0;
unsigned char* p = buf;
unsigned char* p = (unsigned char *) buf;
/* not a valid Unicode character */
if ( c < 0 ) return 0;
@ -298,7 +298,7 @@ ldap_ucs_to_utf8s( struct berval *ucs, int csize, struct berval *utf8s )
char* ldap_utf8_next( const char * p )
{
int i;
const unsigned char *u = p;
const unsigned char *u = (const unsigned char *) p;
if( LDAP_UTF8_ISASCII(u) ) {
return (char *) &p[1];
@ -325,7 +325,7 @@ char* ldap_utf8_next( const char * p )
char* ldap_utf8_prev( const char * p )
{
int i;
const unsigned char *u = p;
const unsigned char *u = (const unsigned char *) p;
for( i=-1; i>-6 ; i-- ) {
if ( ( u[i] & 0xc0 ) != 0x80 ) {
@ -349,7 +349,7 @@ char* ldap_utf8_prev( const char * p )
int ldap_utf8_copy( char* dst, const char *src )
{
int i;
const unsigned char *u = src;
const unsigned char *u = (const unsigned char *) src;
dst[0] = src[0];

View File

@ -122,7 +122,7 @@ int lutil_entropy( unsigned char *buf, ber_len_t nbytes )
for( n = 0; n < nbytes; n += 16 ) {
struct lutil_MD5Context ctx;
char digest[16];
unsigned char digest[16];
/* poor resolution */
#ifdef HAVE_GETTIMEOFDAY

View File

@ -343,7 +343,7 @@ struct berval * lutil_passwd_generate( ber_len_t len )
return NULL;
}
if( lutil_entropy( pw->bv_val, pw->bv_len) < 0 ) {
if( lutil_entropy( (unsigned char *) pw->bv_val, pw->bv_len) < 0 ) {
ber_bvfree( pw );
return NULL;
}
@ -442,7 +442,7 @@ static struct berval * pw_string64(
AC_MEMCPY(b64->bv_val, sc->bv_val, sc->bv_len);
rc = lutil_b64_ntop(
string.bv_val, string.bv_len,
(unsigned char *) string.bv_val, string.bv_len,
&b64->bv_val[sc->bv_len], b64len );
if( salt ) ber_memfree( string.bv_val );
@ -1046,16 +1046,16 @@ static struct berval *hash_ssha1(
{
lutil_SHA1_CTX SHA1context;
unsigned char SHA1digest[LUTIL_SHA1_BYTES];
unsigned char saltdata[4];
char saltdata[4];
struct berval digest;
struct berval salt;
digest.bv_val = SHA1digest;
digest.bv_val = (char *) SHA1digest;
digest.bv_len = sizeof(SHA1digest);
salt.bv_val = saltdata;
salt.bv_len = sizeof(saltdata);
if( lutil_entropy( salt.bv_val, salt.bv_len) < 0 ) {
if( lutil_entropy( (unsigned char *) salt.bv_val, salt.bv_len) < 0 ) {
return NULL;
}
@ -1077,7 +1077,7 @@ static struct berval *hash_sha1(
lutil_SHA1_CTX SHA1context;
unsigned char SHA1digest[LUTIL_SHA1_BYTES];
struct berval digest;
digest.bv_val = SHA1digest;
digest.bv_val = (char *) SHA1digest;
digest.bv_len = sizeof(SHA1digest);
lutil_SHA1Init( &SHA1context );
@ -1096,16 +1096,16 @@ static struct berval *hash_smd5(
{
lutil_MD5_CTX MD5context;
unsigned char MD5digest[LUTIL_MD5_BYTES];
unsigned char saltdata[4];
char saltdata[4];
struct berval digest;
struct berval salt;
digest.bv_val = MD5digest;
digest.bv_val = (char *) MD5digest;
digest.bv_len = sizeof(MD5digest);
salt.bv_val = saltdata;
salt.bv_len = sizeof(saltdata);
if( lutil_entropy( salt.bv_val, salt.bv_len) < 0 ) {
if( lutil_entropy( (unsigned char *) salt.bv_val, salt.bv_len) < 0 ) {
return NULL;
}
@ -1129,7 +1129,7 @@ static struct berval *hash_md5(
struct berval digest;
digest.bv_val = MD5digest;
digest.bv_val = (char *) MD5digest;
digest.bv_len = sizeof(MD5digest);
lutil_MD5Init( &MD5context );
@ -1298,11 +1298,11 @@ static struct berval *hash_crypt(
/* copy the salt we made into entropy before snprintfing
it back into the salt */
char entropy[sizeof(salt)];
strcpy( entropy, salt );
snprintf( salt, sizeof(entropy), salt_format, entropy );
strcpy( entropy, (char *) salt );
snprintf( (char *) salt, sizeof(entropy), salt_format, entropy );
}
hash.bv_val = crypt( passwd->bv_val, salt );
hash.bv_val = crypt( passwd->bv_val, (char *) salt );
if( hash.bv_val == NULL ) return NULL;

View File

@ -641,11 +641,11 @@ int entry_decode(struct berval *bv, Entry **e)
i = entry_getlen(&ptr);
x = ch_calloc(1, i);
i = entry_getlen(&ptr);
x->e_name.bv_val = ptr;
x->e_name.bv_val = (char *) ptr;
x->e_name.bv_len = i;
ptr += i+1;
i = entry_getlen(&ptr);
x->e_nname.bv_val = ptr;
x->e_nname.bv_val = (char *) ptr;
x->e_nname.bv_len = i;
ptr += i+1;
#ifdef NEW_LOGGING
@ -667,7 +667,7 @@ int entry_decode(struct berval *bv, Entry **e)
while ((i = entry_getlen(&ptr))) {
struct berval bv;
bv.bv_len = i;
bv.bv_val = ptr;
bv.bv_val = (char *) ptr;
if (a) {
a->a_next = (Attribute *)bptr;
}