mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
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:
parent
3b95bec700
commit
8d04efa62d
@ -15,10 +15,14 @@
|
|||||||
add_executable(sapi_minibrotli
|
add_executable(sapi_minibrotli
|
||||||
main.cc
|
main.cc
|
||||||
../utils/utils_brotli.cc
|
../utils/utils_brotli.cc
|
||||||
../utils/utils_brotli_enc.cc
|
../utils/utils_brotli.h
|
||||||
../utils/utils_brotli_dec.cc
|
../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
|
target_link_libraries(sapi_minibrotli PRIVATE
|
||||||
|
absl::die_if_null
|
||||||
absl::flags
|
absl::flags
|
||||||
absl::flags_parse
|
absl::flags_parse
|
||||||
absl::log_globals
|
absl::log_globals
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/log/die_if_null.h"
|
||||||
#include "contrib/brotli/sandboxed.h"
|
#include "contrib/brotli/sandboxed.h"
|
||||||
#include "sandboxed_api/util/status_macros.h"
|
#include "sandboxed_api/util/status_macros.h"
|
||||||
|
|
||||||
class BrotliDecoder {
|
class BrotliDecoder {
|
||||||
public:
|
public:
|
||||||
explicit BrotliDecoder(BrotliSandbox* sandbox)
|
explicit BrotliDecoder(BrotliSandbox* sandbox)
|
||||||
: sandbox_(CHECK_NOTNULL(sandbox)), api_(sandbox_), state_(nullptr) {
|
: sandbox_(ABSL_DIE_IF_NULL(sandbox)), api_(sandbox_), state_(nullptr) {
|
||||||
status = InitStructs();
|
status = InitStructs();
|
||||||
}
|
}
|
||||||
~BrotliDecoder();
|
~BrotliDecoder();
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/log/die_if_null.h"
|
||||||
#include "contrib/brotli/sandboxed.h"
|
#include "contrib/brotli/sandboxed.h"
|
||||||
#include "sandboxed_api/util/status_macros.h"
|
#include "sandboxed_api/util/status_macros.h"
|
||||||
|
|
||||||
class BrotliEncoder {
|
class BrotliEncoder {
|
||||||
public:
|
public:
|
||||||
explicit BrotliEncoder(BrotliSandbox* sandbox)
|
explicit BrotliEncoder(BrotliSandbox* sandbox)
|
||||||
: sandbox_(CHECK_NOTNULL(sandbox)), api_(sandbox_), state_(nullptr) {
|
: sandbox_(ABSL_DIE_IF_NULL(sandbox)), api_(sandbox_), state_(nullptr) {
|
||||||
status = InitStructs();
|
status = InitStructs();
|
||||||
}
|
}
|
||||||
~BrotliEncoder();
|
~BrotliEncoder();
|
||||||
|
@ -71,7 +71,8 @@ target_link_libraries(libidn2_sapi_wrapper
|
|||||||
# PUBLIC so that the include directories are included in the interface
|
# PUBLIC so that the include directories are included in the interface
|
||||||
PUBLIC libidn2_sapi
|
PUBLIC libidn2_sapi
|
||||||
sapi::base
|
sapi::base
|
||||||
PRIVATE idn2
|
PRIVATE absl::die_if_null
|
||||||
|
idn2
|
||||||
)
|
)
|
||||||
|
|
||||||
if(BUILD_TESTING AND SAPI_BUILD_TESTING)
|
if(BUILD_TESTING AND SAPI_BUILD_TESTING)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "libidn2_sapi.sapi.h" // NOLINT(build/include)
|
#include "libidn2_sapi.sapi.h" // NOLINT(build/include)
|
||||||
|
#include "absl/log/die_if_null.h"
|
||||||
#include "sandboxed_api/util/fileops.h"
|
#include "sandboxed_api/util/fileops.h"
|
||||||
|
|
||||||
class Idn2SapiSandbox : public IDN2Sandbox {
|
class Idn2SapiSandbox : public IDN2Sandbox {
|
||||||
@ -47,7 +48,7 @@ class Idn2SapiSandbox : public IDN2Sandbox {
|
|||||||
class IDN2Lib {
|
class IDN2Lib {
|
||||||
public:
|
public:
|
||||||
explicit IDN2Lib(Idn2SapiSandbox* sandbox)
|
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,
|
absl::StatusOr<std::string> idn2_register_u8(const char* ulabel,
|
||||||
const char* alabel);
|
const char* alabel);
|
||||||
absl::StatusOr<std::string> idn2_lookup_u8(const char* data);
|
absl::StatusOr<std::string> idn2_lookup_u8(const char* data);
|
||||||
|
@ -17,6 +17,7 @@ add_executable(sapi_minilibraw
|
|||||||
../utils/utils_libraw.cc
|
../utils/utils_libraw.cc
|
||||||
)
|
)
|
||||||
target_link_libraries(sapi_minilibraw PRIVATE
|
target_link_libraries(sapi_minilibraw PRIVATE
|
||||||
|
absl::die_if_null
|
||||||
absl::flags
|
absl::flags
|
||||||
absl::flags_parse
|
absl::flags_parse
|
||||||
absl::log_globals
|
absl::log_globals
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/log/die_if_null.h"
|
||||||
#include "contrib/libraw/sandboxed.h"
|
#include "contrib/libraw/sandboxed.h"
|
||||||
|
|
||||||
enum LibRaw_errors {
|
enum LibRaw_errors {
|
||||||
@ -41,7 +42,7 @@ enum LibRaw_errors {
|
|||||||
class LibRaw {
|
class LibRaw {
|
||||||
public:
|
public:
|
||||||
LibRaw(LibRawSapiSandbox* sandbox, const std::string& file_name)
|
LibRaw(LibRawSapiSandbox* sandbox, const std::string& file_name)
|
||||||
: sandbox_(CHECK_NOTNULL(sandbox)),
|
: sandbox_(ABSL_DIE_IF_NULL(sandbox)),
|
||||||
api_(sandbox_),
|
api_(sandbox_),
|
||||||
file_name_(file_name) {
|
file_name_(file_name) {
|
||||||
init_status_ = InitLibRaw();
|
init_status_ = InitLibRaw();
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
add_executable(sapi_minixls
|
add_executable(sapi_minixls
|
||||||
main.cc
|
main.cc
|
||||||
../utils/utils_libxls.cc
|
../utils/utils_libxls.cc
|
||||||
|
../utils/utils_libxls.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(sapi_minixls PRIVATE
|
target_link_libraries(sapi_minixls PRIVATE
|
||||||
|
absl::die_if_null
|
||||||
absl::flags
|
absl::flags
|
||||||
absl::flags_parse
|
absl::flags_parse
|
||||||
absl::log_globals
|
absl::log_globals
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "absl/log/die_if_null.h"
|
||||||
#include "contrib/libxls/sandboxed.h"
|
#include "contrib/libxls/sandboxed.h"
|
||||||
|
|
||||||
#define XLS_RECORD_FORMULA 0x0006
|
#define XLS_RECORD_FORMULA 0x0006
|
||||||
@ -60,7 +61,7 @@ class LibXlsSheet {
|
|||||||
|
|
||||||
LibXlsSheet(LibxlsSapiSandbox* sandbox, xlsWorkSheet* rws, size_t row,
|
LibXlsSheet(LibxlsSapiSandbox* sandbox, xlsWorkSheet* rws, size_t row,
|
||||||
size_t col)
|
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<std::string> GetStr(const sapi::v::Struct<xlsCell>& sapi_cell);
|
||||||
absl::StatusOr<LibXlsCell> GetNewCell(
|
absl::StatusOr<LibXlsCell> GetNewCell(
|
||||||
|
@ -91,6 +91,9 @@ target_sources(sapi_zip PUBLIC
|
|||||||
utils/utils_zip.cc
|
utils/utils_zip.cc
|
||||||
utils/utils_zip.h
|
utils/utils_zip.h
|
||||||
)
|
)
|
||||||
|
target_link_libraries(sapi_zip PRIVATE
|
||||||
|
absl::die_if_null
|
||||||
|
)
|
||||||
|
|
||||||
if(SAPI_BUILD_EXAMPLES)
|
if(SAPI_BUILD_EXAMPLES)
|
||||||
add_subdirectory(example)
|
add_subdirectory(example)
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "absl/log/die_if_null.h"
|
||||||
#include "contrib/libzip/sandboxed.h"
|
#include "contrib/libzip/sandboxed.h"
|
||||||
#include "sandboxed_api/util/status_macros.h"
|
#include "sandboxed_api/util/status_macros.h"
|
||||||
|
|
||||||
class LibZip {
|
class LibZip {
|
||||||
public:
|
public:
|
||||||
explicit LibZip(ZipSandbox* sandbox, std::string filename, int flags)
|
explicit LibZip(ZipSandbox* sandbox, std::string filename, int flags)
|
||||||
: sandbox_(CHECK_NOTNULL(sandbox)),
|
: sandbox_(ABSL_DIE_IF_NULL(sandbox)),
|
||||||
api_(sandbox_),
|
api_(sandbox_),
|
||||||
filename_(std::move(filename)),
|
filename_(std::move(filename)),
|
||||||
flags_(flags),
|
flags_(flags),
|
||||||
|
@ -18,6 +18,7 @@ add_executable(sapi_miniuriparser
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(sapi_miniuriparser PRIVATE
|
target_link_libraries(sapi_miniuriparser PRIVATE
|
||||||
|
absl::die_if_null
|
||||||
absl::flags
|
absl::flags
|
||||||
absl::flags_parse
|
absl::flags_parse
|
||||||
absl::log_globals
|
absl::log_globals
|
||||||
|
@ -18,13 +18,16 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "absl/container/btree_map.h"
|
#include "absl/container/btree_map.h"
|
||||||
|
#include "absl/log/die_if_null.h"
|
||||||
#include "contrib/uriparser/sandboxed.h"
|
#include "contrib/uriparser/sandboxed.h"
|
||||||
#include "sandboxed_api/util/status_macros.h"
|
#include "sandboxed_api/util/status_macros.h"
|
||||||
|
|
||||||
class UriParser {
|
class UriParser {
|
||||||
public:
|
public:
|
||||||
UriParser(UriparserSandbox* sandbox, const std::string& uri)
|
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();
|
status_ = ParseUri();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,6 +656,7 @@ cc_library(
|
|||||||
"@com_google_absl//absl/base:config",
|
"@com_google_absl//absl/base:config",
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
"@com_google_absl//absl/base:dynamic_annotations",
|
"@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",
|
||||||
"@com_google_absl//absl/status:statusor",
|
"@com_google_absl//absl/status:statusor",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
|
@ -570,7 +570,8 @@ add_library(sandbox2_comms ${SAPI_LIB_TYPE}
|
|||||||
)
|
)
|
||||||
add_library(sandbox2::comms ALIAS sandbox2_comms)
|
add_library(sandbox2::comms ALIAS sandbox2_comms)
|
||||||
target_link_libraries(sandbox2_comms
|
target_link_libraries(sandbox2_comms
|
||||||
PRIVATE absl::status
|
PRIVATE absl::die_if_null
|
||||||
|
absl::status
|
||||||
absl::statusor
|
absl::statusor
|
||||||
absl::str_format
|
absl::str_format
|
||||||
absl::strings
|
absl::strings
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "google/protobuf/message.h"
|
#include "google/protobuf/message.h"
|
||||||
#include "absl/base/config.h"
|
#include "absl/base/config.h"
|
||||||
#include "absl/base/dynamic_annotations.h"
|
#include "absl/base/dynamic_annotations.h"
|
||||||
|
#include "absl/log/die_if_null.h"
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "absl/strings/str_cat.h"
|
#include "absl/strings/str_cat.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user