ITS#1732 signed/unsigned fixes

This commit is contained in:
Howard Chu 2002-04-11 08:47:37 +00:00
parent d4465e376f
commit bb17493d31
9 changed files with 28 additions and 26 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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];

View file

@ -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 */

View file

@ -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;
}

View file

@ -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; i<cred->bv_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; i<cred->bv_len; i++) {
@ -855,7 +855,7 @@ static int chk_crypt(
const struct berval * cred )
{
char *cr;
int i;
unsigned int i;
for( i=0; i<cred->bv_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; i<cred->bv_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; i<passwd->bv_len; i++) {
if(passwd->bv_val[i] == '\0') {