From: James Turner Date: Fri, 28 Oct 2011 11:07:35 +0000 (+0100) Subject: Fix assorted compiler warnings found by Clang X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=95ddc04a734d56d917c94e4bc952e9ac78637ba6;p=simgear.git Fix assorted compiler warnings found by Clang --- diff --git a/simgear/io/HTTPRequest.cxx b/simgear/io/HTTPRequest.cxx index 4b7a11bf..38651a3e 100644 --- a/simgear/io/HTTPRequest.cxx +++ b/simgear/io/HTTPRequest.cxx @@ -66,7 +66,7 @@ void Request::responseStart(const string& r) void Request::responseHeader(const string& key, const string& value) { if (key == "connection") { - _willClose = (value.find("close") >= 0); + _willClose = (value.find("close") != string::npos); } _responseHeaders[key] = value; diff --git a/simgear/io/iochannel.cxx b/simgear/io/iochannel.cxx index 9b88c6d5..468f666b 100644 --- a/simgear/io/iochannel.cxx +++ b/simgear/io/iochannel.cxx @@ -73,6 +73,6 @@ bool SGIOChannel::close() { // dummy eof routine -bool SGIOChannel::eof() { +bool SGIOChannel::eof() const { return false; } diff --git a/simgear/io/iochannel.hxx b/simgear/io/iochannel.hxx index ea1b0077..f5266b03 100644 --- a/simgear/io/iochannel.hxx +++ b/simgear/io/iochannel.hxx @@ -149,7 +149,7 @@ public: * false. * @return result of eof check */ - virtual bool eof(); + virtual bool eof() const; inline void set_type( SGChannelType t ) { type = t; } inline SGChannelType get_type() const { return type; } diff --git a/simgear/io/sg_file.hxx b/simgear/io/sg_file.hxx index 7e5854c1..7d842863 100644 --- a/simgear/io/sg_file.hxx +++ b/simgear/io/sg_file.hxx @@ -88,7 +88,7 @@ public: inline std::string get_file_name() const { return file_name; } /** @return true of eof conditions exists */ - inline bool eof() const { return eof_flag; }; + virtual bool eof() const { return eof_flag; }; }; diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index 2a98b34e..ed31e18b 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -206,7 +206,7 @@ string SGPath::base() const return path; } - if (index >= 0) { + if (index != string::npos) { return path.substr(0, index); } else { return path; @@ -256,7 +256,7 @@ string SGPath::complete_lower_extension() const } string::size_type firstDot = path.find(".", index); - if ((firstDot >= 0) && (path.find(sgDirPathSep, firstDot) == string::npos)) { + if ((firstDot != string::npos) && (path.find(sgDirPathSep, firstDot) == string::npos)) { return boost::to_lower_copy(path.substr(firstDot + 1)); } else { return ""; diff --git a/simgear/misc/sg_path.hxx b/simgear/misc/sg_path.hxx index c19b977d..969eec0b 100644 --- a/simgear/misc/sg_path.hxx +++ b/simgear/misc/sg_path.hxx @@ -124,7 +124,7 @@ public: std::string dir() const; /** - * Get the base part of the path (everything but the extension.) + * Get the base part of the path (everything but the final extension.) * @return the base string */ std::string base() const; diff --git a/simgear/misc/zfstream.cxx b/simgear/misc/zfstream.cxx index 9ad2dd77..0b75eb55 100644 --- a/simgear/misc/zfstream.cxx +++ b/simgear/misc/zfstream.cxx @@ -167,7 +167,7 @@ gzfilebuf::close() std::streampos -gzfilebuf::seekoff( std::streamoff, ios_seekdir, int ) +gzfilebuf::seekoff( std::streamoff, ios_seekdir, ios_openmode ) { return std::streampos(EOF); } diff --git a/simgear/misc/zfstream.hxx b/simgear/misc/zfstream.hxx index a8635483..a9f065ea 100644 --- a/simgear/misc/zfstream.hxx +++ b/simgear/misc/zfstream.hxx @@ -90,7 +90,7 @@ public: bool is_open() const { return (file != NULL); } /** @return stream position */ - virtual std::streampos seekoff( std::streamoff off, ios_seekdir way, int which ); + virtual std::streampos seekoff( std::streamoff off, ios_seekdir way, ios_openmode which ); /** sync the stream */ virtual int sync();