539 } |
539 } |
540 |
540 |
541 return ret; |
541 return ret; |
542 } |
542 } |
543 |
543 |
544 static CxJsonLiteralType json_reader_literal(CxJson *p) { |
544 static CxJsonLiteral json_reader_literal(CxJson *p) { |
545 const char *l = p->reader_token.content; |
545 const char *l = p->reader_token.content; |
546 size_t token_len = p->reader_token.length; |
546 size_t token_len = p->reader_token.length; |
547 if (token_len == 4 && !memcmp(l, "true", 4)) { |
547 if (token_len == 4 && !memcmp(l, "true", 4)) { |
548 return CX_JSON_TRUE; |
548 return CX_JSON_TRUE; |
549 } else if (token_len == 5 && !memcmp(l, "false", 5)) { |
549 } else if (token_len == 5 && !memcmp(l, "false", 5)) { |
744 } |
744 } |
745 break; |
745 break; |
746 } |
746 } |
747 case CX_JSON_READER_INTEGER: { |
747 case CX_JSON_READER_INTEGER: { |
748 v->type = CX_JSON_INTEGER; |
748 v->type = CX_JSON_INTEGER; |
749 v->value.integer.value = p->value_int; |
749 v->value.integer = p->value_int; |
750 break; |
750 break; |
751 } |
751 } |
752 case CX_JSON_READER_NUMBER: { |
752 case CX_JSON_READER_NUMBER: { |
753 v->type = CX_JSON_NUMBER; |
753 v->type = CX_JSON_NUMBER; |
754 v->value.number.value = p->value_double; |
754 v->value.number = p->value_double; |
755 break; |
755 break; |
756 } |
756 } |
757 case CX_JSON_READER_LITERAL: { |
757 case CX_JSON_READER_LITERAL: { |
758 v->type = CX_JSON_LITERAL; |
758 v->type = CX_JSON_LITERAL; |
759 v->value.literal.literal = json_reader_literal(p); |
759 v->value.literal = json_reader_literal(p); |
760 break; |
760 break; |
761 } |
761 } |
762 } |
762 } |
763 } else if (p->readvalue_initialized) { |
763 } else if (p->readvalue_initialized) { |
764 CxJsonReaderType rt = p->reader_type; |
764 CxJsonReaderType rt = p->reader_type; |