Commit b3f795e7 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[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.
parent 1b83c74d
...@@ -170,7 +170,7 @@ CSVFile::checkStreamStatusAndReset(const std::string& operation) const { ...@@ -170,7 +170,7 @@ CSVFile::checkStreamStatusAndReset(const std::string& operation) const {
} }
} }
std::ifstream::pos_type std::streampos
CSVFile::size() const { CSVFile::size() const {
std::ifstream fs(filename_.c_str()); std::ifstream fs(filename_.c_str());
bool ok = fs.good(); bool ok = fs.good();
...@@ -255,7 +255,7 @@ CSVFile::next(CSVRow& row, const bool skip_validation) { ...@@ -255,7 +255,7 @@ CSVFile::next(CSVRow& row, const bool skip_validation) {
void void
CSVFile::open() { CSVFile::open() {
// If file doesn't exist or is empty, we have to create our own file. // If file doesn't exist or is empty, we have to create our own file.
if (size() == 0) { if (size() == static_cast<std::streampos>(0)) {
recreate(); recreate();
} else { } else {
......
...@@ -456,7 +456,7 @@ private: ...@@ -456,7 +456,7 @@ private:
void checkStreamStatusAndReset(const std::string& operation) const; void checkStreamStatusAndReset(const std::string& operation) const;
/// @brief Returns size of the CSV file. /// @brief Returns size of the CSV file.
std::ifstream::pos_type size() const; std::streampos size() const;
/// @brief CSV file name. /// @brief CSV file name.
std::string filename_; std::string filename_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment