Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
b1c66f65
Commit
b1c66f65
authored
Jul 29, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #207 from bick4ord/master
Add casts to fix strict compiler errors [-fpermissive]
parents
2e93cde9
8f79a056
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
mongoose.c
mongoose.c
+6
-5
No files found.
mongoose.c
View file @
b1c66f65
...
@@ -2402,7 +2402,7 @@ static char *mg_fgets(char *buf, size_t size, struct file *filep, char **p) {
...
@@ -2402,7 +2402,7 @@ static char *mg_fgets(char *buf, size_t size, struct file *filep, char **p) {
size_t
len
;
size_t
len
;
if
(
filep
->
membuf
!=
NULL
&&
*
p
!=
NULL
)
{
if
(
filep
->
membuf
!=
NULL
&&
*
p
!=
NULL
)
{
eof
=
memchr
(
*
p
,
'\n'
,
&
filep
->
membuf
[
filep
->
size
]
-
*
p
);
eof
=
(
char
*
)
memchr
(
*
p
,
'\n'
,
&
filep
->
membuf
[
filep
->
size
]
-
*
p
);
len
=
(
size_t
)
(
eof
-
*
p
)
>
size
-
1
?
size
-
1
:
(
size_t
)
(
eof
-
*
p
);
len
=
(
size_t
)
(
eof
-
*
p
)
>
size
-
1
?
size
-
1
:
(
size_t
)
(
eof
-
*
p
);
memcpy
(
buf
,
*
p
,
len
);
memcpy
(
buf
,
*
p
,
len
);
buf
[
len
]
=
'\0'
;
buf
[
len
]
=
'\0'
;
...
@@ -4524,6 +4524,7 @@ static int parse_port_string(const struct vec *vec, struct socket *so) {
...
@@ -4524,6 +4524,7 @@ static int parse_port_string(const struct vec *vec, struct socket *so) {
so
->
lsa
.
sin
.
sin_addr
.
s_addr
=
htonl
((
a
<<
24
)
|
(
b
<<
16
)
|
(
c
<<
8
)
|
d
);
so
->
lsa
.
sin
.
sin_addr
.
s_addr
=
htonl
((
a
<<
24
)
|
(
b
<<
16
)
|
(
c
<<
8
)
|
d
);
so
->
lsa
.
sin
.
sin_port
=
htons
((
uint16_t
)
port
);
so
->
lsa
.
sin
.
sin_port
=
htons
((
uint16_t
)
port
);
#if defined(USE_IPV6)
#if defined(USE_IPV6)
}
else
if
(
sscanf
(
vec
->
ptr
,
"[%49[^]]]:%d%n"
,
buf
,
&
port
,
&
len
)
==
2
&&
}
else
if
(
sscanf
(
vec
->
ptr
,
"[%49[^]]]:%d%n"
,
buf
,
&
port
,
&
len
)
==
2
&&
inet_pton
(
AF_INET6
,
buf
,
&
so
->
lsa
.
sin6
.
sin6_addr
))
{
inet_pton
(
AF_INET6
,
buf
,
&
so
->
lsa
.
sin6
.
sin6_addr
))
{
// IPv6 address, e.g. [3ffe:2a00:100:7031::1]:8080
// IPv6 address, e.g. [3ffe:2a00:100:7031::1]:8080
...
@@ -4581,7 +4582,7 @@ static int set_ports_option(struct mg_context *ctx) {
...
@@ -4581,7 +4582,7 @@ static int set_ports_option(struct mg_context *ctx) {
(
int
)
vec
.
len
,
vec
.
ptr
,
ERRNO
);
(
int
)
vec
.
len
,
vec
.
ptr
,
ERRNO
);
closesocket
(
so
.
sock
);
closesocket
(
so
.
sock
);
success
=
0
;
success
=
0
;
}
else
if
((
ptr
=
realloc
(
ctx
->
listening_sockets
,
}
else
if
((
ptr
=
(
struct
socket
*
)
realloc
(
ctx
->
listening_sockets
,
(
ctx
->
num_listening_sockets
+
1
)
*
(
ctx
->
num_listening_sockets
+
1
)
*
sizeof
(
ctx
->
listening_sockets
[
0
])))
==
NULL
)
{
sizeof
(
ctx
->
listening_sockets
[
0
])))
==
NULL
)
{
closesocket
(
so
.
sock
);
closesocket
(
so
.
sock
);
...
@@ -5101,7 +5102,7 @@ static int consume_socket(struct mg_context *ctx, struct socket *sp) {
...
@@ -5101,7 +5102,7 @@ static int consume_socket(struct mg_context *ctx, struct socket *sp) {
}
}
static
void
*
worker_thread
(
void
*
thread_func_param
)
{
static
void
*
worker_thread
(
void
*
thread_func_param
)
{
struct
mg_context
*
ctx
=
thread_func_param
;
struct
mg_context
*
ctx
=
(
struct
mg_context
*
)
thread_func_param
;
struct
mg_connection
*
conn
;
struct
mg_connection
*
conn
;
conn
=
(
struct
mg_connection
*
)
calloc
(
1
,
sizeof
(
*
conn
)
+
MAX_REQUEST_SIZE
);
conn
=
(
struct
mg_connection
*
)
calloc
(
1
,
sizeof
(
*
conn
)
+
MAX_REQUEST_SIZE
);
...
@@ -5217,7 +5218,7 @@ static void accept_new_connection(const struct socket *listener,
...
@@ -5217,7 +5218,7 @@ static void accept_new_connection(const struct socket *listener,
}
}
static
void
*
master_thread
(
void
*
thread_func_param
)
{
static
void
*
master_thread
(
void
*
thread_func_param
)
{
struct
mg_context
*
ctx
=
thread_func_param
;
struct
mg_context
*
ctx
=
(
struct
mg_context
*
)
thread_func_param
;
struct
pollfd
*
pfd
;
struct
pollfd
*
pfd
;
int
i
;
int
i
;
...
@@ -5232,7 +5233,7 @@ static void *master_thread(void *thread_func_param) {
...
@@ -5232,7 +5233,7 @@ static void *master_thread(void *thread_func_param) {
pthread_setschedparam
(
pthread_self
(),
SCHED_RR
,
&
sched_param
);
pthread_setschedparam
(
pthread_self
(),
SCHED_RR
,
&
sched_param
);
#endif
#endif
pfd
=
calloc
(
ctx
->
num_listening_sockets
,
sizeof
(
pfd
[
0
]));
pfd
=
(
struct
pollfd
*
)
calloc
(
ctx
->
num_listening_sockets
,
sizeof
(
pfd
[
0
]));
while
(
pfd
!=
NULL
&&
ctx
->
stop_flag
==
0
)
{
while
(
pfd
!=
NULL
&&
ctx
->
stop_flag
==
0
)
{
for
(
i
=
0
;
i
<
ctx
->
num_listening_sockets
;
i
++
)
{
for
(
i
=
0
;
i
<
ctx
->
num_listening_sockets
;
i
++
)
{
pfd
[
i
].
fd
=
ctx
->
listening_sockets
[
i
].
sock
;
pfd
[
i
].
fd
=
ctx
->
listening_sockets
[
i
].
sock
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment