From b0e02675e79b2102f9d05de3d9f549b5438dfdcb Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 30 Dec 2009 23:01:36 +0000 Subject: Get rid of Common::String::emptyString, and also of some port specific hackery (getting rid of certain global C++ objs) svn-id: r46781 --- common/config-manager.cpp | 32 +++----------------------------- common/config-manager.h | 18 +++--------------- common/str.cpp | 7 ------- common/str.h | 6 ------ gui/PopUpWidget.h | 2 +- gui/saveload.cpp | 3 ++- 6 files changed, 9 insertions(+), 59 deletions(-) diff --git a/common/config-manager.cpp b/common/config-manager.cpp index 268fac5d2e..5934f32012 100644 --- a/common/config-manager.cpp +++ b/common/config-manager.cpp @@ -40,17 +40,6 @@ static bool isValidDomainName(const Common::String &domName) { namespace Common { -#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) - -const String ConfigManager::kApplicationDomain("scummvm"); -const String ConfigManager::kTransientDomain("__TRANSIENT"); - -#ifdef ENABLE_KEYMAPPER -const String ConfigManager::kKeymapperDomain("keymapper"); -#endif - -#else - const char *ConfigManager::kApplicationDomain = "scummvm"; const char *ConfigManager::kTransientDomain = "__TRANSIENT"; @@ -58,13 +47,10 @@ const char *ConfigManager::kTransientDomain = "__TRANSIENT"; const char *ConfigManager::kKeymapperDomain = "keymapper"; #endif -#endif - #pragma mark - -ConfigManager::ConfigManager() - : _activeDomain(0) { +ConfigManager::ConfigManager() : _activeDomain(0) { } @@ -407,11 +393,7 @@ const String & ConfigManager::get(const String &key) const { else if (_defaultsDomain.contains(key)) return _defaultsDomain[key]; -#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) - return String::emptyString; -#else - return ConfMan._emptyString; -#endif + return _emptyString; } const String & ConfigManager::get(const String &key, const String &domName) const { @@ -434,11 +416,7 @@ const String & ConfigManager::get(const String &key, const String &domName) cons if (!domain->contains(key)) { #if 1 -#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) - return String::emptyString; -#else - return ConfMan._emptyString; -#endif + return _emptyString; #else error("ConfigManager::get(%s,%s) called on non-existent key", key.c_str(), domName.c_str()); @@ -641,11 +619,7 @@ const String &ConfigManager::Domain::get(const String &key) const { if (iter != end()) return iter->_value; -#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) - return String::emptyString; -#else return ConfMan._emptyString; -#endif } void ConfigManager::Domain::setDomainComment(const String &comment) { diff --git a/common/config-manager.h b/common/config-manager.h index 75e6ee6449..699774dfcd 100644 --- a/common/config-manager.h +++ b/common/config-manager.h @@ -68,29 +68,15 @@ public: typedef HashMap DomainMap; -#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) /** The name of the application domain (normally 'scummvm'). */ - static const String kApplicationDomain; + static const char *kApplicationDomain; /** The transient (pseudo) domain. */ - static const String kTransientDomain; - -#ifdef ENABLE_KEYMAPPER - /** The name of keymapper domain used to store the key maps */ - static const String kKeymapperDomain; -#endif - -#else - static const char *kApplicationDomain; static const char *kTransientDomain; - const String _emptyString; - #ifdef ENABLE_KEYMAPPER /** The name of keymapper domain used to store the key maps */ static const char *kKeymapperDomain; -#endif - #endif void loadDefaultConfigFile(); @@ -179,6 +165,8 @@ private: Domain * _activeDomain; String _filename; + + const String _emptyString; }; } // End of namespace Common diff --git a/common/str.cpp b/common/str.cpp index 2f657d2890..6dd5d911a7 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -37,13 +37,6 @@ namespace Common { -#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) -const String String::emptyString; -#else -const char *String::emptyString = ""; -#endif - - MemoryPool *g_refCountPool = 0; // FIXME: This is never freed right now static uint32 computeCapacity(uint32 len) { diff --git a/common/str.h b/common/str.h index f69fc268e1..60103e0242 100644 --- a/common/str.h +++ b/common/str.h @@ -90,12 +90,6 @@ protected: } public: -#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) - static const String emptyString; -#else - static const char *emptyString; -#endif - /** Construct a new empty string. */ String() : _size(0), _str(_storage) { _storage[0] = 0; } diff --git a/gui/PopUpWidget.h b/gui/PopUpWidget.h index 050dc0936d..bd1d3b3918 100644 --- a/gui/PopUpWidget.h +++ b/gui/PopUpWidget.h @@ -75,7 +75,7 @@ public: int getSelected() const { return _selectedItem; } uint32 getSelectedTag() const { return (_selectedItem >= 0) ? _entries[_selectedItem].tag : (uint32)-1; } - const String& getSelectedString() const { return (_selectedItem >= 0) ? _entries[_selectedItem].name : String::emptyString; } +// const String& getSelectedString() const { return (_selectedItem >= 0) ? _entries[_selectedItem].name : String::emptyString; } void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); } void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); draw(); } diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 058911d43f..247b7bdeb8 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -114,7 +114,8 @@ void SaveLoadChooser::open() { } const Common::String &SaveLoadChooser::getResultString() const { - return (_list->getSelected() > -1) ? _list->getSelectedString() : _resultString; + int selItem = _list->getSelected(); + return (selItem >= 0) ? _list->getSelectedString() : _resultString; } void SaveLoadChooser::setSaveMode(bool saveMode) { -- cgit v1.2.3