diff --git a/USERGUIDE.md b/USERGUIDE.md index e7687533d..7100fbfbd 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -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 diff --git a/es-app/src/MetaData.cpp b/es-app/src/MetaData.cpp index 7d7fb7848..60fd10709 100644 --- a/es-app/src/MetaData.cpp +++ b/es-app/src/MetaData.cpp @@ -66,10 +66,10 @@ const std::vector folderMDD(folderDecls, folderDecls + const std::vector& getMDDByType(MetaDataListType type) { switch(type) { - case GAME_METADATA: - return gameMDD; - case FOLDER_METADATA: - return folderMDD; + case GAME_METADATA: + return gameMDD; + case FOLDER_METADATA: + return folderMDD; } LOG(LogError) << "Invalid MDD type"; diff --git a/es-core/src/AudioManager.cpp b/es-core/src/AudioManager.cpp index 78bec00f2..8baff7d6d 100644 --- a/es-core/src/AudioManager.cpp +++ b/es-core/src/AudioManager.cpp @@ -18,7 +18,7 @@ std::vector> AudioManager::sSoundVector; SDL_AudioSpec AudioManager::sAudioFormat; std::shared_ptr AudioManager::sInstance; -void AudioManager::mixAudio(void* /*unused*/, Uint8 *stream, int len) +void AudioManager::mixAudio(void* /*unused*/, Uint8* stream, int len) { bool stillPlaying = false; @@ -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(len)) { // If stream length is smaller than sample length, clip it. restLength = len; } @@ -68,7 +68,7 @@ AudioManager::~AudioManager() deinit(); } -std::shared_ptr & AudioManager::getInstance() +std::shared_ptr& AudioManager::getInstance() { // Check if an AudioManager instance is already created, if not create one. if (sInstance == nullptr && Settings::getInstance()->getBool("NavigationSounds")) { @@ -116,13 +116,13 @@ void AudioManager::deinit() sInstance = nullptr; } -void AudioManager::registerSound(std::shared_ptr & sound) +void AudioManager::registerSound(std::shared_ptr& sound) { getInstance(); sSoundVector.push_back(sound); } -void AudioManager::unregisterSound(std::shared_ptr & sound) +void AudioManager::unregisterSound(std::shared_ptr& sound) { getInstance(); for (unsigned int i = 0; i < sSoundVector.size(); i++) { diff --git a/es-core/src/AudioManager.h b/es-core/src/AudioManager.h index 28ce16c8c..f792e209d 100644 --- a/es-core/src/AudioManager.h +++ b/es-core/src/AudioManager.h @@ -21,18 +21,18 @@ class AudioManager static std::vector> sSoundVector; static std::shared_ptr sInstance; - static void mixAudio(void *unused, Uint8 *stream, int len); + static void mixAudio(void* unused, Uint8* stream, int len); AudioManager(); public: - static std::shared_ptr & getInstance(); + static std::shared_ptr& getInstance(); void init(); void deinit(); - void registerSound(std::shared_ptr & sound); - void unregisterSound(std::shared_ptr & sound); + void registerSound(std::shared_ptr& sound); + void unregisterSound(std::shared_ptr& sound); void play(); void stop(); diff --git a/es-core/src/Sound.cpp b/es-core/src/Sound.cpp index ed901adf4..117a0881e 100644 --- a/es-core/src/Sound.cpp +++ b/es-core/src/Sound.cpp @@ -86,7 +86,7 @@ bool NavigationSounds::isPlayingThemeNavigationSound(NavigationSoundsID soundID) } Sound::Sound( - const std::string & path) + const std::string& path) : mSampleData(nullptr), mSamplePos(0), mSampleLength(0), @@ -100,7 +100,7 @@ Sound::~Sound() deinit(); } -void Sound::loadFile(const std::string & path) +void Sound::loadFile(const std::string& path) { mPath = path; init(); @@ -116,7 +116,7 @@ void Sound::init() // Load WAV file via SDL. SDL_AudioSpec wave; - Uint8 * data = nullptr; + Uint8* data = nullptr; Uint32 dlen = 0; if (SDL_LoadWAV(mPath.c_str(), &wave, &data, &dlen) == nullptr) { LOG(LogError) << "Failed to load theme navigation sound file:"; @@ -203,7 +203,7 @@ void Sound::stop() SDL_UnlockAudio(); } -const Uint8 * Sound::getData() const +const Uint8* Sound::getData() const { return mSampleData; } @@ -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((mSampleLength / 44100.0f / 2.0f * 0.75f) * 1000); } diff --git a/es-core/src/Sound.h b/es-core/src/Sound.h index 12a75ddee..f04f24968 100644 --- a/es-core/src/Sound.h +++ b/es-core/src/Sound.h @@ -25,7 +25,7 @@ class Sound { std::string mPath; SDL_AudioSpec mSampleFormat; - Uint8 * mSampleData; + Uint8* mSampleData; Uint32 mSamplePos; Uint32 mSampleLength; bool playing; @@ -40,21 +40,21 @@ public: void init(); void deinit(); - void loadFile(const std::string & path); + void loadFile(const std::string& path); void play(); bool isPlaying() const; void stop(); - const Uint8 * getData() const; + const Uint8* getData() const; Uint32 getPosition() const; void setPosition(Uint32 newPosition); Uint32 getLength() const; Uint32 getLengthMS() const; private: - Sound(const std::string & path = ""); - static std::map< std::string, std::shared_ptr > sMap; + Sound(const std::string& path = ""); + static std::map> sMap; }; enum NavigationSoundsID { diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index 20a8e244c..657a55e3b 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -229,14 +229,14 @@ std::string resolvePlaceholders(const char* in) return inStr; const size_t variableBegin = inStr.find("${"); - const size_t variableEnd = inStr.find("}", variableBegin); + const size_t variableEnd = inStr.find("}", variableBegin); if ((variableBegin == std::string::npos) || (variableEnd == std::string::npos)) return inStr; - std::string prefix = inStr.substr(0, variableBegin); + std::string prefix = inStr.substr(0, variableBegin); std::string replace = inStr.substr(variableBegin + 2, variableEnd - (variableBegin + 2)); - std::string suffix = resolvePlaceholders(inStr.substr(variableEnd + 1).c_str()); + std::string suffix = resolvePlaceholders(inStr.substr(variableEnd + 1).c_str()); return prefix + mVariables[replace] + suffix; } @@ -413,7 +413,7 @@ void ThemeData::parseView(const pugi::xml_node& root, ThemeView& view) const char* delim = " \t\r\n,"; const std::string nameAttr = node.attribute("name").as_string(); size_t prevOff = nameAttr.find_first_not_of(delim, 0); - size_t off = nameAttr.find_first_of(delim, prevOff); + size_t off = nameAttr.find_first_of(delim, prevOff); while (off != std::string::npos || prevOff != std::string::npos) { std::string elemKey = nameAttr.substr(prevOff, off - prevOff); prevOff = nameAttr.find_first_not_of(delim, off); @@ -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(atof(splits.at(0).c_str())), + static_cast(atof(splits.at(1).c_str())), + static_cast(atof(splits.at(0).c_str())), + static_cast(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(atof(splits.at(0).c_str())), + static_cast(atof(splits.at(1).c_str())), + static_cast(atof(splits.at(2).c_str())), + static_cast(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(atof(first.c_str())), + static_cast(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 [" << diff --git a/es-core/src/ThemeData.h b/es-core/src/ThemeData.h index 9561ec69d..3bc05c77a 100644 --- a/es-core/src/ThemeData.h +++ b/es-core/src/ThemeData.h @@ -14,6 +14,7 @@ #include "math/Vector2f.h" #include "math/Vector4f.h" #include "utils/FileSystemUtil.h" + #include #include #include