| 47 | } |
| 48 | |
| 49 | bool consume_ref_flag(ReadContext &ctx, bool tracking_ref, bool null_only) { |
| 50 | if (!tracking_ref && !null_only) { |
| 51 | return true; |
| 52 | } |
| 53 | int8_t ref_flag = ctx.read_int8(ctx.error()); |
| 54 | if (FORY_PREDICT_FALSE(ctx.has_error())) { |
| 55 | return false; |
| 56 | } |
| 57 | if (ref_flag == NULL_FLAG) { |
| 58 | return false; |
| 59 | } |
| 60 | if (ref_flag == REF_FLAG) { |
| 61 | (void)ctx.read_var_uint32(ctx.error()); |
| 62 | return false; |
| 63 | } |
| 64 | if (ref_flag == NOT_NULL_VALUE_FLAG || ref_flag == REF_VALUE_FLAG) { |
| 65 | return true; |
| 66 | } |
| 67 | ctx.set_error(Error::invalid_data( |
| 68 | "Unknown reference flag: " + std::to_string(static_cast<int>(ref_flag)))); |
| 69 | return false; |
| 70 | } |
| 71 | |
| 72 | void skip_struct_data(ReadContext &ctx, const TypeInfo &type_info) { |
| 73 | if (!type_info.type_meta) { |
no test coverage detected