Fix possible compilation errors with gcc

Remove custom constructors, which is no longer needed with C++11. Use
C++ struct zero initialization instead.

Fixes #686.

Change-Id: I512da9f23a250e8b9ebf8bb8e0a39ad0f822d0d3
This commit is contained in:
KongQun Yang 2020-02-10 16:36:48 -08:00
parent b900565a0f
commit 624b2ca725
2 changed files with 2 additions and 26 deletions

View File

@ -103,22 +103,6 @@ bool H264SliceHeader::IsSISlice() const {
return (slice_type % 5 == kSISlice); return (slice_type % 5 == kSISlice);
} }
H264Sps::H264Sps() {
memset(this, 0, sizeof(*this));
}
H264Pps::H264Pps() {
memset(this, 0, sizeof(*this));
}
H264SliceHeader::H264SliceHeader() {
memset(this, 0, sizeof(*this));
}
H264SEIMessage::H264SEIMessage() {
memset(this, 0, sizeof(*this));
}
#define READ_BITS_OR_RETURN(num_bits, out) \ #define READ_BITS_OR_RETURN(num_bits, out) \
do { \ do { \
if (!br->ReadBits(num_bits, (out))) { \ if (!br->ReadBits(num_bits, (out))) { \
@ -991,7 +975,7 @@ H264Parser::Result H264Parser::ParseSliceHeader(const Nalu& nalu,
reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size()); reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
H26xBitReader* br = &reader; H26xBitReader* br = &reader;
memset(reinterpret_cast<void*>(shdr), 0, sizeof(*shdr)); *shdr = {};
shdr->idr_pic_flag = (nalu.type() == 5); shdr->idr_pic_flag = (nalu.type() == 5);
shdr->nal_ref_idc = nalu.ref_idc(); shdr->nal_ref_idc = nalu.ref_idc();
@ -1137,7 +1121,7 @@ H264Parser::Result H264Parser::ParseSEI(const Nalu& nalu,
reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size()); reader.Initialize(nalu.data() + nalu.header_size(), nalu.payload_size());
H26xBitReader* br = &reader; H26xBitReader* br = &reader;
memset(reinterpret_cast<void*>(sei_msg), 0, sizeof(*sei_msg)); *sei_msg = {};
READ_BITS_OR_RETURN(8, &byte); READ_BITS_OR_RETURN(8, &byte);
while (byte == 0xff) { while (byte == 0xff) {

View File

@ -35,8 +35,6 @@ enum {
}; };
struct H264Sps { struct H264Sps {
H264Sps();
int profile_idc; int profile_idc;
bool constraint_set0_flag; bool constraint_set0_flag;
bool constraint_set1_flag; bool constraint_set1_flag;
@ -92,8 +90,6 @@ struct H264Sps {
}; };
struct H264Pps { struct H264Pps {
H264Pps();
int pic_parameter_set_id; int pic_parameter_set_id;
int seq_parameter_set_id; int seq_parameter_set_id;
bool entropy_coding_mode_flag; bool entropy_coding_mode_flag;
@ -144,8 +140,6 @@ struct H264DecRefPicMarking {
}; };
struct H264SliceHeader { struct H264SliceHeader {
H264SliceHeader();
enum { enum {
kRefListSize = 32, kRefListSize = 32,
kRefListModSize = kRefListSize kRefListModSize = kRefListSize
@ -230,8 +224,6 @@ struct H264SEIRecoveryPoint {
}; };
struct H264SEIMessage { struct H264SEIMessage {
H264SEIMessage();
enum Type { enum Type {
kSEIRecoveryPoint = 6, kSEIRecoveryPoint = 6,
}; };