gcc fixes
This commit is contained in:
@@ -14,8 +14,14 @@
|
||||
'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE',
|
||||
},
|
||||
}],
|
||||
['OS=="linux"', {
|
||||
'cflags_cc': [
|
||||
'-Wno-unknown-pragmas', # We are using '#pragma mark', but it is only available on Darwin.
|
||||
'-Wno-literal-suffix', # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61653
|
||||
],
|
||||
}],
|
||||
],
|
||||
'cflags_cc!': [ '-std=c++11', '-Wall', '-Wextra', '-Wshadow', '-frtti', '-fexceptions' ],
|
||||
'cflags_cc': [ '-std=c++11', '-Werror', '-Wall', '-Wextra', '-Wshadow', '-frtti', '-fexceptions' ],
|
||||
'configurations': {
|
||||
'Debug': {
|
||||
'cflags_cc': [ '-g', '-O0', '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ],
|
||||
|
||||
@@ -13,8 +13,8 @@ GLFWView::~GLFWView() {
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
void GLFWView::initialize(mbgl::Map *map) {
|
||||
View::initialize(map);
|
||||
void GLFWView::initialize(mbgl::Map *map_) {
|
||||
View::initialize(map_);
|
||||
|
||||
if (!glfwInit()) {
|
||||
fprintf(stderr, "Failed to initialize glfw\n");
|
||||
|
||||
@@ -154,11 +154,11 @@ void curl_perform(uv_poll_t *req, int, int events) {
|
||||
while ((message = curl_multi_info_read(multi, &pending))) {
|
||||
switch (message->msg) {
|
||||
case CURLMSG_DONE: {
|
||||
CURLContext *context = nullptr;
|
||||
curl_easy_getinfo(message->easy_handle, CURLINFO_PRIVATE, (char *)&context);
|
||||
CURLContext *ctx = nullptr;
|
||||
curl_easy_getinfo(message->easy_handle, CURLINFO_PRIVATE, (char *)&ctx);
|
||||
|
||||
// Make a copy so that the Baton stays around even after we are calling finish_request
|
||||
util::ptr<HTTPRequestBaton> baton = context->baton;
|
||||
util::ptr<HTTPRequestBaton> baton = ctx->baton;
|
||||
|
||||
// Add human-readable error code
|
||||
if (message->data.result != CURLE_OK) {
|
||||
@@ -242,8 +242,8 @@ int handle_socket(CURL *handle, curl_socket_t sockfd, int action, void *, void *
|
||||
}
|
||||
if (action == CURL_POLL_REMOVE && socketp) {
|
||||
uv_poll_stop(context->poll_handle);
|
||||
uv_close((uv_handle_t *)context->poll_handle, [](uv_handle_t *handle) {
|
||||
delete (uv_poll_t *)handle;
|
||||
uv_close((uv_handle_t *)context->poll_handle, [](uv_handle_t *poll_handle) {
|
||||
delete (uv_poll_t *)poll_handle;
|
||||
});
|
||||
context->poll_handle = nullptr;
|
||||
curl_multi_assign(multi, sockfd, NULL);
|
||||
|
||||
@@ -84,15 +84,15 @@ protected:
|
||||
}
|
||||
|
||||
// Get a pointer to the item at a given index.
|
||||
inline void *getElement(size_t index) {
|
||||
inline void *getElement(size_t i) {
|
||||
if (array == nullptr) {
|
||||
throw std::runtime_error("Buffer was already deleted or doesn't contain elements");
|
||||
}
|
||||
|
||||
if (index * itemSize >= pos) {
|
||||
if (i * itemSize >= pos) {
|
||||
throw new std::runtime_error("Can't get element after array bounds");
|
||||
} else {
|
||||
return static_cast<char *>(array) + (index * itemSize);
|
||||
return static_cast<char *>(array) + (i * itemSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,9 +132,9 @@ double pbf::float64() {
|
||||
|
||||
std::string pbf::string() {
|
||||
uint32_t bytes = static_cast<uint32_t>(varint());
|
||||
const char *string = reinterpret_cast<const char*>(data);
|
||||
const char *string_data = reinterpret_cast<const char*>(data);
|
||||
skipBytes(bytes);
|
||||
return std::string(string, bytes);
|
||||
return std::string(string_data, bytes);
|
||||
}
|
||||
|
||||
bool pbf::boolean() {
|
||||
|
||||
@@ -36,8 +36,8 @@ protected:
|
||||
template <typename T>
|
||||
class ease_transition : public transition {
|
||||
public:
|
||||
ease_transition(T from_, T to_, T& value_, timestamp start, timestamp duration)
|
||||
: transition(start, duration),
|
||||
ease_transition(T from_, T to_, T& value_, timestamp start_, timestamp duration_)
|
||||
: transition(start_, duration_),
|
||||
from(from_),
|
||||
to(to_),
|
||||
value(value_) {}
|
||||
@@ -53,8 +53,8 @@ private:
|
||||
template <typename T>
|
||||
class timeout : public transition {
|
||||
public:
|
||||
timeout(T final_value_, T& value_, timestamp start, timestamp duration)
|
||||
: transition(start, duration),
|
||||
timeout(T final_value_, T& value_, timestamp start_, timestamp duration_)
|
||||
: transition(start_, duration_),
|
||||
final_value(final_value_),
|
||||
value(value_) {}
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
#include <ostream>
|
||||
#include <functional>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wshadow"
|
||||
|
||||
namespace ClipperLib {
|
||||
|
||||
#ifdef use_int32
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <mbgl/platform/log.hpp>
|
||||
#include <csscolorparser/csscolorparser.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using JSVal = const rapidjson::Value&;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <mbgl/util/image.hpp>
|
||||
|
||||
#include <png.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include <mbgl/util/uv_detail.hpp>
|
||||
#include <mbgl/util/std.hpp>
|
||||
|
||||
#include <png.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
12
test/fixtures/fixture_log.cpp
vendored
12
test/fixtures/fixture_log.cpp
vendored
@@ -9,25 +9,25 @@ FixtureLogBackend::~FixtureLogBackend() {
|
||||
}
|
||||
|
||||
size_t FixtureLogBackend::count(const LogMessage &message) const {
|
||||
size_t count = 0;
|
||||
size_t message_count = 0;
|
||||
for (const LogMessage &msg : messages) {
|
||||
if (msg == message) {
|
||||
count++;
|
||||
message_count++;
|
||||
msg.checked = true;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
return message_count;
|
||||
}
|
||||
|
||||
std::vector<FixtureLogBackend::LogMessage> FixtureLogBackend::unchecked() const {
|
||||
std::vector<LogMessage> unchecked;
|
||||
std::vector<LogMessage> unchecked_messages;
|
||||
for (const LogMessage &msg : messages) {
|
||||
if (!msg.checked) {
|
||||
unchecked.push_back(msg);
|
||||
unchecked_messages.push_back(msg);
|
||||
msg.checked = true;
|
||||
}
|
||||
}
|
||||
return unchecked;
|
||||
return unchecked_messages;
|
||||
}
|
||||
|
||||
::std::ostream& operator<<(::std::ostream& os, const std::vector<FixtureLogBackend::LogMessage>& messages) {
|
||||
|
||||
Reference in New Issue
Block a user