1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Remove unused functions reported by cppcheck (#10463)

Run unused functions reported by cppcheck

This change removes a few (but not all) unused functions.
Some unused helper functions were not removed due to their complexity and potential of future use.
This commit is contained in:
SmallJoker 2020-10-05 09:07:33 +02:00 committed by GitHub
parent 81c66d6efb
commit f46509d5e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 14 additions and 440 deletions

View file

@ -65,31 +65,6 @@ void check_noise_params(const NoiseParams *np1, const NoiseParams *np2)
}
std::string read_file_to_string(const std::string &filepath)
{
std::string buf;
FILE *f = fopen(filepath.c_str(), "rb");
if (!f)
return "";
fseek(f, 0, SEEK_END);
long filesize = ftell(f);
if (filesize == -1) {
fclose(f);
return "";
}
rewind(f);
buf.resize(filesize);
UASSERTEQ(size_t, fread(&buf[0], 1, filesize, f), 1);
fclose(f);
return buf;
}
void TestMapSettingsManager::makeUserConfig(Settings *conf)
{
conf->set("mg_name", "v7");
@ -199,7 +174,8 @@ void TestMapSettingsManager::testMapSettingsManager()
};
SHA1 ctx;
std::string metafile_contents = read_file_to_string(test_mapmeta_path);
std::string metafile_contents;
UASSERT(fs::ReadFile(test_mapmeta_path, metafile_contents));
ctx.addBytes(&metafile_contents[0], metafile_contents.size());
unsigned char *sha1_result = ctx.getDigest();
int resultdiff = memcmp(sha1_result, expected_contents_hash, 20);