mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 00:05:13 +02:00
Use spans of std::byte in serialize
This switches .read() and .write() to take spans of bytes.
This commit is contained in:
@@ -46,12 +46,12 @@ bool DumpWallet(CWallet& wallet, bilingual_str& error)
|
||||
// Write out a magic string with version
|
||||
std::string line = strprintf("%s,%u\n", DUMP_MAGIC, DUMP_VERSION);
|
||||
dump_file.write(line.data(), line.size());
|
||||
hasher.write(line.data(), line.size());
|
||||
hasher.write(MakeByteSpan(line));
|
||||
|
||||
// Write out the file format
|
||||
line = strprintf("%s,%s\n", "format", db.Format());
|
||||
dump_file.write(line.data(), line.size());
|
||||
hasher.write(line.data(), line.size());
|
||||
hasher.write(MakeByteSpan(line));
|
||||
|
||||
if (ret) {
|
||||
|
||||
@@ -72,7 +72,7 @@ bool DumpWallet(CWallet& wallet, bilingual_str& error)
|
||||
std::string value_str = HexStr(ss_value);
|
||||
line = strprintf("%s,%s\n", key_str, value_str);
|
||||
dump_file.write(line.data(), line.size());
|
||||
hasher.write(line.data(), line.size());
|
||||
hasher.write(MakeByteSpan(line));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ bool CreateFromDump(const std::string& name, const fs::path& wallet_path, biling
|
||||
return false;
|
||||
}
|
||||
std::string magic_hasher_line = strprintf("%s,%s\n", magic_key, version_value);
|
||||
hasher.write(magic_hasher_line.data(), magic_hasher_line.size());
|
||||
hasher.write(MakeByteSpan(magic_hasher_line));
|
||||
|
||||
// Get the stored file format
|
||||
std::string format_key;
|
||||
@@ -180,7 +180,7 @@ bool CreateFromDump(const std::string& name, const fs::path& wallet_path, biling
|
||||
warnings.push_back(strprintf(_("Warning: Dumpfile wallet format \"%s\" does not match command line specified format \"%s\"."), format_value, file_format));
|
||||
}
|
||||
std::string format_hasher_line = strprintf("%s,%s\n", format_key, format_value);
|
||||
hasher.write(format_hasher_line.data(), format_hasher_line.size());
|
||||
hasher.write(MakeByteSpan(format_hasher_line));
|
||||
|
||||
DatabaseOptions options;
|
||||
DatabaseStatus status;
|
||||
@@ -219,7 +219,7 @@ bool CreateFromDump(const std::string& name, const fs::path& wallet_path, biling
|
||||
}
|
||||
|
||||
std::string line = strprintf("%s,%s\n", key, value);
|
||||
hasher.write(line.data(), line.size());
|
||||
hasher.write(MakeByteSpan(line));
|
||||
|
||||
if (key.empty() || value.empty()) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user