1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-07-16 16:24:12 +00:00

Crash fix - make path on the fly

Newer versions of gcc have a small string optimizations that makes
moving FileRecordData objects behave incorrectly. When a small string is
moved, string_refs into it become invalid. Making a path on the fly
using the path() method also has the side effect of making
FileRecordData smaller in size.
This commit is contained in:
King_DuckZ 2016-05-17 20:21:44 +02:00
parent 21c5b3efcb
commit 8c03ba15bc
5 changed files with 24 additions and 21 deletions

View file

@ -60,7 +60,7 @@ namespace din {
if (parItem.abs_path.size() != 1 or parItem.abs_path != "/") {
parItem.abs_path = std::string("/") + parItem.abs_path;
}
parItem.path = boost::string_ref(parItem.abs_path).substr(1);
parItem.path_offset = 1;
}
{
@ -125,9 +125,9 @@ namespace din {
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13);";
const auto& itm = parData[z];
assert(itm.path.data());
assert(itm.path().data());
conn.query(query,
(itm.path.empty() ? empty_path_string : itm.path),
(itm.path().empty() ? empty_path_string : itm.path()),
tiger_to_string(itm.hash),
itm.level,
new_group_id,