Stifle GCC false positive
When deserializing SkRRects we copy the raw data then recreate a little more analysis stored at the end of the struct that is not serialized. GCC worries we've not copied enough, but we have. We can stifle the warning by casting the pointer to void* before calling memcpy(). Change-Id: I3ae0007927611d4fc84ced8d12f62e0fa23ee3ee Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258267 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
9b849047b8
commit
1713fcc5b4
@ -553,8 +553,10 @@ size_t SkRRect::readFromMemory(const void* buffer, size_t length) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The extra (void*) tells GCC not to worry that kSizeInMemory < sizeof(SkRRect).
|
||||||
|
|
||||||
SkRRect raw;
|
SkRRect raw;
|
||||||
memcpy(&raw, buffer, kSizeInMemory);
|
memcpy((void*)&raw, buffer, kSizeInMemory);
|
||||||
this->setRectRadii(raw.fRect, raw.fRadii);
|
this->setRectRadii(raw.fRect, raw.fRadii);
|
||||||
return kSizeInMemory;
|
return kSizeInMemory;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user