diff --git a/src/App/StringHasher.cpp b/src/App/StringHasher.cpp index d116bf0ab9..f4d0f94cb4 100644 --- a/src/App/StringHasher.cpp +++ b/src/App/StringHasher.cpp @@ -304,9 +304,9 @@ StringIDRef StringHasher::getID(const Data::MappedName& name, const QVector 0) {// If the data had an index + if (res.index != 0) { + indexed.setIndex(res.index); + newStringID._data.resize(newStringID._data.lastIndexOf(':')+1); + } int offset = newStringID.isPostfixEncoded() ? 1 : 0; // Search for the SID with that index for (int i = offset; i < newStringID._sids.size(); ++i) { @@ -579,10 +583,7 @@ void StringHasher::saveStream(std::ostream& stream) const // guarantees to be a single line without space. So it is safe to // store in raw stream. if (d.isPostfixed()) { - if (d.isPrefixIDIndex()) { - stream << ' ' << prefixID.index; - } - else if (!d.isIndexed() && !d.isPrefixID()) { + if (!d.isPrefixIDIndex() && !d.isIndexed() && !d.isPrefixID()) { stream << ' ' << d._data.constData(); } @@ -714,13 +715,9 @@ void StringHasher::restoreStreamNew(std::istream& stream, std::size_t count) if (d._sids.size() <= offset) { FC_THROWM(Base::RuntimeError, "Missing string prefix id"); } - int index = 0; - if (d.isPrefixIDIndex()) { - if (!(stream >> index)) { - FC_THROWM(Base::RuntimeError, "Missing string prefix index"); - } - } - d._data = d._sids[offset]._sid->toString(index).c_str(); + d._data = d._sids[offset]._sid->toString(0).c_str(); + if (d.isPrefixIDIndex()) + d._data += ":"; } else { stream >> content;