tell GCC copying into SkScalerContextRect is safe

GCC warns now about memcpy()ing into types that have no trival copy
assignment.  (I think it's the mix of public and private fields that
makes SkScalerContextRec non-trivial.)

Yet SkScalarContextRec really is designed for memcpy(), so we can just
stifle it by casting the memcpy() destination pointer to void*.

Change-Id: I72f9aedd3e1ff9d496db066260bcde7178c1bf7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258338
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2019-12-05 11:45:25 -06:00 committed by Skia Commit-Bot
parent 908b4a1158
commit 786be72765

View File

@ -44,7 +44,7 @@ static SkDescriptor* auto_descriptor_from_desc(const SkDescriptor* source_desc,
uint32_t size;
auto ptr = source_desc->findEntry(kRec_SkDescriptorTag, &size);
SkScalerContextRec rec;
std::memcpy(&rec, ptr, size);
std::memcpy((void*)&rec, ptr, size);
rec.fFontID = font_id;
desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec);
}
@ -602,7 +602,7 @@ SkStrikeServer::RemoteStrike* SkStrikeServer::getOrCreateCache(
[&desc](){
auto ptr = desc.findEntry(kRec_SkDescriptorTag, nullptr);
SkScalerContextRec rec;
std::memcpy(&rec, ptr, sizeof(rec));
std::memcpy((void*)&rec, ptr, sizeof(rec));
return rec.dump();
}().c_str()
)