Fix #255: gcc, clang compiler warnings

This commit is contained in:
Calcitem 2021-08-02 01:45:47 +08:00
parent e5d96b92cf
commit 71328c0dd8
No known key found for this signature in database
GPG Key ID: F2F7C29E054CFB80
6 changed files with 8 additions and 8 deletions

View File

@ -484,7 +484,7 @@ Depth get_search_depth(const Position *pos)
if (gameOptions.getDrawOnHumanExperience()) { if (gameOptions.getDrawOnHumanExperience()) {
if (index == 4 && if (index == 4 &&
is_star_squares_full((Position *)pos)) { is_star_squares_full(const_cast<Position *>(pos))) {
d = 1; // In order to use Mobility d = 1; // In order to use Mobility
} }
} }

View File

@ -581,7 +581,7 @@ bool Position::reset()
break; break;
} }
if (snprintf(record, RECORD_LEN_MAX, "r%1d s%03zu t%02d", if (snprintf(record, RECORD_LEN_MAX, "r%1d s%03u t%02d",
r + 1, rule.nMoveRule, 0) > 0) { r + 1, rule.nMoveRule, 0) > 0) {
return true; return true;
} }

View File

@ -36,7 +36,7 @@
struct StateInfo struct StateInfo
{ {
// Copied when making a move // Copied when making a move
int rule50 {0}; unsigned int rule50 {0};
int pliesFromNull; int pliesFromNull;
// Not copied when making a move (will be recomputed anyhow) // Not copied when making a move (will be recomputed anyhow)
@ -94,7 +94,7 @@ public:
bool has_game_cycle() const; bool has_game_cycle() const;
bool has_repeated(Sanmill::Stack<Position> &ss) const; bool has_repeated(Sanmill::Stack<Position> &ss) const;
#endif // THREEFOLD_REPETITION #endif // THREEFOLD_REPETITION
int rule50_count() const; unsigned int rule50_count() const;
/// Mill Game /// Mill Game
@ -253,7 +253,7 @@ inline int Position::game_ply() const
return gamePly; return gamePly;
} }
inline int Position::rule50_count() const inline unsigned int Position::rule50_count() const
{ {
return st.rule50; return st.rule50;
} }

View File

@ -70,7 +70,7 @@ struct Rule
bool mayFly; bool mayFly;
// The N-move rule in Mill states that if no remove has been made in the last N moves. // The N-move rule in Mill states that if no remove has been made in the last N moves.
size_t nMoveRule; unsigned int nMoveRule;
}; };
#define N_RULES 5 #define N_RULES 5

View File

@ -154,7 +154,7 @@ void on_mayFly(const Option &o)
void on_nMoveRule(const Option &o) void on_nMoveRule(const Option &o)
{ {
rule.nMoveRule = (size_t)o; rule.nMoveRule = (unsigned int)o;
} }
/// Our case insensitive less() function as required by UCI protocol /// Our case insensitive less() function as required by UCI protocol

View File

@ -394,7 +394,7 @@ void Game::setRule(int ruleNo, int stepLimited /*= -1*/, int timeLimited /*= 0 T
elapsedSeconds[WHITE] = elapsedSeconds[BLACK] = 0; elapsedSeconds[WHITE] = elapsedSeconds[BLACK] = 0;
char record[64] = { 0 }; char record[64] = { 0 };
if (snprintf(record, Position::RECORD_LEN_MAX, "r%1d s%03zu t%02d", r + 1, rule.nMoveRule, 0) <= 0) { if (snprintf(record, Position::RECORD_LEN_MAX, "r%1d s%03u t%02d", r + 1, rule.nMoveRule, 0) <= 0) {
assert(0); assert(0);
} }
string cmd(record); string cmd(record);