Skip to content

Conversation

@copybara-service
Copy link

Added upb_EpsCopyInputStream_ReadEphemeral() and removed other functions that it can replace.

  • upb_EpsCopyInputStream_Skip() is equivalent to calling upb_EpsCopyInputStream_ReadEphemeral() and ignoring the returned string view.
  • upb_EpsCopyInputStream_Copy() is equivalent to calling upb_EpsCopyInputStream_ReadEphemeral() and then memcpy()-ing the contents manually.

Also changed the return type of PushLimit() from int to ptrdiff_t. Since the stream accepts a size_t length for the input buffer, the delta can exceed INT_MAX. For example, if the input buffer is 3G and the user calls PushLimit(1), then the delta will be almost 3G.

…tions that it can replace.

- `upb_EpsCopyInputStream_Skip()` is equivalent to calling `upb_EpsCopyInputStream_ReadEphemeral()` and ignoring the returned string view.
- `upb_EpsCopyInputStream_Copy()` is equivalent to calling `upb_EpsCopyInputStream_ReadEphemeral()` and then `memcpy()`-ing the contents manually.

Also changed the return type of `PushLimit()` from `int` to `ptrdiff_t`.  Since the stream accepts a `size_t` length for the input buffer, the delta can exceed `INT_MAX`.  For example, if the input buffer is 3G and the user calls `PushLimit(1)`, then the delta will be almost 3G.

PiperOrigin-RevId: 837693748
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

Successfully merging this pull request may close these issues.

1 participant