We have deprecated sapi:✌️:NullPtr earlier this year. Users of SAPI can now pass directly a nullptr to the sandboxed API function. We believe that this will reduce development efforts and improve readability.

PiperOrigin-RevId: 614571112
Change-Id: I856a656d115f6cef6f9dc933e47ff6c2a7d7b722
This commit is contained in:
Oliver Kunz 2024-03-11 01:13:16 -07:00 committed by Copybara-Service
parent 64ed644f73
commit d33fe262b9
4 changed files with 12 additions and 15 deletions

View File

@ -23,7 +23,7 @@
absl::Status BrotliDecoder::InitStructs() {
SAPI_ASSIGN_OR_RETURN(
BrotliDecoderState * state,
api_.BrotliDecoderCreateInstance(&null_ptr_, &null_ptr_, &null_ptr_));
api_.BrotliDecoderCreateInstance(nullptr, nullptr, nullptr));
state_.SetRemote(state);
@ -84,12 +84,11 @@ absl::StatusOr<BrotliDecoderResult> BrotliDecoder::Decompress(
sapi::v::IntBase<size_t> sapi_avilable_out(0);
SAPI_ASSIGN_OR_RETURN(
BrotliDecoderResult ret,
api_.BrotliDecoderDecompressStream(
state_.PtrNone(), sapi_size_in.PtrBefore(),
sapi_opaque_buf_in.PtrBefore(), sapi_avilable_out.PtrBefore(),
&null_ptr_, &null_ptr_));
SAPI_ASSIGN_OR_RETURN(BrotliDecoderResult ret,
api_.BrotliDecoderDecompressStream(
state_.PtrNone(), sapi_size_in.PtrBefore(),
sapi_opaque_buf_in.PtrBefore(),
sapi_avilable_out.PtrBefore(), nullptr, nullptr));
// Ignore output error, as we didn't provide any buffer.
if (ret == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {

View File

@ -44,7 +44,6 @@ class BrotliDecoder {
BrotliApi api_;
absl::Status status;
sapi::v::GenericPtr state_;
sapi::v::NullPtr null_ptr_;
};
#endif // CONTRIB_BROTLI_UTILS_UTILS_BROTLI_DEC_H_

View File

@ -23,7 +23,7 @@
absl::Status BrotliEncoder::InitStructs() {
SAPI_ASSIGN_OR_RETURN(
BrotliEncoderState * state,
api_.BrotliEncoderCreateInstance(&null_ptr_, &null_ptr_, &null_ptr_));
api_.BrotliEncoderCreateInstance(nullptr, nullptr, nullptr));
state_.SetRemote(state);
@ -84,11 +84,11 @@ absl::Status BrotliEncoder::Compress(std::vector<uint8_t>& buf_in,
sapi::v::IntBase<size_t> sapi_avilable_out(0);
SAPI_ASSIGN_OR_RETURN(
bool ret, api_.BrotliEncoderCompressStream(
state_.PtrNone(), op, sapi_size_in.PtrBefore(),
sapi_opaque_buf_in.PtrBefore(),
sapi_avilable_out.PtrBefore(), &null_ptr_, &null_ptr_));
SAPI_ASSIGN_OR_RETURN(bool ret,
api_.BrotliEncoderCompressStream(
state_.PtrNone(), op, sapi_size_in.PtrBefore(),
sapi_opaque_buf_in.PtrBefore(),
sapi_avilable_out.PtrBefore(), nullptr, nullptr));
if (!ret) {
return absl::UnavailableError("Unable to compress input");
}

View File

@ -45,7 +45,6 @@ class BrotliEncoder {
BrotliApi api_;
absl::Status status;
sapi::v::GenericPtr state_;
sapi::v::NullPtr null_ptr_;
};
#endif // CONTRIB_BROTLI_UTILS_UTILS_BROTLI_ENC_H_