mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-30 11:29:19 +08:00
mdbx-test: fix key/value generation for long-length cases.
Change-Id: I643bca291948bf7659c77fffa31408c3794785e6
This commit is contained in:
parent
0be592530e
commit
96bdf6559e
@ -165,7 +165,7 @@ bool maker::increment(serial_t &serial, int delta) {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
size_t length(serial_t serial) {
|
||||
static size_t length(serial_t serial) {
|
||||
size_t n = 0;
|
||||
if (serial > UINT32_MAX) {
|
||||
n = 4;
|
||||
@ -199,7 +199,10 @@ void __hot maker::mk(const serial_t serial, const essentials ¶ms,
|
||||
assert(params.maxlen >= length(serial));
|
||||
|
||||
out.value.iov_base = out.bytes;
|
||||
out.value.iov_len = params.minlen;
|
||||
out.value.iov_len =
|
||||
(params.maxlen > params.minlen)
|
||||
? params.minlen + serial % (params.maxlen - params.minlen)
|
||||
: params.minlen;
|
||||
|
||||
if (params.flags & (MDBX_INTEGERKEY | MDBX_INTEGERDUP)) {
|
||||
assert(params.maxlen == params.minlen);
|
||||
|
@ -120,6 +120,4 @@ public:
|
||||
bool increment(serial_t &serial, int delta);
|
||||
};
|
||||
|
||||
size_t length(serial_t serial);
|
||||
|
||||
} /* namespace keygen */
|
||||
|
Loading…
Reference in New Issue
Block a user