Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
d425dd71
Commit
d425dd71
authored
Mar 16, 2015
by
funshine
Browse files
under develop
parent
83f53c23
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/cjson/fpconv.c
→
app/cjson/fpconv.c
.bak
View file @
d425dd71
...
...
@@ -30,7 +30,7 @@
#include "c_stdio.h"
#include "c_stdlib.h"
#include <assert.h>
//
#include <assert.h>
#include "c_string.h"
#include "fpconv.h"
...
...
app/libc/c_string.h
View file @
d425dd71
...
...
@@ -25,7 +25,7 @@
#define c_strncmp os_strncmp
#define c_strncpy os_strncpy
// #define c_strstr os_strstr
#define c_strncasecmp
c_
strcmp
#define c_strncasecmp str
ncase
cmp
#define c_strstr strstr
#define c_strncat strncat
...
...
app/modules/cjson.c
View file @
d425dd71
...
...
@@ -36,7 +36,7 @@
* difficult to know object/array sizes ahead of time.
*/
#include <assert.h>
//
#include <assert.h>
#include "c_string.h"
#include "c_math.h"
#include "c_limits.h"
...
...
@@ -44,7 +44,14 @@
#include "lauxlib.h"
#include "strbuf.h"
#ifdef LUA_NUMBER_INTEGRAL
#include "fpconv.h"
#else
#define FPCONV_G_FMT_BUFSIZE 32
#define fpconv_strtod c_strtod
#define fpconv_init() ((void)0)
#define fpconv_g_fmt fpconv_g_fmt
#endif
#ifndef CJSON_MODNAME
#define CJSON_MODNAME "cjson"
...
...
@@ -964,7 +971,7 @@ static void json_next_string_token(json_parse_t *json, json_token_t *token)
char
ch
;
/* Caller must ensure a string is next */
assert
(
*
json
->
ptr
==
'"'
);
if
(
!
(
*
json
->
ptr
==
'"'
)
)
return
;
/* Skip " */
json
->
ptr
++
;
...
...
@@ -1058,10 +1065,21 @@ static int json_is_invalid_number(json_parse_t *json)
return
0
;
/* Ordinary number */
}
char
tmp
[
4
];
// conv to lower. because c_strncasecmp == c_strcmp
int
i
;
for
(
i
=
0
;
i
<
3
;
++
i
)
{
if
(
p
[
i
]
!=
0
)
tmp
[
i
]
=
tolower
(
p
[
i
]);
else
tmp
[
i
]
=
0
;
}
tmp
[
3
]
=
0
;
/* Reject inf/nan */
if
(
!
strncasecmp
(
p
,
"inf"
,
3
))
if
(
!
c_
strncasecmp
(
tm
p
,
"inf"
,
3
))
return
1
;
if
(
!
strncasecmp
(
p
,
"nan"
,
3
))
if
(
!
c_
strncasecmp
(
tm
p
,
"nan"
,
3
))
return
1
;
/* Pass all other numbers which may still be invalid, but
...
...
@@ -1137,17 +1155,17 @@ static void json_next_token(json_parse_t *json, json_token_t *token)
}
json_next_number_token
(
json
,
token
);
return
;
}
else
if
(
!
strncmp
(
json
->
ptr
,
"true"
,
4
))
{
}
else
if
(
!
c_
strncmp
(
json
->
ptr
,
"true"
,
4
))
{
token
->
type
=
T_BOOLEAN
;
token
->
value
.
boolean
=
1
;
json
->
ptr
+=
4
;
return
;
}
else
if
(
!
strncmp
(
json
->
ptr
,
"false"
,
5
))
{
}
else
if
(
!
c_
strncmp
(
json
->
ptr
,
"false"
,
5
))
{
token
->
type
=
T_BOOLEAN
;
token
->
value
.
boolean
=
0
;
json
->
ptr
+=
5
;
return
;
}
else
if
(
!
strncmp
(
json
->
ptr
,
"null"
,
4
))
{
}
else
if
(
!
c_
strncmp
(
json
->
ptr
,
"null"
,
4
))
{
token
->
type
=
T_NULL
;
json
->
ptr
+=
4
;
return
;
...
...
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