Some cosmetic code cleanup.

This commit is contained in:
Leon Styhre 2020-10-18 19:45:26 +02:00
parent 370914791e
commit 2eb5125d0e
8 changed files with 41 additions and 34 deletions

View file

@ -984,7 +984,7 @@ This will remove any media files for the game file or folder and also remove its
**Delete** _(Files only)_
This will remove the actual game file and its gamelist.xml entry, as well as any media files. A prompt will be shown asking for confirmation. The deletion of folders is not supported as that would potentially be a bit dangerous, instead use the valid operating system tools to handle deletion of folders.
This will remove the actual game file and its gamelist.xml entry, as well as any media files. A prompt will be shown asking for confirmation. The deletion of folders is not supported as that would potentially be a bit dangerous, instead use the appropriate operating system tools to handle deletion of folders.
## Screensaver

View file

@ -32,7 +32,7 @@ void AudioManager::mixAudio(void* /*unused*/, Uint8 *stream, int len)
if (sound->isPlaying()) {
// Calculate rest length of current sample.
Uint32 restLength = (sound->getLength() - sound->getPosition());
if (restLength > (Uint32)len) {
if (restLength > static_cast<Uint32>(len)) {
// If stream length is smaller than sample length, clip it.
restLength = len;
}

View file

@ -232,5 +232,5 @@ Uint32 Sound::getLengthMS() const
{
// 44100 samples per second, 2 channels (stereo).
// I have no idea why the *0.75 is necessary, but otherwise it's inaccurate.
return (Uint32)((mSampleLength / 44100.0f / 2.0f * 0.75f) * 1000);
return static_cast<Uint32>((mSampleLength / 44100.0f / 2.0f * 0.75f) * 1000);
}

View file

@ -453,12 +453,16 @@ void ThemeData::parseElement(const pugi::xml_node& root,
auto splits = Utils::String::delimitedStringToVector(str, " ");
if (splits.size() == 2) {
val = Vector4f((float)atof(splits.at(0).c_str()), (float)atof(splits.at(1).c_str()),
(float)atof(splits.at(0).c_str()), (float)atof(splits.at(1).c_str()));
val = Vector4f(static_cast<float>(atof(splits.at(0).c_str())),
static_cast<float>(atof(splits.at(1).c_str())),
static_cast<float>(atof(splits.at(0).c_str())),
static_cast<float>(atof(splits.at(1).c_str())));
}
else if (splits.size() == 4) {
val = Vector4f((float)atof(splits.at(0).c_str()), (float)atof(splits.at(1).c_str()),
(float)atof(splits.at(2).c_str()), (float)atof(splits.at(3).c_str()));
val = Vector4f(static_cast<float>(atof(splits.at(0).c_str())),
static_cast<float>(atof(splits.at(1).c_str())),
static_cast<float>(atof(splits.at(2).c_str())),
static_cast<float>(atof(splits.at(3).c_str())));
}
element.properties[node.name()] = val;
@ -473,7 +477,8 @@ void ThemeData::parseElement(const pugi::xml_node& root,
std::string first = str.substr(0, divider);
std::string second = str.substr(divider, std::string::npos);
Vector2f val((float)atof(first.c_str()), (float)atof(second.c_str()));
Vector2f val(static_cast<float>(atof(first.c_str())),
static_cast<float>(atof(second.c_str())));
element.properties[node.name()] = val;
break;
@ -536,7 +541,8 @@ const ThemeData::ThemeElement* ThemeData::getElement(const std::string& view,
return nullptr; // Not found.
auto elemIt = viewIt->second.elements.find(element);
if (elemIt == viewIt->second.elements.cend()) return nullptr;
if (elemIt == viewIt->second.elements.cend())
return nullptr;
if (elemIt->second.type != expectedType && !expectedType.empty()) {
LOG(LogWarning) << " requested mismatched theme type for [" <<

View file

@ -14,6 +14,7 @@
#include "math/Vector2f.h"
#include "math/Vector4f.h"
#include "utils/FileSystemUtil.h"
#include <deque>
#include <map>
#include <memory>