mark SkMD5->SkUUID copy as sane

GCC gets worried when we do things like memcpy() into non-trivial types
like SkUUID, but this one is pretty clearly fine.  (SkUUID is
non-trivial because of the implicit constructor that zeros it.)  We can
stifle the warning by casting the destination pointer to void*.

Change-Id: I6637964359f5d923fa97c4af2c608e61fdd1f457
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258448
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2019-12-05 14:40:51 -06:00 committed by Skia Commit-Bot
parent 62836903bc
commit 9347bd8671

View File

@ -162,7 +162,7 @@ SkUUID SkPDFMetadata::CreateUUID(const SkPDF::Metadata& metadata) {
digest.data[8] = (digest.data[6] & 0x3F) | 0x80;
static_assert(sizeof(digest) == sizeof(SkUUID), "uuid_size");
SkUUID uuid;
memcpy(&uuid, &digest, sizeof(digest));
memcpy((void*)&uuid, &digest, sizeof(digest));
return uuid;
}