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
63be1ebd
Commit
63be1ebd
authored
9 years ago
by
Alexander Alashkin
Committed by
rojer
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mongoose MSVC2015 warnings cleanup, part1
PUBLISHED_FROM=9e173215ed69464d1aa421d43a8fda814f36f96d
parent
796dc18c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
mongoose.c
mongoose.c
+12
-9
mongoose.h
mongoose.h
+6
-2
No files found.
mongoose.c
View file @
63be1ebd
...
...
@@ -564,7 +564,9 @@ double cs_time() {
* license, as set out in <http://cesanta.com/products.html>.
*/
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
/* Disable deprecation warning in VS2005+ */
#endif
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -1454,14 +1456,15 @@ size_t mbuf_insert(struct mbuf *a, size_t off, const void *buf, size_t len) {
}
a
->
len
+=
len
;
}
else
if
((
p
=
(
char
*
)
MBUF_REALLOC
(
a
->
buf
,
(
a
->
len
+
len
)
*
MBUF_SIZE_MULTIPLIER
))
!=
NULL
)
{
a
->
buf
,
(
size_t
)((
a
->
len
+
len
)
*
MBUF_SIZE_MULTIPLIER
)))
!=
NULL
)
{
a
->
buf
=
p
;
memmove
(
a
->
buf
+
off
+
len
,
a
->
buf
+
off
,
a
->
len
-
off
);
if
(
buf
!=
NULL
)
{
memcpy
(
a
->
buf
+
off
,
buf
,
len
);
}
a
->
len
+=
len
;
a
->
size
=
a
->
len
*
MBUF_SIZE_MULTIPLIER
;
a
->
size
=
(
size_t
)(
a
->
len
*
MBUF_SIZE_MULTIPLIER
)
;
}
else
{
len
=
0
;
}
...
...
@@ -9089,18 +9092,18 @@ static int mg_get_ip_address_of_nameserver(char *name, size_t name_len) {
char
subkey
[
512
],
value
[
128
],
*
key
=
"SYSTEM
\\
ControlSet001
\\
Services
\\
Tcpip
\\
Parameters
\\
Interfaces"
;
if
((
err
=
RegOpenKey
(
HKEY_LOCAL_MACHINE
,
key
,
&
hKey
))
!=
ERROR_SUCCESS
)
{
if
((
err
=
RegOpenKey
A
(
HKEY_LOCAL_MACHINE
,
key
,
&
hKey
))
!=
ERROR_SUCCESS
)
{
fprintf
(
stderr
,
"cannot open reg key %s: %d
\n
"
,
key
,
err
);
ret
=
-
1
;
}
else
{
for
(
ret
=
-
1
,
i
=
0
;
RegEnumKey
(
hKey
,
i
,
subkey
,
sizeof
(
subkey
))
==
ERROR_SUCCESS
;
i
++
)
{
RegEnumKey
A
(
hKey
,
i
,
subkey
,
sizeof
(
subkey
))
==
ERROR_SUCCESS
;
i
++
)
{
DWORD
type
,
len
=
sizeof
(
value
);
if
(
RegOpenKey
(
hKey
,
subkey
,
&
hSub
)
==
ERROR_SUCCESS
&&
(
RegQueryValueEx
(
hSub
,
"NameServer"
,
0
,
&
type
,
(
void
*
)
value
,
&
len
)
==
ERROR_SUCCESS
||
RegQueryValueEx
(
hSub
,
"DhcpNameServer"
,
0
,
&
type
,
(
void
*
)
value
,
&
len
)
==
ERROR_SUCCESS
))
{
if
(
RegOpenKey
A
(
hKey
,
subkey
,
&
hSub
)
==
ERROR_SUCCESS
&&
(
RegQueryValueEx
A
(
hSub
,
"NameServer"
,
0
,
&
type
,
(
void
*
)
value
,
&
len
)
==
ERROR_SUCCESS
||
RegQueryValueEx
A
(
hSub
,
"DhcpNameServer"
,
0
,
&
type
,
(
void
*
)
value
,
&
len
)
==
ERROR_SUCCESS
))
{
/*
* See https://github.com/cesanta/mongoose/issues/176
* The value taken from the registry can be empty, a single
...
...
This diff is collapsed.
Click to expand it.
mongoose.h
View file @
63be1ebd
...
...
@@ -142,6 +142,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
#include <direct.h>
#include <io.h>
#define random() rand()
#ifdef _MSC_VER
...
...
@@ -167,6 +170,7 @@
#define to64(x) _atoi64(x)
#define popen(x, y) _popen((x), (y))
#define pclose(x) _pclose(x)
#define rmdir _rmdir
#if defined(_MSC_VER) && _MSC_VER >= 1400
#define fseeko(x, y, z) _fseeki64((x), (y), (z))
#else
...
...
@@ -834,8 +838,8 @@ const char *c_strnstr(const char *s, const char *find, size_t slen);
#if (!(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700) && \
!(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L) && \
!(defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200809L) && \
!defined(RTOS_SDK))
||
\
(defined(_MSC_VER) && _MSC_VER < 1600
/*Visual Studio 2010
*/
)
!defined(RTOS_SDK))
&&
\
!(defined(_MSC_VER) && _MSC_VER >= 1600
/* MSVC2013+ has strnlen
*/
)
#define _MG_PROVIDE_STRNLEN
size_t
strnlen
(
const
char
*
s
,
size_t
maxlen
);
#endif
...
...
This diff is collapsed.
Click to expand it.
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