Skip to content

Commit 8ddb736

Browse files
committed
Fix compiler errors
1 parent f29cc1f commit 8ddb736

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

include/config/Config.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,31 @@ const token_t tokens_g[] = {
5454

5555
// Mime type context
5656
{"types", "http", true, 1, 1, 0, 0, NULL},
57-
{"type", "types", false, 1, -1, 2, -1, isMimeType},
57+
{"type", "types", false, 1, static_cast<size_t>(-1), 2, static_cast<size_t>(-1), isMimeType},
5858

5959
// Server context
60-
{"server", "http", true, 1, -1, 0, 0, NULL},
61-
{"listen", "server", false, 1, -1, 1, 1, isListen},
62-
{"server_name", "server", false, 0, -1, 1, -1, NULL},
60+
{"server", "http", true, 1, static_cast<size_t>(-1), 0, 0, NULL},
61+
{"listen", "server", false, 1, static_cast<size_t>(-1), 1, 1, isListen},
62+
{"server_name", "server", false, 0, static_cast<size_t>(-1), 1, static_cast<size_t>(-1), NULL},
6363
{"root", "server", false, 1, 1, 1, 1, NULL},
64-
{"index", "server", false, 0, 1, 1, -1, NULL},
65-
{"allow", "server", false, 0, -1, 1, -1, isMethod},
64+
{"index", "server", false, 0, 1, 1, static_cast<size_t>(-1), NULL},
65+
{"allow", "server", false, 0, static_cast<size_t>(-1), 1, static_cast<size_t>(-1), isMethod},
6666
{"autoindex", "server", false, 0, 1, 1, 1, isBoolean},
6767
{"redirect", "server", false, 0, 1, 1, 1, NULL},
6868
{"max_client_body_size", "server", false, 0, 1, 1, 1, isMemorySize},
69-
{"error_page", "server", false, 0, -1, 2, 2, isErrorPage},
70-
{"cgi", "server", false, 0, -1, 2, 2, isCgi},
69+
{"error_page", "server", false, 0, static_cast<size_t>(-1), 2, 2, isErrorPage},
70+
{"cgi", "server", false, 0, static_cast<size_t>(-1), 2, 2, isCgi},
7171

7272
// Location context
73-
{"location", "server", true, 0, -1, 1, 1, isAbsolutePath},
73+
{"location", "server", true, 0, static_cast<size_t>(-1), 1, 1, isAbsolutePath},
7474
{"alias", "location", false, 0, 1, 1, 1, isAbsolutePath},
7575
{"root", "location", false, 0, 1, 1, 1, NULL},
76-
{"index", "location", false, 0, 1, 1, -1, NULL},
77-
{"allow", "location", false, 0, -1, 1, -1, isMethod},
76+
{"index", "location", false, 0, 1, 1, static_cast<size_t>(-1), NULL},
77+
{"allow", "location", false, 0, static_cast<size_t>(-1), 1, static_cast<size_t>(-1), isMethod},
7878
{"autoindex", "location", false, 0, 1, 1, 1, isBoolean},
7979
{"redirect", "location", false, 0, 1, 1, 1, NULL},
8080
{"max_client_body_size", "location", false, 0, 1, 1, 1, isMemorySize},
81-
{"cgi", "location", false, 0, -1, 2, 2, isCgi}};
81+
{"cgi", "location", false, 0, static_cast<size_t>(-1), 2, 2, isCgi}};
8282

8383
class Config {
8484
private:

src/http/Http.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void Http::processError(std::string code, std::string reason, bool close) {
463463
File file(path);
464464
if (file.exists() && file.file() && file.readable()) {
465465
_response.setBody(new std::ifstream(path.c_str()));
466-
size_t bodySize = file.size();
466+
long int bodySize = file.size();
467467
if (_response.getBody()->good() == false || bodySize < 0)
468468
return processError("500", "Internal Server Error");
469469
_response.setHeader("Content-Length", toString(bodySize));

src/utils/utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ std::string percentDecode(std::string str) {
125125
if (str[i] == '%') {
126126
if (i + 2 >= str.length())
127127
throw std::runtime_error("uriDecode: invalid string");
128-
int value;
128+
unsigned int value;
129129
if (std::sscanf(str.substr(i + 1, 2).c_str(), "%x", &value) == EOF)
130130
throw std::runtime_error("uriDecode: invalid format");
131131
decoded += (char)value;

0 commit comments

Comments
 (0)