X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblunicode%2Fucstr.c;h=53b1ed349f01ee6d00acae2f925f6dd13828d9ed;hb=a3b73b50ce35cf0f7091eb03c491c74a5b79a3f1;hp=69fce783f8efc4f0646b715460ce3ec7864b5094;hpb=873a6802ab10898929cb9c0cc944d99beac56c3f;p=openldap diff --git a/libraries/liblunicode/ucstr.c b/libraries/liblunicode/ucstr.c index 69fce783f8..53b1ed349f 100644 --- a/libraries/liblunicode/ucstr.c +++ b/libraries/liblunicode/ucstr.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2002 The OpenLDAP Foundation + * Copyright 2000-2003 The OpenLDAP Foundation * COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory * of this package for details. */ @@ -15,9 +15,9 @@ #include #include -#define malloc(x) ber_memalloc(x) -#define realloc(x,y) ber_memrealloc(x,y) -#define free(x) ber_memfree(x) +#define malloc(x) ber_memalloc_x(x,ctx) +#define realloc(x,y) ber_memrealloc_x(x,y,ctx) +#define free(x) ber_memfree_x(x,ctx) int ucstrncmp( const ldap_unicode_t *u1, @@ -95,7 +95,8 @@ void ucstr2upper( struct berval * UTF8bvnormalize( struct berval *bv, struct berval *newbv, - unsigned flags ) + unsigned flags, + void *ctx ) { int i, j, len, clen, outpos, ucsoutlen, outsize, last; char *out, *outtmp, *s; @@ -114,7 +115,7 @@ struct berval * UTF8bvnormalize( len = bv->bv_len; if ( len == 0 ) { - return ber_dupbv( newbv, bv ); + return ber_dupbv_x( newbv, bv, ctx ); } /* FIXME: Should first check to see if string is already in @@ -146,7 +147,7 @@ struct berval * UTF8bvnormalize( } if ( i == len ) { - return ber_str2bv( s, len, 1, newbv ); + return ber_str2bv_x( s, len, 1, newbv, ctx ); } outsize = len + 7; @@ -212,7 +213,7 @@ struct berval * UTF8bvnormalize( p++; } /* normalize ucs of length p - ucs */ - uccompatdecomp( ucs, p - ucs, &ucsout, &ucsoutlen ); + uccompatdecomp( ucs, p - ucs, &ucsout, &ucsoutlen, ctx ); if ( approx ) { for ( j = 0; j < ucsoutlen; j++ ) { if ( ucsout[j] < 0x80 ) { @@ -273,7 +274,8 @@ struct berval * UTF8bvnormalize( int UTF8bvnormcmp( struct berval *bv1, struct berval *bv2, - unsigned flags ) + unsigned flags, + void *ctx ) { int i, l1, l2, len, ulen, res = 0; char *s1, *s2, *done; @@ -376,7 +378,7 @@ int UTF8bvnormcmp( return l1 > l2 ? 1 : -1; /* what to do??? */ } } else { - uccompatdecomp( ucs, ulen, &ucsout1, &l1 ); + uccompatdecomp( ucs, ulen, &ucsout1, &l1, ctx ); l1 = uccanoncomp( ucsout1, l1 ); } @@ -395,7 +397,7 @@ int UTF8bvnormcmp( ucsout2 = ucs; l2 = ulen; } else { - uccompatdecomp( ucs, ulen, &ucsout2, &l2 ); + uccompatdecomp( ucs, ulen, &ucsout2, &l2, ctx ); l2 = uccanoncomp( ucsout2, l2 ); free( ucs ); }