aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-11-02 17:34:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-11-02 17:35:06 +0000
commit94c27e7984c9d992b038788b56c79496d105e133 (patch)
treef3c815aeec5fc84decab0d49f90ec8a7b77936ec
parent831180ea51569c57d9d653eee87b2ed89006f8f8 (diff)
downloadpaludis-94c27e7984c9d992b038788b56c79496d105e133.tar.gz
paludis-94c27e7984c9d992b038788b56c79496d105e133.tar.xz
std::boolalpha on input is broken by design
-rw-r--r--paludis/util/destringify.hh17
1 files changed, 7 insertions, 10 deletions
diff --git a/paludis/util/destringify.hh b/paludis/util/destringify.hh
index 66114d0..dc6e4aa 100644
--- a/paludis/util/destringify.hh
+++ b/paludis/util/destringify.hh
@@ -114,18 +114,15 @@ namespace paludis
*/
static bool do_destringify(const std::string & s)
{
- std::istringstream ss(s);
- if ((s[0] >= 'a' && s[0] <= 'z') || (s[0] >= 'A' && s[0] <= 'Z'))
- {
- bool b;
- ss >> std::boolalpha >> b;
- if (ss.eof() && ! ss.bad())
- return b;
- else
- throw Exception_(s);
- }
+ /* Don't use boolalpha on std::istringstream here, since it's way too difficult
+ * to test for errors and eof. See gcc bug 37958. */
+ if (s == "true")
+ return true;
+ else if (s == "false")
+ return false;
else
{
+ std::istringstream ss(s);
int i;
ss >> i;
if (ss.eof() && ! ss.bad())