Fix bug introduced in 5e1fb1dac5
All checks were successful
Tests / Release [gcc] total: 704, passed: 704
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|1|0|1|0|:zzz:
Tests / Release [gcc,aarch64] total: 703, passed: 703
Tests / Coverage total: 702, passed: 702
weaselab/conflict-set/pipeline/head This commit looks good
All checks were successful
Tests / Release [gcc] total: 704, passed: 704
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|1|0|1|0|:zzz:
Tests / Release [gcc,aarch64] total: 703, passed: 703
Tests / Coverage total: 702, passed: 702
weaselab/conflict-set/pipeline/head This commit looks good
This commit is contained in:
@@ -94,6 +94,10 @@ endif()
|
|||||||
|
|
||||||
set(TEST_FLAGS -Wall -Wextra -Wpedantic -Wunreachable-code -UNDEBUG)
|
set(TEST_FLAGS -Wall -Wextra -Wpedantic -Wunreachable-code -UNDEBUG)
|
||||||
|
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
list(APPEND TEST_FLAGS -Wno-gnu-anonymous-struct -Wno-nested-anon-types)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
|
@@ -239,9 +239,13 @@ struct Node {
|
|||||||
int8_t partialKeyLen = 0;
|
int8_t partialKeyLen = 0;
|
||||||
int32_t numChildren = 0;
|
int32_t numChildren = 0;
|
||||||
Node *parent = nullptr;
|
Node *parent = nullptr;
|
||||||
uint8_t partialKey[kPartialKeyMaxLenEntryPresent];
|
union {
|
||||||
// If not entryPresent, then the partial key might spill over into entry
|
uint8_t partialKey[kPartialKeyMaxLenEntryPresent + sizeof(Entry)];
|
||||||
|
struct {
|
||||||
|
uint8_t padding[kPartialKeyMaxLenEntryPresent];
|
||||||
Entry entry;
|
Entry entry;
|
||||||
|
};
|
||||||
|
};
|
||||||
/* end section that's copied to the next node */
|
/* end section that's copied to the next node */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1536,8 +1540,13 @@ template <bool kBegin>
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
if ((*self)->partialKeyLen > 0) {
|
if ((*self)->partialKeyLen > 0) {
|
||||||
|
const bool wouldBePresent =
|
||||||
|
key.size() <= kPartialKeyMaxLenEntryPresent + int(sizeof(Entry));
|
||||||
// Handle an existing partial key
|
// Handle an existing partial key
|
||||||
int commonLen = std::min<int>((*self)->partialKeyLen, key.size());
|
int commonLen = std::min<int>((*self)->partialKeyLen, key.size());
|
||||||
|
if (wouldBePresent) {
|
||||||
|
commonLen = std::min(commonLen, kPartialKeyMaxLenEntryPresent);
|
||||||
|
}
|
||||||
int partialKeyIndex = longestCommonPrefixPartialKey(
|
int partialKeyIndex = longestCommonPrefixPartialKey(
|
||||||
(*self)->partialKey, key.data(), commonLen);
|
(*self)->partialKey, key.data(), commonLen);
|
||||||
if (partialKeyIndex < (*self)->partialKeyLen) {
|
if (partialKeyIndex < (*self)->partialKeyLen) {
|
||||||
|
10
Internal.h
10
Internal.h
@@ -549,14 +549,12 @@ template <class ConflictSetImpl> struct TestDriver {
|
|||||||
}
|
}
|
||||||
#if DEBUG_VERBOSE && !defined(NDEBUG)
|
#if DEBUG_VERBOSE && !defined(NDEBUG)
|
||||||
if (writes[i].end.len == 0) {
|
if (writes[i].end.len == 0) {
|
||||||
fprintf(stderr, "Write: {%s} -> %d\n",
|
fprintf(stderr, "Write: {%s} -> %" PRId64 "\n",
|
||||||
printable(writes[i].begin).c_str(),
|
printable(writes[i].begin).c_str(), writeVersion);
|
||||||
int(writes[i].writeVersion));
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Write: [%s, %s) -> %d\n",
|
fprintf(stderr, "Write: [%s, %s) -> %" PRId64 "\n",
|
||||||
printable(writes[i].begin).c_str(),
|
printable(writes[i].begin).c_str(),
|
||||||
printable(writes[i].end).c_str(),
|
printable(writes[i].end).c_str(), writeVersion);
|
||||||
int(writes[i].writeVersion));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user