]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Explicitly cast the integer value to streampos.
authorMarcin Siodelski <marcin@isc.org>
Fri, 4 Apr 2014 15:07:30 +0000 (17:07 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 4 Apr 2014 15:07:30 +0000 (17:07 +0200)
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.

src/lib/util/csv_file.cc
src/lib/util/csv_file.h

index 3abf4ad667a525aab4781b4ff3176f68ad07fe69..2639eced7c1f6ac71b3574efad0fd2ecf987e792 100644 (file)
@@ -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 {
index 264a993b3621e828cb64589db4f5ae4e5e867364..aab9decfdeaefff2ec0c2fd30133e4f1036ffb5d 100644 (file)
@@ -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_;