summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-10-23 02:46:15 -0700
committerKonstantin Käfer <mail@kkaefer.com>2014-10-23 02:46:15 -0700
commit10cb83579feb53e7524ec899c0bff19161877669 (patch)
treea8bbac3634560412f03cd2404348c06ee7b47bfc /src
parent40a933ddce390b7926c25bb00a95f34fd76453ae (diff)
downloadqtlocation-mapboxgl-10cb83579feb53e7524ec899c0bff19161877669.tar.gz
gcc fixes
Diffstat (limited to 'src')
-rwxr-xr-xsrc/clipper/clipper.cpp2
-rw-r--r--src/geometry/debug_font_buffer.cpp6
-rw-r--r--src/map/raster_tile_data.cpp4
-rw-r--r--src/map/tile.cpp16
-rw-r--r--src/map/transform_state.cpp4
-rw-r--r--src/map/vector_tile_data.cpp4
-rw-r--r--src/renderer/painter.cpp8
-rw-r--r--src/storage/file_source.cpp26
-rw-r--r--src/storage/http_request.cpp4
-rw-r--r--src/storage/response.cpp2
-rw-r--r--src/style/style.cpp1
-rw-r--r--src/style/style_parser.cpp2
-rw-r--r--src/util/image.cpp1
-rw-r--r--src/util/raster.cpp2
14 files changed, 43 insertions, 39 deletions
diff --git a/src/clipper/clipper.cpp b/src/clipper/clipper.cpp
index 7571ae1439..ea468d69e4 100755
--- a/src/clipper/clipper.cpp
+++ b/src/clipper/clipper.cpp
@@ -48,6 +48,8 @@
#include <ostream>
#include <functional>
+#pragma GCC diagnostic ignored "-Wshadow"
+
namespace ClipperLib {
#ifdef use_int32
diff --git a/src/geometry/debug_font_buffer.cpp b/src/geometry/debug_font_buffer.cpp
index 387a646299..2a0924a1c4 100644
--- a/src/geometry/debug_font_buffer.cpp
+++ b/src/geometry/debug_font_buffer.cpp
@@ -10,9 +10,9 @@ using namespace mbgl;
void DebugFontBuffer::addText(const char *text, double left, double baseline, double scale) {
uint16_t *coords = nullptr;
- size_t length = strlen(text);
- for (size_t i = 0; i < length; ++i) {
- if (text[i] < 32 || text[i] > 127) {
+ const size_t len = strlen(text);
+ for (size_t i = 0; i < len; ++i) {
+ if (text[i] < 32 || (unsigned char)(text[i]) > 127) {
continue;
}
diff --git a/src/map/raster_tile_data.cpp b/src/map/raster_tile_data.cpp
index e7725b7abd..99ca327fe7 100644
--- a/src/map/raster_tile_data.cpp
+++ b/src/map/raster_tile_data.cpp
@@ -5,8 +5,8 @@
using namespace mbgl;
-RasterTileData::RasterTileData(Tile::ID id, Map &map, const util::ptr<SourceInfo> &source)
- : TileData(id, map, source),
+RasterTileData::RasterTileData(Tile::ID id_, Map &map_, const util::ptr<SourceInfo> &source_)
+ : TileData(id_, map_, source_),
bucket(map.getTexturepool(), properties) {
}
diff --git a/src/map/tile.cpp b/src/map/tile.cpp
index 1fe0faefde..3070d3fd96 100644
--- a/src/map/tile.cpp
+++ b/src/map/tile.cpp
@@ -25,13 +25,13 @@ std::forward_list<Tile::ID> Tile::ID::children(int32_t child_z) const {
assert(child_z > z);
int32_t factor = std::pow(2, child_z - z);
- std::forward_list<ID> children;
+ std::forward_list<ID> child_ids;
for (int32_t ty = y * factor, y_max = (y + 1) * factor; ty < y_max; ++ty) {
for (int32_t tx = x * factor, x_max = (x + 1) * factor; tx < x_max; ++tx) {
- children.emplace_front(child_z, tx, ty);
+ child_ids.emplace_front(child_z, tx, ty);
}
}
- return children;
+ return child_ids;
}
Tile::ID Tile::ID::normalized() const {
@@ -42,13 +42,13 @@ Tile::ID Tile::ID::normalized() const {
return ID { z, nx, ny };
}
-bool Tile::ID::isChildOf(const Tile::ID &parent) const {
- if (parent.z >= z || parent.w != w) {
+bool Tile::ID::isChildOf(const Tile::ID &parent_id) const {
+ if (parent_id.z >= z || parent_id.w != w) {
return false;
}
- int32_t scale = std::pow(2, z - parent.z);
- return parent.x == ((x < 0 ? x - scale + 1 : x) / scale) &&
- parent.y == y / scale;
+ int32_t scale = std::pow(2, z - parent_id.z);
+ return parent_id.x == ((x < 0 ? x - scale + 1 : x) / scale) &&
+ parent_id.y == y / scale;
}
diff --git a/src/map/transform_state.cpp b/src/map/transform_state.cpp
index fa521400c3..0a858bce6a 100644
--- a/src/map/transform_state.cpp
+++ b/src/map/transform_state.cpp
@@ -96,8 +96,8 @@ float TransformState::lngX(float lon) const {
}
float TransformState::latY(float lat) const {
- float latY = 180 / M_PI * std::log(std::tan(M_PI / 4 + lat * M_PI / 360));
- return (180 - latY) * worldSize() / 360;
+ float lat_y = 180 / M_PI * std::log(std::tan(M_PI / 4 + lat * M_PI / 360));
+ return (180 - lat_y) * worldSize() / 360;
}
std::array<float, 2> TransformState::locationCoordinate(float lon, float lat) const {
diff --git a/src/map/vector_tile_data.cpp b/src/map/vector_tile_data.cpp
index 48b46059a5..b94bc66dea 100644
--- a/src/map/vector_tile_data.cpp
+++ b/src/map/vector_tile_data.cpp
@@ -8,8 +8,8 @@
using namespace mbgl;
-VectorTileData::VectorTileData(Tile::ID id, Map &map, const util::ptr<SourceInfo> &source)
- : TileData(id, map, source),
+VectorTileData::VectorTileData(Tile::ID id_, Map &map_, const util::ptr<SourceInfo> &source_)
+ : TileData(id_, map_, source_),
depth(id.z >= source->max_zoom ? map.getMaxZoom() - id.z : 1) {
}
diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp
index aa522734c5..38c2176aed 100644
--- a/src/renderer/painter.cpp
+++ b/src/renderer/painter.cpp
@@ -128,10 +128,10 @@ void Painter::useProgram(uint32_t program) {
}
}
-void Painter::lineWidth(float lineWidth) {
- if (gl_lineWidth != lineWidth) {
- glLineWidth(lineWidth);
- gl_lineWidth = lineWidth;
+void Painter::lineWidth(float line_width) {
+ if (gl_lineWidth != line_width) {
+ glLineWidth(line_width);
+ gl_lineWidth = line_width;
}
}
diff --git a/src/storage/file_source.cpp b/src/storage/file_source.cpp
index 12d924416c..70b4abe4c7 100644
--- a/src/storage/file_source.cpp
+++ b/src/storage/file_source.cpp
@@ -27,12 +27,12 @@ FileSource::~FileSource() {
// NOTE: We don't need to delete the messenger since it will be deleted by the
// uv_messenger_stop() function.
- util::ptr<BaseRequest> request;
+ util::ptr<BaseRequest> req;
// Send a cancel() message to all requests that we are still holding.
for (const std::pair<std::string, std::weak_ptr<BaseRequest>> &pair : pending) {
- if ((request = pair.second.lock())) {
- request->cancel();
+ if ((req = pair.second.lock())) {
+ req->cancel();
}
}
}
@@ -61,25 +61,25 @@ std::unique_ptr<Request> FileSource::request(ResourceType type, const std::strin
}
}();
- util::ptr<BaseRequest> request;
+ util::ptr<BaseRequest> req;
// First, try to find an existing Request object.
auto it = pending.find(absoluteURL);
if (it != pending.end()) {
- request = it->second.lock();
+ req = it->second.lock();
}
- if (!request) {
+ if (!req) {
if (absoluteURL.substr(0, 7) == "file://") {
- request = std::make_shared<FileRequest>(absoluteURL.substr(7), loop);
+ req = std::make_shared<FileRequest>(absoluteURL.substr(7), loop);
} else {
- request = std::make_shared<HTTPRequest>(type, absoluteURL, loop, store);
+ req = std::make_shared<HTTPRequest>(type, absoluteURL, loop, store);
}
- pending.emplace(absoluteURL, request);
+ pending.emplace(absoluteURL, req);
}
- return std::unique_ptr<Request>(new Request(request));
+ return std::unique_ptr<Request>(new Request(req));
}
void FileSource::prepare(std::function<void()> fn) {
@@ -93,10 +93,10 @@ void FileSource::prepare(std::function<void()> fn) {
void FileSource::retryAllPending() {
assert(thread_id == uv_thread_self());
- util::ptr<BaseRequest> request;
+ util::ptr<BaseRequest> req;
for (const std::pair<std::string, std::weak_ptr<BaseRequest>> &pair : pending) {
- if ((request = pair.second.lock())) {
- request->retryImmediately();
+ if ((req = pair.second.lock())) {
+ req->retryImmediately();
}
}
diff --git a/src/storage/http_request.cpp b/src/storage/http_request.cpp
index 3da4fc7c31..46b1d5e194 100644
--- a/src/storage/http_request.cpp
+++ b/src/storage/http_request.cpp
@@ -20,8 +20,8 @@ struct CacheRequestBaton {
util::ptr<SQLiteStore> store;
};
-HTTPRequest::HTTPRequest(ResourceType type_, const std::string &path, uv_loop_t *loop_, util::ptr<SQLiteStore> store_)
- : BaseRequest(path), thread_id(uv_thread_self()), loop(loop_), store(store_), type(type_) {
+HTTPRequest::HTTPRequest(ResourceType type_, const std::string &path_, uv_loop_t *loop_, util::ptr<SQLiteStore> store_)
+ : BaseRequest(path_), thread_id(uv_thread_self()), loop(loop_), store(store_), type(type_) {
if (store) {
startCacheRequest();
} else {
diff --git a/src/storage/response.cpp b/src/storage/response.cpp
index cdaf33e4e4..f1e1c35874 100644
--- a/src/storage/response.cpp
+++ b/src/storage/response.cpp
@@ -9,7 +9,7 @@ int64_t Response::parseCacheControl(const char *value) {
uint64_t seconds = 0;
// TODO: cache-control may contain other information as well:
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
- if (std::sscanf(value, "max-age=%llu", &seconds) == 1) {
+ if (std::sscanf(value, "max-age=%lu", &seconds) == 1) {
return std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch()).count() +
seconds;
diff --git a/src/style/style.cpp b/src/style/style.cpp
index 6f0a0e3b28..aa5b150882 100644
--- a/src/style/style.cpp
+++ b/src/style/style.cpp
@@ -12,6 +12,7 @@
#include <rapidjson/document.h>
+#include <algorithm>
namespace mbgl {
diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp
index b2714f5da5..47ff0c30ab 100644
--- a/src/style/style_parser.cpp
+++ b/src/style/style_parser.cpp
@@ -6,6 +6,8 @@
#include <mbgl/platform/log.hpp>
#include <csscolorparser/csscolorparser.hpp>
+#include <algorithm>
+
namespace mbgl {
using JSVal = const rapidjson::Value&;
diff --git a/src/util/image.cpp b/src/util/image.cpp
index ec218e0bed..fd0d34de2d 100644
--- a/src/util/image.cpp
+++ b/src/util/image.cpp
@@ -1,4 +1,5 @@
#include <mbgl/util/image.hpp>
+
#include <png.h>
#include <cassert>
diff --git a/src/util/raster.cpp b/src/util/raster.cpp
index c4d7a15400..76cd411223 100644
--- a/src/util/raster.cpp
+++ b/src/util/raster.cpp
@@ -6,8 +6,6 @@
#include <mbgl/util/uv_detail.hpp>
#include <mbgl/util/std.hpp>
-#include <png.h>
-
#include <cassert>
#include <cstring>