[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] compiler warnings
From: |
Evan Berggren Daniel |
Subject: |
Re: [gnugo-devel] compiler warnings |
Date: |
Wed, 20 Nov 2002 18:44:53 -0500 (EST) |
On Thu, 21 Nov 2002, Gunnar Farneback wrote:
> Evan wrote:
> > This patch fixes compiler warnings in oracle.c and play_gmp.c.
> > [...]
> > --- engine/gnugo.h 19 Nov 2002 16:32:35 -0000 1.79
> > +++ engine/gnugo.h 20 Nov 2002 22:59:12 -0000
> > @@ -511,6 +511,10 @@
> > void decide_surrounded(int pos);
> > void decide_oracle(Gameinfo *gameinfo, char *infilename, char
> > *untilstring);
> >
> > +/*oracle.c*/
> > +void dismiss_oracle(void);
> > +void oracle_clear_board(int boardsize);
> > +
>
> If added to gnugo.h these should be removed from liberty.h.
> Duplicating the declarations is no good.
>
> > - to_gnugo_stream = (int) fdopen(pfd_a[1], "w");
> > + to_gnugo_stream = (FILE *) fdopen(pfd_a[1], "w");
> > /* Attach pipe b to from_gnugo_stream */
> > - from_gnugo_stream = (int) fdopen(pfd_b[0], "r");
> > + from_gnugo_stream = (FILE *) fdopen(pfd_b[0], "r");
>
> I have no idea why these were cast to int before, but fdopen() already
> returns a pointer to a FILE, so there's no need to cast at all.
Sounds correct to me. Here's the new version.
Thanks
Evan Daniel
Index: engine/gnugo.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/gnugo.h,v
retrieving revision 1.79
diff -u -r1.79 gnugo.h
--- engine/gnugo.h 19 Nov 2002 16:32:35 -0000 1.79
+++ engine/gnugo.h 20 Nov 2002 23:38:13 -0000
@@ -511,6 +511,10 @@
void decide_surrounded(int pos);
void decide_oracle(Gameinfo *gameinfo, char *infilename, char *untilstring);
+/*oracle.c*/
+void dismiss_oracle(void);
+void oracle_clear_board(int boardsize);
+
#endif /* _GNUGO_H_ */
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.135
diff -u -r1.135 liberty.h
--- engine/liberty.h 19 Nov 2002 16:32:35 -0000 1.135
+++ engine/liberty.h 20 Nov 2002 23:38:13 -0000
@@ -520,11 +520,9 @@
void reset_search_mask(void);
void set_search_limit(int pos, int value);
int oracle_play_move(int pos, int color);
-void oracle_clear_board(int boardsize);
void consult_oracle(int color);
void summon_oracle(void);
void oracle_loadsgf(char *infilename, char *untilstring);
-void dismiss_oracle(void);
int oracle_threatens(int move, int target);
int within_search_area(int pos);
int metamachine_genmove(int *i, int *j, int color);
Index: engine/oracle.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/oracle.c,v
retrieving revision 1.6
diff -u -r1.6 oracle.c
--- engine/oracle.c 16 Nov 2002 17:43:47 -0000 1.6
+++ engine/oracle.c 20 Nov 2002 23:38:13 -0000
@@ -126,9 +126,9 @@
}
oracle_exists = 1;
/* Attach pipe a to to_gnugo_stream */
- to_gnugo_stream = (int) fdopen(pfd_a[1], "w");
+ to_gnugo_stream = fdopen(pfd_a[1], "w");
/* Attach pipe b to from_gnugo_stream */
- from_gnugo_stream = (int) fdopen(pfd_b[0], "r");
+ from_gnugo_stream = fdopen(pfd_b[0], "r");
}
/* load an sgf file */