rc = db->bdi_db->set_h_hash( db->bdi_db, bdb_db_hash );
#endif
rc = db->bdi_db->set_flags( db->bdi_db, DB_DUP | DB_DUPSORT );
- rc = db->bdi_db->set_dup_compare( db->bdi_db, bdb_bt_compare );
file = ch_malloc( strlen( name ) + sizeof(BDB_SUFFIX) );
sprintf( file, "%s" BDB_SUFFIX, name );
DB *db = bdb->bi_id2entry->bdi_db;
DBT key, data;
struct berval bv;
- int rc;
+ char buf[sizeof(ID)];
+ ID tmp;
+ int i, rc;
#ifdef BDB_HIER
struct berval odn, ondn;
e->e_nname = slap_empty_bv;
#endif
DBTzero( &key );
- key.data = (char *) &e->e_id;
+ key.data = buf;
key.size = sizeof(ID);
+ /* Set key in BigEndian order */
+ tmp = e->e_id;
+ for ( i=sizeof(ID)-1; i>=0; i-- ) {
+ buf[i] = tmp & 0xff;
+ tmp >>= 8;
+ }
+
rc = entry_encode( e, &bv );
#ifdef BDB_HIER
e->e_name = odn; e->e_nname = ondn;
DB *db = bdb->bi_id2entry->bdi_db;
DBT key, data;
struct berval bv;
- int rc = 0, ret = 0;
+ char buf[sizeof(ID)];
+ ID tmp;
+ int i, rc = 0, ret = 0;
*e = NULL;
DBTzero( &key );
- key.data = (char *) &id;
+ key.data = buf;
key.size = sizeof(ID);
+ tmp = id;
+ for ( i=sizeof(ID)-1; i>=0; i-- ) {
+ buf[i] = tmp & 0xff;
+ tmp >>= 8;
+ }
DBTzero( &data );
data.flags = DB_DBT_MALLOC;
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
DB *db = bdb->bi_id2entry->bdi_db;
DBT key;
- int rc;
+ char buf[sizeof(ID)];
+ ID tmp;
+ int i, rc;
DBTzero( &key );
- key.data = (char *) &e->e_id;
+ key.data = buf;
key.size = sizeof(ID);
+ tmp = e->e_id;
+ for ( i=sizeof(ID)-1; i>=0; i-- ) {
+ buf[i] = tmp & 0xff;
+ tmp >>= 8;
+ }
/* delete from database */
rc = db->del( db, tid, &key, 0 );
return 0;
}
-int
-bdb_bt_compare(
- DB *db,
- const DBT *usrkey,
- const DBT *curkey
-)
-{
- unsigned char *u, *c;
- int i, x;
-
- u = usrkey->data;
- c = curkey->data;
-
-#ifdef WORDS_BIGENDIAN
- for( i = 0; i < (int)sizeof(ID); i++)
-#else
- for( i = sizeof(ID)-1; i >= 0; i--)
-#endif
- {
- x = u[i] - c[i];
- if( x ) return x;
- }
-
- return 0;
-}
-
static int
bdb_db_open( BackendDB *be )
{
}
if( i == BDB_ID2ENTRY ) {
- rc = db->bdi_db->set_bt_compare( db->bdi_db,
- bdb_bt_compare );
rc = db->bdi_db->set_pagesize( db->bdi_db,
BDB_ID2ENTRY_PAGESIZE );
if ( slapMode & SLAP_TOOL_READMAIN ) {
rc = db->bdi_db->set_flags( db->bdi_db,
DB_DUP | DB_DUPSORT );
#ifndef BDB_HIER
- rc = db->bdi_db->set_dup_compare( db->bdi_db,
- bdb_bt_compare );
if ( slapMode & SLAP_TOOL_READONLY ) {
flags |= DB_RDONLY;
} else {
#else
rc = db->bdi_db->set_dup_compare( db->bdi_db,
bdb_dup_compare );
- rc = db->bdi_db->set_bt_compare( db->bdi_db,
- bdb_bt_compare );
if ( slapMode & (SLAP_TOOL_READONLY|SLAP_TOOL_READMAIN) ) {
flags |= DB_RDONLY;
} else {