char *err;
int rc, k;
unsigned int flag = MDB_NODUPDATA;
+#ifndef MISALIGNED_OK
+ int kbuf[2];
+#endif
{
char buf[16];
if ( slapMode & SLAP_TOOL_QUICK )
flag |= MDB_APPEND;
+#ifndef MISALIGNED_OK
+ if (keys[0].bv_len & 0x03)
+ kbuf[1] = 0;
+#endif
for ( k=0; keys[k].bv_val; k++ ) {
/* Fetch the first data item for this key, to see if it
* exists and if it's a range.
*/
- key.mv_size = keys[k].bv_len;
- key.mv_data = keys[k].bv_val;
+#ifndef MISALIGNED_OK
+ if (keys[k].bv_len & 0x03) {
+ key.mv_size = sizeof(kbuf);
+ key.mv_data = kbuf;
+ memcpy(key.mv_data, keys[k].bv_val, keys[k].bv_len);
+ } else
+#endif
+ {
+ key.mv_size = keys[k].bv_len;
+ key.mv_data = keys[k].bv_val;
+ }
rc = mdb_cursor_get( cursor, &key, &data, MDB_SET );
err = "c_get";
if ( rc == 0 ) {
MDB_val key, data;
ID lo, hi, tmp, *i;
char *err;
+#ifndef MISALIGNED_OK
+ int kbuf[2];
+#endif
{
char buf[16];
}
assert( id != NOID );
+#ifndef MISALIGNED_OK
+ if (keys[0].bv_len & 0x03)
+ kbuf[1] = 0;
+#endif
for ( k=0; keys[k].bv_val; k++) {
/* Fetch the first data item for this key, to see if it
* exists and if it's a range.
*/
- key.mv_size = keys[k].bv_len;
- key.mv_data = keys[k].bv_val;
+#ifndef MISALIGNED_OK
+ if (keys[k].bv_len & 0x03) {
+ key.mv_size = sizeof(kbuf);
+ key.mv_data = kbuf;
+ memcpy(key.mv_data, keys[k].bv_val, keys[k].bv_len);
+ } else
+#endif
+ {
+ key.mv_size = keys[k].bv_len;
+ key.mv_data = keys[k].bv_val;
+ }
rc = mdb_cursor_get( cursor, &key, &data, MDB_SET );
err = "c_get";
if ( rc == 0 ) {
#include "back-mdb.h"
#include "lutil_hash.h"
-static char presence_keyval[] = {0,0};
+static char presence_keyval[] = {0,0,0,0,0};
static struct berval presence_key[2] = {BER_BVC(presence_keyval), BER_BVNULL};
AttrInfo *mdb_index_mask(
{
int rc;
MDB_val key;
+#ifndef MSIALIGNED_OK
+ int kbuf[2];
+#endif
Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
- key.mv_size = k->bv_len;
- key.mv_data = k->bv_val;
+#ifndef MISALIGNED_OK
+ if (k->bv_len & 0x03) {
+ key.mv_size = sizeof(kbuf);
+ key.mv_data = kbuf;
+ kbuf[1] = 0;
+ memcpy(kbuf, k->bv_val, k->bv_len);
+ } else
+#endif
+ {
+ key.mv_size = k->bv_len;
+ key.mv_data = k->bv_val;
+ }
rc = mdb_idl_fetch_key( be, txn, dbi, &key, ids, saved_cursor, get_flag );