]> git.sesse.net Git - stockfish/commitdiff
Strip whitespace from beginning of string sent to set_option_value().
authorTord Romstad <tord@glaurungchess.com>
Fri, 10 Jul 2009 16:34:56 +0000 (18:34 +0200)
committerTord Romstad <tord@glaurungchess.com>
Fri, 10 Jul 2009 16:34:56 +0000 (18:34 +0200)
It turned out that the input sent to set_option_value() when it is called by
set_option() in uci.cpp always started with at least one whitespace. In most
cases, this is not a problem, because the majority of UCI options have numeric
values. It did, however, cause a problem for UCI options with non-numerical
values, like options of type CHECK and COMBO. In particular, changing the
value of an option of type CHECK didn't work, because the comparisons with
"true" and "false" would always return false. This means that the "Ponder"
and "UCI_Chess960" options haven't been working for a while.

src/uci.cpp

index 0a1de3127ae8aa167d6db35032549ee3e5329ac9..1f1ba096ca6aa38edf39889d5e359dc07c96f9e9 100644 (file)
@@ -242,6 +242,11 @@ namespace {
         }
         if (token == "value")
         {
+            // Skip whitespace. There should be a better way to do this, but
+            // I don't know how...
+            while(isspace(uip.get()));
+            uip.unget();
+
             getline(uip, token); // reads until end of line
             set_option_value(name, token);
         } else