C translator portability changes (ITS#1609)

This commit is contained in:
Kurt Zeilenga 2002-02-23 23:47:37 +00:00
parent 6d9307b534
commit d50eb2e959
6 changed files with 32 additions and 10 deletions

View File

@ -601,11 +601,12 @@ ldap_dnfree( LDAPDN *dn )
int
ldap_str2dn( LDAP_CONST char *str, LDAPDN **dn, unsigned flags )
{
struct berval bv = { 0, (char *)str };
struct berval bv;
assert( str );
bv.bv_len = strlen( str );
bv.bv_val = (char *) str;
return ldap_bv2dn( &bv, dn, flags );
}
@ -687,7 +688,9 @@ ldap_bv2dn( struct berval *bv, LDAPDN **dn, unsigned flags )
for ( ; p < end; p++ ) {
int err;
struct berval tmpbv = { bv->bv_len - ( p - str ), (char *)p };
struct berval tmpbv;
tmpbv.bv_len = bv->bv_len - ( p - str );
tmpbv.bv_val = (char *)p;
err = ldap_bv2rdn( &tmpbv, &newRDN, (char **) &p, flags );
if ( err != LDAP_SUCCESS ) {
@ -815,12 +818,13 @@ int
ldap_str2rdn( LDAP_CONST char *str, LDAPRDN **rdn,
char **n_in, unsigned flags )
{
struct berval bv = { 0, (char *)str };
struct berval bv;
assert( str );
assert( str[ 0 ] != '\0' ); /* FIXME: is this required? */
bv.bv_len = strlen( str );
bv.bv_val = (char *) str;
return ldap_bv2rdn( &bv, rdn, n_in, flags );
}

View File

@ -845,10 +845,13 @@ acl_mask(
if ( b->a_group_pat.bv_len && op->o_ndn.bv_len ) {
char buf[1024];
struct berval bv = { sizeof(buf) - 1, buf };
struct berval bv;
struct berval ndn = { 0, NULL };
int rc;
bv.bv_len = sizeof(buf) - 1;
bv.bv_val = buf;
/* b->a_group is an unexpanded entry name, expanded it should be an
* entry with objectclass group* and we test to see if odn is one of
* the values in the attribute group
@ -1823,9 +1826,12 @@ regex_matches(
{
regex_t re;
char newbuf[512];
struct berval bv = {sizeof(newbuf), newbuf};
struct berval bv;
int rc;
bv.bv_len = sizeof(newbuf);
bv.bv_val = newbuf;
if(str == NULL) str = "";
string_expand(&bv, pat, buf, matches);

View File

@ -296,8 +296,12 @@ glue_back_search (
long stoptime = 0;
struct berval bv;
glue_state gs = {0};
slap_callback cb = {glue_back_response, glue_back_sresult,
glue_back_sendentry, &gs};
slap_callback cb;
cb.sc_response = glue_back_response;
cb.sc_sresult = glue_back_sresult;
cb.sc_sendentry = glue_back_sendentry;
cb.sc_private = &gs;
gs.prevcb = op->o_callback;

View File

@ -590,7 +590,9 @@ int entry_decode(struct berval *bv, Entry **e)
a = NULL;
while (i = entry_getlen(&ptr)) {
struct berval bv = { i, ptr };
struct berval bv;
bv.bv_len = i;
bv.bv_val = ptr;
if (a) {
a->a_next = (Attribute *)bptr;
}

View File

@ -119,9 +119,12 @@ set_chase (SLAP_SET_GATHER gatherer,
{
BerVarray vals, nset;
char attrstr[32];
struct berval bv = {attr->bv_len, attrstr};
struct berval bv;
int i;
bv.bv_len = attr->bv_len;
bv.bv_val = attrstr;
if (set == NULL)
return(ch_calloc(1, sizeof(struct berval)));

View File

@ -53,7 +53,10 @@ main( int argc, char **argv )
while( ldif_read_record( ldiffp, &lineno, &buf, &lmax ) ) {
Entry *e = str2entry( buf );
struct berval bvtext = { textlen, textbuf };
struct berval bvtext;
bvtext.bv_len = textlen;
bvtext.bv_val = textbuf;
if( e == NULL ) {
fprintf( stderr, "%s: could not parse entry (line=%d)\n",