]> git.sesse.net Git - stockfish/commitdiff
Fix MSVC warning on streampos to size_t conversion
authorMarco Costalba <mcostalba@gmail.com>
Sun, 26 Feb 2012 11:04:35 +0000 (12:04 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 26 Feb 2012 11:05:37 +0000 (12:05 +0100)
Fix this warning with MSVC 64 bits:

warning C4244: '=' : conversion from 'std::streampos' to 'size_t',
possible loss of data

Point is that std::streampos could be negative, while size_t
is always non-negative.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/book.cpp

index d5bab90b3f144cf167b3e8726905c938298c1fd9..1dd5aa6dadb4675cec1be733b3fb5380cdaab8cf 100644 (file)
@@ -383,7 +383,7 @@ bool Book::open(const char* fName) {
       return false; // Silently fail if the file is not found
 
   // Get the book size in number of entries, we are already at the end of file
       return false; // Silently fail if the file is not found
 
   // Get the book size in number of entries, we are already at the end of file
-  size = tellg() / sizeof(BookEntry);
+  size = (size_t)tellg() / sizeof(BookEntry);
 
   if (!good())
   {
 
   if (!good())
   {