Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bool类型的数据无法正确解析 #5

Open
Mrtuifei opened this issue Oct 9, 2021 · 2 comments
Open

Bool类型的数据无法正确解析 #5

Mrtuifei opened this issue Oct 9, 2021 · 2 comments

Comments

@Mrtuifei
Copy link

Mrtuifei commented Oct 9, 2021

首先感谢分享代码,json中的bool类型无法解析正确,每次都是0,不管数据是true还是false。

@NevermindZZT
Copy link
Owner

确实是代码上有错误,您可以先修改使用

cson.c第298行

        case CSON_TYPE_BOOL:
            *(char *)((int)obj + model[i].offset) = (char)csonDecodeNumber(json, model[i].key);
            break;

修改为

        case CSON_TYPE_BOOL:
            *(char *)((int)obj + model[i].offset) = (char)csonDecodeBool(json, model[i].key);
            break;

@MagiciSource
Copy link

.h里cson类型也得改才能生效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants