diff --git a/src/asfvideo.cpp b/src/asfvideo.cpp index 15d0edc3..f52d39eb 100644 --- a/src/asfvideo.cpp +++ b/src/asfvideo.cpp @@ -47,9 +47,9 @@ bool AsfVideo::GUIDTag::operator==(const AsfVideo::GUIDTag& other) const { } AsfVideo::GUIDTag::GUIDTag(const uint8_t* bytes) { - std::copy_n(bytes, DWORD, reinterpret_cast(&data1_)); - std::copy_n(bytes + DWORD, WORD, reinterpret_cast(&data2_)); - std::copy_n(bytes + DWORD + WORD, WORD, reinterpret_cast(&data3_)); + std::memcpy(&data1_, bytes, DWORD); + std::memcpy(&data2_, bytes + DWORD, WORD); + std::memcpy(&data3_, bytes + DWORD + WORD, WORD); std::copy(bytes + QWORD, bytes + 2 * QWORD, data4_.begin()); if (isBigEndianPlatform()) { data1_ = byteSwap(data1_, true); diff --git a/src/jp2image.cpp b/src/jp2image.cpp index c61cc355..153bc725 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -601,7 +601,7 @@ void Jp2Image::encodeJp2Header(const DataBuf& boxBuf, DataBuf& outBuf) { while (count < length && !bWroteColor) { Internal::enforce(boxHSize <= length - count, ErrorCode::kerCorruptedMetadata); Internal::Jp2BoxHeader subBox; - std::copy_n(boxBuf.c_data(count), boxHSize, reinterpret_cast(&subBox)); + std::memcpy(&subBox, boxBuf.c_data(count), boxHSize); Internal::Jp2BoxHeader newBox = subBox; if (count < length) {