Replace usages of deprecated `sapi:✌️:NullPtr`

PiperOrigin-RevId: 611463218
Change-Id: Id3002f03bff9407c670d6656550b1aa518b7fe58
main
Wiktor Garbacz 2024-02-29 07:24:30 -08:00 committed by Copybara-Service
parent 86e356b7ee
commit c8a26fbfa0
7 changed files with 14 additions and 25 deletions

View File

@ -60,10 +60,9 @@ absl::StatusOr<std::string> IDN2Lib::idn2_register_u8(const char* ulabel,
alabel_ptr.emplace(alabel);
}
sapi::v::GenericPtr ptr;
sapi::v::NullPtr null_ptr;
const auto untrusted_res = api_.idn2_register_u8(
ulabel ? ulabel_ptr->PtrBefore() : &null_ptr,
alabel ? alabel_ptr->PtrBefore() : &null_ptr, ptr.PtrAfter(),
ulabel ? ulabel_ptr->PtrBefore() : nullptr,
alabel ? alabel_ptr->PtrBefore() : nullptr, ptr.PtrAfter(),
IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL);
return this->ProcessErrors(untrusted_res, ptr);
}

View File

@ -63,9 +63,8 @@ absl::Status LibZip::OpenRemote() {
SAPI_ASSIGN_OR_RETURN(void* zipsource, CreateSourceFromFd(rfd_));
zipsource_ = std::make_unique<sapi::v::RemotePtr>(zipsource);
sapi::v::NullPtr null_ptr;
absl::StatusOr<zip_t*> status_or_zip =
api_.zip_open_from_source(&(*zipsource_), flags_, &null_ptr);
api_.zip_open_from_source(&(*zipsource_), flags_, nullptr);
if (!status_or_zip.ok() || *status_or_zip == nullptr) {
api_.zip_source_free(&(*zipsource_)).IgnoreError();
zipsource_ = nullptr;
@ -220,10 +219,8 @@ absl::StatusOr<uint64_t> LibZip::AddFile(const std::string& filename,
}
absl::StatusOr<void*> LibZip::CreateSourceFromFd(sapi::v::Fd& rfd) {
sapi::v::NullPtr null_ptr;
SAPI_ASSIGN_OR_RETURN(void* zipsource, api_.zip_read_fd_to_source(
rfd.GetRemoteFd(), &null_ptr));
SAPI_ASSIGN_OR_RETURN(void* zipsource,
api_.zip_read_fd_to_source(rfd.GetRemoteFd(), nullptr));
if (zipsource == nullptr) {
return absl::UnavailableError("Unable to create buffer");
}

View File

@ -168,10 +168,9 @@ absl::StatusOr<std::string> UriParser::GetUri(sapi::v::Struct<UriUriA>* uri) {
}
sapi::v::Array<char> buf(size.GetValue() + 1);
sapi::v::NullPtr null_ptr;
SAPI_ASSIGN_OR_RETURN(ret, api_.uriToStringA(buf.PtrAfter(), uri->PtrNone(),
buf.GetSize(), &null_ptr));
buf.GetSize(), nullptr));
if (ret != 0) {
return absl::UnavailableError("Unable to Recomposing URI");
}

View File

@ -92,9 +92,8 @@ absl::Status Example4() {
if (still_running.GetValue()) {
// Wait for an event or timeout
sapi::v::NullPtr null_ptr;
SAPI_ASSIGN_OR_RETURN(
curl_code, api.curl_multi_poll_sapi(&multi_handle, &null_ptr, 0, 1000,
curl_code, api.curl_multi_poll_sapi(&multi_handle, nullptr, 0, 1000,
numfds.PtrBoth()));
if (curl_code != 0) {
return absl::UnavailableError(absl::StrCat(

View File

@ -63,10 +63,9 @@ absl::StatusOr<Data> ReadPng(LibPNGApi& api, absl::string_view infile) {
absl::StatusOr<png_structp> status_or_png_structp;
sapi::v::ConstCStr ver_string_var(PNG_LIBPNG_VER_STRING);
sapi::v::NullPtr null = sapi::v::NullPtr();
SAPI_ASSIGN_OR_RETURN(
status_or_png_structp,
api.png_create_read_struct_wrapper(ver_string_var.PtrBefore(), &null));
api.png_create_read_struct_wrapper(ver_string_var.PtrBefore(), nullptr));
sapi::v::RemotePtr struct_ptr(status_or_png_structp.value());
if (!struct_ptr.GetValue()) {
@ -141,10 +140,9 @@ absl::Status WritePng(LibPNGApi& api, absl::string_view outfile, Data& data) {
absl::StatusOr<png_structp> status_or_png_structp;
sapi::v::ConstCStr ver_string_var(PNG_LIBPNG_VER_STRING);
sapi::v::NullPtr null = sapi::v::NullPtr();
SAPI_ASSIGN_OR_RETURN(
status_or_png_structp,
api.png_create_write_struct_wrapper(ver_string_var.PtrBefore(), &null));
api.png_create_write_struct_wrapper(ver_string_var.PtrBefore(), nullptr));
sapi::v::RemotePtr struct_ptr(status_or_png_structp.value());
if (!struct_ptr.GetValue()) {
@ -176,7 +174,7 @@ absl::Status WritePng(LibPNGApi& api, absl::string_view outfile, Data& data) {
&struct_ptr, data.row_pointers->PtrBefore(), data.height, data.rowbytes));
SAPI_RETURN_IF_ERROR(api.png_setjmp(&struct_ptr));
SAPI_RETURN_IF_ERROR(api.png_write_end(&struct_ptr, &null));
SAPI_RETURN_IF_ERROR(api.png_write_end(&struct_ptr, nullptr));
SAPI_RETURN_IF_ERROR(api.png_fclose(&file));
return absl::OkStatus();

View File

@ -67,9 +67,8 @@ void ReadPng(LibPNGApi& api, absl::string_view infile, Data& data) {
ASSERT_THAT(status_or_int.value(), Eq(0)) << infile << " is not a PNG file";
sapi::v::ConstCStr ver_string_var(PNG_LIBPNG_VER_STRING);
sapi::v::NullPtr null = sapi::v::NullPtr();
absl::StatusOr<png_structp> status_or_png_structp =
api.png_create_read_struct_wrapper(ver_string_var.PtrBefore(), &null);
api.png_create_read_struct_wrapper(ver_string_var.PtrBefore(), nullptr);
ASSERT_THAT(status_or_png_structp, IsOk());
sapi::v::RemotePtr struct_ptr(status_or_png_structp.value());
@ -149,9 +148,8 @@ void WritePng(LibPNGApi& api, absl::string_view outfile, Data& data) {
ASSERT_THAT(file.GetValue(), NotNull()) << "Could not open " << outfile;
sapi::v::ConstCStr ver_string_var(PNG_LIBPNG_VER_STRING);
sapi::v::NullPtr null = sapi::v::NullPtr();
absl::StatusOr<png_structp> status_or_png_structp =
api.png_create_write_struct_wrapper(ver_string_var.PtrBefore(), &null);
api.png_create_write_struct_wrapper(ver_string_var.PtrBefore(), nullptr);
ASSERT_THAT(status_or_png_structp, IsOk());
sapi::v::RemotePtr struct_ptr(status_or_png_structp.value());
@ -185,7 +183,7 @@ void WritePng(LibPNGApi& api, absl::string_view outfile, Data& data) {
IsOk());
ASSERT_THAT(api.png_setjmp(&struct_ptr), IsOk());
ASSERT_THAT(api.png_write_end(&struct_ptr, &null), IsOk());
ASSERT_THAT(api.png_write_end(&struct_ptr, nullptr), IsOk());
ASSERT_THAT(api.png_fclose(&file), IsOk());
}

View File

@ -131,11 +131,10 @@ absl::Status SumTransaction::Main() {
TRANSACTION_FAIL_IF_NOT(ret.GetValue() == 15, "puts('Hello World!!!') != 15");
sapi::v::Int vp;
sapi::v::NullPtr nptr;
LOG(INFO) << "Test whether pointer is NOT NULL - new pointers";
SAPI_RETURN_IF_ERROR(f.testptr(vp.PtrBefore()));
LOG(INFO) << "Test whether pointer is NULL";
SAPI_RETURN_IF_ERROR(f.testptr(&nptr));
SAPI_RETURN_IF_ERROR(f.testptr(nullptr));
// Protobuf test.
sumsapi::SumParamsProto proto;