replaces sizeof(raw_context) with sizeof(*raw_context)

Using `sizeof(raw_context)` generates the following warning (which is
an error in ChromeOS):

```
'memset' call operates on objects of type 'MDRawContextX86' while the size
is based on a different type 'MDRawContextX86 *'
```

This commit follows the implied advice of this warning and adjusts the
expression.

Bug: b:238678030, b:243982778
Test: Locally
Change-Id: I26111c6ff7a1223223e6096a75ad52c48d941e89
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3960915
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Christopher Di Bella 2022-10-17 18:15:05 +00:00 committed by Joshua Peraza
parent f9bf260e94
commit b90119e3f3

View File

@ -147,7 +147,7 @@ class TestDumpContext : public DumpContext {
TestDumpContext::TestDumpContext(bool x86_64) { TestDumpContext::TestDumpContext(bool x86_64) {
if (!x86_64) { if (!x86_64) {
MDRawContextX86* raw_context = new MDRawContextX86(); MDRawContextX86* raw_context = new MDRawContextX86();
memset(raw_context, 0, sizeof(raw_context)); memset(raw_context, 0, sizeof(*raw_context));
raw_context->context_flags = MD_CONTEXT_X86_FULL; raw_context->context_flags = MD_CONTEXT_X86_FULL;
@ -170,7 +170,7 @@ TestDumpContext::TestDumpContext(bool x86_64) {
this->valid_ = true; this->valid_ = true;
} else { } else {
MDRawContextAMD64* raw_context = new MDRawContextAMD64(); MDRawContextAMD64* raw_context = new MDRawContextAMD64();
memset(raw_context, 0, sizeof(raw_context)); memset(raw_context, 0, sizeof(*raw_context));
raw_context->context_flags = MD_CONTEXT_AMD64_FULL; raw_context->context_flags = MD_CONTEXT_AMD64_FULL;
@ -461,4 +461,4 @@ TEST(DisassemblerObjdumpTest, AMD64CallRegOffset) {
ASSERT_FALSE(dis.CalculateSrcAddress(context, src_address)); ASSERT_FALSE(dis.CalculateSrcAddress(context, src_address));
ASSERT_EQ(dest_address, kAMD64TestRsi + 0x9999999); ASSERT_EQ(dest_address, kAMD64TestRsi + 0x9999999);
} }
} // namespace google_breakpad } // namespace google_breakpad