summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-08-03 15:01:35 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-08-04 14:08:19 +0200
commit78ec33320ff5837f23e85e336716692f63fd0254 (patch)
treede48fe425d31e2378cc02544d97e981600c4dc61
parentab7456075c7744c8528c2b86cfa77f80d6a04ef1 (diff)
downloadqtlocation-mapboxgl-78ec33320ff5837f23e85e336716692f63fd0254.tar.gz
don't use certain STL functions

some functions defined in <cmath>, as well as std::to_string aren't available on GNU's STL for some platforms, e.g. Android
-rw-r--r--include/mbgl/util/projection.hpp8
-rw-r--r--linux/main.cpp2
-rw-r--r--linux/mapboxgl-app.gypi1
-rw-r--r--macosx/mapboxgl-app.gypi1
-rw-r--r--platform/default/asset_request_fs.cpp3
-rw-r--r--platform/default/glfw_view.cpp3
-rw-r--r--platform/default/http_request_curl.cpp6
-rw-r--r--platform/default/sqlite3.cpp1
-rw-r--r--src/csscolorparser/csscolorparser.cpp2
-rw-r--r--src/mbgl/geometry/collision_box_buffer.cpp4
-rw-r--r--src/mbgl/geometry/debug_font_buffer.cpp4
-rw-r--r--src/mbgl/geometry/icon_buffer.cpp6
-rw-r--r--src/mbgl/geometry/line_buffer.cpp4
-rw-r--r--src/mbgl/geometry/text_buffer.cpp6
-rw-r--r--src/mbgl/map/annotation.cpp12
-rw-r--r--src/mbgl/map/map.cpp6
-rw-r--r--src/mbgl/map/map_context.cpp3
-rw-r--r--src/mbgl/map/source.cpp4
-rw-r--r--src/mbgl/map/transform.cpp4
-rw-r--r--src/mbgl/map/transform_state.cpp4
-rw-r--r--src/mbgl/platform/gl.cpp3
-rw-r--r--src/mbgl/platform/log.cpp1
-rw-r--r--src/mbgl/renderer/fill_bucket.cpp2
-rw-r--r--src/mbgl/renderer/frame_history.cpp4
-rw-r--r--src/mbgl/renderer/painter_line.cpp2
-rw-r--r--src/mbgl/renderer/symbol_bucket.cpp2
-rw-r--r--src/mbgl/text/collision_tile.cpp2
-rw-r--r--src/mbgl/text/font_stack.cpp4
-rw-r--r--src/mbgl/text/get_anchors.cpp2
-rw-r--r--src/mbgl/util/compression.cpp1
m---------src/mbgl/util/geojsonvt0
-rw-r--r--src/mbgl/util/io.cpp1
-rw-r--r--src/mbgl/util/tile_cover.cpp8
-rw-r--r--src/mbgl/util/time.cpp2
34 files changed, 68 insertions, 50 deletions
diff --git a/include/mbgl/util/projection.hpp b/include/mbgl/util/projection.hpp
index f301d93005..9563900851 100644
--- a/include/mbgl/util/projection.hpp
+++ b/include/mbgl/util/projection.hpp
@@ -33,16 +33,16 @@ public:
static inline double getMetersPerPixelAtLatitude(const double lat, const double zoom) {
const double mapPixelWidthAtZoom = std::pow(2.0, zoom) * util::tileSize;
- const double constrainedLatitude = std::fmin(std::fmax(lat, -util::LATITUDE_MAX), util::LATITUDE_MAX);
+ const double constrainedLatitude = ::fmin(::fmax(lat, -util::LATITUDE_MAX), util::LATITUDE_MAX);
return std::cos(constrainedLatitude * util::DEG2RAD) * util::M2PI * util::EARTH_RADIUS_M / mapPixelWidthAtZoom;
}
static inline const ProjectedMeters projectedMetersForLatLng(const LatLng latLng) {
- const double constrainedLatitude = std::fmin(std::fmax(latLng.latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
+ const double constrainedLatitude = ::fmin(::fmax(latLng.latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
const double m = 1 - 1e-15;
- const double f = std::fmin(std::fmax(std::sin(util::DEG2RAD * constrainedLatitude), -m), m);
+ const double f = ::fmin(::fmax(std::sin(util::DEG2RAD * constrainedLatitude), -m), m);
const double easting = util::EARTH_RADIUS_M * latLng.longitude * util::DEG2RAD;
const double northing = 0.5 * util::EARTH_RADIUS_M * std::log((1 + f) / (1 - f));
@@ -54,7 +54,7 @@ public:
double latitude = (2 * std::atan(std::exp(projectedMeters.northing / util::EARTH_RADIUS_M)) - (M_PI / 2)) * util::RAD2DEG;
double longitude = projectedMeters.easting * util::RAD2DEG / util::EARTH_RADIUS_M;
- latitude = std::fmin(std::fmax(latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
+ latitude = ::fmin(::fmax(latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
return LatLng(latitude, longitude);
}
diff --git a/linux/main.cpp b/linux/main.cpp
index 9145b180f4..9acbbb659f 100644
--- a/linux/main.cpp
+++ b/linux/main.cpp
@@ -12,6 +12,8 @@
#include <getopt.h>
#include <fstream>
#include <sstream>
+#include <cstdlib>
+#include <cstdio>
namespace {
diff --git a/linux/mapboxgl-app.gypi b/linux/mapboxgl-app.gypi
index 35ca322e29..3d43da3847 100644
--- a/linux/mapboxgl-app.gypi
+++ b/linux/mapboxgl-app.gypi
@@ -29,6 +29,7 @@
'variables' : {
'cflags_cc': [
+ '<@(boost_cflags)',
'<@(glfw3_cflags)',
],
'ldflags': [
diff --git a/macosx/mapboxgl-app.gypi b/macosx/mapboxgl-app.gypi
index c56bca659f..3b7d904a7d 100644
--- a/macosx/mapboxgl-app.gypi
+++ b/macosx/mapboxgl-app.gypi
@@ -34,6 +34,7 @@
'variables' : {
'cflags_cc': [
+ '<@(boost_cflags)',
'<@(glfw3_cflags)',
],
'ldflags': [
diff --git a/platform/default/asset_request_fs.cpp b/platform/default/asset_request_fs.cpp
index 4511cf882a..733e240fb9 100644
--- a/platform/default/asset_request_fs.cpp
+++ b/platform/default/asset_request_fs.cpp
@@ -4,6 +4,7 @@
#include <mbgl/util/util.hpp>
#include <mbgl/util/url.hpp>
#include <mbgl/util/uv.hpp>
+#include <mbgl/util/string.hpp>
#include <uv.h>
@@ -131,7 +132,7 @@ void AssetRequest::fileStated(uv_fs_t *req) {
#else
self->response->modified = stat->st_mtime;
#endif
- self->response->etag = std::to_string(stat->st_ino);
+ self->response->etag = util::toString(stat->st_ino);
const auto size = (unsigned int)(stat->st_size);
self->response->data.resize(size);
self->buffer = uv_buf_init(const_cast<char *>(self->response->data.data()), size);
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index 49ae8c4f68..fb08b92344 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -5,6 +5,7 @@
#include <mbgl/platform/gl.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/util/gl_helper.hpp>
+#include <mbgl/util/string.hpp>
#include <cassert>
#include <cstdlib>
@@ -188,7 +189,7 @@ void GLFWView::addRandomCustomPointAnnotations(int count) {
for (int i = 0; i < count; i++) {
static int spriteID = 1;
- const auto name = std::string{ "marker-" } + std::to_string(spriteID++);
+ const auto name = std::string{ "marker-" } + mbgl::util::toString(spriteID++);
map->setSprite(name, makeSpriteImage(22, 22, 1));
spriteIDs.push_back(name);
points.emplace_back(makeRandomPoint(), name);
diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp
index 6b2c38e77b..22cb1df6f3 100644
--- a/platform/default/http_request_curl.cpp
+++ b/platform/default/http_request_curl.cpp
@@ -7,6 +7,7 @@
#include <mbgl/util/time.hpp>
#include <mbgl/util/util.hpp>
+#include <mbgl/util/string.hpp>
#include <curl/curl.h>
@@ -20,6 +21,7 @@
#include <map>
#include <cassert>
#include <cstring>
+#include <cstdio>
void handleError(CURLMcode code) {
if (code != CURLM_OK) {
@@ -700,12 +702,12 @@ void HTTPCURLRequest::handleResult(CURLcode code) {
} else if (responseCode >= 500 && responseCode < 600) {
// Server errors may be temporary, so back off exponentially.
response->status = Response::Error;
- response->message = "HTTP status code " + std::to_string(responseCode);
+ response->message = "HTTP status code " + util::toString(responseCode);
return finish(ResponseStatus::TemporaryError);
} else {
// We don't know how to handle any other errors, so declare them as permanently failing.
response->status = Response::Error;
- response->message = "HTTP status code " + std::to_string(responseCode);
+ response->message = "HTTP status code " + util::toString(responseCode);
return finish(ResponseStatus::PermanentError);
}
}
diff --git a/platform/default/sqlite3.cpp b/platform/default/sqlite3.cpp
index b2ae4e65bc..ca525cd20b 100644
--- a/platform/default/sqlite3.cpp
+++ b/platform/default/sqlite3.cpp
@@ -3,6 +3,7 @@
#include <cassert>
#include <cstring>
+#include <cstdio>
// Check sqlite3 library version.
const static bool sqliteVersionCheck = []() {
diff --git a/src/csscolorparser/csscolorparser.cpp b/src/csscolorparser/csscolorparser.cpp
index 7ba989fde8..8281eb4202 100644
--- a/src/csscolorparser/csscolorparser.cpp
+++ b/src/csscolorparser/csscolorparser.cpp
@@ -116,7 +116,7 @@ const size_t namedColorCount = sizeof (namedColors) / sizeof (NamedColor);
template <typename T>
uint8_t clamp_css_byte(T i) { // Clamp to integer 0 .. 255.
- i = std::round(i); // Seems to be what Chrome does (vs truncation).
+ i = ::round(i); // Seems to be what Chrome does (vs truncation).
return i < 0 ? 0 : i > 255 ? 255 : i;
}
diff --git a/src/mbgl/geometry/collision_box_buffer.cpp b/src/mbgl/geometry/collision_box_buffer.cpp
index 050a999db8..da9031c895 100644
--- a/src/mbgl/geometry/collision_box_buffer.cpp
+++ b/src/mbgl/geometry/collision_box_buffer.cpp
@@ -13,8 +13,8 @@ size_t CollisionBoxVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, f
int16_t *shorts = static_cast<int16_t *>(data);
shorts[0] /* pos */ = x;
shorts[1] /* pos */ = y;
- shorts[2] /* offset */ = std::round(ox); // use 1/64 pixels for placement
- shorts[3] /* offset */ = std::round(oy);
+ shorts[2] /* offset */ = ::round(ox); // use 1/64 pixels for placement
+ shorts[3] /* offset */ = ::round(oy);
uint8_t *ubytes = static_cast<uint8_t *>(data);
// a_data1
diff --git a/src/mbgl/geometry/debug_font_buffer.cpp b/src/mbgl/geometry/debug_font_buffer.cpp
index 1ec71463e5..e4af707660 100644
--- a/src/mbgl/geometry/debug_font_buffer.cpp
+++ b/src/mbgl/geometry/debug_font_buffer.cpp
@@ -23,8 +23,8 @@ void DebugFontBuffer::addText(const char *text, double left, double baseline, do
if (glyph.data[j] == -1 && glyph.data[j + 1] == -1) {
prev = false;
} else {
- int16_t x = std::round(left + glyph.data[j] * scale);
- int16_t y = std::round(baseline - glyph.data[j + 1] * scale);
+ int16_t x = ::round(left + glyph.data[j] * scale);
+ int16_t y = ::round(baseline - glyph.data[j + 1] * scale);
if (prev) {
coords = static_cast<uint16_t *>(addElement());
coords[0] = prev_x;
diff --git a/src/mbgl/geometry/icon_buffer.cpp b/src/mbgl/geometry/icon_buffer.cpp
index 2ca15b6c5c..831ffc72ac 100644
--- a/src/mbgl/geometry/icon_buffer.cpp
+++ b/src/mbgl/geometry/icon_buffer.cpp
@@ -13,8 +13,8 @@ size_t IconVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, int16_t t
int16_t *shorts = static_cast<int16_t *>(data);
shorts[0] /* pos */ = x;
shorts[1] /* pos */ = y;
- shorts[2] /* offset */ = std::round(ox * 64); // use 1/64 pixels for placement
- shorts[3] /* offset */ = std::round(oy * 64);
+ shorts[2] /* offset */ = ::round(ox * 64); // use 1/64 pixels for placement
+ shorts[3] /* offset */ = ::round(oy * 64);
uint8_t *ubytes = static_cast<uint8_t *>(data);
// a_data1
@@ -24,7 +24,7 @@ size_t IconVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, int16_t t
// a_data2
ubytes[12] /* minzoom */ = minzoom * 10; // 1/10 zoom levels: z16 == 160.
- ubytes[13] /* maxzoom */ = std::fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
+ ubytes[13] /* maxzoom */ = ::fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
return idx;
}
diff --git a/src/mbgl/geometry/line_buffer.cpp b/src/mbgl/geometry/line_buffer.cpp
index 7704838483..f475c63b24 100644
--- a/src/mbgl/geometry/line_buffer.cpp
+++ b/src/mbgl/geometry/line_buffer.cpp
@@ -14,8 +14,8 @@ size_t LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, i
coords[1] = (y * 2) | ty;
int8_t *extrude = static_cast<int8_t *>(data);
- extrude[4] = std::round(extrudeScale * ex);
- extrude[5] = std::round(extrudeScale * ey);
+ extrude[4] = ::round(extrudeScale * ex);
+ extrude[5] = ::round(extrudeScale * ey);
extrude[6] = static_cast<int8_t>(linesofar / 128);
extrude[7] = static_cast<int8_t>(linesofar % 128);
diff --git a/src/mbgl/geometry/text_buffer.cpp b/src/mbgl/geometry/text_buffer.cpp
index e3f7117eb0..8f312c9faf 100644
--- a/src/mbgl/geometry/text_buffer.cpp
+++ b/src/mbgl/geometry/text_buffer.cpp
@@ -13,8 +13,8 @@ size_t TextVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, uint16_t
int16_t *shorts = static_cast<int16_t *>(data);
shorts[0] /* pos */ = x;
shorts[1] /* pos */ = y;
- shorts[2] /* offset */ = std::round(ox * 64); // use 1/64 pixels for placement
- shorts[3] /* offset */ = std::round(oy * 64);
+ shorts[2] /* offset */ = ::round(ox * 64); // use 1/64 pixels for placement
+ shorts[3] /* offset */ = ::round(oy * 64);
uint8_t *ubytes = static_cast<uint8_t *>(data);
// a_data1
@@ -24,7 +24,7 @@ size_t TextVertexBuffer::add(int16_t x, int16_t y, float ox, float oy, uint16_t
// a_data2
ubytes[12] /* minzoom */ = minzoom * 10; // 1/10 zoom levels: z16 == 160.
- ubytes[13] /* maxzoom */ = std::fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
+ ubytes[13] /* maxzoom */ = ::fmin(maxzoom, 25) * 10; // 1/10 zoom levels: z16 == 160.
return idx;
}
diff --git a/src/mbgl/map/annotation.cpp b/src/mbgl/map/annotation.cpp
index 9915bcb1f9..8744597975 100644
--- a/src/mbgl/map/annotation.cpp
+++ b/src/mbgl/map/annotation.cpp
@@ -6,6 +6,8 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/util/geojsonvt/geojsonvt_convert.hpp>
#include <mbgl/util/ptr.hpp>
+#include <mbgl/util/string.hpp>
+
#include <algorithm>
#include <memory>
@@ -66,7 +68,7 @@ uint32_t AnnotationManager::nextID() {
vec2<double> AnnotationManager::projectPoint(const LatLng& point) {
// Clamp to the latitude limits of Mercator.
- const double constrainedLatitude = std::fmin(std::fmax(point.latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
+ const double constrainedLatitude = ::fmin(::fmax(point.latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
// Project a coordinate into unit space in a square map.
const double sine = std::sin(constrainedLatitude * M_PI / 180.0);
@@ -109,7 +111,7 @@ AnnotationManager::addTileFeature(const uint32_t annotationID,
std::vector<LonLat> points;
for (size_t i = 0; i < segments[0].size(); ++i) { // first segment for now (no holes)
- const double constraintedLatitude = std::fmin(std::fmax(segments[0][i].latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
+ const double constraintedLatitude = ::fmin(::fmax(segments[0][i].latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
points.push_back(LonLat(segments[0][i].longitude, constraintedLatitude));
}
@@ -219,7 +221,7 @@ AnnotationManager::addTileFeature(const uint32_t annotationID,
if (type == AnnotationType::Point) {
layerID = PointLayerID;
} else {
- layerID = ShapeLayerID + "." + std::to_string(annotationID);
+ layerID = ShapeLayerID + "." + util::toString(annotationID);
}
if (tile_pos.second || tile_pos.first->second.second->getMutableLayer(layerID) == nullptr) {
layer = std::make_shared<LiveTileLayer>();
@@ -382,7 +384,7 @@ std::unordered_set<TileID, TileID::Hash> AnnotationManager::removeAnnotations(co
// remove shape layer from tiles if relevant
for (auto tile_it = tiles.begin(); tile_it != tiles.end(); ++tile_it) {
if (tile_it->second.first.count(annotationID)) {
- tile_it->second.second->removeLayer(ShapeLayerID + "." + std::to_string(annotationID));
+ tile_it->second.second->removeLayer(ShapeLayerID + "." + util::toString(annotationID));
affectedTiles.insert(tile_it->first);
}
}
@@ -507,7 +509,7 @@ const LiveTile* AnnotationManager::getTile(const TileID& id) {
// create shape tile layers from GeoJSONVT queries
for (auto& tiler_it : shapeTilers) {
const auto annotationID = tiler_it.first;
- const std::string layerID = ShapeLayerID + "." + std::to_string(annotationID);
+ const std::string layerID = ShapeLayerID + "." + util::toString(annotationID);
// check for existing render layer
auto renderLayer = renderTile->getMutableLayer(layerID);
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 5b96b83199..f357c05e88 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -202,9 +202,9 @@ void Map::fitBounds(AnnotationSegment segment, EdgeInsets padding, const Duratio
// Calculate the zoom level.
double scaleX = (getWidth() - padding.left - padding.right) / size.x;
double scaleY = (getHeight() - padding.top - padding.bottom) / size.y;
- double minScale = std::fmin(scaleX, scaleY);
- double zoom = std::log2(getScale() * minScale);
- zoom = std::fmax(std::fmin(zoom, getMaxZoom()), getMinZoom());
+ double minScale = ::fmin(scaleX, scaleY);
+ double zoom = ::log2(getScale() * minScale);
+ zoom = ::fmax(::fmin(zoom, getMaxZoom()), getMinZoom());
// Calculate the center point of a virtual bounds that is extended in all directions by padding.
vec2<> paddedNEPixel = {
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index 55652272d8..56bca24af4 100644
--- a/src/mbgl/map/map_context.cpp
+++ b/src/mbgl/map/map_context.cpp
@@ -24,6 +24,7 @@
#include <mbgl/util/worker.hpp>
#include <mbgl/util/texture_pool.hpp>
#include <mbgl/util/exception.hpp>
+#include <mbgl/util/string.hpp>
#include <algorithm>
@@ -170,7 +171,7 @@ void MapContext::updateAnnotationTiles(const std::unordered_set<TileID, TileID::
// create (if necessary) layers and buckets for each shape
for (const auto &shapeAnnotationID : annotationManager->getOrderedShapeAnnotations()) {
- const std::string shapeLayerID = shapeID + "." + std::to_string(shapeAnnotationID);
+ const std::string shapeLayerID = shapeID + "." + util::toString(shapeAnnotationID);
const auto layer_it = std::find_if(style->layers.begin(), style->layers.end(),
[&shapeLayerID](util::ptr<StyleLayer> layer) {
diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp
index 94931602e9..7368d1b441 100644
--- a/src/mbgl/map/source.cpp
+++ b/src/mbgl/map/source.cpp
@@ -312,7 +312,7 @@ double Source::getZoom(const TransformState& state) const {
int32_t Source::coveringZoomLevel(const TransformState& state) const {
double zoom = getZoom(state);
if (info.type == SourceType::Raster || info.type == SourceType::Video) {
- zoom = std::round(zoom);
+ zoom = ::round(zoom);
} else {
zoom = std::floor(zoom);
}
@@ -407,7 +407,7 @@ bool Source::update(MapData& data,
double zoom = getZoom(transformState);
if (info.type == SourceType::Raster || info.type == SourceType::Video) {
- zoom = std::round(zoom);
+ zoom = ::round(zoom);
} else {
zoom = std::floor(zoom);
}
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index b39614888b..08cca3db22 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -101,7 +101,7 @@ void Transform::setLatLng(const LatLng latLng, const Duration& duration) {
}
const double m = 1 - 1e-15;
- const double f = std::fmin(std::fmax(std::sin(util::DEG2RAD * latLng.latitude), -m), m);
+ const double f = ::fmin(::fmax(std::sin(util::DEG2RAD * latLng.latitude), -m), m);
double xn = -latLng.longitude * state.Bc;
double yn = 0.5 * state.Cc * std::log((1 + f) / (1 - f));
@@ -121,7 +121,7 @@ void Transform::setLatLngZoom(const LatLng latLng, const double zoom, const Dura
state.Cc = s / util::M2PI;
const double m = 1 - 1e-15;
- const double f = std::fmin(std::fmax(std::sin(util::DEG2RAD * latLng.latitude), -m), m);
+ const double f = ::fmin(::fmax(std::sin(util::DEG2RAD * latLng.latitude), -m), m);
double xn = -latLng.longitude * state.Bc;
double yn = 0.5 * state.Cc * std::log((1 + f) / (1 - f));
diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp
index bb3e86d33e..9a5e530920 100644
--- a/src/mbgl/map/transform_state.cpp
+++ b/src/mbgl/map/transform_state.cpp
@@ -140,11 +140,11 @@ double TransformState::getMinZoom() const {
double test_y = y;
constrain(test_scale, test_y);
- return std::log2(std::fmin(min_scale, test_scale));
+ return ::log2(::fmin(min_scale, test_scale));
}
double TransformState::getMaxZoom() const {
- return std::log2(max_scale);
+ return ::log2(max_scale);
}
diff --git a/src/mbgl/platform/gl.cpp b/src/mbgl/platform/gl.cpp
index 76be580b91..d387f3fbf8 100644
--- a/src/mbgl/platform/gl.cpp
+++ b/src/mbgl/platform/gl.cpp
@@ -1,4 +1,5 @@
#include <mbgl/platform/gl.hpp>
+#include <mbgl/util/string.hpp>
#include <mutex>
@@ -51,7 +52,7 @@ void checkError(const char *cmd, const char *file, int line) {
default: error = "(unknown)"; break;
}
- throw ::mbgl::gl::Error(err, std::string(cmd) + ": Error GL_" + error + " - " + file + ":" + std::to_string(line));
+ throw ::mbgl::gl::Error(err, std::string(cmd) + ": Error GL_" + error + " - " + file + ":" + util::toString(line));
}
}
diff --git a/src/mbgl/platform/log.cpp b/src/mbgl/platform/log.cpp
index eec33444b9..6daed40888 100644
--- a/src/mbgl/platform/log.cpp
+++ b/src/mbgl/platform/log.cpp
@@ -2,6 +2,7 @@
#include <mbgl/util/thread_context.hpp>
+#include <cstdio>
#include <cstdarg>
#include <sstream>
diff --git a/src/mbgl/renderer/fill_bucket.cpp b/src/mbgl/renderer/fill_bucket.cpp
index fd4df4314a..151e4c4a4f 100644
--- a/src/mbgl/renderer/fill_bucket.cpp
+++ b/src/mbgl/renderer/fill_bucket.cpp
@@ -141,7 +141,7 @@ void FillBucket::tessellate() {
for (size_t i = 0; i < vertex_count; ++i) {
if (vertex_indices[i] == TESS_UNDEF) {
- vertexBuffer.add(std::round(vertices[i * 2]), std::round(vertices[i * 2 + 1]));
+ vertexBuffer.add(::round(vertices[i * 2]), ::round(vertices[i * 2 + 1]));
vertex_indices[i] = (TESSindex)total_vertex_count;
total_vertex_count++;
}
diff --git a/src/mbgl/renderer/frame_history.cpp b/src/mbgl/renderer/frame_history.cpp
index c95e82631e..cdc60f4eb6 100644
--- a/src/mbgl/renderer/frame_history.cpp
+++ b/src/mbgl/renderer/frame_history.cpp
@@ -63,8 +63,8 @@ FadeProperties FrameHistory::getFadeProperties(const Duration& duration) {
float startingZ = history.front().z;
const FrameSnapshot lastFrame = history.back();
float endingZ = lastFrame.z;
- float lowZ = std::fmin(startingZ, endingZ);
- float highZ = std::fmax(startingZ, endingZ);
+ float lowZ = ::fmin(startingZ, endingZ);
+ float highZ = ::fmax(startingZ, endingZ);
// Calculate the speed of zooming, and how far it would zoom in terms of zoom levels in one
// duration
diff --git a/src/mbgl/renderer/painter_line.cpp b/src/mbgl/renderer/painter_line.cpp
index 0860bbc03a..f406c0d8f1 100644
--- a/src/mbgl/renderer/painter_line.cpp
+++ b/src/mbgl/renderer/painter_line.cpp
@@ -70,7 +70,7 @@ void Painter::renderLine(LineBucket& bucket, const StyleLayer &layer_desc, const
LinePatternPos posB = lineAtlas->getDashPosition(properties.dash_array.to, layout.cap == CapType::Round);
lineAtlas->bind();
- float patternratio = std::pow(2.0, std::floor(std::log2(state.getScale())) - id.z) / 8.0 * id.overscaling;
+ float patternratio = std::pow(2.0, std::floor(::log2(state.getScale())) - id.z) / 8.0 * id.overscaling;
float scaleXA = patternratio / posA.width / properties.dash_line_width / properties.dash_array.fromScale;
float scaleYA = -posA.height / 2.0;
float scaleXB = patternratio / posB.width / properties.dash_line_width / properties.dash_array.toScale;
diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp
index c4347febbc..1ee90293d2 100644
--- a/src/mbgl/renderer/symbol_bucket.cpp
+++ b/src/mbgl/renderer/symbol_bucket.cpp
@@ -448,7 +448,7 @@ template <typename Buffer, typename GroupType>
void SymbolBucket::addSymbols(Buffer &buffer, const SymbolQuads &symbols, float scale, const bool keepUpright, const bool alongLine) {
const float zoom = collision.zoom;
- const float placementZoom = std::fmax(std::log(scale) / std::log(2) + zoom, 0);
+ const float placementZoom = ::fmax(std::log(scale) / std::log(2) + zoom, 0);
for (const auto& symbol : symbols) {
const auto &tl = symbol.tl;
diff --git a/src/mbgl/text/collision_tile.cpp b/src/mbgl/text/collision_tile.cpp
index 3c2d22a5b2..1c7806a4e0 100644
--- a/src/mbgl/text/collision_tile.cpp
+++ b/src/mbgl/text/collision_tile.cpp
@@ -44,7 +44,7 @@ float CollisionTile::placeFeature(const CollisionFeature &feature) {
if (std::isnan(s1) || std::isnan(s2)) s1 = s2 = 1;
if (std::isnan(s3) || std::isnan(s4)) s3 = s4 = 1;
- float collisionFreeScale = std::fmin(std::fmax(s1, s2), std::fmax(s3, s4));
+ float collisionFreeScale = ::fmin(::fmax(s1, s2), ::fmax(s3, s4));
if (collisionFreeScale > blocking.maxScale) {
// After a box's maxScale the label has shrunk enough that the box is no longer needed to cover it,
diff --git a/src/mbgl/text/font_stack.cpp b/src/mbgl/text/font_stack.cpp
index d4d3a39475..6d06796e84 100644
--- a/src/mbgl/text/font_stack.cpp
+++ b/src/mbgl/text/font_stack.cpp
@@ -27,8 +27,8 @@ const Shaping FontStack::getShaping(const std::u32string &string, const float ma
// the y offset *should* be part of the font metadata
const int32_t yOffset = -17;
- float x = std::round(translate.x * 24); // one em
- const float y = std::round(translate.y * 24) + yOffset; // one em
+ float x = ::round(translate.x * 24); // one em
+ const float y = ::round(translate.y * 24) + yOffset; // one em
// Loop through all characters of this label and shape.
for (uint32_t chr : string) {
diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp
index ef8a75c02e..6492fd0679 100644
--- a/src/mbgl/text/get_anchors.cpp
+++ b/src/mbgl/text/get_anchors.cpp
@@ -32,7 +32,7 @@ Anchors resample(const std::vector<Coordinate> &line, const float offset, const
y = util::interpolate(float(a.y), float(b.y), t);
if (x >= 0 && x < 4096 && y >= 0 && y < 4096) {
- Anchor anchor(std::round(x), std::round(y), angle, 0.5f, i);
+ Anchor anchor(::round(x), ::round(y), angle, 0.5f, i);
if (!angleWindowSize || checkMaxAngle(line, anchor, labelLength, angleWindowSize, maxAngle)) {
anchors.push_back(anchor);
diff --git a/src/mbgl/util/compression.cpp b/src/mbgl/util/compression.cpp
index 3a1658b8f6..139dba7546 100644
--- a/src/mbgl/util/compression.cpp
+++ b/src/mbgl/util/compression.cpp
@@ -2,6 +2,7 @@
#include <zlib.h>
+#include <cstdio>
#include <cstring>
#include <stdexcept>
diff --git a/src/mbgl/util/geojsonvt b/src/mbgl/util/geojsonvt
-Subproject ed99a6290fa42107a982e7f3675aae49d29026b
+Subproject 995ffc72c556da4b4880a6036fbcf7159fc5ecc
diff --git a/src/mbgl/util/io.cpp b/src/mbgl/util/io.cpp
index bb4c3595c3..0f7ce0e55d 100644
--- a/src/mbgl/util/io.cpp
+++ b/src/mbgl/util/io.cpp
@@ -1,6 +1,7 @@
#include <mbgl/util/io.hpp>
#include <cstdio>
+#include <cerrno>
#include <iostream>
#include <sstream>
#include <fstream>
diff --git a/src/mbgl/util/tile_cover.cpp b/src/mbgl/util/tile_cover.cpp
index f410b8e813..9e444fec12 100644
--- a/src/mbgl/util/tile_cover.cpp
+++ b/src/mbgl/util/tile_cover.cpp
@@ -27,8 +27,8 @@ typedef const std::function<void(int32_t x0, int32_t x1, int32_t y)> ScanLine;
// scan-line conversion
static void scanSpans(edge e0, edge e1, int32_t ymin, int32_t ymax, ScanLine scanLine) {
- double y0 = std::fmax(ymin, std::floor(e1.y0));
- double y1 = std::fmin(ymax, std::ceil(e1.y1));
+ double y0 = ::fmax(ymin, std::floor(e1.y0));
+ double y1 = ::fmin(ymax, std::ceil(e1.y1));
// sort edges by x-coordinate
if ((e0.x0 == e1.x0 && e0.y0 == e1.y0) ?
@@ -43,8 +43,8 @@ static void scanSpans(edge e0, edge e1, int32_t ymin, int32_t ymax, ScanLine sca
double d0 = e0.dx > 0; // use y + 1 to compute x0
double d1 = e1.dx < 0; // use y + 1 to compute x1
for (int32_t y = y0; y < y1; y++) {
- double x0 = m0 * std::fmax(0, std::fmin(e0.dy, y + d0 - e0.y0)) + e0.x0;
- double x1 = m1 * std::fmax(0, std::fmin(e1.dy, y + d1 - e1.y0)) + e1.x0;
+ double x0 = m0 * ::fmax(0, ::fmin(e0.dy, y + d0 - e0.y0)) + e0.x0;
+ double x1 = m1 * ::fmax(0, ::fmin(e1.dy, y + d1 - e1.y0)) + e1.x0;
scanLine(std::floor(x1), std::ceil(x0), y);
}
}
diff --git a/src/mbgl/util/time.cpp b/src/mbgl/util/time.cpp
index 94936acff0..4612ae29b5 100644
--- a/src/mbgl/util/time.cpp
+++ b/src/mbgl/util/time.cpp
@@ -1,6 +1,8 @@
#include <mbgl/util/time.hpp>
#include <mbgl/util/uv_detail.hpp>
+#include <cstdio>
+
namespace mbgl {
namespace util {