contrib: Replace uses of CHECK_NOTNULL

Abseil's standard name for this is `ABSL_DIE_IF_NULL`.

PiperOrigin-RevId: 483648443
Change-Id: I9d6826443be72b30f71c18972436fa5f9c05048a
This commit is contained in:
Christian Blichmann 2022-10-25 05:50:16 -07:00 committed by Copybara-Service
parent 3b95bec700
commit 8d04efa62d
16 changed files with 34 additions and 10 deletions

View File

@ -15,10 +15,14 @@
add_executable(sapi_minibrotli
main.cc
../utils/utils_brotli.cc
../utils/utils_brotli_enc.cc
../utils/utils_brotli.h
../utils/utils_brotli_dec.cc
../utils/utils_brotli_dec.h
../utils/utils_brotli_enc.cc
../utils/utils_brotli_enc.h
)
target_link_libraries(sapi_minibrotli PRIVATE
absl::die_if_null
absl::flags
absl::flags_parse
absl::log_globals

View File

@ -17,13 +17,14 @@
#include <vector>
#include "absl/log/die_if_null.h"
#include "contrib/brotli/sandboxed.h"
#include "sandboxed_api/util/status_macros.h"
class BrotliDecoder {
public:
explicit BrotliDecoder(BrotliSandbox* sandbox)
: sandbox_(CHECK_NOTNULL(sandbox)), api_(sandbox_), state_(nullptr) {
: sandbox_(ABSL_DIE_IF_NULL(sandbox)), api_(sandbox_), state_(nullptr) {
status = InitStructs();
}
~BrotliDecoder();

View File

@ -17,13 +17,14 @@
#include <vector>
#include "absl/log/die_if_null.h"
#include "contrib/brotli/sandboxed.h"
#include "sandboxed_api/util/status_macros.h"
class BrotliEncoder {
public:
explicit BrotliEncoder(BrotliSandbox* sandbox)
: sandbox_(CHECK_NOTNULL(sandbox)), api_(sandbox_), state_(nullptr) {
: sandbox_(ABSL_DIE_IF_NULL(sandbox)), api_(sandbox_), state_(nullptr) {
status = InitStructs();
}
~BrotliEncoder();

View File

@ -71,7 +71,8 @@ target_link_libraries(libidn2_sapi_wrapper
# PUBLIC so that the include directories are included in the interface
PUBLIC libidn2_sapi
sapi::base
PRIVATE idn2
PRIVATE absl::die_if_null
idn2
)
if(BUILD_TESTING AND SAPI_BUILD_TESTING)

View File

@ -21,6 +21,7 @@
#include <cstdlib>
#include "libidn2_sapi.sapi.h" // NOLINT(build/include)
#include "absl/log/die_if_null.h"
#include "sandboxed_api/util/fileops.h"
class Idn2SapiSandbox : public IDN2Sandbox {
@ -47,7 +48,7 @@ class Idn2SapiSandbox : public IDN2Sandbox {
class IDN2Lib {
public:
explicit IDN2Lib(Idn2SapiSandbox* sandbox)
: sandbox_(CHECK_NOTNULL(sandbox)), api_(sandbox_) {}
: sandbox_(ABSL_DIE_IF_NULL(sandbox)), api_(sandbox_) {}
absl::StatusOr<std::string> idn2_register_u8(const char* ulabel,
const char* alabel);
absl::StatusOr<std::string> idn2_lookup_u8(const char* data);

View File

@ -17,6 +17,7 @@ add_executable(sapi_minilibraw
../utils/utils_libraw.cc
)
target_link_libraries(sapi_minilibraw PRIVATE
absl::die_if_null
absl::flags
absl::flags_parse
absl::log_globals

View File

@ -17,6 +17,7 @@
#include <vector>
#include "absl/log/die_if_null.h"
#include "contrib/libraw/sandboxed.h"
enum LibRaw_errors {
@ -41,7 +42,7 @@ enum LibRaw_errors {
class LibRaw {
public:
LibRaw(LibRawSapiSandbox* sandbox, const std::string& file_name)
: sandbox_(CHECK_NOTNULL(sandbox)),
: sandbox_(ABSL_DIE_IF_NULL(sandbox)),
api_(sandbox_),
file_name_(file_name) {
init_status_ = InitLibRaw();

View File

@ -15,9 +15,11 @@
add_executable(sapi_minixls
main.cc
../utils/utils_libxls.cc
../utils/utils_libxls.h
)
target_link_libraries(sapi_minixls PRIVATE
absl::die_if_null
absl::flags
absl::flags_parse
absl::log_globals

View File

@ -17,6 +17,7 @@
#include <fcntl.h>
#include "absl/log/die_if_null.h"
#include "contrib/libxls/sandboxed.h"
#define XLS_RECORD_FORMULA 0x0006
@ -60,7 +61,7 @@ class LibXlsSheet {
LibXlsSheet(LibxlsSapiSandbox* sandbox, xlsWorkSheet* rws, size_t row,
size_t col)
: sandbox_(CHECK_NOTNULL(sandbox)), rws_(rws), row_(row), col_(col) {}
: sandbox_(ABSL_DIE_IF_NULL(sandbox)), rws_(rws), row_(row), col_(col) {}
absl::StatusOr<std::string> GetStr(const sapi::v::Struct<xlsCell>& sapi_cell);
absl::StatusOr<LibXlsCell> GetNewCell(

View File

@ -91,6 +91,9 @@ target_sources(sapi_zip PUBLIC
utils/utils_zip.cc
utils/utils_zip.h
)
target_link_libraries(sapi_zip PRIVATE
absl::die_if_null
)
if(SAPI_BUILD_EXAMPLES)
add_subdirectory(example)

View File

@ -17,13 +17,14 @@
#include <fcntl.h>
#include "absl/log/die_if_null.h"
#include "contrib/libzip/sandboxed.h"
#include "sandboxed_api/util/status_macros.h"
class LibZip {
public:
explicit LibZip(ZipSandbox* sandbox, std::string filename, int flags)
: sandbox_(CHECK_NOTNULL(sandbox)),
: sandbox_(ABSL_DIE_IF_NULL(sandbox)),
api_(sandbox_),
filename_(std::move(filename)),
flags_(flags),

View File

@ -18,6 +18,7 @@ add_executable(sapi_miniuriparser
)
target_link_libraries(sapi_miniuriparser PRIVATE
absl::die_if_null
absl::flags
absl::flags_parse
absl::log_globals

View File

@ -18,13 +18,16 @@
#include <vector>
#include "absl/container/btree_map.h"
#include "absl/log/die_if_null.h"
#include "contrib/uriparser/sandboxed.h"
#include "sandboxed_api/util/status_macros.h"
class UriParser {
public:
UriParser(UriparserSandbox* sandbox, const std::string& uri)
: sandbox_(CHECK_NOTNULL(sandbox)), api_(sandbox_), c_uri_(uri.c_str()) {
: sandbox_(ABSL_DIE_IF_NULL(sandbox)),
api_(sandbox_),
c_uri_(uri.c_str()) {
status_ = ParseUri();
}

View File

@ -656,6 +656,7 @@ cc_library(
"@com_google_absl//absl/base:config",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/base:dynamic_annotations",
"@com_google_absl//absl/log:die_if_null",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",

View File

@ -570,7 +570,8 @@ add_library(sandbox2_comms ${SAPI_LIB_TYPE}
)
add_library(sandbox2::comms ALIAS sandbox2_comms)
target_link_libraries(sandbox2_comms
PRIVATE absl::status
PRIVATE absl::die_if_null
absl::status
absl::statusor
absl::str_format
absl::strings

View File

@ -39,6 +39,7 @@
#include "google/protobuf/message.h"
#include "absl/base/config.h"
#include "absl/base/dynamic_annotations.h"
#include "absl/log/die_if_null.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"