Fix uninitialized variable in book code
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 7 Oct 2010 09:59:33 +0000 (11:59 +0200)
committerArun Persaud <arun@nubati.net>
Fri, 8 Oct 2010 02:30:11 +0000 (19:30 -0700)
The variable ' power' was used uninitialized in case -bookVariation was
set to 0, which can be an error even if it was only multiplied by zero.

book.c

diff --git a/book.c b/book.c
index 48fbc9d..e19ef0b 100644 (file)
--- a/book.c
+++ b/book.c
@@ -499,7 +499,7 @@ char *ProbeBook(int moveNr, char *book)
         entries[count++] = entry;
     }
     if(appData.bookStrength != 50) { // transform weights
-        double power, maxWeight = 0.0;
+        double power = 0, maxWeight = 0.0;
         if(appData.bookStrength) power = (100.-appData.bookStrength)/appData.bookStrength;
         for(i=0; i<count; i++) if(entries[i].weight > maxWeight) maxWeight = entries[i].weight;
         for(i=0; i<count; i++){