From 88913c0139ac6d1dfb356d3048702b7bc8ef4079 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 20 Jun 2011 00:59:48 +0200 Subject: ALL: Remove trailing whitespaces This tries to make our code a bit more compliant with our code formatting conventions. For future use, this is the command I used: git ls-files "*.cpp" "*.h" | xargs sed -i -e 's/[ \t]*$//' --- base/main.cpp | 8 ++++---- base/plugins.cpp | 36 ++++++++++++++++++------------------ base/plugins.h | 20 ++++++++++---------- 3 files changed, 32 insertions(+), 32 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 395ba8344c..717ccb3344 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -333,7 +333,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { PluginManager::instance().init(); PluginManager::instance().loadAllPlugins(); // load plugins for cached plugin manager - + // If we received an invalid music parameter via command line we check this here. // We can't check this before loading the music plugins. // On the other hand we cannot load the plugins before we know the file paths (in case of external plugins). @@ -385,7 +385,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { system.getAudioCDManager(); MusicManager::instance(); Common::DebugManager::instance(); - + // Init the event manager. As the virtual keyboard is loaded here, it must // take place after the backend is initiated and the screen has been setup system.getEventManager()->init(); @@ -424,8 +424,8 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // reallocate the config manager to get rid of any fragmentation ConfMan.defragment(); - #endif - + #endif + // Did an error occur ? if (result.getCode() != Common::kNoError && result.getCode() != Common::kUserCanceled) { // Shows an informative error dialog if starting the selected game failed. diff --git a/base/plugins.cpp b/base/plugins.cpp index 8ce7b53254..4c2fd2cffc 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -313,7 +313,7 @@ PluginManager &PluginManager::instance() { if (_instance) return *_instance; -#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES) +#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES) _instance = new PluginManagerUncached(); #else _instance = new PluginManager(); @@ -348,7 +348,7 @@ void PluginManager::addPluginProvider(PluginProvider *pp) { void PluginManagerUncached::init() { unloadAllPlugins(); _allEnginePlugins.clear(); - + // Resize our pluginsInMem list to prevent fragmentation _pluginsInMem[PLUGIN_TYPE_ENGINE].resize(2); unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // empty the engine plugins @@ -357,7 +357,7 @@ void PluginManagerUncached::init() { pp != _providers.end(); ++pp) { PluginList pl((*pp)->getPlugins()); - + for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) { // This is a 'hack' based on the assumption that we have no sound // file plugins. Currently this is the case. If it changes, we @@ -365,15 +365,15 @@ void PluginManagerUncached::init() { // music or an engine plugin. if ((*pp)->isFilePluginProvider()) { _allEnginePlugins.push_back(*p); - } else if ((*p)->loadPlugin()) { // and this is the proper method + } else if ((*p)->loadPlugin()) { // and this is the proper method if ((*p)->getType() == PLUGIN_TYPE_ENGINE) { (*p)->unloadPlugin(); _allEnginePlugins.push_back(*p); } else { // add non-engine plugins to the 'in-memory' list // these won't ever get unloaded - addToPluginsInMemList(*p); + addToPluginsInMemList(*p); } - } + } } } } @@ -403,7 +403,7 @@ bool PluginManagerUncached::loadPluginFromGameId(const Common::String &gameId) { bool PluginManagerUncached::loadPluginByFileName(const Common::String &filename) { if (filename.empty()) return false; - + unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); PluginList::iterator i; @@ -417,7 +417,7 @@ bool PluginManagerUncached::loadPluginByFileName(const Common::String &filename) return false; } -/** +/** * Update the config manager with a plugin file name that we found can handle * the game. **/ @@ -435,7 +435,7 @@ void PluginManagerUncached::updateConfigWithFileName(const Common::String &gameI } } -void PluginManagerUncached::loadFirstPlugin() { +void PluginManagerUncached::loadFirstPlugin() { unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // let's try to find one we can load @@ -517,7 +517,7 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) { bool found = false; // The plugin is valid, see if it provides the same module as an // already loaded one and should replace it. - + PluginList::iterator pl = _pluginsInMem[plugin->getType()].begin(); while (!found && pl != _pluginsInMem[plugin->getType()].end()) { if (!strcmp(plugin->getName(), (*pl)->getName())) { @@ -542,7 +542,7 @@ void PluginManager::addToPluginsInMemList(Plugin *plugin) { DECLARE_SINGLETON(EngineManager); -/** +/** * This function works for both cached and uncached PluginManagers. * For the cached version, most of the logic here will short circuit. * @@ -554,24 +554,24 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Eng // First look for the game using the plugins in memory. This is critical // for calls coming from inside games - result = findGameInLoadedPlugins(gameName, plugin); + result = findGameInLoadedPlugins(gameName, plugin); if (!result.gameid().empty()) { return result; } - + // Now look for the game using the gameId. This is much faster than scanning plugin // by plugin if (PluginMan.loadPluginFromGameId(gameName)) { - result = findGameInLoadedPlugins(gameName, plugin); + result = findGameInLoadedPlugins(gameName, plugin); if (!result.gameid().empty()) { return result; } } - + // We failed to find it using the gameid. Scan the list of plugins PluginMan.loadFirstPlugin(); do { - result = findGameInLoadedPlugins(gameName, plugin); + result = findGameInLoadedPlugins(gameName, plugin); if (!result.gameid().empty()) { // Update with new plugin file name PluginMan.updateConfigWithFileName(gameName); @@ -582,7 +582,7 @@ GameDescriptor EngineManager::findGame(const Common::String &gameName, const Eng return result; } -/** +/** * Find the game within the plugins loaded in memory **/ GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &gameName, const EnginePlugin **plugin) const { @@ -594,7 +594,7 @@ GameDescriptor EngineManager::findGameInLoadedPlugins(const Common::String &game *plugin = 0; EnginePlugin::List::const_iterator iter; - + for (iter = plugins.begin(); iter != plugins.end(); ++iter) { result = (**iter)->findGame(gameName.c_str()); if (!result.gameid().empty()) { diff --git a/base/plugins.h b/base/plugins.h index a1ae734159..fffb5fb910 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -143,7 +143,7 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX]; // Abstract plugins /** - * Abstract base class for the plugin objects which handle plugins + * Abstract base class for the plugin objects which handle plugins * instantiation. Subclasses for this may be used for engine plugins and other * types of plugins. An existing PluginObject refers to an executable file * loaded in memory and ready to run. The plugin, on the other hand, is just @@ -310,7 +310,7 @@ protected: bool tryLoadPlugin(Plugin *plugin); void addToPluginsInMemList(Plugin *plugin); - + static PluginManager *_instance; PluginManager(); @@ -326,9 +326,9 @@ public: virtual void init() {} virtual void loadFirstPlugin() {} virtual bool loadNextPlugin() { return false; } - virtual bool loadPluginFromGameId(const Common::String &gameId) { return false; } - virtual void updateConfigWithFileName(const Common::String &gameId) {} - + virtual bool loadPluginFromGameId(const Common::String &gameId) { return false; } + virtual void updateConfigWithFileName(const Common::String &gameId) {} + // Functions used only by the cached PluginManager virtual void loadAllPlugins(); void unloadAllPlugins(); @@ -338,7 +338,7 @@ public: const PluginList &getPlugins(PluginType t) { return _pluginsInMem[t]; } }; -/** +/** * Uncached version of plugin manager * Keeps only one dynamic plugin in memory at a time **/ @@ -349,15 +349,15 @@ protected: PluginList::iterator _currentPlugin; PluginManagerUncached() {} - bool loadPluginByFileName(const Common::String &filename); + bool loadPluginByFileName(const Common::String &filename); public: virtual void init(); virtual void loadFirstPlugin(); virtual bool loadNextPlugin(); - virtual bool loadPluginFromGameId(const Common::String &gameId); - virtual void updateConfigWithFileName(const Common::String &gameId); - + virtual bool loadPluginFromGameId(const Common::String &gameId); + virtual void updateConfigWithFileName(const Common::String &gameId); + virtual void loadAllPlugins() {} // we don't allow this }; -- cgit v1.2.3