From: Marcin Siodelski Date: Fri, 4 Apr 2014 15:07:30 +0000 (+0200) Subject: [master] Explicitly cast the integer value to streampos. X-Git-Tag: bind10-1.2.0rc1-release~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b3f795e7faf5cde5c864db15ed4ed79faea85b6a;p=thirdparty%2Fkea.git [master] Explicitly cast the integer value to streampos. Older gcc compiler (4.1) doesn't implicitly cast the integer value to a streampos value. This caused compilation problems on Centos5. The explicit cast eliminates this issue. --- diff --git a/src/lib/util/csv_file.cc b/src/lib/util/csv_file.cc index 3abf4ad667..2639eced7c 100644 --- a/src/lib/util/csv_file.cc +++ b/src/lib/util/csv_file.cc @@ -170,7 +170,7 @@ CSVFile::checkStreamStatusAndReset(const std::string& operation) const { } } -std::ifstream::pos_type +std::streampos CSVFile::size() const { std::ifstream fs(filename_.c_str()); bool ok = fs.good(); @@ -255,7 +255,7 @@ CSVFile::next(CSVRow& row, const bool skip_validation) { void CSVFile::open() { // If file doesn't exist or is empty, we have to create our own file. - if (size() == 0) { + if (size() == static_cast(0)) { recreate(); } else { diff --git a/src/lib/util/csv_file.h b/src/lib/util/csv_file.h index 264a993b36..aab9decfde 100644 --- a/src/lib/util/csv_file.h +++ b/src/lib/util/csv_file.h @@ -456,7 +456,7 @@ private: void checkStreamStatusAndReset(const std::string& operation) const; /// @brief Returns size of the CSV file. - std::ifstream::pos_type size() const; + std::streampos size() const; /// @brief CSV file name. std::string filename_;