]> git.sesse.net Git - stockfish/commitdiff
Use unsigned char as argument of std::isspace
authorMarco Costalba <mcostalba@gmail.com>
Fri, 6 Jun 2014 23:16:31 +0000 (01:16 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 6 Jun 2014 23:21:47 +0000 (01:21 +0200)
Although signature allows an int:

int isspace( int ch );

The behavior is undefined if the value of ch is
not representable as unsigned char and is not
equal to EOF.

See

http://en.cppreference.com/w/cpp/string/byte/isspace
http://www.greenend.org.uk/rjk/tech/cfu.html

This is really a tricky corner case of C standard!

Spotted and reported by Ron Britvich.

No functional change.

src/position.cpp

index 982352c51b74bbde4f91d0f4f34f8a84e78c33e8..2d5119389b989c0719c1514dd330ad7ddbeeca81 100644 (file)
@@ -226,7 +226,7 @@ void Position::set(const string& fenStr, bool isChess960, Thread* th) {
       incremented after Black's move.
 */
 
-  char col, row, token;
+  unsigned char col, row, token;
   size_t idx;
   Square sq = SQ_A8;
   std::istringstream ss(fenStr);