all repos — openbox @ aa827d0c91dcb808469af768cc9bed0ef8980abd

openbox fork - make it a bit more like ryudo

fixed getStringValue failure case and compiler warnings
Marius Nita marius@cs.pdx.edu
commit

aa827d0c91dcb808469af768cc9bed0ef8980abd

parent

4d0f46e554d1f0e379f411aa5f8f0ad140fd3237

2 files changed, 7 insertions(+), 5 deletions(-)

jump to
M util/epist/config.ccutil/epist/config.cc

@@ -35,13 +35,16 @@ items.clear();

} -const string &Config::getStringValue(Config::ItemType type) const +bool Config::getStringValue(Config::ItemType type, string &ret) const { ItemList::const_iterator it = items.begin(), end = items.end(); for (; it != end; ++it) { - if ((*it)->getType() == type) - return (*it)->getStringValue(); + if ((*it)->getType() == type) { + ret = (*it)->getStringValue(); + return true; + } } + return false; }

@@ -52,7 +55,6 @@ for (; it != end; ++it) {

if ((*it)->getType() == type) return (*it)->getNumberValue(); } - return 0; }
M util/epist/config.hhutil/epist/config.hh

@@ -45,7 +45,7 @@ public:

Config(); ~Config(); - const std::string &getStringValue(Config::ItemType) const; + bool getStringValue(Config::ItemType, std::string &) const; int getNumberValue(Config::ItemType) const; void addOption(ConfigItem *); void addOption(const std::string &, const std::string &);