mirror of
https://github.com/sockspls/badfish
synced 2025-05-02 09:39:36 +00:00
Improve handling of the debug log file.
Fix handling of empty strings in uci options and reassigning of the log file Fixes https://github.com/official-stockfish/Stockfish/issues/3650 Closes https://github.com/official-stockfish/Stockfish/pull/3655 No functional change
This commit is contained in:
parent
1946a67567
commit
ccf0239bc4
3 changed files with 10 additions and 9 deletions
2
AUTHORS
2
AUTHORS
|
@ -1,4 +1,4 @@
|
||||||
# List of authors for Stockfish, as of June 14, 2021
|
# List of authors for Stockfish
|
||||||
|
|
||||||
# Founders of the Stockfish project and fishtest infrastructure
|
# Founders of the Stockfish project and fishtest infrastructure
|
||||||
Tord Romstad (romstad)
|
Tord Romstad (romstad)
|
||||||
|
|
15
src/misc.cpp
15
src/misc.cpp
|
@ -110,7 +110,14 @@ public:
|
||||||
|
|
||||||
static Logger l;
|
static Logger l;
|
||||||
|
|
||||||
if (!fname.empty() && !l.file.is_open())
|
if (l.file.is_open())
|
||||||
|
{
|
||||||
|
cout.rdbuf(l.out.buf);
|
||||||
|
cin.rdbuf(l.in.buf);
|
||||||
|
l.file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fname.empty())
|
||||||
{
|
{
|
||||||
l.file.open(fname, ifstream::out);
|
l.file.open(fname, ifstream::out);
|
||||||
|
|
||||||
|
@ -123,12 +130,6 @@ public:
|
||||||
cin.rdbuf(&l.in);
|
cin.rdbuf(&l.in);
|
||||||
cout.rdbuf(&l.out);
|
cout.rdbuf(&l.out);
|
||||||
}
|
}
|
||||||
else if (fname.empty() && l.file.is_open())
|
|
||||||
{
|
|
||||||
cout.rdbuf(l.out.buf);
|
|
||||||
cin.rdbuf(l.in.buf);
|
|
||||||
l.file.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ Option& Option::operator=(const string& v) {
|
||||||
|
|
||||||
assert(!type.empty());
|
assert(!type.empty());
|
||||||
|
|
||||||
if ( (type != "button" && v.empty())
|
if ( (type != "button" && type != "string" && v.empty())
|
||||||
|| (type == "check" && v != "true" && v != "false")
|
|| (type == "check" && v != "true" && v != "false")
|
||||||
|| (type == "spin" && (stof(v) < min || stof(v) > max)))
|
|| (type == "spin" && (stof(v) < min || stof(v) > max)))
|
||||||
return *this;
|
return *this;
|
||||||
|
|
Loading…
Add table
Reference in a new issue