fix compile warnings

This commit is contained in:
Konstantin Käfer
2014-10-22 10:45:42 +02:00
parent b9d422ebc3
commit 2f3952b305
8 changed files with 27 additions and 51 deletions

View File

@@ -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[] = {

View File

@@ -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:

View File

@@ -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];

View File

@@ -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];

View File

@@ -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;
}

View File

@@ -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();
}

View File

@@ -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() });
}
}

View File

@@ -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",