diff --git a/contrib/libidn2/libidn2_sapi.cc b/contrib/libidn2/libidn2_sapi.cc index cb8f514..8e528fb 100644 --- a/contrib/libidn2/libidn2_sapi.cc +++ b/contrib/libidn2/libidn2_sapi.cc @@ -60,10 +60,9 @@ absl::StatusOr 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); } diff --git a/contrib/libzip/utils/utils_zip.cc b/contrib/libzip/utils/utils_zip.cc index a039409..d9d8eb6 100644 --- a/contrib/libzip/utils/utils_zip.cc +++ b/contrib/libzip/utils/utils_zip.cc @@ -63,9 +63,8 @@ absl::Status LibZip::OpenRemote() { SAPI_ASSIGN_OR_RETURN(void* zipsource, CreateSourceFromFd(rfd_)); zipsource_ = std::make_unique(zipsource); - sapi::v::NullPtr null_ptr; absl::StatusOr 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 LibZip::AddFile(const std::string& filename, } absl::StatusOr 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"); } diff --git a/contrib/uriparser/utils/utils_uriparser.cc b/contrib/uriparser/utils/utils_uriparser.cc index c2d44f6..9933a76 100644 --- a/contrib/uriparser/utils/utils_uriparser.cc +++ b/contrib/uriparser/utils/utils_uriparser.cc @@ -168,10 +168,9 @@ absl::StatusOr UriParser::GetUri(sapi::v::Struct* uri) { } sapi::v::Array 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"); } diff --git a/oss-internship-2020/curl/examples/example4.cc b/oss-internship-2020/curl/examples/example4.cc index c994125..6f7ef35 100644 --- a/oss-internship-2020/curl/examples/example4.cc +++ b/oss-internship-2020/curl/examples/example4.cc @@ -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( diff --git a/oss-internship-2020/libpng/examples/example2.cc b/oss-internship-2020/libpng/examples/example2.cc index 1a5a986..8612fe2 100644 --- a/oss-internship-2020/libpng/examples/example2.cc +++ b/oss-internship-2020/libpng/examples/example2.cc @@ -63,10 +63,9 @@ absl::StatusOr ReadPng(LibPNGApi& api, absl::string_view infile) { absl::StatusOr 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 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(); diff --git a/oss-internship-2020/libpng/tests/extended_test.cc b/oss-internship-2020/libpng/tests/extended_test.cc index 4eb5de8..2bd0225 100644 --- a/oss-internship-2020/libpng/tests/extended_test.cc +++ b/oss-internship-2020/libpng/tests/extended_test.cc @@ -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 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 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()); } diff --git a/sandboxed_api/examples/sum/main_sum.cc b/sandboxed_api/examples/sum/main_sum.cc index 86f0086..19a2043 100644 --- a/sandboxed_api/examples/sum/main_sum.cc +++ b/sandboxed_api/examples/sum/main_sum.cc @@ -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;