From 705a573d29be2a440558b304fa6955d05cb1ae62 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 1 Nov 2011 11:55:23 -0400 Subject: [PATCH] csv: use unsigned to avoid compiler warnings --- plugins/input/csv/csv_datasource.cpp | 10 +++++----- plugins/input/csv/csv_datasource.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 4d26bdd0f..f76656311 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -127,7 +127,7 @@ void csv_datasource::parse_csv(T& stream, std::string const& quote) const { stream.seekg (0, std::ios::end); - int file_length_ = stream.tellg(); + file_length_ = stream.tellg(); if (filesize_max_ > 0) { @@ -151,7 +151,7 @@ void csv_datasource::parse_csv(T& stream, char newline = '\n'; int newline_count = 0; int carriage_count = 0; - for(std::size_t idx = 0; idx < file_length_; idx++) + for(unsigned idx = 0; idx < file_length_; idx++) { char c = static_cast(stream.get()); if (c == '\n') @@ -357,7 +357,7 @@ void csv_datasource::parse_csv(T& stream, int feature_count(1); bool extent_initialized = false; - int num_headers = headers_.size(); + unsigned num_headers = headers_.size(); mapnik::transcoder tr(desc_.get_encoding()); while (std::getline(stream,csv_line,newline)) @@ -387,7 +387,7 @@ void csv_datasource::parse_csv(T& stream, // early return for strict mode if (strict_) { - int num_fields = std::distance(beg,tok.end()); + unsigned num_fields = std::distance(beg,tok.end()); if (num_fields != num_headers) { std::ostringstream s; @@ -405,7 +405,7 @@ void csv_datasource::parse_csv(T& stream, bool null_geom = false; std::vector collected; - for (int i = 0; i < num_headers; ++i) + for (unsigned i = 0; i < num_headers; ++i) { std::string fld_name(headers_.at(i)); collected.push_back(fld_name); diff --git a/plugins/input/csv/csv_datasource.hpp b/plugins/input/csv/csv_datasource.hpp index e3fbb1683..d2e51bf8c 100644 --- a/plugins/input/csv/csv_datasource.hpp +++ b/plugins/input/csv/csv_datasource.hpp @@ -29,7 +29,7 @@ class csv_datasource : public mapnik::datasource mutable mapnik::box2d extent_; mutable std::string filename_; mutable std::string inline_string_; - mutable int file_length_; + mutable unsigned file_length_; mutable int row_limit_; mutable std::vector features_; mutable std::string escape_;