Parcourir la source

[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.
Marcin Siodelski il y a 11 ans
Parent
commit
b3f795e7fa
2 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 2 2
      src/lib/util/csv_file.cc
  2. 1 1
      src/lib/util/csv_file.h

+ 2 - 2
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<std::streampos>(0)) {
         recreate();
 
     } else {

+ 1 - 1
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_;