remotefilelog: fix ctreemanifest serialization

Summary:
The serialization was completely broken because std::string.append("\0") treated
the argument as a c-string which was completely empty. Let's use the
append(char*, size_t) version instead to make sure it appends the correct
characters.

Also makes othere uses of append in that function match the same pattern.

Test Plan: Later patches worked

Reviewers: #fastmanifest

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3885014
This commit is contained in:
Durham Goode 2016-09-19 13:25:34 -07:00
parent 55d5e7a777
commit e0483997ca

View File

@ -202,12 +202,12 @@ void Manifest::serialize(std::string &result) {
ManifestEntry *entry;
while ((entry = iterator.next()) != NULL) {
result.append(entry->filename, entry->filenamelen);
result.append("\0");
result.append("\0", 1);
result.append(entry->node, HEX_NODE_SIZE);
if (entry->flag) {
result.append(1, *entry->flag);
result.append(entry->flag, 1);
}
result.append("\n");
result.append("\n", 1);
}
}