| // Protocol Buffers - Google's data interchange format |
| // Copyright 2023 Google LLC. All rights reserved. |
| // |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file or at |
| // https://developers.google.com/open-source/licenses/bsd |
| |
| #include "upb/wire/internal/decoder.h" |
| |
| #include "upb/message/internal/accessors.h" |
| #include "upb/message/message.h" |
| #include "upb/mini_table/message.h" |
| #include "upb/wire/decode.h" |
| #include "upb/wire/eps_copy_input_stream.h" |
| |
| // Must be last. |
| #include "upb/port/def.inc" |
| |
| UPB_NOINLINE |
| const char* _upb_Decoder_CheckRequired(upb_Decoder* d, const char* ptr, |
| const upb_Message* msg, |
| const upb_MiniTable* m) { |
| UPB_ASSERT(m->UPB_PRIVATE(required_count)); |
| if (UPB_UNLIKELY(d->options & kUpb_DecodeOption_CheckRequired)) { |
| d->missing_required = |
| !UPB_PRIVATE(_upb_Message_IsInitializedShallow)(msg, m); |
| } |
| return ptr; |
| } |
| |
| UPB_NORETURN void* _upb_Decoder_ErrorJmp(upb_Decoder* d, |
| upb_DecodeStatus status) { |
| UPB_ASSERT(status != kUpb_DecodeStatus_Ok); |
| d->status = status; |
| UPB_LONGJMP(d->err, 1); |
| } |
| |
| UPB_NOINLINE |
| const char* _upb_Decoder_IsDoneFallback(upb_EpsCopyInputStream* e, |
| const char* ptr, int overrun) { |
| return _upb_EpsCopyInputStream_IsDoneFallbackInline( |
| e, ptr, overrun, _upb_Decoder_BufferFlipCallback); |
| } |