webmts: Fix implicit conversion warnings.

Fix warnings exposed by addition of -Wshorten-64-32 compiler flag
in webmts sources.

Change-Id: I3104e7be2bf991d7e108b652857ecca8e82c5ef9
This commit is contained in:
Tom Finegan 2016-04-07 14:58:03 -07:00
parent ef464c2a95
commit 22b0845686
4 changed files with 10 additions and 10 deletions

View File

@ -145,7 +145,7 @@ bool VpxPes2Ts::ReceivePacket(const PacketDataBuffer& packet_data) {
const int kTsHeaderSize = 4;
const int kTsPayloadSize = 184;
const int kTsPacketSize = kTsHeaderSize + kTsPayloadSize;
int bytes_to_packetize = packet_data.size();
int bytes_to_packetize = static_cast<int>(packet_data.size());
std::uint8_t continuity_counter = 0;
std::size_t read_pos = 0;

View File

@ -47,7 +47,7 @@ bool VpxPesParser::Open(const std::string& pes_file) {
pes_file_data_.push_back(static_cast<std::uint8_t>(byte));
if (!feof(file.get()) || ferror(file.get()) ||
pes_file_size_ != static_cast<std::int64_t>(pes_file_data_.size())) {
pes_file_size_ != pes_file_data_.size()) {
return false;
}
@ -95,7 +95,7 @@ bool VpxPesParser::ParsePesHeader(PesHeader* header) {
if (!VerifyPacketStartCode())
return false;
int pos = read_pos_;
std::size_t pos = read_pos_;
for (auto& a : header->start_code) {
a = pes_file_data_[pos++];
}
@ -121,7 +121,7 @@ bool VpxPesParser::ParsePesOptionalHeader(PesOptionalHeader* header) {
if (!header || parse_state_ != kParsePesOptionalHeader)
return false;
int offset = read_pos_;
size_t offset = read_pos_;
if (offset >= pes_file_size_)
return false;
@ -142,7 +142,7 @@ bool VpxPesParser::ParsePesOptionalHeader(PesOptionalHeader* header) {
if (header->remaining_size != kWebm2PesOptHeaderRemainingSize)
return false;
int bytes_left = header->remaining_size;
size_t bytes_left = header->remaining_size;
if (header->has_pts) {
// Read PTS markers. Format:
@ -169,7 +169,7 @@ bool VpxPesParser::ParsePesOptionalHeader(PesOptionalHeader* header) {
}
// Validate stuffing byte(s).
for (int i = 0; i < bytes_left; ++i) {
for (size_t i = 0; i < bytes_left; ++i) {
if (pes_file_data_[offset + i] != 0xff)
return false;
}
@ -210,7 +210,7 @@ bool VpxPesParser::ParseBcmvHeader(BcmvHeader* header) {
}
int VpxPesParser::BytesAvailable() const {
return pes_file_data_.size() - read_pos_;
return static_cast<int>(pes_file_data_.size() - read_pos_);
}
bool VpxPesParser::ParseNextPacket(PesHeader* header, VpxFrame* frame) {

View File

@ -137,7 +137,7 @@ class VpxPesParser {
// header.
bool ParseBcmvHeader(BcmvHeader* header);
std::int64_t pes_file_size_ = 0;
std::size_t pes_file_size_ = 0;
PesFileData pes_file_data_;
std::size_t read_pos_ = 0;
ParseState parse_state_ = kParsePesHeader;

View File

@ -483,7 +483,7 @@ bool Webm2Pes::WritePesPacket(const mkvparser::Block::Frame& vpx_frame,
}
write_pts = false;
BCMVHeader bcmv_header(packet_payload_range.length);
BCMVHeader bcmv_header(static_cast<uint32_t>(packet_payload_range.length));
if (bcmv_header.Write(&packet_data_) != true) {
std::fprintf(stderr, "Webm2Pes: BCMV write failed.\n");
return false;