mirror of
https://github.com/encounter/crashpad.git
synced 2026-03-30 11:04:28 -07:00
Convert NULL to nullptr.
This change was generated mechanically by running:
find . \( -name \*.cc -or -name \*.mm -or -name \*.h \) \
-and -not -path ./third_party/\* -and -not -path ./out/\* \
-exec sed -i '' -E -e 's/(^|[^_])NULL/\1nullptr/g' {} +
Further manual fix-ups were applied to remove casts of nullptr to other
pointer types where possible, to preserve the intentional use of NULL
(as a short form of MACH_PORT_NULL) in exception_port_tool, and to fix
80-column violations.
https://groups.google.com/a/chromium.org/d/topic/chromium-dev/4mijeJHzxLg/discussion
TEST=*_test
R=rsesek@chromium.org
Review URL: https://codereview.chromium.org/656703002
This commit is contained in:
@@ -78,8 +78,8 @@ class TSimpleStringDictionary {
|
||||
current_(0) {
|
||||
}
|
||||
|
||||
//! \brief Returns the next entry in the map, or `NULL` if at the end of the
|
||||
//! collection.
|
||||
//! \brief Returns the next entry in the map, or `nullptr` if at the end of
|
||||
//! the collection.
|
||||
const Entry* Next() {
|
||||
while (current_ < map_.num_entries) {
|
||||
const Entry* entry = &map_.entries_[current_++];
|
||||
@@ -87,7 +87,7 @@ class TSimpleStringDictionary {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -134,19 +134,19 @@ class TSimpleStringDictionary {
|
||||
|
||||
//! \brief Given \a key, returns its corresponding value.
|
||||
//!
|
||||
//! \param[in] key The key to look up. This must not be `NULL`.
|
||||
//! \param[in] key The key to look up. This must not be `nullptr`.
|
||||
//!
|
||||
//! \return The corresponding value for \a key, or if \a key is not found,
|
||||
//! `NULL`.
|
||||
//! `nullptr`.
|
||||
const char* GetValueForKey(const char* key) const {
|
||||
DCHECK(key);
|
||||
if (!key) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Entry* entry = GetConstEntryForKey(key);
|
||||
if (!entry) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return entry->value;
|
||||
@@ -155,12 +155,12 @@ class TSimpleStringDictionary {
|
||||
//! \brief Stores \a value into \a key, replacing the existing value if \a key
|
||||
//! is already present.
|
||||
//!
|
||||
//! If there \a key is not yet in the map and the map is already full
|
||||
//! (containing \a NumEntries active entries), this operation silently fails.
|
||||
//! If \a key is not yet in the map and the map is already full (containing
|
||||
//! \a NumEntries active entries), this operation silently fails.
|
||||
//!
|
||||
//! \param[in] key The key to store. This must not be `NULL`.
|
||||
//! \param[in] value The value to store. If `NULL`, \a key is removed from the
|
||||
//! map.
|
||||
//! \param[in] key The key to store. This must not be `nullptr`.
|
||||
//! \param[in] value The value to store. If `nullptr`, \a key is removed from
|
||||
//! the map.
|
||||
void SetKeyValue(const char* key, const char* value) {
|
||||
if (!value) {
|
||||
RemoveKey(key);
|
||||
@@ -194,7 +194,7 @@ class TSimpleStringDictionary {
|
||||
}
|
||||
}
|
||||
|
||||
// If the map is out of space, entry will be NULL.
|
||||
// If the map is out of space, |entry| will be nullptr.
|
||||
if (!entry) {
|
||||
return;
|
||||
}
|
||||
@@ -216,9 +216,9 @@ class TSimpleStringDictionary {
|
||||
|
||||
//! \brief Removes \a key from the map.
|
||||
//!
|
||||
//! If the key is not found, this is a no-op.
|
||||
//! If \a key is not found, this is a no-op.
|
||||
//!
|
||||
//! \param[in] key The key of the entry to remove. This must not be `NULL`.
|
||||
//! \param[in] key The key of the entry to remove. This must not be `nullptr`.
|
||||
void RemoveKey(const char* key) {
|
||||
DCHECK(key);
|
||||
if (!key) {
|
||||
@@ -231,7 +231,7 @@ class TSimpleStringDictionary {
|
||||
entry->value[0] = '\0';
|
||||
}
|
||||
|
||||
DCHECK_EQ(GetEntryForKey(key), static_cast<void*>(NULL));
|
||||
DCHECK_EQ(GetEntryForKey(key), static_cast<Entry*>(nullptr));
|
||||
}
|
||||
|
||||
//! \brief Returns a serialized form of the map.
|
||||
@@ -253,7 +253,7 @@ class TSimpleStringDictionary {
|
||||
return &entries_[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Entry* GetEntryForKey(const char* key) {
|
||||
|
||||
@@ -71,8 +71,8 @@ TEST(SimpleStringDictionary, SimpleStringDictionary) {
|
||||
// Now make sure it's not there anymore
|
||||
EXPECT_FALSE(dict.GetValueForKey("key3"));
|
||||
|
||||
// Remove by setting value to NULL
|
||||
dict.SetKeyValue("key2", NULL);
|
||||
// Remove by setting value to nullptr
|
||||
dict.SetKeyValue("key2", nullptr);
|
||||
|
||||
// Now make sure it's not there anymore
|
||||
EXPECT_FALSE(dict.GetValueForKey("key2"));
|
||||
@@ -279,13 +279,13 @@ TEST(SimpleStringDictionary, OutOfSpace) {
|
||||
|
||||
TEST(SimpleStringDictionaryDeathTest, NullKey) {
|
||||
TSimpleStringDictionary<4, 6, 6> map;
|
||||
ASSERT_DEATH(map.SetKeyValue(NULL, "hello"), "key");
|
||||
ASSERT_DEATH(map.SetKeyValue(nullptr, "hello"), "key");
|
||||
|
||||
map.SetKeyValue("hi", "there");
|
||||
ASSERT_DEATH(map.GetValueForKey(NULL), "key");
|
||||
ASSERT_DEATH(map.GetValueForKey(nullptr), "key");
|
||||
EXPECT_STREQ("there", map.GetValueForKey("hi"));
|
||||
|
||||
ASSERT_DEATH(map.GetValueForKey(NULL), "key");
|
||||
ASSERT_DEATH(map.GetValueForKey(nullptr), "key");
|
||||
map.RemoveKey("hi");
|
||||
EXPECT_EQ(0u, map.GetCount());
|
||||
}
|
||||
|
||||
@@ -37,22 +37,22 @@ namespace {
|
||||
// getsectbyname() function. getsectbyname() is always present in libmacho.
|
||||
// getsectiondata() and getsegmentdata() are not always present, but when they
|
||||
// are, they’re in the same library as getsectbyname(). If the library cannot
|
||||
// be found or a handle to it cannot be returned, returns NULL.
|
||||
// be found or a handle to it cannot be returned, returns nullptr.
|
||||
void* SystemLibMachOHandle() {
|
||||
Dl_info info;
|
||||
if (!dladdr(reinterpret_cast<void*>(getsectbyname), &info)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return dlopen(info.dli_fname, RTLD_LAZY | RTLD_LOCAL);
|
||||
}
|
||||
|
||||
// Returns a function pointer to a function in libmacho based on a lookup of
|
||||
// that function by symbol name. Returns NULL if libmacho cannot be found or
|
||||
// that function by symbol name. Returns nullptr if libmacho cannot be found or
|
||||
// opened, or if the named symbol cannot be found in libmacho.
|
||||
void* LookUpSystemLibMachOSymbol(const char* symbol) {
|
||||
static void* dl_handle = SystemLibMachOHandle();
|
||||
if (!dl_handle) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return dlsym(dl_handle, symbol);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
namespace crashpad {
|
||||
|
||||
MinidumpExceptionWriter::MinidumpExceptionWriter()
|
||||
: MinidumpStreamWriter(), exception_(), context_(NULL) {
|
||||
: MinidumpStreamWriter(), exception_(), context_(nullptr) {
|
||||
}
|
||||
|
||||
void MinidumpExceptionWriter::SetContext(MinidumpContextWriter* context) {
|
||||
|
||||
@@ -171,8 +171,8 @@ MinidumpModuleWriter::MinidumpModuleWriter()
|
||||
: MinidumpWritable(),
|
||||
module_(),
|
||||
name_(),
|
||||
codeview_record_(NULL),
|
||||
misc_debug_record_(NULL) {
|
||||
codeview_record_(nullptr),
|
||||
misc_debug_record_(nullptr) {
|
||||
module_.VersionInfo.dwSignature = VS_FFI_SIGNATURE;
|
||||
module_.VersionInfo.dwStrucVersion = VS_FFI_STRUCVERSION;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,11 @@ TEST(MinidumpModuleWriter, EmptyModuleList) {
|
||||
EXPECT_EQ(0u, module_list->NumberOfModules);
|
||||
}
|
||||
|
||||
// If |expected_pdb_name| is non-NULL, |codeview_record| is used to locate a
|
||||
// If |expected_pdb_name| is not nullptr, |codeview_record| is used to locate a
|
||||
// CodeView record in |file_contents|, and its fields are compared against the
|
||||
// the |expected_pdb_*| values. If |expected_pdb_uuid| is supplied, the CodeView
|
||||
// record must be a PDB 7.0 link, otherwise, it must be a PDB 2.0 link. If
|
||||
// |expected_pdb_name| is NULL, |codeview_record| must not point to anything.
|
||||
// |expected_pdb_name| is nullptr, |codeview_record| must not point to anything.
|
||||
void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
|
||||
const std::string& file_contents,
|
||||
const char* expected_pdb_name,
|
||||
@@ -148,10 +148,10 @@ void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
|
||||
}
|
||||
}
|
||||
|
||||
// If |expected_debug_name| is non-NULL, |misc_record| is used to locate a
|
||||
// If |expected_debug_name| is not nullptr, |misc_record| is used to locate a
|
||||
// miscellanous debugging record in |file_contents|, and its fields are compared
|
||||
// against the the |expected_debug_*| values. If |expected_debug_name| is NULL,
|
||||
// |misc_record| must not point to anything.
|
||||
// against the the |expected_debug_*| values. If |expected_debug_name| is
|
||||
// nullptr, |misc_record| must not point to anything.
|
||||
void ExpectMiscellaneousDebugRecord(
|
||||
const MINIDUMP_LOCATION_DESCRIPTOR* misc_record,
|
||||
const std::string& file_contents,
|
||||
@@ -315,11 +315,11 @@ TEST(MinidumpModuleWriter, EmptyModule) {
|
||||
&module_list->Modules[0],
|
||||
file_writer.string(),
|
||||
kModuleName,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
false));
|
||||
}
|
||||
@@ -479,7 +479,7 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
||||
file_writer.string(),
|
||||
kModuleName,
|
||||
kPDBName,
|
||||
NULL,
|
||||
nullptr,
|
||||
kPDBTimestamp,
|
||||
kPDBAge,
|
||||
kDebugName,
|
||||
@@ -578,7 +578,7 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
&pdb_uuid_0,
|
||||
0,
|
||||
kPDBAge0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
false));
|
||||
}
|
||||
@@ -593,11 +593,11 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
&module_list->Modules[1],
|
||||
file_writer.string(),
|
||||
kModuleName1,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
false));
|
||||
}
|
||||
@@ -613,10 +613,10 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||
file_writer.string(),
|
||||
kModuleName2,
|
||||
kPDBName2,
|
||||
NULL,
|
||||
nullptr,
|
||||
kPDBTimestamp2,
|
||||
kPDBAge2,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
false));
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ TEST(MinidumpStringWriter, ConvertInvalidUTF8ToUTF16) {
|
||||
size_t out_units =
|
||||
minidump_string->Length / sizeof(minidump_string->Buffer[0]);
|
||||
EXPECT_EQ(0, minidump_string->Buffer[out_units]);
|
||||
EXPECT_NE(reinterpret_cast<char16*>(NULL),
|
||||
EXPECT_NE(nullptr,
|
||||
base::c16memchr(minidump_string->Buffer, 0xfffd, out_units));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
namespace crashpad {
|
||||
|
||||
MinidumpThreadWriter::MinidumpThreadWriter()
|
||||
: MinidumpWritable(), thread_(), stack_(NULL), context_(NULL) {
|
||||
: MinidumpWritable(), thread_(), stack_(nullptr), context_(nullptr) {
|
||||
}
|
||||
|
||||
const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
|
||||
@@ -95,7 +95,7 @@ MinidumpThreadListWriter::MinidumpThreadListWriter()
|
||||
: MinidumpStreamWriter(),
|
||||
thread_list_base_(),
|
||||
threads_(),
|
||||
memory_list_writer_(NULL) {
|
||||
memory_list_writer_(nullptr) {
|
||||
}
|
||||
|
||||
MinidumpThreadListWriter::~MinidumpThreadListWriter() {
|
||||
|
||||
@@ -55,7 +55,7 @@ class MinidumpThreadWriter final : public internal::MinidumpWritable {
|
||||
//! corresponding to this object’s stack.
|
||||
//!
|
||||
//! If the thread does not have a stack, or its stack could not be determined,
|
||||
//! this will return NULL.
|
||||
//! this will return nullptr.
|
||||
//!
|
||||
//! This method is provided so that MinidumpThreadListWriter can obtain thread
|
||||
//! stack memory regions for the purposes of adding them to a
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace test {
|
||||
namespace {
|
||||
|
||||
// This returns the MINIDUMP_THREAD_LIST stream in |thread_list|. If
|
||||
// |memory_list| is non-NULL, a MINIDUMP_MEMORY_LIST stream is also expected in
|
||||
// |file_contents|, and that stream will be returned in |memory_list|.
|
||||
// |memory_list| is not nullptr, a MINIDUMP_MEMORY_LIST stream is also expected
|
||||
// in |file_contents|, and that stream will be returned in |memory_list|.
|
||||
void GetThreadListStream(const std::string& file_contents,
|
||||
const MINIDUMP_THREAD_LIST** thread_list,
|
||||
const MINIDUMP_MEMORY_LIST** memory_list) {
|
||||
@@ -85,15 +85,15 @@ TEST(MinidumpThreadWriter, EmptyThreadList) {
|
||||
|
||||
const MINIDUMP_THREAD_LIST* thread_list;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetThreadListStream(file_writer.string(), &thread_list, NULL));
|
||||
GetThreadListStream(file_writer.string(), &thread_list, nullptr));
|
||||
|
||||
EXPECT_EQ(0u, thread_list->NumberOfThreads);
|
||||
}
|
||||
|
||||
// The MINIDUMP_THREADs |expected| and |observed| are compared against each
|
||||
// other using gtest assertions. If |stack| is non-NULL, |observed| is expected
|
||||
// to contain a populated MINIDUMP_MEMORY_DESCRIPTOR in its Stack field,
|
||||
// otherwise, its Stack field is expected to be zeroed out. The memory
|
||||
// other using gtest assertions. If |stack| is not nullptr, |observed| is
|
||||
// expected to contain a populated MINIDUMP_MEMORY_DESCRIPTOR in its Stack
|
||||
// field, otherwise, its Stack field is expected to be zeroed out. The memory
|
||||
// descriptor will be placed in |stack|. |observed| must contain a populated
|
||||
// ThreadContext field. The context will be recovered from |file_contents| and
|
||||
// stored in |context_base|.
|
||||
@@ -166,7 +166,7 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||
|
||||
const MINIDUMP_THREAD_LIST* thread_list;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetThreadListStream(file_writer.string(), &thread_list, NULL));
|
||||
GetThreadListStream(file_writer.string(), &thread_list, nullptr));
|
||||
|
||||
EXPECT_EQ(1u, thread_list->NumberOfThreads);
|
||||
|
||||
@@ -183,7 +183,7 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||
ExpectThread(&expected,
|
||||
&thread_list->Threads[0],
|
||||
file_writer.string(),
|
||||
NULL,
|
||||
nullptr,
|
||||
reinterpret_cast<const void**>(&observed_context)));
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextX86(kSeed, observed_context));
|
||||
@@ -231,7 +231,7 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
||||
|
||||
const MINIDUMP_THREAD_LIST* thread_list;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
GetThreadListStream(file_writer.string(), &thread_list, NULL));
|
||||
GetThreadListStream(file_writer.string(), &thread_list, nullptr));
|
||||
|
||||
EXPECT_EQ(1u, thread_list->NumberOfThreads);
|
||||
|
||||
|
||||
+10
-10
@@ -45,15 +45,15 @@ namespace internal {
|
||||
//! \param[in] flavor The native thread state flavor of \a state. This may be
|
||||
//! `x86_THREAD_STATE32`, `x86_FLOAT_STATE32`, `x86_DEBUG_STATE32`,
|
||||
//! `x86_THREAD_STATE`, `x86_FLOAT_STATE`, or `x86_DEBUG_STATE`. It may also
|
||||
//! be `THREAD_STATE_NONE` if \a state is not supplied (and is `NULL`).
|
||||
//! be `THREAD_STATE_NONE` if \a state is not supplied (and is `nullptr`).
|
||||
//! \param[in] state The native thread state, which may be a casted pointer to
|
||||
//! `x86_thread_state32_t`, `x86_float_state32_t`, `x86_debug_state32_t`,
|
||||
//! `x86_thread_state`, `x86_float_state`, or `x86_debug_state`. This
|
||||
//! parameter may be `NULL` to not supply this data, in which case \a flavor
|
||||
//! must be `THREAD_STATE_NONE`. If a “universal” structure is used, it must
|
||||
//! carry 32-bit state data of the correct type.
|
||||
//! parameter may be `nullptr` to not supply this data, in which case \a
|
||||
//! flavor must be `THREAD_STATE_NONE`. If a “universal” structure is used,
|
||||
//! it must carry 32-bit state data of the correct type.
|
||||
//! \param[in] state_count The number of `natural_t`-sized (`int`-sized) units
|
||||
//! in \a state. This may be 0 if \a state is `NULL`.
|
||||
//! in \a state. This may be 0 if \a state is `nullptr`.
|
||||
//! \param[in] x86_thread_state32 The state of the thread’s integer registers.
|
||||
//! \param[in] x86_float_state32 The state of the thread’s floating-point
|
||||
//! registers.
|
||||
@@ -86,15 +86,15 @@ void InitializeCPUContextX86(CPUContextX86* context,
|
||||
//! \param[in] flavor The native thread state flavor of \a state. This may be
|
||||
//! `x86_THREAD_STATE64`, `x86_FLOAT_STATE64`, `x86_DEBUG_STATE64`,
|
||||
//! `x86_THREAD_STATE`, `x86_FLOAT_STATE`, or `x86_DEBUG_STATE`. It may also
|
||||
//! be `THREAD_STATE_NONE` if \a state is not supplied (and is `NULL`).
|
||||
//! be `THREAD_STATE_NONE` if \a state is not supplied (and is `nullptr`).
|
||||
//! \param[in] state The native thread state, which may be a casted pointer to
|
||||
//! `x86_thread_state64_t`, `x86_float_state64_t`, `x86_debug_state64_t`,
|
||||
//! `x86_thread_state`, `x86_float_state`, or `x86_debug_state`. This
|
||||
//! parameter may be `NULL` to not supply this data, in which case \a flavor
|
||||
//! must be `THREAD_STATE_NONE`. If a “universal” structure is used, it must
|
||||
//! carry 64-bit state data of the correct type.
|
||||
//! parameter may be `nullptr` to not supply this data, in which case \a
|
||||
//! flavor must be `THREAD_STATE_NONE`. If a “universal” structure is used,
|
||||
//! it must carry 64-bit state data of the correct type.
|
||||
//! \param[in] state_count The number of `int`-sized units in \a state. This may
|
||||
//! be 0 if \a state is `NULL`.
|
||||
//! be 0 if \a state is `nullptr`.
|
||||
//! \param[in] x86_thread_state64 The state of the thread’s integer registers.
|
||||
//! \param[in] x86_float_state64 The state of the thread’s floating-point
|
||||
//! registers.
|
||||
|
||||
@@ -38,7 +38,7 @@ TEST(CPUContextMac, InitializeContextX86) {
|
||||
CPUContextX86 cpu_context_x86 = {};
|
||||
internal::InitializeCPUContextX86(&cpu_context_x86,
|
||||
THREAD_STATE_NONE,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
&x86_thread_state32,
|
||||
&x86_float_state32,
|
||||
@@ -233,7 +233,7 @@ TEST(CPUContextMac, InitializeContextX86_64) {
|
||||
CPUContextX86_64 cpu_context_x86_64 = {};
|
||||
internal::InitializeCPUContextX86_64(&cpu_context_x86_64,
|
||||
THREAD_STATE_NONE,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
&x86_thread_state64,
|
||||
&x86_float_state64,
|
||||
|
||||
@@ -61,7 +61,7 @@ bool ExceptionSnapshotMac::Initialize(ProcessReader* process_reader,
|
||||
|
||||
if (exception_ == EXC_CRASH) {
|
||||
exception_ = ExcCrashRecoverOriginalException(
|
||||
exception_code_0, &exception_code_0, NULL);
|
||||
exception_code_0, &exception_code_0, nullptr);
|
||||
}
|
||||
|
||||
// ExceptionInfo() returns code[0] in a 32-bit field. This shouldn’t be a
|
||||
@@ -74,7 +74,7 @@ bool ExceptionSnapshotMac::Initialize(ProcessReader* process_reader,
|
||||
return false;
|
||||
}
|
||||
|
||||
const ProcessReader::Thread* thread = NULL;
|
||||
const ProcessReader::Thread* thread = nullptr;
|
||||
for (const ProcessReader::Thread& loop_thread : process_reader->Threads()) {
|
||||
if (exception_thread == loop_thread.port) {
|
||||
thread = &loop_thread;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace internal {
|
||||
|
||||
MemorySnapshotMac::MemorySnapshotMac()
|
||||
: MemorySnapshot(),
|
||||
process_reader_(NULL),
|
||||
process_reader_(nullptr),
|
||||
address_(0),
|
||||
size_(0),
|
||||
initialized_() {
|
||||
|
||||
@@ -104,7 +104,7 @@ class ProcessSnapshot {
|
||||
//! \return An ExceptionSnapshot object. The caller does not take ownership of
|
||||
//! this object, it is scoped to the lifetime of the ProcessSnapshot
|
||||
//! object that it was obtained from. If the snapshot is not a result of
|
||||
//! an exception, returns `NULL`.
|
||||
//! an exception, returns `nullptr`.
|
||||
virtual const ExceptionSnapshot* Exception() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -35,7 +35,7 @@ template <typename T>
|
||||
T ReadIntSysctlByName(const char* name, T default_value) {
|
||||
T value;
|
||||
size_t value_len = sizeof(value);
|
||||
if (sysctlbyname(name, &value, &value_len, NULL, 0) != 0) {
|
||||
if (sysctlbyname(name, &value, &value_len, nullptr, 0) != 0) {
|
||||
PLOG(WARNING) << "sysctlbyname " << name;
|
||||
return default_value;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ T CastIntSysctlByName(const char* name, T default_value) {
|
||||
|
||||
std::string ReadStringSysctlByName(const char* name) {
|
||||
size_t buf_len;
|
||||
if (sysctlbyname(name, NULL, &buf_len, NULL, 0) != 0) {
|
||||
if (sysctlbyname(name, nullptr, &buf_len, nullptr, 0) != 0) {
|
||||
PLOG(WARNING) << "sysctlbyname (size) " << name;
|
||||
return std::string();
|
||||
}
|
||||
@@ -61,7 +61,7 @@ std::string ReadStringSysctlByName(const char* name) {
|
||||
}
|
||||
|
||||
std::string value(buf_len - 1, '\0');
|
||||
if (sysctlbyname(name, &value[0], &buf_len, NULL, 0) != 0) {
|
||||
if (sysctlbyname(name, &value[0], &buf_len, nullptr, 0) != 0) {
|
||||
PLOG(WARNING) << "sysctlbyname " << name;
|
||||
return std::string();
|
||||
}
|
||||
@@ -89,8 +89,8 @@ SystemSnapshotMac::SystemSnapshotMac()
|
||||
: SystemSnapshot(),
|
||||
os_version_full_(),
|
||||
os_version_build_(),
|
||||
process_reader_(NULL),
|
||||
snapshot_time_(NULL),
|
||||
process_reader_(nullptr),
|
||||
snapshot_time_(nullptr),
|
||||
os_version_major_(0),
|
||||
os_version_minor_(0),
|
||||
os_version_bugfix_(0),
|
||||
|
||||
@@ -50,7 +50,7 @@ class SystemSnapshotMacTest : public testing::Test {
|
||||
// testing::Test:
|
||||
virtual void SetUp() override {
|
||||
ASSERT_TRUE(process_reader_.Initialize(mach_task_self()));
|
||||
ASSERT_EQ(0, gettimeofday(&snapshot_time_, NULL))
|
||||
ASSERT_EQ(0, gettimeofday(&snapshot_time_, nullptr))
|
||||
<< ErrnoMessage("gettimeofday");
|
||||
system_snapshot_.Initialize(&process_reader_, &snapshot_time_);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ bool ThreadSnapshotMac::Initialize(
|
||||
context_.x86_64 = &context_union_.x86_64;
|
||||
InitializeCPUContextX86_64(context_.x86_64,
|
||||
THREAD_STATE_NONE,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
&process_reader_thread.thread_context.t64,
|
||||
&process_reader_thread.float_context.f64,
|
||||
@@ -69,7 +69,7 @@ bool ThreadSnapshotMac::Initialize(
|
||||
context_.x86 = &context_union_.x86;
|
||||
InitializeCPUContextX86(context_.x86,
|
||||
THREAD_STATE_NONE,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
&process_reader_thread.thread_context.t32,
|
||||
&process_reader_thread.float_context.f32,
|
||||
|
||||
@@ -200,18 +200,18 @@ int CatchExceptionToolMain(int argc, char* argv[]) {
|
||||
Options options = {};
|
||||
|
||||
const struct option long_options[] = {
|
||||
{"file", required_argument, NULL, kOptionFile},
|
||||
{"mach_service", required_argument, NULL, kOptionMachService},
|
||||
{"nonblocking", no_argument, NULL, kOptionNonblocking},
|
||||
{"persistent", no_argument, NULL, kOptionPersistent},
|
||||
{"timeout", required_argument, NULL, kOptionTimeout},
|
||||
{"help", no_argument, NULL, kOptionHelp},
|
||||
{"version", no_argument, NULL, kOptionVersion},
|
||||
{NULL, 0, NULL, 0},
|
||||
{"file", required_argument, nullptr, kOptionFile},
|
||||
{"mach_service", required_argument, nullptr, kOptionMachService},
|
||||
{"nonblocking", no_argument, nullptr, kOptionNonblocking},
|
||||
{"persistent", no_argument, nullptr, kOptionPersistent},
|
||||
{"timeout", required_argument, nullptr, kOptionTimeout},
|
||||
{"help", no_argument, nullptr, kOptionHelp},
|
||||
{"version", no_argument, nullptr, kOptionVersion},
|
||||
{nullptr, 0, nullptr, 0},
|
||||
};
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt_long(argc, argv, "f:m:npt:", long_options, NULL)) !=
|
||||
while ((opt = getopt_long(argc, argv, "f:m:npt:", long_options, nullptr)) !=
|
||||
-1) {
|
||||
switch (opt) {
|
||||
case kOptionFile:
|
||||
@@ -240,7 +240,7 @@ int CatchExceptionToolMain(int argc, char* argv[]) {
|
||||
ToolSupport::Version(me);
|
||||
return EXIT_SUCCESS;
|
||||
default:
|
||||
ToolSupport::UsageHint(me, NULL);
|
||||
ToolSupport::UsageHint(me, nullptr);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ bool ParseHandlerString(const char* handler_string_ro,
|
||||
char* handler_string_c = &handler_string[0];
|
||||
|
||||
char* token;
|
||||
while ((token = strsep(&handler_string_c, ",")) != NULL) {
|
||||
while ((token = strsep(&handler_string_c, ",")) != nullptr) {
|
||||
if (strncmp(token, kTargetEquals, strlen(kTargetEquals)) == 0) {
|
||||
const char* value = token + strlen(kTargetEquals);
|
||||
if (strcmp(value, "host") == 0) {
|
||||
@@ -402,23 +402,23 @@ int ExceptionPortToolMain(int argc, char* argv[]) {
|
||||
} options = {};
|
||||
|
||||
const struct option long_options[] = {
|
||||
{"set_handler", required_argument, NULL, kOptionSetPort},
|
||||
{"show_bootstrap", required_argument, NULL, kOptionShowBootstrap},
|
||||
{"pid", required_argument, NULL, kOptionPid},
|
||||
{"show_host", no_argument, NULL, kOptionShowHost},
|
||||
{"show_task", no_argument, NULL, kOptionShowTask},
|
||||
{"show_thread", no_argument, NULL, kOptionShowThread},
|
||||
{"show_new_host", no_argument, NULL, kOptionShowNewHost},
|
||||
{"show_new_task", no_argument, NULL, kOptionShowNewTask},
|
||||
{"show_new_thread", no_argument, NULL, kOptionShowNewThread},
|
||||
{"numeric", no_argument, NULL, kOptionNumeric},
|
||||
{"help", no_argument, NULL, kOptionHelp},
|
||||
{"version", no_argument, NULL, kOptionVersion},
|
||||
{NULL, 0, NULL, 0},
|
||||
{"set_handler", required_argument, nullptr, kOptionSetPort},
|
||||
{"show_bootstrap", required_argument, nullptr, kOptionShowBootstrap},
|
||||
{"pid", required_argument, nullptr, kOptionPid},
|
||||
{"show_host", no_argument, nullptr, kOptionShowHost},
|
||||
{"show_task", no_argument, nullptr, kOptionShowTask},
|
||||
{"show_thread", no_argument, nullptr, kOptionShowThread},
|
||||
{"show_new_host", no_argument, nullptr, kOptionShowNewHost},
|
||||
{"show_new_task", no_argument, nullptr, kOptionShowNewTask},
|
||||
{"show_new_thread", no_argument, nullptr, kOptionShowNewThread},
|
||||
{"numeric", no_argument, nullptr, kOptionNumeric},
|
||||
{"help", no_argument, nullptr, kOptionHelp},
|
||||
{"version", no_argument, nullptr, kOptionVersion},
|
||||
{nullptr, 0, nullptr, 0},
|
||||
};
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt_long(argc, argv, "+s:p:htHTn", long_options, NULL)) !=
|
||||
while ((opt = getopt_long(argc, argv, "+s:p:htHTn", long_options, nullptr)) !=
|
||||
-1) {
|
||||
switch (opt) {
|
||||
case kOptionSetPort: {
|
||||
@@ -475,7 +475,7 @@ int ExceptionPortToolMain(int argc, char* argv[]) {
|
||||
ToolSupport::Version(me);
|
||||
return kExitSuccess;
|
||||
default:
|
||||
ToolSupport::UsageHint(me, NULL);
|
||||
ToolSupport::UsageHint(me, nullptr);
|
||||
return kExitFailure;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user