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
00d1d2c0
Commit
00d1d2c0
authored
7 years ago
by
Бобби
Committed by
Cesanta Bot
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make mjs & frozen vc98 & vc2017 friendly
PUBLISHED_FROM=7cde8b374d5e318b5cdd69fc5b4de86b2a9552f5
parent
6e50fe44
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
mongoose.c
mongoose.c
+14
-2
mongoose.h
mongoose.h
+18
-1
No files found.
mongoose.c
View file @
00d1d2c0
...
@@ -1936,12 +1936,24 @@ int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap) {
...
@@ -1936,12 +1936,24 @@ int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap) {
*
buf
=
NULL
;
/* LCOV_EXCL_START */
*
buf
=
NULL
;
/* LCOV_EXCL_START */
while
(
len
<
0
)
{
while
(
len
<
0
)
{
MG_FREE
(
*
buf
);
MG_FREE
(
*
buf
);
if
(
size
==
0
)
{
size
=
5
;
}
size
*=
2
;
size
*=
2
;
if
((
*
buf
=
(
char
*
)
MG_MALLOC
(
size
))
==
NULL
)
break
;
if
((
*
buf
=
(
char
*
)
MG_MALLOC
(
size
))
==
NULL
)
{
len
=
-
1
;
break
;
}
va_copy
(
ap_copy
,
ap
);
va_copy
(
ap_copy
,
ap
);
len
=
vsnprintf
(
*
buf
,
size
,
fmt
,
ap_copy
);
len
=
vsnprintf
(
*
buf
,
size
-
1
,
fmt
,
ap_copy
);
va_end
(
ap_copy
);
va_end
(
ap_copy
);
}
}
/*
* Microsoft version of vsnprintf() is not always null-terminated, so put
* the terminator manually
*/
(
*
buf
)[
len
]
=
0
;
/* LCOV_EXCL_STOP */
/* LCOV_EXCL_STOP */
}
else
if
(
len
>=
(
int
)
size
)
{
}
else
if
(
len
>=
(
int
)
size
)
{
/* Standard-compliant code path. Allocate a buffer that is large enough. */
/* Standard-compliant code path. Allocate a buffer that is large enough. */
...
...
This diff is collapsed.
Click to expand it.
mongoose.h
View file @
00d1d2c0
...
@@ -210,6 +210,12 @@
...
@@ -210,6 +210,12 @@
#include <windows.h>
#include <windows.h>
#include <process.h>
#include <process.h>
#if _MSC_VER < 1700
typedef
int
bool
;
#else
#include <stdbool.h>
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1800
#if defined(_MSC_VER) && _MSC_VER >= 1800
#define strdup _strdup
#define strdup _strdup
#endif
#endif
...
@@ -323,9 +329,16 @@ typedef struct _stati64 cs_stat_t;
...
@@ -323,9 +329,16 @@ typedef struct _stati64 cs_stat_t;
#define MG_NET_IF MG_NET_IF_SOCKET
#define MG_NET_IF MG_NET_IF_SOCKET
#endif
#endif
int
rmdir
(
const
char
*
dirname
);
unsigned
int
sleep
(
unsigned
int
seconds
);
unsigned
int
sleep
(
unsigned
int
seconds
);
/* https://stackoverflow.com/questions/16647819/timegm-cross-platform */
#define timegm _mkgmtime
#define gmtime_r(a, b) \
do { \
*(b) = *gmtime(a); \
} while (0)
#endif
/* CS_PLATFORM == CS_P_WINDOWS */
#endif
/* CS_PLATFORM == CS_P_WINDOWS */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_WINDOWS_H_ */
#endif
/* CS_COMMON_PLATFORMS_PLATFORM_WINDOWS_H_ */
#ifdef MG_MODULE_LINES
#ifdef MG_MODULE_LINES
...
@@ -374,6 +387,7 @@ unsigned int sleep(unsigned int seconds);
...
@@ -374,6 +387,7 @@ unsigned int sleep(unsigned int seconds);
#include <pthread.h>
#include <pthread.h>
#include <signal.h>
#include <signal.h>
#include <stdarg.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
...
@@ -493,6 +507,7 @@ typedef struct stat cs_stat_t;
...
@@ -493,6 +507,7 @@ typedef struct stat cs_stat_t;
#include <fcntl.h>
#include <fcntl.h>
#include <inttypes.h>
#include <inttypes.h>
#include <machine/endian.h>
#include <machine/endian.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdint.h>
#include <string.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/stat.h>
...
@@ -536,6 +551,7 @@ typedef struct stat cs_stat_t;
...
@@ -536,6 +551,7 @@ typedef struct stat cs_stat_t;
#include <fcntl.h>
#include <fcntl.h>
#include <inttypes.h>
#include <inttypes.h>
#include <machine/endian.h>
#include <machine/endian.h>
#include <stdbool.h>
#include <string.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/time.h>
...
@@ -642,6 +658,7 @@ int inet_pton(int af, const char *src, void *dst);
...
@@ -642,6 +658,7 @@ int inet_pton(int af, const char *src, void *dst);
#include <ctype.h>
#include <ctype.h>
#include <errno.h>
#include <errno.h>
#include <inttypes.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdint.h>
#include <string.h>
#include <string.h>
#include <time.h>
#include <time.h>
...
...
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