Skip to content

Commit dff6953

Browse files
committed
Add casting
1 parent 9e6861e commit dff6953

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tutorial03/leptjson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static int lept_parse_string(lept_context* c, lept_value* v) {
9696
switch (ch) {
9797
case '\"':
9898
len = c->top - head;
99-
lept_set_string(v, lept_context_pop(c, len), len);
99+
lept_set_string(v, (const char*)lept_context_pop(c, len), len);
100100
c->json = p;
101101
return LEPT_PARSE_OK;
102102
case '\0':

tutorial03/tutorial03.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ int lept_parse(lept_value* v, const char* json) {
197197
198198
然后,我们实现堆栈的压入及弹出操作。和普通的堆栈不一样,我们这个堆栈是以字节储存的。每次可要求压入任意大小的数据,它会返回数据起始的指针(会 C++ 的同学可再参考[1]):
199199
200-
~~~
200+
~~~c
201201
#ifndef LEPT_PARSE_STACK_INIT_SIZE
202202
#define LEPT_PARSE_STACK_INIT_SIZE 256
203203
#endif
@@ -246,7 +246,7 @@ static int lept_parse_string(lept_context* c, lept_value* v) {
246246
switch (ch) {
247247
case '\"':
248248
len = c->top - head;
249-
lept_set_string(v, lept_context_pop(c, len), len);
249+
lept_set_string(v, (const char*)lept_context_pop(c, len), len);
250250
c->json = p;
251251
return LEPT_PARSE_OK;
252252
case '\0':

tutorial03_answer/leptjson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int lept_parse_string(lept_context* c, lept_value* v) {
100100
switch (ch) {
101101
case '\"':
102102
len = c->top - head;
103-
lept_set_string(v, lept_context_pop(c, len), len);
103+
lept_set_string(v, (const char*)lept_context_pop(c, len), len);
104104
c->json = p;
105105
return LEPT_PARSE_OK;
106106
case '\\':

0 commit comments

Comments
 (0)