int i, rc;
MDB_cursor *mc;
MDB_val key, data;
+ struct berval bdata;
const char *text;
AttributeDescription *ad;
rc = mdb_cursor_get( mc, &key, &data, MDB_SET );
while ( rc == MDB_SUCCESS ) {
+ bdata.bv_len = data.mv_size;
+ bdata.bv_val = data.mv_data;
ad = NULL;
- rc = slap_bv2ad( (struct berval *)&data, &ad, &text );
+ rc = slap_bv2ad( &bdata, &ad, &text );
if ( rc ) {
- rc = slap_bv2undef_ad( (struct berval *)&data, &mdb->mi_ads[i], &text, 0 );
+ rc = slap_bv2undef_ad( &bdata, &mdb->mi_ads[i], &text, 0 );
} else {
mdb->mi_adxs[ad->ad_index] = i;
mdb->mi_ads[i] = ad;
int mdb_ad_get( struct mdb_info *mdb, MDB_txn *txn, AttributeDescription *ad )
{
int i, rc;
- MDB_val key;
+ MDB_val key, val;
rc = mdb_ad_read( mdb, txn );
if (rc)
i = mdb->mi_numads+1;
key.mv_size = sizeof(int);
key.mv_data = &i;
+ val.mv_size = ad->ad_cname.bv_len;
+ val.mv_data = ad->ad_cname.bv_val;
- rc = mdb_put( txn, mdb->mi_ad2id, &key, (MDB_val *)&ad->ad_cname, 0 );
+ rc = mdb_put( txn, mdb->mi_ad2id, &key, &val, 0 );
if ( rc == MDB_SUCCESS ) {
mdb->mi_adxs[ad->ad_index] = i;
mdb->mi_ads[i] = ad;
"DESC 'Attribute index parameters' "
"EQUALITY caseIgnoreMatch "
"SYNTAX OMsDirectoryString )", NULL, NULL },
- { "maxreaders", "num", 2, 2, 0, ARG_INT|ARG_MAGIC|MDB_MAXREADERS,
+ { "maxreaders", "num", 2, 2, 0, ARG_UINT|ARG_MAGIC|MDB_MAXREADERS,
mdb_cf_gen, "( OLcfgDbAt:12.1 NAME 'olcDbMaxReaders' "
"DESC 'Maximum number of threads that may access the DB concurrently' "
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
rc = mdb_cursor_get( cursor, &key, &data, MDB_SET );
if ( rc == 0 ) {
- unsigned long dkids;
+ size_t dkids;
rc = mdb_cursor_count( cursor, &dkids );
if ( rc == 0 ) {
if ( dkids < 2 ) rc = MDB_NOTFOUND;
memcpy(&lo, data.mv_data, sizeof(ID));
if ( lo != 0 ) {
/* not a range, count the number of items */
- unsigned long count;
+ size_t count;
rc = mdb_cursor_count( cursor, &count );
if ( rc != 0 ) {
err = "c_count";
static char presence_keyval[] = {0,0};
static struct berval presence_key[2] = {BER_BVC(presence_keyval), BER_BVNULL};
+static MDB_val presence_mdbkey[2] = {{1, presence_keyval}, {0, NULL}};
AttrInfo *mdb_index_mask(
Backend *be,
keyfunc = mdb_idl_delete_keys;
if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
- rc = keyfunc( mc, (MDB_val *)presence_key, id );
+ rc = keyfunc( mc, presence_mdbkey, id );
if( rc ) {
err = "presence";
goto done;