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
02f6867a
Commit
02f6867a
authored
9 years ago
by
Alexander Alashkin
Committed by
rojer
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement %lld in c_vsnprintf. Closes cesanta/dev#2120
PUBLISHED_FROM=1f24878425356f625b4f5b2b0fe40ab5f17501ab
parent
b93fa314
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
28 deletions
+3
-28
mongoose.c
mongoose.c
+3
-28
No files found.
mongoose.c
View file @
02f6867a
...
@@ -1748,6 +1748,9 @@ int c_vsnprintf(char *buf, size_t buf_size, const char *fmt, va_list ap) {
...
@@ -1748,6 +1748,9 @@ int c_vsnprintf(char *buf, size_t buf_size, const char *fmt, va_list ap) {
}
else
if
(
ch
==
'd'
&&
len_mod
==
'l'
)
{
}
else
if
(
ch
==
'd'
&&
len_mod
==
'l'
)
{
i
+=
c_itoa
(
buf
+
i
,
buf_size
-
i
,
va_arg
(
ap
,
long
),
10
,
flags
,
i
+=
c_itoa
(
buf
+
i
,
buf_size
-
i
,
va_arg
(
ap
,
long
),
10
,
flags
,
field_width
);
field_width
);
}
else
if
(
ch
==
'd'
&&
len_mod
==
'q'
)
{
i
+=
c_itoa
(
buf
+
i
,
buf_size
-
i
,
va_arg
(
ap
,
int64_t
),
10
,
flags
,
field_width
);
}
else
if
((
ch
==
'x'
||
ch
==
'u'
)
&&
len_mod
==
0
)
{
}
else
if
((
ch
==
'x'
||
ch
==
'u'
)
&&
len_mod
==
0
)
{
i
+=
c_itoa
(
buf
+
i
,
buf_size
-
i
,
va_arg
(
ap
,
unsigned
),
i
+=
c_itoa
(
buf
+
i
,
buf_size
-
i
,
va_arg
(
ap
,
unsigned
),
ch
==
'x'
?
16
:
10
,
flags
,
field_width
);
ch
==
'x'
?
16
:
10
,
flags
,
field_width
);
...
@@ -4631,12 +4634,7 @@ void mg_send_head(struct mg_connection *c, int status_code,
...
@@ -4631,12 +4634,7 @@ void mg_send_head(struct mg_connection *c, int status_code,
if
(
content_length
<
0
)
{
if
(
content_length
<
0
)
{
mg_printf
(
c
,
"%s"
,
"Transfer-Encoding: chunked
\r\n
"
);
mg_printf
(
c
,
"%s"
,
"Transfer-Encoding: chunked
\r\n
"
);
}
else
{
}
else
{
#ifdef MG_ESP8266
/* TODO(lsm): remove this when ESP stdlib supports %lld */
mg_printf
(
c
,
"Content-Length: %lu
\r\n
"
,
(
unsigned
long
)
content_length
);
#else
mg_printf
(
c
,
"Content-Length: %"
INT64_FMT
"
\r\n
"
,
content_length
);
mg_printf
(
c
,
"Content-Length: %"
INT64_FMT
"
\r\n
"
,
content_length
);
#endif
}
}
mg_send
(
c
,
"
\r\n
"
,
2
);
mg_send
(
c
,
"
\r\n
"
,
2
);
}
}
...
@@ -5425,7 +5423,6 @@ static void print_props(struct mg_connection *nc, const char *name,
...
@@ -5425,7 +5423,6 @@ static void print_props(struct mg_connection *nc, const char *name,
time_t
t
=
stp
->
st_mtime
;
/* store in local variable for NDK compile */
time_t
t
=
stp
->
st_mtime
;
/* store in local variable for NDK compile */
gmt_time_string
(
mtime
,
sizeof
(
mtime
),
&
t
);
gmt_time_string
(
mtime
,
sizeof
(
mtime
),
&
t
);
mg_url_encode
(
name
,
strlen
(
name
),
buf
,
sizeof
(
buf
));
mg_url_encode
(
name
,
strlen
(
name
),
buf
,
sizeof
(
buf
));
#ifndef MG_ESP8266
mg_printf
(
nc
,
mg_printf
(
nc
,
"<d:response>"
"<d:response>"
"<d:href>%s</d:href>"
"<d:href>%s</d:href>"
...
@@ -5441,28 +5438,6 @@ static void print_props(struct mg_connection *nc, const char *name,
...
@@ -5441,28 +5438,6 @@ static void print_props(struct mg_connection *nc, const char *name,
"</d:response>
\n
"
,
"</d:response>
\n
"
,
buf
,
S_ISDIR
(
stp
->
st_mode
)
?
"<d:collection/>"
:
""
,
buf
,
S_ISDIR
(
stp
->
st_mode
)
?
"<d:collection/>"
:
""
,
(
int64_t
)
stp
->
st_size
,
mtime
);
(
int64_t
)
stp
->
st_size
,
mtime
);
#else
/*
* TODO(alashkin): esp's sprintf doesn't handle INT64_FMT and call abort()
* Fix it
*/
mg_printf
(
nc
,
"<d:response>"
"<d:href>%s</d:href>"
"<d:propstat>"
"<d:prop>"
"<d:resourcetype>%s</d:resourcetype>"
"<d:getcontentlength>%lu"
"</d:getcontentlength>"
"<d:getlastmodified>%s</d:getlastmodified>"
"</d:prop>"
"<d:status>HTTP/1.1 200 OK</d:status>"
"</d:propstat>"
"</d:response>
\n
"
,
buf
,
S_ISDIR
(
stp
->
st_mode
)
?
"<d:collection/>"
:
""
,
(
unsigned
long
)
stp
->
st_size
,
mtime
);
#endif
}
}
static
void
handle_propfind
(
struct
mg_connection
*
nc
,
const
char
*
path
,
static
void
handle_propfind
(
struct
mg_connection
*
nc
,
const
char
*
path
,
...
...
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