return OTHER_FAILURE;
}
- k.dptr = (void *)name;
+ k.dptr = discard_const_p(uint8_t, name);
k.dsize = strlen(name);
locking_would_block = 0;
tdb->methods = &large_io_methods;
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
+ key.dptr = discard_const_p(uint8_t, "hi");
orig_data.dsize = strlen("world");
- orig_data.dptr = (void *)"world";
+ orig_data.dptr = discard_const_p(uint8_t, "world");
/* Enlarge the file (internally multiplies by 2). */
ret = tdb_expand(tdb, 1500000000);
ok1(tdb_check(tdb, NULL, NULL) == 0);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
+ key.dptr = discard_const_p(uint8_t, "hi");
data.dsize = strlen("world");
- data.dptr = (void *)"world";
+ data.dptr = discard_const_p(uint8_t, "world");
ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0);
ok1(tdb_check(tdb, NULL, NULL) == 0);
ok1(tdb_check(tdb, NULL, NULL) == 0);
- key.dptr = (void *)"hello";
+ key.dptr = discard_const_p(uint8_t, "hello");
data.dsize = strlen("world");
- data.dptr = (void *)"world";
+ data.dptr = discard_const_p(uint8_t, "world");
/* Key and data size respectively. */
dsize = ksize = 0;
/* Put key for agent to fetch. */
key.dsize = strlen(KEY_STRING);
- key.dptr = (void *)KEY_STRING;
+ key.dptr = discard_const_p(uint8_t, KEY_STRING);
if (tdb_store(tdb, key, key, TDB_INSERT) != 0)
return false;
ok1(tdb);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
+ key.dptr = discard_const_p(uint8_t, "hi");
data.dsize = strlen("world");
- data.dptr = (void *)"world";
+ data.dptr = discard_const_p(uint8_t, "world");
ok1(tdb_store(tdb, key, data, TDB_MODIFY) < 0);
ok1(tdb_error(tdb) == TDB_ERR_NOEXIST);
ok1(tdb);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
+ key.dptr = discard_const_p(uint8_t, "hi");
data = tdb_fetch(tdb, key);
ok1(data.dsize == strlen("world"));
ok1(memcmp(data.dptr, "world", strlen("world")) == 0);
NULL);
ok1(tdb);
ok1(log_count == 0);
- d.dptr = (void *)"Hello";
+ d.dptr = discard_const_p(uint8_t, "Hello");
d.dsize = 5;
ok1(tdb_store(tdb, d, d, TDB_INSERT) == 0);
tdb_close(tdb);
NULL);
ok1(tdb);
ok1(log_count == 0);
- d.dptr = (void *)"Hello";
+ d.dptr = discard_const_p(uint8_t, "Hello");
d.dsize = 5;
ok1(tdb_store(tdb, d, d, TDB_INSERT) == 0);
tdb_close(tdb);
tdb_dumb_hash);
ok1(tdb);
ok1(log_count == 0);
- d.dptr = (void *)"Hello";
+ d.dptr = discard_const_p(uint8_t, "Hello");
d.dsize = 5;
ok1(tdb_store(tdb, d, d, TDB_INSERT) == 0);
tdb_close(tdb);
plan_tests(27);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
+ key.dptr = discard_const_p(uint8_t, "hi");
tdb = tdb_open_ex("run-nested-transactions.tdb",
1024, TDB_CLEAR_IF_FIRST|TDB_DISALLOW_NESTING,
/* Nesting disallowed. */
ok1(tdb_transaction_start(tdb) == 0);
- data.dptr = (void *)"world";
+ data.dptr = discard_const_p(uint8_t, "world");
data.dsize = strlen("world");
ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0);
data = tdb_fetch(tdb, key);
== SUCCESS);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
- data.dptr = (void *)"world";
+ key.dptr = discard_const_p(uint8_t, "hi");
+ data.dptr = discard_const_p(uint8_t, "world");
data.dsize = strlen("world");
ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0);
key.dsize = sizeof(i);
key.dptr = (void *)&i;
data.dsize = strlen("world");
- data.dptr = (void *)"world";
+ data.dptr = discard_const_p(uint8_t, "world");
if (tdb_store(tdb, key, data, 0) != 0)
return false;
opened = true;
ok1(tdb_transaction_start(tdb) == 0);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
- data.dptr = (void *)"world";
+ key.dptr = discard_const_p(uint8_t, "hi");
+ data.dptr = discard_const_p(uint8_t, "world");
data.dsize = strlen("world");
ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0);
ok1(tdb);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
+ key.dptr = discard_const_p(uint8_t, "hi");
data.dsize = strlen("world");
- data.dptr = (void *)"world";
+ data.dptr = discard_const_p(uint8_t, "world");
ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0);
ok1(tdb_check(tdb, NULL, NULL) == 0);
static inline TDB_DATA tdb_mkdata(const void *p, size_t len)
{
TDB_DATA d;
- d.dptr = (void *)p;
+ d.dptr = discard_const_p(uint8_t, p);
d.dsize = len;
return d;
}
O_CREAT|O_TRUNC|O_RDWR, 0600, &log_ctx, NULL);
wd.key.dsize = strlen("hi");
- wd.key.dptr = (void *)"hi";
+ wd.key.dptr = discard_const_p(uint8_t, "hi");
wd.data.dsize = strlen("world");
- wd.data.dptr = (void *)"world";
+ wd.data.dptr = discard_const_p(uint8_t, "world");
wd.count = 0;
wd.fail = false;
{
TDB_DATA key;
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
+ key.dptr = discard_const_p(uint8_t, "hi");
data->dsize += extra_len;
tdb_transaction_start(tdb);
ok1(tdb);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
- data.dptr = (void *)"world";
+ key.dptr = discard_const_p(uint8_t, "hi");
+ data.dptr = discard_const_p(uint8_t, "world");
data.dsize = strlen("world");
ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0);
O_CREAT|O_RDWR|O_TRUNC, 0600, &log_ctx, NULL);
ok1(tdb);
ok1(log_count == 0);
- d.dptr = (void *)"Hello";
+ d.dptr = discard_const_p(uint8_t, "Hello");
d.dsize = 5;
ok1(tdb_store(tdb, d, d, TDB_INSERT) == 0);
tdb_close(tdb);
/* Tickle bug on appending zero length buffer to zero length buffer. */
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
- data.dptr = (void *)"world";
+ key.dptr = discard_const_p(uint8_t, "hi");
+ data.dptr = discard_const_p(uint8_t, "world");
data.dsize = 0;
ok1(tdb_append(tdb, key, data) == 0);
ok1(tdb);
key.dsize = strlen("hi");
- key.dptr = (void *)"hi";
+ key.dptr = discard_const_p(uint8_t, "hi");
data.dsize = strlen("world");
- data.dptr = (void *)"world";
+ data.dptr = discard_const_p(uint8_t, "world");
ok1(tdb_store(tdb, key, data, TDB_MODIFY) < 0);
ok1(tdb_error(tdb) == TDB_ERR_NOEXIST);