diff options
-rw-r--r-- | include/mbgl/platform/event.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/platform/log.hpp | 2 | ||||
-rw-r--r-- | macosx/main.mm | 2 | ||||
-rw-r--r-- | src/util/compression.cpp | 4 | ||||
-rw-r--r-- | src/util/parsedate.c | 2 | ||||
-rw-r--r-- | test/fixtures/fixture_request.cpp | 14 | ||||
-rw-r--r-- | test/headless.cpp | 16 | ||||
-rw-r--r-- | test/test.gyp | 32 |
8 files changed, 27 insertions, 51 deletions
diff --git a/include/mbgl/platform/event.hpp b/include/mbgl/platform/event.hpp index d2a06618a3..0405cddfad 100644 --- a/include/mbgl/platform/event.hpp +++ b/include/mbgl/platform/event.hpp @@ -57,11 +57,13 @@ struct EventPermutation { } }; -constexpr EventSeverity disabledEventSeverities[] = { #if !DEBUG +constexpr EventSeverity disabledEventSeverities[] = { EventSeverity::Debug, -#endif }; +#else +constexpr EventSeverity *disabledEventSeverities = nullptr; +#endif constexpr Event disabledEvents[] = { diff --git a/include/mbgl/platform/log.hpp b/include/mbgl/platform/log.hpp index dc000b4d52..bcb6d79224 100644 --- a/include/mbgl/platform/log.hpp +++ b/include/mbgl/platform/log.hpp @@ -21,7 +21,7 @@ class Log { private: template <typename T> constexpr static bool includes(const T e, T const *l, const size_t i = 0) { - return i >= sizeof l ? false : *(l + i) == e ? true : includes(e, l, i + 1); + return l == nullptr ? false : i >= sizeof l ? false : *(l + i) == e ? true : includes(e, l, i + 1); } public: diff --git a/macosx/main.mm b/macosx/main.mm index aeb49225cb..8cf3cc81c3 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -85,7 +85,7 @@ int main() { // Notify map object when network reachability status changes. Reachability* reachability = [Reachability reachabilityForInternetConnection]; - reachability.reachableBlock = ^(Reachability *reachability) { + reachability.reachableBlock = ^(Reachability *) { map_ptr->setReachability(true); }; [reachability startNotifier]; diff --git a/src/util/compression.cpp b/src/util/compression.cpp index de4e09764c..d6d6370546 100644 --- a/src/util/compression.cpp +++ b/src/util/compression.cpp @@ -18,7 +18,7 @@ std::string compress(const std::string &raw) { } deflate_stream.next_in = (Bytef *)raw.data(); - deflate_stream.avail_in = raw.size(); + deflate_stream.avail_in = uInt(raw.size()); std::string result; char out[16384]; @@ -53,7 +53,7 @@ std::string decompress(const std::string &raw) { } inflate_stream.next_in = (Bytef *)raw.data(); - inflate_stream.avail_in = raw.size(); + inflate_stream.avail_in = uInt(raw.size()); std::string result; char out[15384]; diff --git a/src/util/parsedate.c b/src/util/parsedate.c index 123c5c4e5f..f888def853 100644 --- a/src/util/parsedate.c +++ b/src/util/parsedate.c @@ -208,7 +208,7 @@ int raw_equal(const char *first, const char *second) int clamp_to_int(long slnum) { - return slnum > INT_MAX ? INT_MAX : slnum < INT_MIN ? INT_MIN : slnum; + return slnum > INT_MAX ? INT_MAX : slnum < INT_MIN ? INT_MIN : (int)slnum; } diff --git a/test/fixtures/fixture_request.cpp b/test/fixtures/fixture_request.cpp index 3f72b890db..9d2971c73e 100644 --- a/test/fixtures/fixture_request.cpp +++ b/test/fixtures/fixture_request.cpp @@ -35,11 +35,17 @@ void HTTPRequestBaton::start(const util::ptr<HTTPRequestBaton> &baton) { const size_t size = ftell(file); fseek(file, 0, SEEK_SET); baton->response->data.resize(size); - fread(&baton->response->data[0], size, 1, file); + const size_t read = fread(&baton->response->data[0], 1, size, file); fclose(file); - baton->response->code = 200; - baton->type = HTTPResponseType::Successful; + if (read == size) { + baton->response->code = 200; + baton->type = HTTPResponseType::Successful; + } else { + baton->response->code = 500; + baton->type = HTTPResponseType::PermanentError; + baton->response->message = "Read bytes differed from file size"; + } } else { baton->type = HTTPResponseType::PermanentError; baton->response->code = 404; @@ -48,7 +54,7 @@ void HTTPRequestBaton::start(const util::ptr<HTTPRequestBaton> &baton) { uv_async_send(baton->async); } -void HTTPRequestBaton::stop(const util::ptr<HTTPRequestBaton> &baton) { +void HTTPRequestBaton::stop(const util::ptr<HTTPRequestBaton> &) { fprintf(stderr, "HTTP request cannot be canceled because it is answered immediately"); abort(); } diff --git a/test/headless.cpp b/test/headless.cpp index 3cc2607e47..3255cff062 100644 --- a/test/headless.cpp +++ b/test/headless.cpp @@ -35,8 +35,8 @@ TEST_P(HeadlessTest, render) { // Parse style. rapidjson::Document styleDoc; styleDoc.Parse<0>((const char *const)style.c_str()); - ASSERT_EQ(false, styleDoc.HasParseError()); - ASSERT_EQ(true, styleDoc.IsObject()); + ASSERT_FALSE(styleDoc.HasParseError()); + ASSERT_TRUE(styleDoc.IsObject()); rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); @@ -46,16 +46,16 @@ TEST_P(HeadlessTest, render) { // Parse settings. rapidjson::Document infoDoc; infoDoc.Parse<0>((const char *const)info.c_str()); - ASSERT_EQ(false, infoDoc.HasParseError()); - ASSERT_EQ(true, infoDoc.IsObject()); + ASSERT_FALSE(infoDoc.HasParseError()); + ASSERT_TRUE(infoDoc.IsObject()); Log::Set<FixtureLogBackend>(); for (auto it = infoDoc.MemberBegin(), end = infoDoc.MemberEnd(); it != end; it++) { const std::string name { it->name.GetString(), it->name.GetStringLength() }; const rapidjson::Value &value = it->value; - ASSERT_EQ(true, value.IsObject()); - if (value.HasMember("center")) ASSERT_EQ(true, value["center"].IsArray()); + ASSERT_TRUE(value.IsObject()); + if (value.HasMember("center")) ASSERT_TRUE(value["center"].IsArray()); const std::string actual_image = base_directory + "tests/" + base + "/" + name + "/actual.png"; @@ -70,10 +70,10 @@ TEST_P(HeadlessTest, render) { std::vector<std::string> classes; if (value.HasMember("classes")) { const rapidjson::Value &js_classes = value["classes"]; - ASSERT_EQ(true, js_classes.IsArray()); + ASSERT_TRUE(js_classes.IsArray()); for (rapidjson::SizeType i = 0; i < js_classes.Size(); i++) { const rapidjson::Value &js_class = js_classes[i]; - ASSERT_EQ(true, js_class.IsString()); + ASSERT_TRUE(js_class.IsString()); classes.push_back({ js_class.GetString(), js_class.GetStringLength() }); } } diff --git a/test/test.gyp b/test/test.gyp index bd13ad7fd2..1f63756e71 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -10,11 +10,6 @@ 'direct_dependent_settings': { 'conditions': [ ['OS == "mac"', { - 'link_settings': { - 'libraries': [ - '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW - ], - }, 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW @@ -62,9 +57,6 @@ "target_name": "rotation_range", "product_name": "test_rotation_range", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./rotation_range.cpp", @@ -78,9 +70,6 @@ "target_name": "clip_ids", "product_name": "test_clip_ids", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./clip_ids.cpp", @@ -94,9 +83,6 @@ "target_name": "enums", "product_name": "test_enums", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./enums.cpp", @@ -110,9 +96,6 @@ "target_name": "style_parser", "product_name": "test_style_parser", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./style_parser.cpp", @@ -129,9 +112,6 @@ "target_name": "variant", "product_name": "test_variant", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./variant.cpp", @@ -145,9 +125,6 @@ "target_name": "comparisons", "product_name": "test_comparisons", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./comparisons.cpp", @@ -161,9 +138,6 @@ "target_name": "tile", "product_name": "test_tile", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./tile.cpp", @@ -177,9 +151,6 @@ "target_name": "functions", "product_name": "test_functions", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./functions.cpp", @@ -193,9 +164,6 @@ "target_name": "headless", "product_name": "test_headless", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./headless.cpp", |