]> git.sur5r.net Git - openldap/commitdiff
Set ber_errno here and there.
authorKurt Zeilenga <kurt@openldap.org>
Mon, 6 Dec 1999 06:33:26 +0000 (06:33 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 6 Dec 1999 06:33:26 +0000 (06:33 +0000)
include/lber.h
libraries/liblber/encode.c
libraries/liblber/memory.c
libraries/liblber/options.c

index c1d0d82a57ebd2aa52e24adcee54c2628d960732..d85ec9f38b0758a512216faf16c7a96f1cb50140 100644 (file)
@@ -64,7 +64,7 @@ LDAP_BEGIN_DECL
  * as valid BER tags, and so it is safe to use them to report errors.  In
  * fact, any tag for which the following is true is invalid:
  */
-#define LBER_INVALID(t)     (((t) & (ber_tag_t) 0x080) \
+#define LBER_INVALID(t)     (((t) & (ber_tag_t) 0x080UL) \
        && (((t) & (ber_tag_t) ~ 0x0FF))
 
 #define LBER_ERROR                     ((ber_tag_t) -1)
index 5f3ad7da4c05f3bc17343bce294e661a9ca32a73..3003ddb3300357e97ec02f3fd45bd2eb0de1bd3a 100644 (file)
@@ -299,8 +299,7 @@ ber_put_ostring(
 #ifdef STR_TRANSLATION
        if ( len > 0 && ( ber->ber_options & LBER_TRANSLATE_STRINGS ) != 0 &&
            ber->ber_encode_translate_proc ) {
-               if ( (*(ber->ber_encode_translate_proc))( &str, &len, 0 )
-                   != 0 ) {
+               if ( (*(ber->ber_encode_translate_proc))( &str, &len, 0 ) != 0 ) {
                        return( -1 );
                }
                free_str = 1;
index 604e8ccc940cc49b0e442ced1cea018b599f27d5..5e1719ca6898278ce73821583bffb666b80f3939 100644 (file)
@@ -83,7 +83,6 @@ ber_memfree( void *p )
 
        assert( ber_int_memory_fns->bmf_free );
 
-               
        (*ber_int_memory_fns->bmf_free)( p );
 }
 
@@ -268,10 +267,12 @@ ber_bvdup(
        ber_int_options.lbo_valid = LBER_INITIALIZED;
 
        if( bv == NULL ) {
+               ber_errno = LBER_ERROR_PARAM;
                return NULL;
        }
 
        if(( new = LBER_MALLOC( sizeof(struct berval) )) == NULL ) {
+               ber_errno = LBER_ERROR_MEMORY;
                return NULL;
        }
 
@@ -282,6 +283,7 @@ ber_bvdup(
        }
 
        if(( new->bv_val = LBER_MALLOC( bv->bv_len + 1 )) == NULL ) {
+               ber_errno = LBER_ERROR_MEMORY;
                LBER_FREE( new );
                return NULL;
        }
@@ -312,6 +314,7 @@ ber_strdup( LDAP_CONST char *s )
        len = strlen( s ) + 1;
 
        if ( (p = LBER_MALLOC( len )) == NULL ) {
+               ber_errno = LBER_ERROR_MEMORY;
                return( NULL );
        }
 
index 27a1de0ac0952cba14a3f697dc542a5bfe51bf69..811867810de75ab6e77c74308bc9a8c00e60ca41 100644 (file)
@@ -29,6 +29,7 @@ ber_get_option(
 
        if(outvalue == NULL) {
                /* no place to get to */
+               ber_errno = LBER_ERROR_PARAM;
                return LBER_OPT_ERROR;
        }
 
@@ -38,6 +39,7 @@ ber_get_option(
                        return LBER_OPT_SUCCESS;
                }
 
+               ber_errno = LBER_ERROR_PARAM;
                return LBER_OPT_ERROR;
        }
 
@@ -69,6 +71,7 @@ ber_get_option(
 
        default:
                /* bad param */
+               ber_errno = LBER_ERROR_PARAM;
                break;
        }
 
@@ -96,6 +99,7 @@ ber_set_option(
                if(!( f->bmf_malloc && f->bmf_calloc
                        && f->bmf_realloc && f->bmf_free ))
                {
+                       ber_errno = LBER_ERROR_PARAM;
                        return LBER_OPT_ERROR;
                }
 
@@ -103,6 +107,7 @@ ber_set_option(
                        (*(f->bmf_malloc))(sizeof(BerMemoryFunctions));
 
                if ( ber_int_memory_fns == NULL ) {
+                       ber_errno = LBER_ERROR_MEMORY;
                        return LBER_OPT_ERROR;
                }
 
@@ -116,6 +121,7 @@ ber_set_option(
 
        if(invalue == NULL) {
                /* no place to set from */
+               ber_errno = LBER_ERROR_PARAM;
                return LBER_OPT_ERROR;
        }
 
@@ -129,6 +135,7 @@ ber_set_option(
                        return LBER_OPT_SUCCESS;
                }
 
+               ber_errno = LBER_ERROR_PARAM;
                return LBER_OPT_ERROR;
        }
 
@@ -160,6 +167,7 @@ ber_set_option(
 
        default:
                /* bad param */
+               ber_errno = LBER_ERROR_PARAM;
                break;
        }