X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fcharset.c;h=75c30ff9d96f007796ffdc5306e0cc5a323d0eb9;hb=8482d2b4889b32f70c51144ac73423dd4e8ddc14;hp=1052c19ab6880c0bf659fb3e1fcce8b592d1d250;hpb=b6d85256e7d42ced89f2aead107c38eaea810a05;p=openldap diff --git a/libraries/libldap/charset.c b/libraries/libldap/charset.c index 1052c19ab6..75c30ff9d9 100644 --- a/libraries/libldap/charset.c +++ b/libraries/libldap/charset.c @@ -14,7 +14,8 @@ #ifdef STR_TRANSLATION #include -#include + +#include #include #include @@ -53,7 +54,7 @@ ldap_enable_translation( LDAP *ld, LDAPMessage *entry, int enable ) int -ldap_translate_from_t61( LDAP *ld, char **bufp, unsigned long *lenp, +ldap_translate_from_t61( LDAP *ld, char **bufp, ber_len_t *lenp, int free_input ) { if ( ld->ld_lber_decode_translate_proc == 0 ) { @@ -65,7 +66,7 @@ ldap_translate_from_t61( LDAP *ld, char **bufp, unsigned long *lenp, int -ldap_translate_to_t61( LDAP *ld, char **bufp, unsigned long *lenp, +ldap_translate_to_t61( LDAP *ld, char **bufp, ber_len_t *lenp, int free_input ) { if ( ld->ld_lber_encode_translate_proc == 0 ) { @@ -147,7 +148,7 @@ ldap_translate_to_t61( LDAP *ld, char **bufp, unsigned long *lenp, #include -#include +#include #include /* Character set used: ISO 8859-1, ISO 8859-2, ISO 8859-3, ... */ @@ -1021,12 +1022,12 @@ c_to_cc( Byte *o, const Couple *cc, Byte c ) /* --- routine to convert from T.61 to ISO 8859-n --- */ int -ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input ) +ldap_t61_to_8859( char **bufp, ber_len_t *buflenp, int free_input ) { Byte *s, *oo, *o; unsigned int n; int c; - unsigned long len; + ber_len_t len; Debug( LDAP_DEBUG_TRACE, "ldap_t61_to_8859 input length: %ld\n", *buflenp, 0, 0 ); @@ -1034,7 +1035,7 @@ ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input ) len = *buflenp; s = (Byte *) *bufp; - if ( (o = oo = (Byte *)malloc( 2 * len + 64 )) == NULL ) { + if ( (o = oo = (Byte *)LDAP_MALLOC( 2 * len + 64 )) == NULL ) { return( 1 ); } @@ -1136,13 +1137,13 @@ ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input ) len = o - oo; o = oo; - if ( (oo = (Byte *)realloc( o, len )) == NULL ) { - free( o ); + if ( (oo = (Byte *)LDAP_REALLOC( o, len )) == NULL ) { + LDAP_FREE( o ); return( 1 ); } if ( free_input ) { - free( *bufp ); + LDAP_FREE( *bufp ); } *bufp = (char *) oo; *buflenp = len; @@ -1558,11 +1559,11 @@ cc_to_t61( Byte *o, const Byte *s ) /* --- routine to convert from ISO 8859-n to T.61 --- */ int -ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input ) +ldap_8859_to_t61( char **bufp, ber_len_t *buflenp, int free_input ) { Byte *s, *oo, *o, *aux; int c; - unsigned long len; + ber_len_t len; const Couple *cc; Debug( LDAP_DEBUG_TRACE, "ldap_8859_to_t61 input length: %ld\n", @@ -1571,7 +1572,7 @@ ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input ) len = *buflenp; s = (Byte *) *bufp; - if ( (o = oo = (Byte *)malloc( 2 * len + 64 )) == NULL ) { + if ( (o = oo = (Byte *)LDAP_MALLOC( 2 * len + 64 )) == NULL ) { return( 1 ); } @@ -1650,13 +1651,13 @@ ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input ) len = o - oo; o = oo; - if ( (oo = (Byte *)realloc( o, len )) == NULL ) { - free( o ); + if ( (oo = (Byte *)LDAP_REALLOC( o, len )) == NULL ) { + LDAP_FREE( o ); return( 1 ); } if ( free_input ) { - free( *bufp ); + LDAP_FREE( *bufp ); } *bufp = (char *) oo; *buflenp = len; @@ -1694,7 +1695,7 @@ const Byte *s; Byte *o, *oo; Byte n; - if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) { + if ( (o = oo = (Byte *)LDAP_MALLOC( 2 * strlen( s ) + 64 )) == NULL ) { return( NULL ); } @@ -1713,8 +1714,8 @@ const Byte *s; o = oo; - if ( (oo = (Byte *)realloc( o, strlen( o ) + 1 )) == NULL ) { - free( o ); + if ( (oo = (Byte *)LDAP_REALLOC( o, strlen( o ) + 1 )) == NULL ) { + LDAP_FREE( o ); return( NULL ); } @@ -1748,7 +1749,7 @@ Byte *s; Byte n; const Couple *cc; - if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) { + if ( (o = oo = (Byte *)LDAP_MALLOC( 2 * strlen( s ) + 64 )) == NULL ) { return( NULL ); } @@ -1791,8 +1792,8 @@ Byte *s; o = oo; - if ( (oo = (Byte *)realloc( o, strlen( o ) + 1 )) == NULL ) { - free( o ); + if ( (oo = (Byte *)LDAP_REALLOC( o, strlen( o ) + 1 )) == NULL ) { + LDAP_FREE( o ); return( NULL ); }