From: Howard Chu Date: Thu, 11 Apr 2002 08:47:37 +0000 (+0000) Subject: ITS#1732 signed/unsigned fixes X-Git-Tag: OPENLDAP_REL_ENG_2_MP~224 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bb17493d31e19c47bc3a906a39ffa3d57e28aaa4;p=openldap ITS#1732 signed/unsigned fixes --- diff --git a/libraries/liblber/encode.c b/libraries/liblber/encode.c index 9affa46c67..50eb6b5f92 100644 --- a/libraries/liblber/encode.c +++ b/libraries/liblber/encode.c @@ -45,7 +45,7 @@ static int ber_put_int_or_enum LDAP_P(( ber_tag_t tag )); -static ber_len_t +static int ber_calc_taglen( ber_tag_t tag ) { int i; @@ -68,8 +68,8 @@ ber_put_tag( int nosos ) { int rc; - ber_len_t taglen; - ber_len_t i; + int taglen; + int i; unsigned char nettag[sizeof(ber_tag_t)]; assert( ber != NULL ); @@ -178,8 +178,8 @@ ber_put_int_or_enum( ber_tag_t tag ) { int rc; - int i, j, sign; - ber_len_t len, lenlen, taglen; + int i, j, sign, taglen, lenlen; + ber_len_t len; ber_uint_t unum, mask; unsigned char netnum[sizeof(ber_uint_t)]; @@ -276,8 +276,7 @@ ber_put_ostring( ber_len_t len, ber_tag_t tag ) { - ber_len_t taglen, lenlen; - int rc; + int taglen, lenlen, rc; assert( ber != NULL ); assert( str != NULL ); @@ -339,7 +338,8 @@ ber_put_bitstring( ber_len_t blen /* in bits */, ber_tag_t tag ) { - ber_len_t taglen, lenlen, len; + int taglen, lenlen; + ber_len_t len; unsigned char unusedbits; assert( ber != NULL ); @@ -376,7 +376,7 @@ ber_put_bitstring( int ber_put_null( BerElement *ber, ber_tag_t tag ) { - ber_len_t taglen; + int taglen; assert( ber != NULL ); assert( LBER_VALID( ber ) ); @@ -402,7 +402,7 @@ ber_put_boolean( ber_int_t boolval, ber_tag_t tag ) { - ber_len_t taglen; + int taglen; unsigned char c; assert( ber != NULL ); @@ -497,7 +497,8 @@ ber_put_seqorset( BerElement *ber ) int rc; ber_len_t len; unsigned char netlen[sizeof(ber_len_t)]; - ber_len_t taglen, lenlen; + int taglen; + ber_len_t lenlen; unsigned char ltag = 0x80U + FOUR_BYTE_LEN - 1; Seqorset *next; Seqorset **sos = &ber->ber_sos; @@ -579,7 +580,7 @@ ber_put_seqorset( BerElement *ber ) (*sos)->sos_ber->ber_ptr += len; } else { - ber_len_t i; + int i; unsigned char nettag[sizeof(ber_tag_t)]; ber_tag_t tmptag = (*sos)->sos_tag; diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index e9c1bac4f4..95dc49b79e 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -514,7 +514,7 @@ ber_get_next( /* Now look for the length */ if (*ber->ber_ptr & 0x80) { /* multi-byte */ int llen = *(unsigned char *)ber->ber_ptr++ & 0x7f; - if (llen > sizeof(ber_len_t)) { + if (llen > (int)sizeof(ber_len_t)) { errno = ERANGE; return LBER_DEFAULT; } diff --git a/libraries/libldap/cache.c b/libraries/libldap/cache.c index b9d4747438..ccfc763092 100644 --- a/libraries/libldap/cache.c +++ b/libraries/libldap/cache.c @@ -496,7 +496,7 @@ ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request ) ld->ld_cache->lc_memused -= msg_size( m ); ldap_msgfree( m ); } else { - if ( m->lm_msgtype == (int)msgtype && + if ( m->lm_msgtype == msgtype && request_cmp( m->lm_ber, &reqber ) == 0 ) { break; } diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 5c018ca7b8..3c4d2347f7 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -899,7 +899,8 @@ ldap_chase_referrals( LDAP *ld, int sref, int *hadrefp ) { - int rc, count, len; + int rc, count; + unsigned len; char *p, *ref, *unfollowed; LDAPRequest *origreq; LDAPURLDesc *srv; diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index 781b5e0340..c99e2a84ff 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -888,7 +888,7 @@ static ber_tag_t build_result_ber( LDAP *ld, BerElement **bp, LDAPRequest *lr ) { ber_len_t len; - ber_int_t tag; + ber_tag_t tag; ber_int_t along; BerElement *ber; diff --git a/libraries/libldap/schema.c b/libraries/libldap/schema.c index 783c6127fc..4fd83bc4bd 100644 --- a/libraries/libldap/schema.c +++ b/libraries/libldap/schema.c @@ -2341,7 +2341,7 @@ static char *const err2text[] = { char * ldap_scherr2str(int code) { - if ( code < 0 || code >= (sizeof(err2text)/sizeof(char *)) ) { + if ( code < 0 || code >= (int)(sizeof(err2text)/sizeof(char *)) ) { return "Unknown error"; } else { return err2text[code]; diff --git a/libraries/libldap/utf-8-conv.c b/libraries/libldap/utf-8-conv.c index bb977a3f3c..9b51bcd6f6 100644 --- a/libraries/libldap/utf-8-conv.c +++ b/libraries/libldap/utf-8-conv.c @@ -87,7 +87,7 @@ ldap_x_utf8_to_wc ( wchar_t *wchar, const char *utf8char ) /* Get UTF-8 sequence length from 1st byte */ utflen = LDAP_UTF8_CHARLEN2(utf8char, utflen); - if( utflen==0 || utflen > LDAP_MAX_UTF8_LEN ) + if( utflen==0 || utflen > (int)LDAP_MAX_UTF8_LEN ) return -1; /* Invalid input */ /* First byte minus length tag */ @@ -132,7 +132,7 @@ ldap_x_utf8s_to_wcs ( wchar_t *wcstr, const char *utf8str, size_t count ) /* Get UTF-8 sequence length from 1st byte */ utflen = LDAP_UTF8_CHARLEN2(utf8str, utflen); - if( utflen==0 || utflen > LDAP_MAX_UTF8_LEN ) + if( utflen==0 || utflen > (int)LDAP_MAX_UTF8_LEN ) return -1; /* Invalid input */ /* First byte minus length tag */ diff --git a/libraries/liblunicode/ure/ure.c b/libraries/liblunicode/ure/ure.c index b855584a40..f546354199 100644 --- a/libraries/liblunicode/ure/ure.c +++ b/libraries/liblunicode/ure/ure.c @@ -2044,7 +2044,7 @@ ure_exec(ure_dfa_t dfa, int flags, ucs2_t *text, unsigned long textlen, } if (matched) { - if (ms == ~0) + if (ms == ~0UL) ms = lp - text; else me = sp - text; @@ -2119,5 +2119,5 @@ ure_exec(ure_dfa_t dfa, int flags, ucs2_t *text, unsigned long textlen, *match_start = ms; *match_end = me; - return (ms != ~0) ? 1 : 0; + return (ms != ~0UL) ? 1 : 0; } diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 5cf49a7464..ee9282310c 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -632,7 +632,7 @@ static int chk_sasl( const struct berval * passwd, const struct berval * cred ) { - int i; + unsigned int i; int rtn; for( i=0; ibv_len; i++) { @@ -681,7 +681,7 @@ static int chk_kerberos( const struct berval * passwd, const struct berval * cred ) { - int i; + unsigned int i; int rtn; for( i=0; ibv_len; i++) { @@ -855,7 +855,7 @@ static int chk_crypt( const struct berval * cred ) { char *cr; - int i; + unsigned int i; for( i=0; ibv_len; i++) { if(cred->bv_val[i] == '\0') { @@ -897,7 +897,7 @@ static int chk_unix( const struct berval * passwd, const struct berval * cred ) { - int i; + unsigned int i; char *pw,*cr; for( i=0; ibv_len; i++) { @@ -1196,7 +1196,7 @@ static struct berval *hash_crypt( { struct berval hash; unsigned char salt[32]; /* salt suitable for most anything */ - int i; + unsigned int i; for( i=0; ibv_len; i++) { if(passwd->bv_val[i] == '\0') {