Improved code based on CppCheck results

None of this should change the engine's behavior, but the code is better
this way.


Former-commit-id: 0127769848fc1f7fc8006ee607985cfc0ead2965
This commit is contained in:
Lynix
2015-06-05 13:25:17 +02:00
parent 0f27930467
commit fc65b30f84
15 changed files with 22 additions and 49 deletions

View File

@@ -551,7 +551,6 @@ NzString NzFile::AbsolutePath(const NzString& filePath)
return path;
// Nous avons un chemin absolu, mais il nous faut un peu le nettoyer
unsigned int pathLen = base.GetSize();
for (unsigned int i = 0; i < sep.size(); ++i)
{
if (sep[i] == '.')
@@ -563,12 +562,8 @@ NzString NzFile::AbsolutePath(const NzString& filePath)
sep.erase(sep.begin() + i--);
}
else
pathLen += sep[i].GetSize();
}
pathLen += sep.size()-1;
NzStringStream stream(base);
for (unsigned int i = 0; i < sep.size(); ++i)
{
@@ -730,10 +725,9 @@ bool NzFile::FillHash(NzAbstractHash* hash) const
nzUInt64 remainingSize = file.GetSize();
char buffer[NAZARA_CORE_FILE_BUFFERSIZE];
unsigned int size;
while (remainingSize > 0)
{
size = static_cast<unsigned int>(std::min(remainingSize, static_cast<nzUInt64>(NAZARA_CORE_FILE_BUFFERSIZE)));
unsigned int size = static_cast<unsigned int>(std::min(remainingSize, static_cast<nzUInt64>(NAZARA_CORE_FILE_BUFFERSIZE)));
if (file.Read(&buffer[0], sizeof(char), size) != sizeof(char)*size)
{
NazaraError("Unable to read file");