File: epd.c.patch

package info (click to toggle)
sjeng 11.2-15
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,436 kB
  • sloc: ansic: 13,378; sh: 324; makefile: 29
file content (51 lines) | stat: -rw-r--r-- 1,276 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Author: Lukas Geyer <geyer@math.uni-dortmund.de>
Description: Fixed format mismatches in printf().

--- sjeng-11.2.orig/epd.c
+++ sjeng-11.2/epd.c
@@ -24,6 +24,7 @@
 #include "sjeng.h"
 #include "protos.h"
 #include "extvars.h"
+#include <errno.h>
 
 void setup_epd_line(char* inbuff)
 {
@@ -243,6 +244,10 @@
   thinktime *= 100;
 
   testsuite = fopen(testname, "r");
+  if (testsuite==NULL) {
+	  fprintf(stderr, "Cannot open file %s: %s\n", testname, strerror(errno));
+	  return;
+  }
 
   while (fgets(readbuff, 2000, testsuite) != NULL)
     {
@@ -264,8 +269,8 @@
     //  cpu_end = clock();
      // rdelay(2);
      
-     elapsed = (cpu_end-cpu_start)/(double) CLOCKS_PER_SEC;
-     printf("Time: %f\n", elapsed);
+     // elapsed = (cpu_end-cpu_start)/(double) CLOCKS_PER_SEC;
+     // printf("Time: %f\n", elapsed);
       
      if (interrupt()) rinput(tempbuff, STR_BUFF, stdin);
       
@@ -304,7 +309,7 @@
       
       printf("Move ordering : %f%%\n", (((float)FHF*100)/(float)FH+1));
       
-      printf("Material score: %d   Eval : %d\n", Material, eval());
+      printf("Material score: %d   Eval : %ld\n", Material, eval());
       printf("\n");
      
       if (!forcedwin)
@@ -329,5 +334,6 @@
     };
  
   printf("\n");
+  fclose(testsuite);
 };