| Index: net/quic/quic_framer.cc
|
| diff --git a/net/quic/quic_framer.cc b/net/quic/quic_framer.cc
|
| index e22b9a03cd8628c5cc078cc7de801bdfa2d00e92..f78278b81dc8cb78f11025affaec67bc9633c6fd 100644
|
| --- a/net/quic/quic_framer.cc
|
| +++ b/net/quic/quic_framer.cc
|
| @@ -6,7 +6,6 @@
|
|
|
| #include <stdint.h>
|
|
|
| -#include "base/basictypes.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/logging.h"
|
| #include "base/stl_util.h"
|
| @@ -43,7 +42,7 @@ const QuicConnectionId k4ByteConnectionIdMask = UINT64_C(0x00000000FFFFFFFF);
|
|
|
| // Number of bits the packet number length bits are shifted from the right
|
| // edge of the public header.
|
| -const uint8 kPublicHeaderSequenceNumberShift = 4;
|
| +const uint8_t kPublicHeaderSequenceNumberShift = 4;
|
|
|
| // New Frame Types, QUIC v. >= 10:
|
| // There are two interpretations for the Frame Type byte in the QUIC protocol,
|
| @@ -67,36 +66,36 @@ const uint8 kPublicHeaderSequenceNumberShift = 4;
|
|
|
| // Masks to determine if the frame type is a special use
|
| // and for specific special frame types.
|
| -const uint8 kQuicFrameTypeSpecialMask = 0xE0; // 0b 11100000
|
| -const uint8 kQuicFrameTypeStreamMask = 0x80;
|
| -const uint8 kQuicFrameTypeAckMask = 0x40;
|
| +const uint8_t kQuicFrameTypeSpecialMask = 0xE0; // 0b 11100000
|
| +const uint8_t kQuicFrameTypeStreamMask = 0x80;
|
| +const uint8_t kQuicFrameTypeAckMask = 0x40;
|
|
|
| // Stream frame relative shifts and masks for interpreting the stream flags.
|
| // StreamID may be 1, 2, 3, or 4 bytes.
|
| -const uint8 kQuicStreamIdShift = 2;
|
| -const uint8 kQuicStreamIDLengthMask = 0x03;
|
| +const uint8_t kQuicStreamIdShift = 2;
|
| +const uint8_t kQuicStreamIDLengthMask = 0x03;
|
|
|
| // Offset may be 0, 2, 3, 4, 5, 6, 7, 8 bytes.
|
| -const uint8 kQuicStreamOffsetShift = 3;
|
| -const uint8 kQuicStreamOffsetMask = 0x07;
|
| +const uint8_t kQuicStreamOffsetShift = 3;
|
| +const uint8_t kQuicStreamOffsetMask = 0x07;
|
|
|
| // Data length may be 0 or 2 bytes.
|
| -const uint8 kQuicStreamDataLengthShift = 1;
|
| -const uint8 kQuicStreamDataLengthMask = 0x01;
|
| +const uint8_t kQuicStreamDataLengthShift = 1;
|
| +const uint8_t kQuicStreamDataLengthMask = 0x01;
|
|
|
| // Fin bit may be set or not.
|
| -const uint8 kQuicStreamFinShift = 1;
|
| -const uint8 kQuicStreamFinMask = 0x01;
|
| +const uint8_t kQuicStreamFinShift = 1;
|
| +const uint8_t kQuicStreamFinMask = 0x01;
|
|
|
| // packet number size shift used in AckFrames.
|
| -const uint8 kQuicSequenceNumberLengthShift = 2;
|
| +const uint8_t kQuicSequenceNumberLengthShift = 2;
|
|
|
| // Acks may be truncated.
|
| -const uint8 kQuicAckTruncatedShift = 1;
|
| -const uint8 kQuicAckTruncatedMask = 0x01;
|
| +const uint8_t kQuicAckTruncatedShift = 1;
|
| +const uint8_t kQuicAckTruncatedMask = 0x01;
|
|
|
| // Acks may not have any nacks.
|
| -const uint8 kQuicHasNacksMask = 0x01;
|
| +const uint8_t kQuicHasNacksMask = 0x01;
|
|
|
| // Returns the absolute value of the difference between |a| and |b|.
|
| QuicPacketNumber Delta(QuicPacketNumber a, QuicPacketNumber b) {
|
| @@ -113,7 +112,7 @@ QuicPacketNumber ClosestTo(QuicPacketNumber target,
|
| return (Delta(target, a) < Delta(target, b)) ? a : b;
|
| }
|
|
|
| -QuicPacketNumberLength ReadSequenceNumberLength(uint8 flags) {
|
| +QuicPacketNumberLength ReadSequenceNumberLength(uint8_t flags) {
|
| switch (flags & PACKET_FLAGS_6BYTE_PACKET) {
|
| case PACKET_FLAGS_6BYTE_PACKET:
|
| return PACKET_6BYTE_PACKET_NUMBER;
|
| @@ -458,8 +457,8 @@ QuicEncryptedPacket* QuicFramer::BuildPublicResetPacket(
|
| scoped_ptr<char[]> buffer(new char[len]);
|
| QuicDataWriter writer(len, buffer.get());
|
|
|
| - uint8 flags = static_cast<uint8>(PACKET_PUBLIC_FLAGS_RST |
|
| - PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID);
|
| + uint8_t flags = static_cast<uint8_t>(PACKET_PUBLIC_FLAGS_RST |
|
| + PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID);
|
| if (!writer.WriteUInt8(flags)) {
|
| return nullptr;
|
| }
|
| @@ -484,8 +483,8 @@ QuicEncryptedPacket* QuicFramer::BuildVersionNegotiationPacket(
|
| scoped_ptr<char[]> buffer(new char[len]);
|
| QuicDataWriter writer(len, buffer.get());
|
|
|
| - uint8 flags = static_cast<uint8>(PACKET_PUBLIC_FLAGS_VERSION |
|
| - PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID);
|
| + uint8_t flags = static_cast<uint8_t>(PACKET_PUBLIC_FLAGS_VERSION |
|
| + PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID);
|
| if (!writer.WriteUInt8(flags)) {
|
| return nullptr;
|
| }
|
| @@ -696,7 +695,7 @@ bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header,
|
| QuicDataWriter* writer) {
|
| DVLOG(1) << "Appending header: " << header;
|
| DCHECK(header.fec_group > 0 || header.is_in_fec_group == NOT_IN_FEC_GROUP);
|
| - uint8 public_flags = 0;
|
| + uint8_t public_flags = 0;
|
| if (header.public_header.reset_flag) {
|
| public_flags |= PACKET_PUBLIC_FLAGS_RST;
|
| }
|
| @@ -768,7 +767,7 @@ bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header,
|
| return false;
|
| }
|
|
|
| - uint8 private_flags = 0;
|
| + uint8_t private_flags = 0;
|
| if (header.entropy_flag) {
|
| private_flags |= PACKET_PRIVATE_FLAGS_ENTROPY;
|
| }
|
| @@ -789,8 +788,8 @@ bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header,
|
| DCHECK_LT(header.packet_number - header.fec_group, 255u);
|
| // Offset from the current packet number to the first fec
|
| // protected packet.
|
| - uint8 first_fec_protected_packet_offset =
|
| - static_cast<uint8>(header.packet_number - header.fec_group);
|
| + uint8_t first_fec_protected_packet_offset =
|
| + static_cast<uint8_t>(header.packet_number - header.fec_group);
|
| if (!writer->WriteBytes(&first_fec_protected_packet_offset, 1)) {
|
| return false;
|
| }
|
| @@ -800,7 +799,7 @@ bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header,
|
| }
|
|
|
| const QuicTime::Delta QuicFramer::CalculateTimestampFromWire(
|
| - uint32 time_delta_us) {
|
| + uint32_t time_delta_us) {
|
| // The new time_delta might have wrapped to the next epoch, or it
|
| // might have reverse wrapped to the previous epoch, or it might
|
| // remain in the same epoch. Select the time closest to the previous
|
| @@ -808,13 +807,13 @@ const QuicTime::Delta QuicFramer::CalculateTimestampFromWire(
|
| //
|
| // epoch_delta is the delta between epochs. A delta is 4 bytes of
|
| // microseconds.
|
| - const uint64 epoch_delta = UINT64_C(1) << 32;
|
| - uint64 epoch = last_timestamp_.ToMicroseconds() & ~(epoch_delta - 1);
|
| + const uint64_t epoch_delta = UINT64_C(1) << 32;
|
| + uint64_t epoch = last_timestamp_.ToMicroseconds() & ~(epoch_delta - 1);
|
| // Wrapping is safe here because a wrapped value will not be ClosestTo below.
|
| - uint64 prev_epoch = epoch - epoch_delta;
|
| - uint64 next_epoch = epoch + epoch_delta;
|
| + uint64_t prev_epoch = epoch - epoch_delta;
|
| + uint64_t next_epoch = epoch + epoch_delta;
|
|
|
| - uint64 time = ClosestTo(
|
| + uint64_t time = ClosestTo(
|
| last_timestamp_.ToMicroseconds(), epoch + time_delta_us,
|
| ClosestTo(last_timestamp_.ToMicroseconds(), prev_epoch + time_delta_us,
|
| next_epoch + time_delta_us));
|
| @@ -847,7 +846,7 @@ QuicPacketNumber QuicFramer::CalculatePacketNumberFromWire(
|
|
|
| bool QuicFramer::ProcessPublicHeader(QuicDataReader* reader,
|
| QuicPacketPublicHeader* public_header) {
|
| - uint8 public_flags;
|
| + uint8_t public_flags;
|
| if (!reader->ReadBytes(&public_flags, 1)) {
|
| set_detailed_error("Unable to read public flags.");
|
| return false;
|
| @@ -960,7 +959,7 @@ QuicPacketNumberLength QuicFramer::GetMinSequenceNumberLength(
|
| }
|
|
|
| // static
|
| -uint8 QuicFramer::GetSequenceNumberFlags(
|
| +uint8_t QuicFramer::GetSequenceNumberFlags(
|
| QuicPacketNumberLength packet_number_length) {
|
| switch (packet_number_length) {
|
| case PACKET_1BYTE_PACKET_NUMBER:
|
| @@ -992,12 +991,12 @@ QuicFramer::AckFrameInfo QuicFramer::GetAckFrameInfo(
|
| QuicPacketNumber last_missing = *iter;
|
| ++iter;
|
| for (; iter != frame.missing_packets.end(); ++iter) {
|
| - if (cur_range_length < numeric_limits<uint8>::max() &&
|
| + if (cur_range_length < numeric_limits<uint8_t>::max() &&
|
| *iter == (last_missing + 1)) {
|
| ++cur_range_length;
|
| } else {
|
| ack_info.nack_ranges[last_missing - cur_range_length] =
|
| - static_cast<uint8>(cur_range_length);
|
| + static_cast<uint8_t>(cur_range_length);
|
| cur_range_length = 0;
|
| }
|
| ack_info.max_delta = max(ack_info.max_delta, *iter - last_missing);
|
| @@ -1005,7 +1004,7 @@ QuicFramer::AckFrameInfo QuicFramer::GetAckFrameInfo(
|
| }
|
| // Include the last nack range.
|
| ack_info.nack_ranges[last_missing - cur_range_length] =
|
| - static_cast<uint8>(cur_range_length);
|
| + static_cast<uint8_t>(cur_range_length);
|
| // Include the range to the largest observed.
|
| ack_info.max_delta =
|
| max(ack_info.max_delta, frame.largest_observed - last_missing);
|
| @@ -1040,7 +1039,7 @@ bool QuicFramer::ProcessUnauthenticatedHeader(QuicDataReader* encrypted_reader,
|
|
|
| bool QuicFramer::ProcessAuthenticatedHeader(QuicDataReader* reader,
|
| QuicPacketHeader* header) {
|
| - uint8 private_flags;
|
| + uint8_t private_flags;
|
| if (!reader->ReadBytes(&private_flags, 1)) {
|
| set_detailed_error("Unable to read private flags.");
|
| return RaiseError(QUIC_INVALID_PACKET_HEADER);
|
| @@ -1056,7 +1055,7 @@ bool QuicFramer::ProcessAuthenticatedHeader(QuicDataReader* reader,
|
|
|
| if ((private_flags & PACKET_PRIVATE_FLAGS_FEC_GROUP) != 0) {
|
| header->is_in_fec_group = IN_FEC_GROUP;
|
| - uint8 first_fec_protected_packet_offset;
|
| + uint8_t first_fec_protected_packet_offset;
|
| if (!reader->ReadBytes(&first_fec_protected_packet_offset, 1)) {
|
| set_detailed_error("Unable to read first fec protected packet offset.");
|
| return RaiseError(QUIC_INVALID_PACKET_HEADER);
|
| @@ -1109,7 +1108,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
|
| return RaiseError(QUIC_MISSING_PAYLOAD);
|
| }
|
| while (!reader->IsDoneReading()) {
|
| - uint8 frame_type;
|
| + uint8_t frame_type;
|
| if (!reader->ReadBytes(&frame_type, 1)) {
|
| set_detailed_error("Unable to read frame type.");
|
| return RaiseError(QUIC_INVALID_FRAME_DATA);
|
| @@ -1256,17 +1255,17 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
|
| }
|
|
|
| bool QuicFramer::ProcessStreamFrame(QuicDataReader* reader,
|
| - uint8 frame_type,
|
| + uint8_t frame_type,
|
| QuicStreamFrame* frame) {
|
| - uint8 stream_flags = frame_type;
|
| + uint8_t stream_flags = frame_type;
|
|
|
| stream_flags &= ~kQuicFrameTypeStreamMask;
|
|
|
| // Read from right to left: StreamID, Offset, Data Length, Fin.
|
| - const uint8 stream_id_length = (stream_flags & kQuicStreamIDLengthMask) + 1;
|
| + const uint8_t stream_id_length = (stream_flags & kQuicStreamIDLengthMask) + 1;
|
| stream_flags >>= kQuicStreamIdShift;
|
|
|
| - uint8 offset_length = (stream_flags & kQuicStreamOffsetMask);
|
| + uint8_t offset_length = (stream_flags & kQuicStreamOffsetMask);
|
| // There is no encoding for 1 byte, only 0 and 2 through 8.
|
| if (offset_length > 0) {
|
| offset_length += 1;
|
| @@ -1305,13 +1304,13 @@ bool QuicFramer::ProcessStreamFrame(QuicDataReader* reader,
|
| }
|
| }
|
| frame->frame_buffer = data.data();
|
| - frame->frame_length = static_cast<uint16>(data.length());
|
| + frame->frame_length = static_cast<uint16_t>(data.length());
|
|
|
| return true;
|
| }
|
|
|
| bool QuicFramer::ProcessAckFrame(QuicDataReader* reader,
|
| - uint8 frame_type,
|
| + uint8_t frame_type,
|
| QuicAckFrame* ack_frame) {
|
| // Determine the three lengths from the frame type: largest observed length,
|
| // missing packet number length, and missing range length.
|
| @@ -1336,7 +1335,7 @@ bool QuicFramer::ProcessAckFrame(QuicDataReader* reader,
|
| return false;
|
| }
|
|
|
| - uint64 delta_time_largest_observed_us;
|
| + uint64_t delta_time_largest_observed_us;
|
| if (!reader->ReadUFloat16(&delta_time_largest_observed_us)) {
|
| set_detailed_error("Unable to read delta time largest observed.");
|
| return false;
|
| @@ -1357,7 +1356,7 @@ bool QuicFramer::ProcessAckFrame(QuicDataReader* reader,
|
| return true;
|
| }
|
|
|
| - uint8 num_missing_ranges;
|
| + uint8_t num_missing_ranges;
|
| if (!reader->ReadBytes(&num_missing_ranges, 1)) {
|
| set_detailed_error("Unable to read num missing packet ranges.");
|
| return false;
|
| @@ -1386,7 +1385,7 @@ bool QuicFramer::ProcessAckFrame(QuicDataReader* reader,
|
|
|
| // Parse the revived packets list.
|
| // TODO(ianswett): Change the ack frame so it only expresses one revived.
|
| - uint8 num_revived_packets;
|
| + uint8_t num_revived_packets;
|
| if (!reader->ReadBytes(&num_revived_packets, 1)) {
|
| set_detailed_error("Unable to read num revived packets.");
|
| return false;
|
| @@ -1410,14 +1409,14 @@ bool QuicFramer::ProcessTimestampsInAckFrame(QuicDataReader* reader,
|
| if (ack_frame->is_truncated) {
|
| return true;
|
| }
|
| - uint8 num_received_packets;
|
| + uint8_t num_received_packets;
|
| if (!reader->ReadBytes(&num_received_packets, 1)) {
|
| set_detailed_error("Unable to read num received packets.");
|
| return false;
|
| }
|
|
|
| if (num_received_packets > 0) {
|
| - uint8 delta_from_largest_observed;
|
| + uint8_t delta_from_largest_observed;
|
| if (!reader->ReadBytes(&delta_from_largest_observed,
|
| PACKET_1BYTE_PACKET_NUMBER)) {
|
| set_detailed_error("Unable to read sequence delta in received packets.");
|
| @@ -1427,7 +1426,7 @@ bool QuicFramer::ProcessTimestampsInAckFrame(QuicDataReader* reader,
|
| ack_frame->largest_observed - delta_from_largest_observed;
|
|
|
| // Time delta from the framer creation.
|
| - uint32 time_delta_us;
|
| + uint32_t time_delta_us;
|
| if (!reader->ReadBytes(&time_delta_us, sizeof(time_delta_us))) {
|
| set_detailed_error("Unable to read time delta in received packets.");
|
| return false;
|
| @@ -1439,7 +1438,7 @@ bool QuicFramer::ProcessTimestampsInAckFrame(QuicDataReader* reader,
|
| ack_frame->received_packet_times.push_back(
|
| std::make_pair(seq_num, creation_time_.Add(last_timestamp_)));
|
|
|
| - for (uint8 i = 1; i < num_received_packets; ++i) {
|
| + for (uint8_t i = 1; i < num_received_packets; ++i) {
|
| if (!reader->ReadBytes(&delta_from_largest_observed,
|
| PACKET_1BYTE_PACKET_NUMBER)) {
|
| set_detailed_error(
|
| @@ -1449,7 +1448,7 @@ bool QuicFramer::ProcessTimestampsInAckFrame(QuicDataReader* reader,
|
| seq_num = ack_frame->largest_observed - delta_from_largest_observed;
|
|
|
| // Time delta from the previous timestamp.
|
| - uint64 incremental_time_delta_us;
|
| + uint64_t incremental_time_delta_us;
|
| if (!reader->ReadUFloat16(&incremental_time_delta_us)) {
|
| set_detailed_error(
|
| "Unable to read incremental time delta in received packets.");
|
| @@ -1497,7 +1496,7 @@ bool QuicFramer::ProcessRstStreamFrame(QuicDataReader* reader,
|
| return false;
|
| }
|
|
|
| - uint32 error_code;
|
| + uint32_t error_code;
|
| if (!reader->ReadUInt32(&error_code)) {
|
| set_detailed_error("Unable to read rst stream error code.");
|
| return false;
|
| @@ -1514,7 +1513,7 @@ bool QuicFramer::ProcessRstStreamFrame(QuicDataReader* reader,
|
|
|
| bool QuicFramer::ProcessConnectionCloseFrame(QuicDataReader* reader,
|
| QuicConnectionCloseFrame* frame) {
|
| - uint32 error_code;
|
| + uint32_t error_code;
|
| if (!reader->ReadUInt32(&error_code)) {
|
| set_detailed_error("Unable to read connection close error code.");
|
| return false;
|
| @@ -1539,7 +1538,7 @@ bool QuicFramer::ProcessConnectionCloseFrame(QuicDataReader* reader,
|
|
|
| bool QuicFramer::ProcessGoAwayFrame(QuicDataReader* reader,
|
| QuicGoAwayFrame* frame) {
|
| - uint32 error_code;
|
| + uint32_t error_code;
|
| if (!reader->ReadUInt32(&error_code)) {
|
| set_detailed_error("Unable to read go away error code.");
|
| return false;
|
| @@ -1551,7 +1550,7 @@ bool QuicFramer::ProcessGoAwayFrame(QuicDataReader* reader,
|
| return false;
|
| }
|
|
|
| - uint32 stream_id;
|
| + uint32_t stream_id;
|
| if (!reader->ReadUInt32(&stream_id)) {
|
| set_detailed_error("Unable to read last good stream id.");
|
| return false;
|
| @@ -1810,7 +1809,7 @@ size_t QuicFramer::ComputeFrameLength(
|
| bool QuicFramer::AppendTypeByte(const QuicFrame& frame,
|
| bool no_stream_frame_length,
|
| QuicDataWriter* writer) {
|
| - uint8 type_byte = 0;
|
| + uint8_t type_byte = 0;
|
| switch (frame.type) {
|
| case STREAM_FRAME: {
|
| if (frame.stream_frame == nullptr) {
|
| @@ -1839,10 +1838,10 @@ bool QuicFramer::AppendTypeByte(const QuicFrame& frame,
|
| case ACK_FRAME:
|
| return true;
|
| case MTU_DISCOVERY_FRAME:
|
| - type_byte = static_cast<uint8>(PING_FRAME);
|
| + type_byte = static_cast<uint8_t>(PING_FRAME);
|
| break;
|
| default:
|
| - type_byte = static_cast<uint8>(frame.type);
|
| + type_byte = static_cast<uint8_t>(frame.type);
|
| break;
|
| }
|
|
|
| @@ -1890,8 +1889,8 @@ bool QuicFramer::AppendStreamFrame(const QuicStreamFrame& frame,
|
| return false;
|
| }
|
| if (!no_stream_frame_length) {
|
| - if ((frame.frame_length > numeric_limits<uint16>::max()) ||
|
| - !writer->WriteUInt16(static_cast<uint16>(frame.frame_length))) {
|
| + if ((frame.frame_length > numeric_limits<uint16_t>::max()) ||
|
| + !writer->WriteUInt16(static_cast<uint16_t>(frame.frame_length))) {
|
| LOG(DFATAL) << "Writing stream frame length failed";
|
| return false;
|
| }
|
| @@ -1933,7 +1932,7 @@ bool QuicFramer::AppendAckFrameAndTypeByte(const QuicPacketHeader& header,
|
| // Write out the type byte by setting the low order bits and doing shifts
|
| // to make room for the next bit flags to be set.
|
| // Whether there are any nacks.
|
| - uint8 type_byte = ack_info.nack_ranges.empty() ? 0 : kQuicHasNacksMask;
|
| + uint8_t type_byte = ack_info.nack_ranges.empty() ? 0 : kQuicHasNacksMask;
|
|
|
| // truncating bit.
|
| type_byte <<= kQuicAckTruncatedShift;
|
| @@ -1980,7 +1979,7 @@ bool QuicFramer::AppendAckFrameAndTypeByte(const QuicPacketHeader& header,
|
| return false;
|
| }
|
|
|
| - uint64 delta_time_largest_observed_us = kUFloat16MaxValue;
|
| + uint64_t delta_time_largest_observed_us = kUFloat16MaxValue;
|
| if (!frame.delta_time_largest_observed.IsInfinite()) {
|
| DCHECK_LE(0u, frame.delta_time_largest_observed.ToMicroseconds());
|
| delta_time_largest_observed_us =
|
| @@ -2002,8 +2001,8 @@ bool QuicFramer::AppendAckFrameAndTypeByte(const QuicPacketHeader& header,
|
| return true;
|
| }
|
|
|
| - const uint8 num_missing_ranges =
|
| - static_cast<uint8>(min(ack_info.nack_ranges.size(), max_num_ranges));
|
| + const uint8_t num_missing_ranges =
|
| + static_cast<uint8_t>(min(ack_info.nack_ranges.size(), max_num_ranges));
|
| if (!writer->WriteBytes(&num_missing_ranges, 1)) {
|
| return false;
|
| }
|
| @@ -2030,7 +2029,7 @@ bool QuicFramer::AppendAckFrameAndTypeByte(const QuicPacketHeader& header,
|
|
|
| // Append revived packets.
|
| // If not all the revived packets fit, only mention the ones that do.
|
| - uint8 num_revived_packets = frame.latest_revived_packet == 0 ? 0 : 1;
|
| + uint8_t num_revived_packets = frame.latest_revived_packet == 0 ? 0 : 1;
|
| if (((writer->capacity() - writer->length()) / largest_observed_length) ==
|
| 0) {
|
| num_revived_packets = 0;
|
| @@ -2053,13 +2052,13 @@ bool QuicFramer::AppendAckFrameAndTypeByte(const QuicPacketHeader& header,
|
|
|
| bool QuicFramer::AppendTimestampToAckFrame(const QuicAckFrame& frame,
|
| QuicDataWriter* writer) {
|
| - DCHECK_GE(numeric_limits<uint8>::max(), frame.received_packet_times.size());
|
| + DCHECK_GE(numeric_limits<uint8_t>::max(), frame.received_packet_times.size());
|
| // num_received_packets is only 1 byte.
|
| - if (frame.received_packet_times.size() > numeric_limits<uint8>::max()) {
|
| + if (frame.received_packet_times.size() > numeric_limits<uint8_t>::max()) {
|
| return false;
|
| }
|
|
|
| - uint8 num_received_packets = frame.received_packet_times.size();
|
| + uint8_t num_received_packets = frame.received_packet_times.size();
|
| if (!writer->WriteBytes(&num_received_packets, 1)) {
|
| return false;
|
| }
|
| @@ -2072,8 +2071,8 @@ bool QuicFramer::AppendTimestampToAckFrame(const QuicAckFrame& frame,
|
| QuicPacketNumber delta_from_largest_observed =
|
| frame.largest_observed - packet_number;
|
|
|
| - DCHECK_GE(numeric_limits<uint8>::max(), delta_from_largest_observed);
|
| - if (delta_from_largest_observed > numeric_limits<uint8>::max()) {
|
| + DCHECK_GE(numeric_limits<uint8_t>::max(), delta_from_largest_observed);
|
| + if (delta_from_largest_observed > numeric_limits<uint8_t>::max()) {
|
| return false;
|
| }
|
|
|
| @@ -2083,10 +2082,10 @@ bool QuicFramer::AppendTimestampToAckFrame(const QuicAckFrame& frame,
|
| }
|
|
|
| // Use the lowest 4 bytes of the time delta from the creation_time_.
|
| - const uint64 time_epoch_delta_us = UINT64_C(1) << 32;
|
| - uint32 time_delta_us =
|
| - static_cast<uint32>(it->second.Subtract(creation_time_).ToMicroseconds() &
|
| - (time_epoch_delta_us - 1));
|
| + const uint64_t time_epoch_delta_us = UINT64_C(1) << 32;
|
| + uint32_t time_delta_us = static_cast<uint32_t>(
|
| + it->second.Subtract(creation_time_).ToMicroseconds() &
|
| + (time_epoch_delta_us - 1));
|
| if (!writer->WriteBytes(&time_delta_us, sizeof(time_delta_us))) {
|
| return false;
|
| }
|
| @@ -2097,7 +2096,7 @@ bool QuicFramer::AppendTimestampToAckFrame(const QuicAckFrame& frame,
|
| packet_number = it->first;
|
| delta_from_largest_observed = frame.largest_observed - packet_number;
|
|
|
| - if (delta_from_largest_observed > numeric_limits<uint8>::max()) {
|
| + if (delta_from_largest_observed > numeric_limits<uint8_t>::max()) {
|
| return false;
|
| }
|
|
|
| @@ -2106,7 +2105,7 @@ bool QuicFramer::AppendTimestampToAckFrame(const QuicAckFrame& frame,
|
| return false;
|
| }
|
|
|
| - uint64 frame_time_delta_us =
|
| + uint64_t frame_time_delta_us =
|
| it->second.Subtract(prev_time).ToMicroseconds();
|
| prev_time = it->second;
|
| if (!writer->WriteUFloat16(frame_time_delta_us)) {
|
| @@ -2155,7 +2154,7 @@ bool QuicFramer::AppendRstStreamFrame(const QuicRstStreamFrame& frame,
|
| return false;
|
| }
|
|
|
| - uint32 error_code = static_cast<uint32>(frame.error_code);
|
| + uint32_t error_code = static_cast<uint32_t>(frame.error_code);
|
| if (!writer->WriteUInt32(error_code)) {
|
| return false;
|
| }
|
| @@ -2166,7 +2165,7 @@ bool QuicFramer::AppendRstStreamFrame(const QuicRstStreamFrame& frame,
|
| bool QuicFramer::AppendConnectionCloseFrame(
|
| const QuicConnectionCloseFrame& frame,
|
| QuicDataWriter* writer) {
|
| - uint32 error_code = static_cast<uint32>(frame.error_code);
|
| + uint32_t error_code = static_cast<uint32_t>(frame.error_code);
|
| if (!writer->WriteUInt32(error_code)) {
|
| return false;
|
| }
|
| @@ -2178,11 +2177,11 @@ bool QuicFramer::AppendConnectionCloseFrame(
|
|
|
| bool QuicFramer::AppendGoAwayFrame(const QuicGoAwayFrame& frame,
|
| QuicDataWriter* writer) {
|
| - uint32 error_code = static_cast<uint32>(frame.error_code);
|
| + uint32_t error_code = static_cast<uint32_t>(frame.error_code);
|
| if (!writer->WriteUInt32(error_code)) {
|
| return false;
|
| }
|
| - uint32 stream_id = static_cast<uint32>(frame.last_good_stream_id);
|
| + uint32_t stream_id = static_cast<uint32_t>(frame.last_good_stream_id);
|
| if (!writer->WriteUInt32(stream_id)) {
|
| return false;
|
| }
|
| @@ -2194,7 +2193,7 @@ bool QuicFramer::AppendGoAwayFrame(const QuicGoAwayFrame& frame,
|
|
|
| bool QuicFramer::AppendWindowUpdateFrame(const QuicWindowUpdateFrame& frame,
|
| QuicDataWriter* writer) {
|
| - uint32 stream_id = static_cast<uint32>(frame.stream_id);
|
| + uint32_t stream_id = static_cast<uint32_t>(frame.stream_id);
|
| if (!writer->WriteUInt32(stream_id)) {
|
| return false;
|
| }
|
| @@ -2206,7 +2205,7 @@ bool QuicFramer::AppendWindowUpdateFrame(const QuicWindowUpdateFrame& frame,
|
|
|
| bool QuicFramer::AppendBlockedFrame(const QuicBlockedFrame& frame,
|
| QuicDataWriter* writer) {
|
| - uint32 stream_id = static_cast<uint32>(frame.stream_id);
|
| + uint32_t stream_id = static_cast<uint32_t>(frame.stream_id);
|
| if (!writer->WriteUInt32(stream_id)) {
|
| return false;
|
| }
|
|
|