From: Hallvard Furuseth Date: Sun, 19 Jan 2003 13:10:17 +0000 (+0000) Subject: Fix LBER_ERROR vs. -1 confusion. X-Git-Tag: NO_SLAP_OP_BLOCKS~612 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1fbbc1181152a32c1b9b82342ad6d63034ec7fbb;p=openldap Fix LBER_ERROR vs. -1 confusion. --- diff --git a/clients/tools/ldapcompare.c b/clients/tools/ldapcompare.c index d3c7c06260..b357c6d09a 100644 --- a/clients/tools/ldapcompare.c +++ b/clients/tools/ldapcompare.c @@ -152,7 +152,7 @@ main( int argc, char **argv ) bvalue.bv_len = lutil_b64_pton( &sep[1], bvalue.bv_val, strlen( &sep[1] )); - if (bvalue.bv_len == -1) { + if (bvalue.bv_len == (ber_len_t)-1) { fprintf(stderr, "base64 decode error\n"); exit(-1); } diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index c18ae86fd8..e546287224 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -543,13 +543,13 @@ getNextPage: } err = ber_printf( seber, "{b}", abs(subentries) == 1 ? 0 : 1 ); - if ( err == LBER_ERROR ) { + if ( err == -1 ) { ber_free( seber, 1 ); fprintf( stderr, "Subentries control encoding error!\n" ); return EXIT_FAILURE; } - if ( ber_flatten2( seber, &c[i].ldctl_value, 0 ) == LBER_ERROR ) { + if ( ber_flatten2( seber, &c[i].ldctl_value, 0 ) == -1 ) { return EXIT_FAILURE; } @@ -594,7 +594,7 @@ getNextPage: return EXIT_FAILURE; } - if ( ber_flatten2( vrber, &c[i].ldctl_value, 0 ) == LBER_ERROR ) { + if ( ber_flatten2( vrber, &c[i].ldctl_value, 0 ) == -1 ) { return EXIT_FAILURE; } @@ -609,7 +609,7 @@ getNextPage: } ber_printf( prber, "{iO}", pageSize, &cookie ); - if ( ber_flatten2( prber, &c[i].ldctl_value, 0 ) == LBER_ERROR ) { + if ( ber_flatten2( prber, &c[i].ldctl_value, 0 ) == -1 ) { return EXIT_FAILURE; } diff --git a/doc/man/man3/lber-decode.3 b/doc/man/man3/lber-decode.3 index a01f04809e..0494010a43 100644 --- a/doc/man/man3/lber-decode.3 +++ b/doc/man/man3/lber-decode.3 @@ -336,7 +336,7 @@ as follows. .fi .SH ERRORS If an error occurs during decoding, generally these routines return -LBER_ERROR (\-1). +LBER_ERROR ((ber_tag_t)\-1). .LP .SH NOTES .LP diff --git a/doc/man/man3/lber-encode.3 b/doc/man/man3/lber-encode.3 index 07a19b1088..c9a1115074 100644 --- a/doc/man/man3/lber-encode.3 +++ b/doc/man/man3/lber-encode.3 @@ -62,7 +62,7 @@ applications that need more control than .BR ber_printf () provides. In general, these routines return the length of the element encoded, or -LBER_ERROR if an error occurred. +-1 if an error occurred. .LP The .BR ber_alloc_t () @@ -250,14 +250,14 @@ can be achieved like so: rc = ber_printf( ber, "{siiiib{v}}", dn, scope, ali, size, time, attrsonly, attrs ); - if( rc == LBER_ERROR ) { + if( rc == -1 ) { /* error */ } else { /* success */ } .fi .SH ERRORS -If an error occurs during encoding, generally these routines return LBER_ERROR. +If an error occurs during encoding, generally these routines return -1. .LP .SH NOTES .LP diff --git a/libraries/libldap/passwd.c b/libraries/libldap/passwd.c index 245e9e99c5..e1682c5a90 100644 --- a/libraries/libldap/passwd.c +++ b/libraries/libldap/passwd.c @@ -52,7 +52,7 @@ int ldap_parse_passwd( tag = ber_scanf( ber, "{o}", newpasswd ); ber_free( ber, 1 ); - if( tag == -1 ) { + if( tag == LBER_ERROR ) { rc = ld->ld_errno = LDAP_DECODING_ERROR; } } diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 47877341cf..f85c8b5c09 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -1135,7 +1135,7 @@ send_pagerequest_response( */ ber_printf( ber, "{iO}", tentries, &cookie ); - if ( ber_flatten2( ber, &ctrls[0]->ldctl_value, 0 ) == LBER_ERROR ) { + if ( ber_flatten2( ber, &ctrls[0]->ldctl_value, 0 ) == -1 ) { goto done; }