refactor: Tidy fixups

Requested by clang-tidy:

src/wallet/salvage.cpp:119:18: error: use emplace_back instead of push_back [modernize-use-emplace,-warnings-as-errors]
   119 |         warnings.push_back(Untranslated("Salvage: Database salvage found errors, all data may not be recoverable."));
       |                  ^~~~~~~~~~
       |                  emplace_back(
This commit is contained in:
MarcoFalke
2024-10-09 15:10:35 +02:00
parent fa72646f2b
commit fa3e074304
3 changed files with 17 additions and 17 deletions

View File

@@ -117,7 +117,7 @@ bool RecoverDatabaseFile(const ArgsManager& args, const fs::path& file_path, bil
Db db(env->dbenv.get(), 0);
result = db.verify(newFilename.c_str(), nullptr, &strDump, DB_SALVAGE | DB_AGGRESSIVE);
if (result == DB_VERIFY_BAD) {
warnings.push_back(Untranslated("Salvage: Database salvage found errors, all data may not be recoverable."));
warnings.emplace_back(Untranslated("Salvage: Database salvage found errors, all data may not be recoverable."));
}
if (result != 0 && result != DB_VERIFY_BAD) {
error = strprintf(Untranslated("Salvage: Database salvage failed with result %d."), result);
@@ -144,7 +144,7 @@ bool RecoverDatabaseFile(const ArgsManager& args, const fs::path& file_path, bil
break;
getline(strDump, valueHex);
if (valueHex == DATA_END) {
warnings.push_back(Untranslated("Salvage: WARNING: Number of keys in data does not match number of values."));
warnings.emplace_back(Untranslated("Salvage: WARNING: Number of keys in data does not match number of values."));
break;
}
salvagedData.emplace_back(ParseHex(keyHex), ParseHex(valueHex));
@@ -153,7 +153,7 @@ bool RecoverDatabaseFile(const ArgsManager& args, const fs::path& file_path, bil
bool fSuccess;
if (keyHex != DATA_END) {
warnings.push_back(Untranslated("Salvage: WARNING: Unexpected end of file while reading salvage output."));
warnings.emplace_back(Untranslated("Salvage: WARNING: Unexpected end of file while reading salvage output."));
fSuccess = false;
} else {
fSuccess = (result == 0);