Revert "tag/Pool: use strncmp() without strlen() to compare strings"
This reverts commit 1532983fb5
. This
optimization was bad because now all strings match if they are a
prefix of another string, and this caused collisions in the tag string
pool, corrupting the database.
This commit is contained in:
parent
1dc71f383a
commit
650a30d794
2
NEWS
2
NEWS
|
@ -6,6 +6,8 @@ ver 0.22.7 (not yet released)
|
||||||
- gme: support RSN files
|
- gme: support RSN files
|
||||||
* storage
|
* storage
|
||||||
- curl: don't use glibc extension
|
- curl: don't use glibc extension
|
||||||
|
* database
|
||||||
|
- simple: fix database corruption bug
|
||||||
* output
|
* output
|
||||||
- httpd: send header "Access-Control-Allow-Origin: *"
|
- httpd: send header "Access-Control-Allow-Origin: *"
|
||||||
- wasapi: add algorithm for finding usable audio format
|
- wasapi: add algorithm for finding usable audio format
|
||||||
|
|
|
@ -114,10 +114,7 @@ tag_pool_get_item(TagType type, StringView value) noexcept
|
||||||
auto slot_p = tag_value_slot_p(type, value);
|
auto slot_p = tag_value_slot_p(type, value);
|
||||||
for (auto slot = *slot_p; slot != nullptr; slot = slot->next) {
|
for (auto slot = *slot_p; slot != nullptr; slot = slot->next) {
|
||||||
if (slot->item.type == type &&
|
if (slot->item.type == type &&
|
||||||
/* strncmp() only works if there are no null
|
value.Equals(slot->item.value) &&
|
||||||
bytes, which FixTagString() has already ensured
|
|
||||||
at this point */
|
|
||||||
strncmp(value.data, slot->item.value, value.size) == 0 &&
|
|
||||||
slot->ref < TagPoolSlot::MAX_REF) {
|
slot->ref < TagPoolSlot::MAX_REF) {
|
||||||
assert(slot->ref > 0);
|
assert(slot->ref > 0);
|
||||||
++slot->ref;
|
++slot->ref;
|
||||||
|
|
Loading…
Reference in New Issue