From 322faf1a0192abb6ffd8ce5d83ec0b2d9deff534 Mon Sep 17 00:00:00 2001 From: Daigo Moriwaki Date: Sun, 4 Dec 2016 22:31:34 +0900 Subject: Fix compiler warnings with GCC 6 --- bin/gpsshogi.cc | 4 ++-- bin/gpsusi.cc | 7 +++++-- sample/gpsshell/httpclient.cc | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bin/gpsshogi.cc b/bin/gpsshogi.cc index 7b7fd5d..5365159 100644 --- a/bin/gpsshogi.cc +++ b/bin/gpsshogi.cc @@ -239,7 +239,7 @@ void play(int argc,char **argv) } } if (vm.count("benchmark") || vm.count("benchmark-single")) { - std::auto_ptr player + std::unique_ptr player (makePlayer(eval_options.eval_type, match_options.use_alpha_beta)); search_options.setConfig(*player); benchmark(*player, match_options.initial_csa_file, @@ -349,7 +349,7 @@ void play(int argc,char **argv) output = makeOutput(match_options.csa_mode, match_options.output_filename, record_id); - std::auto_ptr logger(new CsaLogger(*output)); + std::unique_ptr logger(new CsaLogger(*output)); std::unique_ptr client; #ifndef MINIMAL diff --git a/bin/gpsusi.cc b/bin/gpsusi.cc index ad684c2..4d097aa 100644 --- a/bin/gpsusi.cc +++ b/bin/gpsusi.cc @@ -926,8 +926,11 @@ void play(std::istream& is, std::ostream& os) if (line == "isready") { static bool initalized = false; if (! initalized) { - if (error_log_file != "") - freopen(error_log_file.c_str(), "w", stderr); + if (error_log_file != "") { + if (freopen(error_log_file.c_str(), "w", stderr) == nullptr) { + std::cerr << "Failed to create error log file\n"; + } + } eval::ml::OpenMidEndingEval::setUp(); progress::ml::NewProgress::setUp(); rating::StandardFeatureSet::instance(); diff --git a/sample/gpsshell/httpclient.cc b/sample/gpsshell/httpclient.cc index dcbc434..6110f47 100644 --- a/sample/gpsshell/httpclient.cc +++ b/sample/gpsshell/httpclient.cc @@ -23,7 +23,7 @@ int gpsshell::getFileOverHttp(const std::string& url, const std::string& tempfil return 1; } Poco::URI uri(url); - std::auto_ptr ptrHttpStream(Poco::URIStreamOpener::defaultOpener().open(uri)); + std::unique_ptr ptrHttpStream(Poco::URIStreamOpener::defaultOpener().open(uri)); Poco::StreamCopier::copyStream(*ptrHttpStream.get(), localFile); } catch (Poco::Exception& exc) -- 2.20.1