This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
h26xparser: Fix build error with GCC9
GCC9 causing build failure: | ../../git/codecparsers/h264Parser.cpp: In constructor 'YamiParser::H264::PPS::PPS()': | ../../git/codecparsers/h264Parser.cpp:140:41: error: 'void* memset(void*, int, size_t)' clearing an object of type 'struct YamiParser::H264::PPS' with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] | 140 | memset(this, 0, offsetof(PPS, m_sps)); | | ^ | In file included from ../../git/codecparsers/h264Parser.cpp:21: | ../../git/codecparsers/h264Parser.h:292:8: note: 'struct YamiParser::H264::PPS' declared here | 292 | struct PPS { | | ^~~ | ../../git/codecparsers/h264Parser.cpp: In constructor 'YamiParser::H264::SliceHeader::SliceHeader()': | ../../git/codecparsers/h264Parser.cpp:686:49: error: 'void* memset(void*, int, size_t)' clearing an object of type 'class YamiParser::H264::SliceHeader' with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] | 686 | memset(this, 0, offsetof(SliceHeader, m_pps)); | | ^ | In file included from ../../git/codecparsers/h264Parser.cpp:21: | ../../git/codecparsers/h264Parser.h:371:7: note: 'class YamiParser::H264::SliceHeader' declared here | 371 | class SliceHeader { | | ^~~~~~~~~~~ | ../../git/codecparsers/h265Parser.cpp: In constructor 'YamiParser::H265::VPS::VPS()': | ../../git/codecparsers/h265Parser.cpp:165:53: error: 'void* memset(void*, int, size_t)' clearing an object of type 'struct YamiParser::H265::VPS' with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] | 165 | memset(this, 0, offsetof(VPS, hrd_layer_set_idx)); | | ^ | In file included from ../../git/codecparsers/h265Parser.cpp:21: | ../../git/codecparsers/h265Parser.h:256:12: note: 'struct YamiParser::H265::VPS' declared here | 256 | struct VPS { | | ^~~ | ../../git/codecparsers/h265Parser.cpp: In constructor 'YamiParser::H265::SPS::SPS()': | ../../git/codecparsers/h265Parser.cpp:174:39: error: 'void* memset(void*, int, size_t)' clearing an object of type 'struct YamiParser::H265::SPS' with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] | 174 | memset(this, 0, offsetof(SPS, vps)); | | ^ | In file included from ../../git/codecparsers/h265Parser.cpp:21: | ../../git/codecparsers/h265Parser.h:290:12: note: 'struct YamiParser::H265::SPS' declared here | 290 | struct SPS { | | ^~~ | ../../git/codecparsers/h265Parser.cpp: In constructor 'YamiParser::H265::PPS::PPS()': | ../../git/codecparsers/h265Parser.cpp:179:39: error: 'void* memset(void*, int, size_t)' clearing an object of type 'struct YamiParser::H265::PPS' with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] | 179 | memset(this, 0, offsetof(PPS, sps)); | | ^ | In file included from ../../git/codecparsers/h265Parser.cpp:21: | ../../git/codecparsers/h265Parser.h:362:12: note: 'struct YamiParser::H265::PPS' declared here | 362 | struct PPS { | | ^~~ | ../../git/codecparsers/h265Parser.cpp: In constructor 'YamiParser::H265::SliceHeader::SliceHeader()': | ../../git/codecparsers/h265Parser.cpp:184:47: error: 'void* memset(void*, int, size_t)' clearing an object of type 'struct YamiParser::H265::SliceHeader' with no trivial copy-assignment; use assignment or value-initialization instead [-Werror=class-memaccess] | 184 | memset(this, 0, offsetof(SliceHeader, pps)); | | ^ | In file included from ../../git/codecparsers/h265Parser.cpp:21: | ../../git/codecparsers/h265Parser.h:499:12: note: 'struct YamiParser::H265::SliceHeader' declared here | 499 | struct SliceHeader { | | ^~~~~~~~~~~ | ../../git/codecparsers/mpeg2_parser.cpp: In constructor 'YamiParser::MPEG2::SeqHeader::SeqHeader()': | ../../git/codecparsers/mpeg2_parser.cpp:163:59: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct YamiParser::MPEG2::SeqHeader'; use assignment or value-initialization instead [-Werror=class-memaccess] | 163 | SeqHeader::SeqHeader() { memset(this, 0, sizeof(*this)); } | | ^ | In file included from ../../git/codecparsers/mpeg2_parser.cpp:34: | ../../git/codecparsers/mpeg2_parser.h:153:12: note: 'struct YamiParser::MPEG2::SeqHeader' declared here | 153 | struct SeqHeader { | | ^~~~~~~~~ | cc1plus: all warnings being treated as errors By typecasting structure pointer to void pointer, GCC9 does normal memset operation where offsetof() give correct number of bytes to set. Signed-off-by: Naveen Saini <[email protected]>
- Loading branch information