Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
diff --git a/webrtc/base/asyncinvoker.cc b/webrtc/base/asyncinvoker.cc
index 563ccb7..8285d55 100644
--- a/webrtc/base/asyncinvoker.cc
+++ b/webrtc/base/asyncinvoker.cc
@@ -36,7 +36,7 @@
closure->Execute();
}
-void AsyncInvoker::Flush(Thread* thread, uint32 id /*= MQID_ANY*/) {
+void AsyncInvoker::Flush(Thread* thread, uint32_t id /*= MQID_ANY*/) {
if (destroying_) return;
// Run this on |thread| to reduce the number of context switches.
@@ -57,7 +57,7 @@
void AsyncInvoker::DoInvoke(Thread* thread,
const scoped_refptr<AsyncClosure>& closure,
- uint32 id) {
+ uint32_t id) {
if (destroying_) {
LOG(LS_WARNING) << "Tried to invoke while destroying the invoker.";
return;
@@ -67,8 +67,8 @@
void AsyncInvoker::DoInvokeDelayed(Thread* thread,
const scoped_refptr<AsyncClosure>& closure,
- uint32 delay_ms,
- uint32 id) {
+ uint32_t delay_ms,
+ uint32_t id) {
if (destroying_) {
LOG(LS_WARNING) << "Tried to invoke while destroying the invoker.";
return;
@@ -85,7 +85,7 @@
GuardedAsyncInvoker::~GuardedAsyncInvoker() {
}
-bool GuardedAsyncInvoker::Flush(uint32 id) {
+bool GuardedAsyncInvoker::Flush(uint32_t id) {
rtc::CritScope cs(&crit_);
if (thread_ == nullptr)
return false;
diff --git a/webrtc/base/asyncinvoker.h b/webrtc/base/asyncinvoker.h
index 2d2c65c..a351337 100644
--- a/webrtc/base/asyncinvoker.h
+++ b/webrtc/base/asyncinvoker.h
@@ -74,9 +74,7 @@
// Call |functor| asynchronously on |thread|, with no callback upon
// completion. Returns immediately.
template <class ReturnT, class FunctorT>
- void AsyncInvoke(Thread* thread,
- const FunctorT& functor,
- uint32 id = 0) {
+ void AsyncInvoke(Thread* thread, const FunctorT& functor, uint32_t id = 0) {
scoped_refptr<AsyncClosure> closure(
new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor));
DoInvoke(thread, closure, id);
@@ -87,8 +85,8 @@
template <class ReturnT, class FunctorT>
void AsyncInvokeDelayed(Thread* thread,
const FunctorT& functor,
- uint32 delay_ms,
- uint32 id = 0) {
+ uint32_t delay_ms,
+ uint32_t id = 0) {
scoped_refptr<AsyncClosure> closure(
new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor));
DoInvokeDelayed(thread, closure, delay_ms, id);
@@ -100,7 +98,7 @@
const FunctorT& functor,
void (HostT::*callback)(ReturnT),
HostT* callback_host,
- uint32 id = 0) {
+ uint32_t id = 0) {
scoped_refptr<AsyncClosure> closure(
new RefCountedObject<NotifyingAsyncClosure<ReturnT, FunctorT, HostT> >(
this, Thread::Current(), functor, callback, callback_host));
@@ -114,7 +112,7 @@
const FunctorT& functor,
void (HostT::*callback)(),
HostT* callback_host,
- uint32 id = 0) {
+ uint32_t id = 0) {
scoped_refptr<AsyncClosure> closure(
new RefCountedObject<NotifyingAsyncClosure<void, FunctorT, HostT> >(
this, Thread::Current(), functor, callback, callback_host));
@@ -126,19 +124,20 @@
// before returning. Optionally filter by message id.
// The destructor will not wait for outstanding calls, so if that
// behavior is desired, call Flush() before destroying this object.
- void Flush(Thread* thread, uint32 id = MQID_ANY);
+ void Flush(Thread* thread, uint32_t id = MQID_ANY);
// Signaled when this object is destructed.
sigslot::signal0<> SignalInvokerDestroyed;
private:
void OnMessage(Message* msg) override;
- void DoInvoke(Thread* thread, const scoped_refptr<AsyncClosure>& closure,
- uint32 id);
+ void DoInvoke(Thread* thread,
+ const scoped_refptr<AsyncClosure>& closure,
+ uint32_t id);
void DoInvokeDelayed(Thread* thread,
const scoped_refptr<AsyncClosure>& closure,
- uint32 delay_ms,
- uint32 id);
+ uint32_t delay_ms,
+ uint32_t id);
bool destroying_;
RTC_DISALLOW_COPY_AND_ASSIGN(AsyncInvoker);
@@ -159,12 +158,12 @@
// complete before returning. Optionally filter by message id. The destructor
// will not wait for outstanding calls, so if that behavior is desired, call
// Flush() first. Returns false if the thread has died.
- bool Flush(uint32 id = MQID_ANY);
+ bool Flush(uint32_t id = MQID_ANY);
// Call |functor| asynchronously with no callback upon completion. Returns
// immediately. Returns false if the thread has died.
template <class ReturnT, class FunctorT>
- bool AsyncInvoke(const FunctorT& functor, uint32 id = 0) {
+ bool AsyncInvoke(const FunctorT& functor, uint32_t id = 0) {
rtc::CritScope cs(&crit_);
if (thread_ == nullptr)
return false;
@@ -176,8 +175,8 @@
// completion. Returns immediately. Returns false if the thread has died.
template <class ReturnT, class FunctorT>
bool AsyncInvokeDelayed(const FunctorT& functor,
- uint32 delay_ms,
- uint32 id = 0) {
+ uint32_t delay_ms,
+ uint32_t id = 0) {
rtc::CritScope cs(&crit_);
if (thread_ == nullptr)
return false;
@@ -192,7 +191,7 @@
bool AsyncInvoke(const FunctorT& functor,
void (HostT::*callback)(ReturnT),
HostT* callback_host,
- uint32 id = 0) {
+ uint32_t id = 0) {
rtc::CritScope cs(&crit_);
if (thread_ == nullptr)
return false;
@@ -207,7 +206,7 @@
bool AsyncInvoke(const FunctorT& functor,
void (HostT::*callback)(),
HostT* callback_host,
- uint32 id = 0) {
+ uint32_t id = 0) {
rtc::CritScope cs(&crit_);
if (thread_ == nullptr)
return false;
diff --git a/webrtc/base/asyncpacketsocket.h b/webrtc/base/asyncpacketsocket.h
index f0c221d..07cacf7 100644
--- a/webrtc/base/asyncpacketsocket.h
+++ b/webrtc/base/asyncpacketsocket.h
@@ -28,7 +28,7 @@
int rtp_sendtime_extension_id; // extension header id present in packet.
std::vector<char> srtp_auth_key; // Authentication key.
int srtp_auth_tag_len; // Authentication tag length.
- int64 srtp_packet_index; // Required for Rtp Packet authentication.
+ int64_t srtp_packet_index; // Required for Rtp Packet authentication.
};
// This structure holds meta information for the packet which is about to send
@@ -45,19 +45,19 @@
// received by socket.
struct PacketTime {
PacketTime() : timestamp(-1), not_before(-1) {}
- PacketTime(int64 timestamp, int64 not_before)
- : timestamp(timestamp), not_before(not_before) {
- }
+ PacketTime(int64_t timestamp, int64_t not_before)
+ : timestamp(timestamp), not_before(not_before) {}
- int64 timestamp; // Receive time after socket delivers the data.
- int64 not_before; // Earliest possible time the data could have arrived,
- // indicating the potential error in the |timestamp| value,
- // in case the system, is busy. For example, the time of
- // the last select() call.
- // If unknown, this value will be set to zero.
+ int64_t timestamp; // Receive time after socket delivers the data.
+
+ // Earliest possible time the data could have arrived, indicating the
+ // potential error in the |timestamp| value, in case the system, is busy. For
+ // example, the time of the last select() call.
+ // If unknown, this value will be set to zero.
+ int64_t not_before;
};
-inline PacketTime CreatePacketTime(int64 not_before) {
+inline PacketTime CreatePacketTime(int64_t not_before) {
return PacketTime(TimeMicros(), not_before);
}
diff --git a/webrtc/base/asyncsocket.cc b/webrtc/base/asyncsocket.cc
index dc0de3d..db451c6 100644
--- a/webrtc/base/asyncsocket.cc
+++ b/webrtc/base/asyncsocket.cc
@@ -96,7 +96,7 @@
return socket_->GetState();
}
-int AsyncSocketAdapter::EstimateMTU(uint16* mtu) {
+int AsyncSocketAdapter::EstimateMTU(uint16_t* mtu) {
return socket_->EstimateMTU(mtu);
}
diff --git a/webrtc/base/asyncsocket.h b/webrtc/base/asyncsocket.h
index 37bad4c..7a859be 100644
--- a/webrtc/base/asyncsocket.h
+++ b/webrtc/base/asyncsocket.h
@@ -64,7 +64,7 @@
int GetError() const override;
void SetError(int error) override;
ConnState GetState() const override;
- int EstimateMTU(uint16* mtu) override;
+ int EstimateMTU(uint16_t* mtu) override;
int GetOption(Option opt, int* value) override;
int SetOption(Option opt, int value) override;
diff --git a/webrtc/base/asynctcpsocket.cc b/webrtc/base/asynctcpsocket.cc
index 97d1e17..66fd3f1 100644
--- a/webrtc/base/asynctcpsocket.cc
+++ b/webrtc/base/asynctcpsocket.cc
@@ -24,7 +24,7 @@
static const size_t kMaxPacketSize = 64 * 1024;
-typedef uint16 PacketLength;
+typedef uint16_t PacketLength;
static const size_t kPacketLenSize = sizeof(PacketLength);
static const size_t kBufSize = kMaxPacketSize + kPacketLenSize;
diff --git a/webrtc/base/autodetectproxy.cc b/webrtc/base/autodetectproxy.cc
index 4ebc2d4..22950fb 100644
--- a/webrtc/base/autodetectproxy.cc
+++ b/webrtc/base/autodetectproxy.cc
@@ -102,7 +102,7 @@
IPAddress address_ip = proxy().address.ipaddr();
- uint16 address_port = proxy().address.port();
+ uint16_t address_port = proxy().address.port();
char autoconfig_url[kSavedStringLimit];
SaveStringToStack(autoconfig_url,
diff --git a/webrtc/base/autodetectproxy_unittest.cc b/webrtc/base/autodetectproxy_unittest.cc
index 4a26882..bc57304 100644
--- a/webrtc/base/autodetectproxy_unittest.cc
+++ b/webrtc/base/autodetectproxy_unittest.cc
@@ -19,7 +19,7 @@
static const char kUserAgent[] = "";
static const char kPath[] = "/";
static const char kHost[] = "relay.google.com";
-static const uint16 kPort = 443;
+static const uint16_t kPort = 443;
static const bool kSecure = true;
// At most, AutoDetectProxy should take ~6 seconds. Each connect step is
// allotted 2 seconds, with the initial resolution + connect given an
@@ -37,10 +37,10 @@
AutoDetectProxyTest() : auto_detect_proxy_(NULL), done_(false) {}
protected:
- bool Create(const std::string &user_agent,
- const std::string &path,
- const std::string &host,
- uint16 port,
+ bool Create(const std::string& user_agent,
+ const std::string& path,
+ const std::string& host,
+ uint16_t port,
bool secure,
bool startnow) {
auto_detect_proxy_ = new AutoDetectProxy(user_agent);
diff --git a/webrtc/base/bandwidthsmoother.cc b/webrtc/base/bandwidthsmoother.cc
index 09c7b99..d48c12e 100644
--- a/webrtc/base/bandwidthsmoother.cc
+++ b/webrtc/base/bandwidthsmoother.cc
@@ -16,7 +16,7 @@
namespace rtc {
BandwidthSmoother::BandwidthSmoother(int initial_bandwidth_guess,
- uint32 time_between_increase,
+ uint32_t time_between_increase,
double percent_increase,
size_t samples_count_to_average,
double min_sample_count_percent)
@@ -33,7 +33,7 @@
// Samples a new bandwidth measurement
// returns true if the bandwidth estimation changed
-bool BandwidthSmoother::Sample(uint32 sample_time, int bandwidth) {
+bool BandwidthSmoother::Sample(uint32_t sample_time, int bandwidth) {
if (bandwidth < 0) {
return false;
}
diff --git a/webrtc/base/bandwidthsmoother.h b/webrtc/base/bandwidthsmoother.h
index dbb4c81..eae565ea 100644
--- a/webrtc/base/bandwidthsmoother.h
+++ b/webrtc/base/bandwidthsmoother.h
@@ -31,7 +31,7 @@
class BandwidthSmoother {
public:
BandwidthSmoother(int initial_bandwidth_guess,
- uint32 time_between_increase,
+ uint32_t time_between_increase,
double percent_increase,
size_t samples_count_to_average,
double min_sample_count_percent);
@@ -40,16 +40,16 @@
// Samples a new bandwidth measurement.
// bandwidth is expected to be non-negative.
// returns true if the bandwidth estimation changed
- bool Sample(uint32 sample_time, int bandwidth);
+ bool Sample(uint32_t sample_time, int bandwidth);
int get_bandwidth_estimation() const {
return bandwidth_estimation_;
}
private:
- uint32 time_between_increase_;
+ uint32_t time_between_increase_;
double percent_increase_;
- uint32 time_at_last_change_;
+ uint32_t time_at_last_change_;
int bandwidth_estimation_;
RollingAccumulator<int> accumulator_;
double min_sample_count_percent_;
diff --git a/webrtc/base/basictypes_unittest.cc b/webrtc/base/basictypes_unittest.cc
index 4e243fd..df5ed5e 100644
--- a/webrtc/base/basictypes_unittest.cc
+++ b/webrtc/base/basictypes_unittest.cc
@@ -14,18 +14,9 @@
namespace rtc {
-static_assert(sizeof(int8) == 1, "Unexpected size");
-static_assert(sizeof(uint8) == 1, "Unexpected size");
-static_assert(sizeof(int16) == 2, "Unexpected size");
-static_assert(sizeof(uint16) == 2, "Unexpected size");
-static_assert(sizeof(int32) == 4, "Unexpected size");
-static_assert(sizeof(uint32) == 4, "Unexpected size");
-static_assert(sizeof(int64) == 8, "Unexpected size");
-static_assert(sizeof(uint64) == 8, "Unexpected size");
-
TEST(BasicTypesTest, Endian) {
- uint16 v16 = 0x1234u;
- uint8 first_byte = *reinterpret_cast<uint8*>(&v16);
+ uint16_t v16 = 0x1234u;
+ uint8_t first_byte = *reinterpret_cast<uint8_t*>(&v16);
#if defined(RTC_ARCH_CPU_LITTLE_ENDIAN)
EXPECT_EQ(0x34u, first_byte);
#elif defined(RTC_ARCH_CPU_BIG_ENDIAN)
@@ -33,33 +24,6 @@
#endif
}
-TEST(BasicTypesTest, SizeOfTypes) {
- int8 i8 = -1;
- uint8 u8 = 1u;
- int16 i16 = -1;
- uint16 u16 = 1u;
- int32 i32 = -1;
- uint32 u32 = 1u;
- int64 i64 = -1;
- uint64 u64 = 1u;
- EXPECT_EQ(1u, sizeof(i8));
- EXPECT_EQ(1u, sizeof(u8));
- EXPECT_EQ(2u, sizeof(i16));
- EXPECT_EQ(2u, sizeof(u16));
- EXPECT_EQ(4u, sizeof(i32));
- EXPECT_EQ(4u, sizeof(u32));
- EXPECT_EQ(8u, sizeof(i64));
- EXPECT_EQ(8u, sizeof(u64));
- EXPECT_GT(0, i8);
- EXPECT_LT(0u, u8);
- EXPECT_GT(0, i16);
- EXPECT_LT(0u, u16);
- EXPECT_GT(0, i32);
- EXPECT_LT(0u, u32);
- EXPECT_GT(0, i64);
- EXPECT_LT(0u, u64);
-}
-
TEST(BasicTypesTest, SizeOfConstants) {
EXPECT_EQ(8u, sizeof(INT64_C(0)));
EXPECT_EQ(8u, sizeof(UINT64_C(0)));
diff --git a/webrtc/base/bitbuffer_unittest.cc b/webrtc/base/bitbuffer_unittest.cc
index b9c348e..99701f7 100644
--- a/webrtc/base/bitbuffer_unittest.cc
+++ b/webrtc/base/bitbuffer_unittest.cc
@@ -16,9 +16,9 @@
namespace rtc {
TEST(BitBufferTest, ConsumeBits) {
- const uint8 bytes[64] = {0};
+ const uint8_t bytes[64] = {0};
BitBuffer buffer(bytes, 32);
- uint64 total_bits = 32 * 8;
+ uint64_t total_bits = 32 * 8;
EXPECT_EQ(total_bits, buffer.RemainingBitCount());
EXPECT_TRUE(buffer.ConsumeBits(3));
total_bits -= 3;
@@ -38,10 +38,10 @@
}
TEST(BitBufferTest, ReadBytesAligned) {
- const uint8 bytes[] = {0x0A, 0xBC, 0xDE, 0xF1, 0x23, 0x45, 0x67, 0x89};
- uint8 val8;
- uint16 val16;
- uint32 val32;
+ const uint8_t bytes[] = {0x0A, 0xBC, 0xDE, 0xF1, 0x23, 0x45, 0x67, 0x89};
+ uint8_t val8;
+ uint16_t val16;
+ uint32_t val32;
BitBuffer buffer(bytes, 8);
EXPECT_TRUE(buffer.ReadUInt8(&val8));
EXPECT_EQ(0x0Au, val8);
@@ -54,10 +54,11 @@
}
TEST(BitBufferTest, ReadBytesOffset4) {
- const uint8 bytes[] = {0x0A, 0xBC, 0xDE, 0xF1, 0x23, 0x45, 0x67, 0x89, 0x0A};
- uint8 val8;
- uint16 val16;
- uint32 val32;
+ const uint8_t bytes[] = {0x0A, 0xBC, 0xDE, 0xF1, 0x23,
+ 0x45, 0x67, 0x89, 0x0A};
+ uint8_t val8;
+ uint16_t val16;
+ uint32_t val32;
BitBuffer buffer(bytes, 9);
EXPECT_TRUE(buffer.ConsumeBits(4));
@@ -88,11 +89,11 @@
// The bytes. It almost looks like counting down by two at a time, except the
// jump at 5->3->0, since that's when the high bit is turned off.
- const uint8 bytes[] = {0x1F, 0xDB, 0x97, 0x53, 0x0E, 0xCA, 0x86, 0x42};
+ const uint8_t bytes[] = {0x1F, 0xDB, 0x97, 0x53, 0x0E, 0xCA, 0x86, 0x42};
- uint8 val8;
- uint16 val16;
- uint32 val32;
+ uint8_t val8;
+ uint16_t val16;
+ uint32_t val32;
BitBuffer buffer(bytes, 8);
EXPECT_TRUE(buffer.ConsumeBits(3));
EXPECT_TRUE(buffer.ReadUInt8(&val8));
@@ -101,7 +102,7 @@
EXPECT_EQ(0xDCBAu, val16);
EXPECT_TRUE(buffer.ReadUInt32(&val32));
EXPECT_EQ(0x98765432u, val32);
- // 5 bits left unread. Not enough to read a uint8.
+ // 5 bits left unread. Not enough to read a uint8_t.
EXPECT_EQ(5u, buffer.RemainingBitCount());
EXPECT_FALSE(buffer.ReadUInt8(&val8));
}
@@ -110,7 +111,7 @@
// Bit values are:
// 0b01001101,
// 0b00110010
- const uint8 bytes[] = {0x4D, 0x32};
+ const uint8_t bytes[] = {0x4D, 0x32};
uint32_t val;
BitBuffer buffer(bytes, 2);
EXPECT_TRUE(buffer.ReadBits(&val, 3));
@@ -136,7 +137,7 @@
}
TEST(BitBufferTest, SetOffsetValues) {
- uint8 bytes[4] = {0};
+ uint8_t bytes[4] = {0};
BitBufferWriter buffer(bytes, 4);
size_t byte_offset, bit_offset;
@@ -174,31 +175,31 @@
#endif
}
-uint64 GolombEncoded(uint32 val) {
+uint64_t GolombEncoded(uint32_t val) {
val++;
- uint32 bit_counter = val;
- uint64 bit_count = 0;
+ uint32_t bit_counter = val;
+ uint64_t bit_count = 0;
while (bit_counter > 0) {
bit_count++;
bit_counter >>= 1;
}
- return static_cast<uint64>(val) << (64 - (bit_count * 2 - 1));
+ return static_cast<uint64_t>(val) << (64 - (bit_count * 2 - 1));
}
TEST(BitBufferTest, GolombUint32Values) {
ByteBuffer byteBuffer;
byteBuffer.Resize(16);
- BitBuffer buffer(reinterpret_cast<const uint8*>(byteBuffer.Data()),
+ BitBuffer buffer(reinterpret_cast<const uint8_t*>(byteBuffer.Data()),
byteBuffer.Capacity());
- // Test over the uint32 range with a large enough step that the test doesn't
+ // Test over the uint32_t range with a large enough step that the test doesn't
// take forever. Around 20,000 iterations should do.
- const int kStep = std::numeric_limits<uint32>::max() / 20000;
- for (uint32 i = 0; i < std::numeric_limits<uint32>::max() - kStep;
+ const int kStep = std::numeric_limits<uint32_t>::max() / 20000;
+ for (uint32_t i = 0; i < std::numeric_limits<uint32_t>::max() - kStep;
i += kStep) {
- uint64 encoded_val = GolombEncoded(i);
+ uint64_t encoded_val = GolombEncoded(i);
byteBuffer.Clear();
byteBuffer.WriteUInt64(encoded_val);
- uint32 decoded_val;
+ uint32_t decoded_val;
EXPECT_TRUE(buffer.Seek(0, 0));
EXPECT_TRUE(buffer.ReadExponentialGolomb(&decoded_val));
EXPECT_EQ(i, decoded_val);
@@ -225,11 +226,11 @@
}
TEST(BitBufferTest, NoGolombOverread) {
- const uint8 bytes[] = {0x00, 0xFF, 0xFF};
+ const uint8_t bytes[] = {0x00, 0xFF, 0xFF};
// Make sure the bit buffer correctly enforces byte length on golomb reads.
// If it didn't, the above buffer would be valid at 3 bytes.
BitBuffer buffer(bytes, 1);
- uint32 decoded_val;
+ uint32_t decoded_val;
EXPECT_FALSE(buffer.ReadExponentialGolomb(&decoded_val));
BitBuffer longer_buffer(bytes, 2);
@@ -243,7 +244,7 @@
}
TEST(BitBufferWriterTest, SymmetricReadWrite) {
- uint8 bytes[16] = {0};
+ uint8_t bytes[16] = {0};
BitBufferWriter buffer(bytes, 4);
// Write some bit data at various sizes.
@@ -257,7 +258,7 @@
EXPECT_FALSE(buffer.WriteBits(1, 1));
EXPECT_TRUE(buffer.Seek(0, 0));
- uint32 val;
+ uint32_t val;
EXPECT_TRUE(buffer.ReadBits(&val, 3));
EXPECT_EQ(0x2u, val);
EXPECT_TRUE(buffer.ReadBits(&val, 2));
@@ -275,7 +276,7 @@
}
TEST(BitBufferWriterTest, SymmetricBytesMisaligned) {
- uint8 bytes[16] = {0};
+ uint8_t bytes[16] = {0};
BitBufferWriter buffer(bytes, 16);
// Offset 3, to get things misaligned.
@@ -285,9 +286,9 @@
EXPECT_TRUE(buffer.WriteUInt32(0x789ABCDEu));
buffer.Seek(0, 3);
- uint8 val8;
- uint16 val16;
- uint32 val32;
+ uint8_t val8;
+ uint16_t val16;
+ uint32_t val32;
EXPECT_TRUE(buffer.ReadUInt8(&val8));
EXPECT_EQ(0x12u, val8);
EXPECT_TRUE(buffer.ReadUInt16(&val16));
@@ -298,22 +299,22 @@
TEST(BitBufferWriterTest, SymmetricGolomb) {
char test_string[] = "my precious";
- uint8 bytes[64] = {0};
+ uint8_t bytes[64] = {0};
BitBufferWriter buffer(bytes, 64);
for (size_t i = 0; i < ARRAY_SIZE(test_string); ++i) {
EXPECT_TRUE(buffer.WriteExponentialGolomb(test_string[i]));
}
buffer.Seek(0, 0);
for (size_t i = 0; i < ARRAY_SIZE(test_string); ++i) {
- uint32 val;
+ uint32_t val;
EXPECT_TRUE(buffer.ReadExponentialGolomb(&val));
- EXPECT_LE(val, std::numeric_limits<uint8>::max());
+ EXPECT_LE(val, std::numeric_limits<uint8_t>::max());
EXPECT_EQ(test_string[i], static_cast<char>(val));
}
}
TEST(BitBufferWriterTest, WriteClearsBits) {
- uint8 bytes[] = {0xFF, 0xFF};
+ uint8_t bytes[] = {0xFF, 0xFF};
BitBufferWriter buffer(bytes, 2);
EXPECT_TRUE(buffer.ConsumeBits(3));
EXPECT_TRUE(buffer.WriteBits(0, 1));
diff --git a/webrtc/base/bytebuffer.cc b/webrtc/base/bytebuffer.cc
index 4b6a1d8..8bc1f23 100644
--- a/webrtc/base/bytebuffer.cc
+++ b/webrtc/base/bytebuffer.cc
@@ -66,16 +66,16 @@
delete[] bytes_;
}
-bool ByteBuffer::ReadUInt8(uint8* val) {
+bool ByteBuffer::ReadUInt8(uint8_t* val) {
if (!val) return false;
return ReadBytes(reinterpret_cast<char*>(val), 1);
}
-bool ByteBuffer::ReadUInt16(uint16* val) {
+bool ByteBuffer::ReadUInt16(uint16_t* val) {
if (!val) return false;
- uint16 v;
+ uint16_t v;
if (!ReadBytes(reinterpret_cast<char*>(&v), 2)) {
return false;
} else {
@@ -84,10 +84,10 @@
}
}
-bool ByteBuffer::ReadUInt24(uint32* val) {
+bool ByteBuffer::ReadUInt24(uint32_t* val) {
if (!val) return false;
- uint32 v = 0;
+ uint32_t v = 0;
char* read_into = reinterpret_cast<char*>(&v);
if (byte_order_ == ORDER_NETWORK || IsHostBigEndian()) {
++read_into;
@@ -101,10 +101,10 @@
}
}
-bool ByteBuffer::ReadUInt32(uint32* val) {
+bool ByteBuffer::ReadUInt32(uint32_t* val) {
if (!val) return false;
- uint32 v;
+ uint32_t v;
if (!ReadBytes(reinterpret_cast<char*>(&v), 4)) {
return false;
} else {
@@ -113,10 +113,10 @@
}
}
-bool ByteBuffer::ReadUInt64(uint64* val) {
+bool ByteBuffer::ReadUInt64(uint64_t* val) {
if (!val) return false;
- uint64 v;
+ uint64_t v;
if (!ReadBytes(reinterpret_cast<char*>(&v), 8)) {
return false;
} else {
@@ -147,17 +147,17 @@
}
}
-void ByteBuffer::WriteUInt8(uint8 val) {
+void ByteBuffer::WriteUInt8(uint8_t val) {
WriteBytes(reinterpret_cast<const char*>(&val), 1);
}
-void ByteBuffer::WriteUInt16(uint16 val) {
- uint16 v = (byte_order_ == ORDER_NETWORK) ? HostToNetwork16(val) : val;
+void ByteBuffer::WriteUInt16(uint16_t val) {
+ uint16_t v = (byte_order_ == ORDER_NETWORK) ? HostToNetwork16(val) : val;
WriteBytes(reinterpret_cast<const char*>(&v), 2);
}
-void ByteBuffer::WriteUInt24(uint32 val) {
- uint32 v = (byte_order_ == ORDER_NETWORK) ? HostToNetwork32(val) : val;
+void ByteBuffer::WriteUInt24(uint32_t val) {
+ uint32_t v = (byte_order_ == ORDER_NETWORK) ? HostToNetwork32(val) : val;
char* start = reinterpret_cast<char*>(&v);
if (byte_order_ == ORDER_NETWORK || IsHostBigEndian()) {
++start;
@@ -165,13 +165,13 @@
WriteBytes(start, 3);
}
-void ByteBuffer::WriteUInt32(uint32 val) {
- uint32 v = (byte_order_ == ORDER_NETWORK) ? HostToNetwork32(val) : val;
+void ByteBuffer::WriteUInt32(uint32_t val) {
+ uint32_t v = (byte_order_ == ORDER_NETWORK) ? HostToNetwork32(val) : val;
WriteBytes(reinterpret_cast<const char*>(&v), 4);
}
-void ByteBuffer::WriteUInt64(uint64 val) {
- uint64 v = (byte_order_ == ORDER_NETWORK) ? HostToNetwork64(val) : val;
+void ByteBuffer::WriteUInt64(uint64_t val) {
+ uint64_t v = (byte_order_ == ORDER_NETWORK) ? HostToNetwork64(val) : val;
WriteBytes(reinterpret_cast<const char*>(&v), 8);
}
diff --git a/webrtc/base/bytebuffer.h b/webrtc/base/bytebuffer.h
index 6cab2a8..ad2e552 100644
--- a/webrtc/base/bytebuffer.h
+++ b/webrtc/base/bytebuffer.h
@@ -47,11 +47,11 @@
// Read a next value from the buffer. Return false if there isn't
// enough data left for the specified type.
- bool ReadUInt8(uint8* val);
- bool ReadUInt16(uint16* val);
- bool ReadUInt24(uint32* val);
- bool ReadUInt32(uint32* val);
- bool ReadUInt64(uint64* val);
+ bool ReadUInt8(uint8_t* val);
+ bool ReadUInt16(uint16_t* val);
+ bool ReadUInt24(uint32_t* val);
+ bool ReadUInt32(uint32_t* val);
+ bool ReadUInt64(uint64_t* val);
bool ReadBytes(char* val, size_t len);
// Appends next |len| bytes from the buffer to |val|. Returns false
@@ -60,11 +60,11 @@
// Write value to the buffer. Resizes the buffer when it is
// neccessary.
- void WriteUInt8(uint8 val);
- void WriteUInt16(uint16 val);
- void WriteUInt24(uint32 val);
- void WriteUInt32(uint32 val);
- void WriteUInt64(uint64 val);
+ void WriteUInt8(uint8_t val);
+ void WriteUInt16(uint16_t val);
+ void WriteUInt24(uint32_t val);
+ void WriteUInt32(uint32_t val);
+ void WriteUInt64(uint64_t val);
void WriteString(const std::string& val);
void WriteBytes(const char* val, size_t len);
diff --git a/webrtc/base/bytebuffer_unittest.cc b/webrtc/base/bytebuffer_unittest.cc
index f4b0504..56b0e05 100644
--- a/webrtc/base/bytebuffer_unittest.cc
+++ b/webrtc/base/bytebuffer_unittest.cc
@@ -16,9 +16,9 @@
namespace rtc {
TEST(ByteBufferTest, TestByteOrder) {
- uint16 n16 = 1;
- uint32 n32 = 1;
- uint64 n64 = 1;
+ uint16_t n16 = 1;
+ uint32_t n32 = 1;
+ uint64_t n64 = 1;
EXPECT_EQ(n16, NetworkToHost16(HostToNetwork16(n16)));
EXPECT_EQ(n32, NetworkToHost32(HostToNetwork32(n32)));
@@ -117,45 +117,45 @@
for (size_t i = 0; i < ARRAY_SIZE(orders); i++) {
ByteBuffer buffer(orders[i]);
EXPECT_EQ(orders[i], buffer.Order());
- uint8 ru8;
+ uint8_t ru8;
EXPECT_FALSE(buffer.ReadUInt8(&ru8));
- // Write and read uint8.
- uint8 wu8 = 1;
+ // Write and read uint8_t.
+ uint8_t wu8 = 1;
buffer.WriteUInt8(wu8);
EXPECT_TRUE(buffer.ReadUInt8(&ru8));
EXPECT_EQ(wu8, ru8);
EXPECT_EQ(0U, buffer.Length());
- // Write and read uint16.
- uint16 wu16 = (1 << 8) + 1;
+ // Write and read uint16_t.
+ uint16_t wu16 = (1 << 8) + 1;
buffer.WriteUInt16(wu16);
- uint16 ru16;
+ uint16_t ru16;
EXPECT_TRUE(buffer.ReadUInt16(&ru16));
EXPECT_EQ(wu16, ru16);
EXPECT_EQ(0U, buffer.Length());
// Write and read uint24.
- uint32 wu24 = (3 << 16) + (2 << 8) + 1;
+ uint32_t wu24 = (3 << 16) + (2 << 8) + 1;
buffer.WriteUInt24(wu24);
- uint32 ru24;
+ uint32_t ru24;
EXPECT_TRUE(buffer.ReadUInt24(&ru24));
EXPECT_EQ(wu24, ru24);
EXPECT_EQ(0U, buffer.Length());
- // Write and read uint32.
- uint32 wu32 = (4 << 24) + (3 << 16) + (2 << 8) + 1;
+ // Write and read uint32_t.
+ uint32_t wu32 = (4 << 24) + (3 << 16) + (2 << 8) + 1;
buffer.WriteUInt32(wu32);
- uint32 ru32;
+ uint32_t ru32;
EXPECT_TRUE(buffer.ReadUInt32(&ru32));
EXPECT_EQ(wu32, ru32);
EXPECT_EQ(0U, buffer.Length());
- // Write and read uint64.
- uint32 another32 = (8 << 24) + (7 << 16) + (6 << 8) + 5;
- uint64 wu64 = (static_cast<uint64>(another32) << 32) + wu32;
+ // Write and read uint64_t.
+ uint32_t another32 = (8 << 24) + (7 << 16) + (6 << 8) + 5;
+ uint64_t wu64 = (static_cast<uint64_t>(another32) << 32) + wu32;
buffer.WriteUInt64(wu64);
- uint64 ru64;
+ uint64_t ru64;
EXPECT_TRUE(buffer.ReadUInt64(&ru64));
EXPECT_EQ(wu64, ru64);
EXPECT_EQ(0U, buffer.Length());
diff --git a/webrtc/base/byteorder.h b/webrtc/base/byteorder.h
index d907d9e..d579e6e 100644
--- a/webrtc/base/byteorder.h
+++ b/webrtc/base/byteorder.h
@@ -27,104 +27,102 @@
// TODO: Optimized versions, with direct read/writes of
// integers in host-endian format, when the platform supports it.
-inline void Set8(void* memory, size_t offset, uint8 v) {
- static_cast<uint8*>(memory)[offset] = v;
+inline void Set8(void* memory, size_t offset, uint8_t v) {
+ static_cast<uint8_t*>(memory)[offset] = v;
}
-inline uint8 Get8(const void* memory, size_t offset) {
- return static_cast<const uint8*>(memory)[offset];
+inline uint8_t Get8(const void* memory, size_t offset) {
+ return static_cast<const uint8_t*>(memory)[offset];
}
-inline void SetBE16(void* memory, uint16 v) {
- Set8(memory, 0, static_cast<uint8>(v >> 8));
- Set8(memory, 1, static_cast<uint8>(v >> 0));
+inline void SetBE16(void* memory, uint16_t v) {
+ Set8(memory, 0, static_cast<uint8_t>(v >> 8));
+ Set8(memory, 1, static_cast<uint8_t>(v >> 0));
}
-inline void SetBE32(void* memory, uint32 v) {
- Set8(memory, 0, static_cast<uint8>(v >> 24));
- Set8(memory, 1, static_cast<uint8>(v >> 16));
- Set8(memory, 2, static_cast<uint8>(v >> 8));
- Set8(memory, 3, static_cast<uint8>(v >> 0));
+inline void SetBE32(void* memory, uint32_t v) {
+ Set8(memory, 0, static_cast<uint8_t>(v >> 24));
+ Set8(memory, 1, static_cast<uint8_t>(v >> 16));
+ Set8(memory, 2, static_cast<uint8_t>(v >> 8));
+ Set8(memory, 3, static_cast<uint8_t>(v >> 0));
}
-inline void SetBE64(void* memory, uint64 v) {
- Set8(memory, 0, static_cast<uint8>(v >> 56));
- Set8(memory, 1, static_cast<uint8>(v >> 48));
- Set8(memory, 2, static_cast<uint8>(v >> 40));
- Set8(memory, 3, static_cast<uint8>(v >> 32));
- Set8(memory, 4, static_cast<uint8>(v >> 24));
- Set8(memory, 5, static_cast<uint8>(v >> 16));
- Set8(memory, 6, static_cast<uint8>(v >> 8));
- Set8(memory, 7, static_cast<uint8>(v >> 0));
+inline void SetBE64(void* memory, uint64_t v) {
+ Set8(memory, 0, static_cast<uint8_t>(v >> 56));
+ Set8(memory, 1, static_cast<uint8_t>(v >> 48));
+ Set8(memory, 2, static_cast<uint8_t>(v >> 40));
+ Set8(memory, 3, static_cast<uint8_t>(v >> 32));
+ Set8(memory, 4, static_cast<uint8_t>(v >> 24));
+ Set8(memory, 5, static_cast<uint8_t>(v >> 16));
+ Set8(memory, 6, static_cast<uint8_t>(v >> 8));
+ Set8(memory, 7, static_cast<uint8_t>(v >> 0));
}
-inline uint16 GetBE16(const void* memory) {
- return static_cast<uint16>((Get8(memory, 0) << 8) |
- (Get8(memory, 1) << 0));
+inline uint16_t GetBE16(const void* memory) {
+ return static_cast<uint16_t>((Get8(memory, 0) << 8) | (Get8(memory, 1) << 0));
}
-inline uint32 GetBE32(const void* memory) {
- return (static_cast<uint32>(Get8(memory, 0)) << 24) |
- (static_cast<uint32>(Get8(memory, 1)) << 16) |
- (static_cast<uint32>(Get8(memory, 2)) << 8) |
- (static_cast<uint32>(Get8(memory, 3)) << 0);
+inline uint32_t GetBE32(const void* memory) {
+ return (static_cast<uint32_t>(Get8(memory, 0)) << 24) |
+ (static_cast<uint32_t>(Get8(memory, 1)) << 16) |
+ (static_cast<uint32_t>(Get8(memory, 2)) << 8) |
+ (static_cast<uint32_t>(Get8(memory, 3)) << 0);
}
-inline uint64 GetBE64(const void* memory) {
- return (static_cast<uint64>(Get8(memory, 0)) << 56) |
- (static_cast<uint64>(Get8(memory, 1)) << 48) |
- (static_cast<uint64>(Get8(memory, 2)) << 40) |
- (static_cast<uint64>(Get8(memory, 3)) << 32) |
- (static_cast<uint64>(Get8(memory, 4)) << 24) |
- (static_cast<uint64>(Get8(memory, 5)) << 16) |
- (static_cast<uint64>(Get8(memory, 6)) << 8) |
- (static_cast<uint64>(Get8(memory, 7)) << 0);
+inline uint64_t GetBE64(const void* memory) {
+ return (static_cast<uint64_t>(Get8(memory, 0)) << 56) |
+ (static_cast<uint64_t>(Get8(memory, 1)) << 48) |
+ (static_cast<uint64_t>(Get8(memory, 2)) << 40) |
+ (static_cast<uint64_t>(Get8(memory, 3)) << 32) |
+ (static_cast<uint64_t>(Get8(memory, 4)) << 24) |
+ (static_cast<uint64_t>(Get8(memory, 5)) << 16) |
+ (static_cast<uint64_t>(Get8(memory, 6)) << 8) |
+ (static_cast<uint64_t>(Get8(memory, 7)) << 0);
}
-inline void SetLE16(void* memory, uint16 v) {
- Set8(memory, 0, static_cast<uint8>(v >> 0));
- Set8(memory, 1, static_cast<uint8>(v >> 8));
+inline void SetLE16(void* memory, uint16_t v) {
+ Set8(memory, 0, static_cast<uint8_t>(v >> 0));
+ Set8(memory, 1, static_cast<uint8_t>(v >> 8));
}
-inline void SetLE32(void* memory, uint32 v) {
- Set8(memory, 0, static_cast<uint8>(v >> 0));
- Set8(memory, 1, static_cast<uint8>(v >> 8));
- Set8(memory, 2, static_cast<uint8>(v >> 16));
- Set8(memory, 3, static_cast<uint8>(v >> 24));
+inline void SetLE32(void* memory, uint32_t v) {
+ Set8(memory, 0, static_cast<uint8_t>(v >> 0));
+ Set8(memory, 1, static_cast<uint8_t>(v >> 8));
+ Set8(memory, 2, static_cast<uint8_t>(v >> 16));
+ Set8(memory, 3, static_cast<uint8_t>(v >> 24));
}
-inline void SetLE64(void* memory, uint64 v) {
- Set8(memory, 0, static_cast<uint8>(v >> 0));
- Set8(memory, 1, static_cast<uint8>(v >> 8));
- Set8(memory, 2, static_cast<uint8>(v >> 16));
- Set8(memory, 3, static_cast<uint8>(v >> 24));
- Set8(memory, 4, static_cast<uint8>(v >> 32));
- Set8(memory, 5, static_cast<uint8>(v >> 40));
- Set8(memory, 6, static_cast<uint8>(v >> 48));
- Set8(memory, 7, static_cast<uint8>(v >> 56));
+inline void SetLE64(void* memory, uint64_t v) {
+ Set8(memory, 0, static_cast<uint8_t>(v >> 0));
+ Set8(memory, 1, static_cast<uint8_t>(v >> 8));
+ Set8(memory, 2, static_cast<uint8_t>(v >> 16));
+ Set8(memory, 3, static_cast<uint8_t>(v >> 24));
+ Set8(memory, 4, static_cast<uint8_t>(v >> 32));
+ Set8(memory, 5, static_cast<uint8_t>(v >> 40));
+ Set8(memory, 6, static_cast<uint8_t>(v >> 48));
+ Set8(memory, 7, static_cast<uint8_t>(v >> 56));
}
-inline uint16 GetLE16(const void* memory) {
- return static_cast<uint16>((Get8(memory, 0) << 0) |
- (Get8(memory, 1) << 8));
+inline uint16_t GetLE16(const void* memory) {
+ return static_cast<uint16_t>((Get8(memory, 0) << 0) | (Get8(memory, 1) << 8));
}
-inline uint32 GetLE32(const void* memory) {
- return (static_cast<uint32>(Get8(memory, 0)) << 0) |
- (static_cast<uint32>(Get8(memory, 1)) << 8) |
- (static_cast<uint32>(Get8(memory, 2)) << 16) |
- (static_cast<uint32>(Get8(memory, 3)) << 24);
+inline uint32_t GetLE32(const void* memory) {
+ return (static_cast<uint32_t>(Get8(memory, 0)) << 0) |
+ (static_cast<uint32_t>(Get8(memory, 1)) << 8) |
+ (static_cast<uint32_t>(Get8(memory, 2)) << 16) |
+ (static_cast<uint32_t>(Get8(memory, 3)) << 24);
}
-inline uint64 GetLE64(const void* memory) {
- return (static_cast<uint64>(Get8(memory, 0)) << 0) |
- (static_cast<uint64>(Get8(memory, 1)) << 8) |
- (static_cast<uint64>(Get8(memory, 2)) << 16) |
- (static_cast<uint64>(Get8(memory, 3)) << 24) |
- (static_cast<uint64>(Get8(memory, 4)) << 32) |
- (static_cast<uint64>(Get8(memory, 5)) << 40) |
- (static_cast<uint64>(Get8(memory, 6)) << 48) |
- (static_cast<uint64>(Get8(memory, 7)) << 56);
+inline uint64_t GetLE64(const void* memory) {
+ return (static_cast<uint64_t>(Get8(memory, 0)) << 0) |
+ (static_cast<uint64_t>(Get8(memory, 1)) << 8) |
+ (static_cast<uint64_t>(Get8(memory, 2)) << 16) |
+ (static_cast<uint64_t>(Get8(memory, 3)) << 24) |
+ (static_cast<uint64_t>(Get8(memory, 4)) << 32) |
+ (static_cast<uint64_t>(Get8(memory, 5)) << 40) |
+ (static_cast<uint64_t>(Get8(memory, 6)) << 48) |
+ (static_cast<uint64_t>(Get8(memory, 7)) << 56);
}
// Check if the current host is big endian.
@@ -133,33 +131,33 @@
return 0 == *reinterpret_cast<const char*>(&number);
}
-inline uint16 HostToNetwork16(uint16 n) {
- uint16 result;
+inline uint16_t HostToNetwork16(uint16_t n) {
+ uint16_t result;
SetBE16(&result, n);
return result;
}
-inline uint32 HostToNetwork32(uint32 n) {
- uint32 result;
+inline uint32_t HostToNetwork32(uint32_t n) {
+ uint32_t result;
SetBE32(&result, n);
return result;
}
-inline uint64 HostToNetwork64(uint64 n) {
- uint64 result;
+inline uint64_t HostToNetwork64(uint64_t n) {
+ uint64_t result;
SetBE64(&result, n);
return result;
}
-inline uint16 NetworkToHost16(uint16 n) {
+inline uint16_t NetworkToHost16(uint16_t n) {
return GetBE16(&n);
}
-inline uint32 NetworkToHost32(uint32 n) {
+inline uint32_t NetworkToHost32(uint32_t n) {
return GetBE32(&n);
}
-inline uint64 NetworkToHost64(uint64 n) {
+inline uint64_t NetworkToHost64(uint64_t n) {
return GetBE64(&n);
}
diff --git a/webrtc/base/byteorder_unittest.cc b/webrtc/base/byteorder_unittest.cc
index f4e7df3..c3135aa 100644
--- a/webrtc/base/byteorder_unittest.cc
+++ b/webrtc/base/byteorder_unittest.cc
@@ -17,7 +17,7 @@
// Test memory set functions put values into memory in expected order.
TEST(ByteOrderTest, TestSet) {
- uint8 buf[8] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u };
+ uint8_t buf[8] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u};
Set8(buf, 0, 0xfb);
Set8(buf, 1, 0x12);
EXPECT_EQ(0xfb, buf[0]);
@@ -60,7 +60,7 @@
// Test memory get functions get values from memory in expected order.
TEST(ByteOrderTest, TestGet) {
- uint8 buf[8];
+ uint8_t buf[8];
buf[0] = 0x01u;
buf[1] = 0x23u;
buf[2] = 0x45u;
diff --git a/webrtc/base/crc32.cc b/webrtc/base/crc32.cc
index d643a25..eae338a 100644
--- a/webrtc/base/crc32.cc
+++ b/webrtc/base/crc32.cc
@@ -18,14 +18,14 @@
// CRC32 polynomial, in reversed form.
// See RFC 1952, or http://en.wikipedia.org/wiki/Cyclic_redundancy_check
-static const uint32 kCrc32Polynomial = 0xEDB88320;
-static uint32 kCrc32Table[256] = { 0 };
+static const uint32_t kCrc32Polynomial = 0xEDB88320;
+static uint32_t kCrc32Table[256] = {0};
static void EnsureCrc32TableInited() {
if (kCrc32Table[ARRAY_SIZE(kCrc32Table) - 1])
return; // already inited
- for (uint32 i = 0; i < ARRAY_SIZE(kCrc32Table); ++i) {
- uint32 c = i;
+ for (uint32_t i = 0; i < ARRAY_SIZE(kCrc32Table); ++i) {
+ uint32_t c = i;
for (size_t j = 0; j < 8; ++j) {
if (c & 1) {
c = kCrc32Polynomial ^ (c >> 1);
@@ -37,11 +37,11 @@
}
}
-uint32 UpdateCrc32(uint32 start, const void* buf, size_t len) {
+uint32_t UpdateCrc32(uint32_t start, const void* buf, size_t len) {
EnsureCrc32TableInited();
- uint32 c = start ^ 0xFFFFFFFF;
- const uint8* u = static_cast<const uint8*>(buf);
+ uint32_t c = start ^ 0xFFFFFFFF;
+ const uint8_t* u = static_cast<const uint8_t*>(buf);
for (size_t i = 0; i < len; ++i) {
c = kCrc32Table[(c ^ u[i]) & 0xFF] ^ (c >> 8);
}
diff --git a/webrtc/base/crc32.h b/webrtc/base/crc32.h
index 99b4cac..9661876 100644
--- a/webrtc/base/crc32.h
+++ b/webrtc/base/crc32.h
@@ -19,13 +19,13 @@
// Updates a CRC32 checksum with |len| bytes from |buf|. |initial| holds the
// checksum result from the previous update; for the first call, it should be 0.
-uint32 UpdateCrc32(uint32 initial, const void* buf, size_t len);
+uint32_t UpdateCrc32(uint32_t initial, const void* buf, size_t len);
// Computes a CRC32 checksum using |len| bytes from |buf|.
-inline uint32 ComputeCrc32(const void* buf, size_t len) {
+inline uint32_t ComputeCrc32(const void* buf, size_t len) {
return UpdateCrc32(0, buf, len);
}
-inline uint32 ComputeCrc32(const std::string& str) {
+inline uint32_t ComputeCrc32(const std::string& str) {
return ComputeCrc32(str.c_str(), str.size());
}
diff --git a/webrtc/base/crc32_unittest.cc b/webrtc/base/crc32_unittest.cc
index 0bfdeee..6da5c32 100644
--- a/webrtc/base/crc32_unittest.cc
+++ b/webrtc/base/crc32_unittest.cc
@@ -25,7 +25,7 @@
TEST(Crc32Test, TestMultipleUpdates) {
std::string input =
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
- uint32 c = 0;
+ uint32_t c = 0;
for (size_t i = 0; i < input.size(); ++i) {
c = UpdateCrc32(c, &input[i], 1);
}
diff --git a/webrtc/base/dbus_unittest.cc b/webrtc/base/dbus_unittest.cc
index 505ddbb..17752f1 100644
--- a/webrtc/base/dbus_unittest.cc
+++ b/webrtc/base/dbus_unittest.cc
@@ -18,7 +18,7 @@
#define SIG_NAME "NameAcquired"
-static const uint32 kTimeoutMs = 5000U;
+static const uint32_t kTimeoutMs = 5000U;
class DBusSigFilterTest : public DBusSigFilter {
public:
diff --git a/webrtc/base/faketaskrunner.h b/webrtc/base/faketaskrunner.h
index 5408ab8..88e4826 100644
--- a/webrtc/base/faketaskrunner.h
+++ b/webrtc/base/faketaskrunner.h
@@ -25,12 +25,12 @@
virtual void WakeTasks() { RunTasks(); }
- virtual int64 CurrentTime() {
+ virtual int64_t CurrentTime() {
// Implement if needed.
return current_time_++;
}
- int64 current_time_;
+ int64_t current_time_;
};
} // namespace rtc
diff --git a/webrtc/base/fileutils.h b/webrtc/base/fileutils.h
index 8d085ef..bf02571 100644
--- a/webrtc/base/fileutils.h
+++ b/webrtc/base/fileutils.h
@@ -234,7 +234,7 @@
// Delete the contents of the folder returned by GetAppTempFolder
bool CleanAppTempFolder();
- virtual bool GetDiskFreeSpace(const Pathname& path, int64 *freebytes) = 0;
+ virtual bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) = 0;
// Returns the absolute path of the current directory.
virtual Pathname GetCurrentDirectory() = 0;
@@ -379,7 +379,7 @@
return EnsureDefaultFilesystem()->CleanAppTempFolder();
}
- static bool GetDiskFreeSpace(const Pathname& path, int64 *freebytes) {
+ static bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) {
return EnsureDefaultFilesystem()->GetDiskFreeSpace(path, freebytes);
}
diff --git a/webrtc/base/fileutils_mock.h b/webrtc/base/fileutils_mock.h
index e9d20a7..428d444 100644
--- a/webrtc/base/fileutils_mock.h
+++ b/webrtc/base/fileutils_mock.h
@@ -237,7 +237,7 @@
EXPECT_TRUE(false) << "Unsupported operation";
return false;
}
- bool GetDiskFreeSpace(const Pathname &path, int64 *freebytes) {
+ bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) {
EXPECT_TRUE(false) << "Unsupported operation";
return false;
}
diff --git a/webrtc/base/fileutils_unittest.cc b/webrtc/base/fileutils_unittest.cc
index 9076bc7..6e98e14 100644
--- a/webrtc/base/fileutils_unittest.cc
+++ b/webrtc/base/fileutils_unittest.cc
@@ -90,29 +90,29 @@
Pathname path;
ASSERT_TRUE(Filesystem::GetAppDataFolder(&path, true));
- int64 free1 = 0;
+ int64_t free1 = 0;
EXPECT_TRUE(Filesystem::IsFolder(path));
EXPECT_FALSE(Filesystem::IsFile(path));
EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free1));
EXPECT_GT(free1, 0);
- int64 free2 = 0;
+ int64_t free2 = 0;
path.AppendFolder("this_folder_doesnt_exist");
EXPECT_FALSE(Filesystem::IsFolder(path));
EXPECT_TRUE(Filesystem::IsAbsent(path));
EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free2));
// These should be the same disk, and disk free space should not have changed
// by more than 1% between the two calls.
- EXPECT_LT(static_cast<int64>(free1 * .9), free2);
- EXPECT_LT(free2, static_cast<int64>(free1 * 1.1));
+ EXPECT_LT(static_cast<int64_t>(free1 * .9), free2);
+ EXPECT_LT(free2, static_cast<int64_t>(free1 * 1.1));
- int64 free3 = 0;
+ int64_t free3 = 0;
path.clear();
EXPECT_TRUE(path.empty());
EXPECT_TRUE(Filesystem::GetDiskFreeSpace(path, &free3));
// Current working directory may not be where exe is.
- // EXPECT_LT(static_cast<int64>(free1 * .9), free3);
- // EXPECT_LT(free3, static_cast<int64>(free1 * 1.1));
+ // EXPECT_LT(static_cast<int64_t>(free1 * .9), free3);
+ // EXPECT_LT(free3, static_cast<int64_t>(free1 * 1.1));
EXPECT_GT(free3, 0);
}
diff --git a/webrtc/base/gunit.h b/webrtc/base/gunit.h
index 7431fcf..c2bc844 100644
--- a/webrtc/base/gunit.h
+++ b/webrtc/base/gunit.h
@@ -20,22 +20,21 @@
#endif
// Wait until "ex" is true, or "timeout" expires.
-#define WAIT(ex, timeout) \
- for (uint32 start = rtc::Time(); \
- !(ex) && rtc::Time() < start + timeout;) \
+#define WAIT(ex, timeout) \
+ for (uint32_t start = rtc::Time(); !(ex) && rtc::Time() < start + timeout;) \
rtc::Thread::Current()->ProcessMessages(1);
// This returns the result of the test in res, so that we don't re-evaluate
// the expression in the XXXX_WAIT macros below, since that causes problems
// when the expression is only true the first time you check it.
-#define WAIT_(ex, timeout, res) \
- do { \
- uint32 start = rtc::Time(); \
- res = (ex); \
+#define WAIT_(ex, timeout, res) \
+ do { \
+ uint32_t start = rtc::Time(); \
+ res = (ex); \
while (!res && rtc::Time() < start + timeout) { \
- rtc::Thread::Current()->ProcessMessages(1); \
- res = (ex); \
- } \
+ rtc::Thread::Current()->ProcessMessages(1); \
+ res = (ex); \
+ } \
} while (0);
// The typical EXPECT_XXXX and ASSERT_XXXXs, but done until true or a timeout.
diff --git a/webrtc/base/helpers.cc b/webrtc/base/helpers.cc
index 0102c10..8e59b64 100644
--- a/webrtc/base/helpers.cc
+++ b/webrtc/base/helpers.cc
@@ -152,7 +152,7 @@
bool Init(const void* seed, size_t len) override { return true; }
bool Generate(void* buf, size_t len) override {
for (size_t i = 0; i < len; ++i) {
- static_cast<uint8*>(buf)[i] = static_cast<uint8>(GetRandom());
+ static_cast<uint8_t*>(buf)[i] = static_cast<uint8_t>(GetRandom());
}
return true;
}
@@ -219,7 +219,7 @@
const char* table, int table_size,
std::string* str) {
str->clear();
- scoped_ptr<uint8[]> bytes(new uint8[len]);
+ scoped_ptr<uint8_t[]> bytes(new uint8_t[len]);
if (!Rng().Generate(bytes.get(), len)) {
LOG(LS_ERROR) << "Failed to generate random string!";
return false;
@@ -241,20 +241,20 @@
static_cast<int>(table.size()), str);
}
-uint32 CreateRandomId() {
- uint32 id;
+uint32_t CreateRandomId() {
+ uint32_t id;
if (!Rng().Generate(&id, sizeof(id))) {
LOG(LS_ERROR) << "Failed to generate random id!";
}
return id;
}
-uint64 CreateRandomId64() {
- return static_cast<uint64>(CreateRandomId()) << 32 | CreateRandomId();
+uint64_t CreateRandomId64() {
+ return static_cast<uint64_t>(CreateRandomId()) << 32 | CreateRandomId();
}
-uint32 CreateRandomNonZeroId() {
- uint32 id;
+uint32_t CreateRandomNonZeroId() {
+ uint32_t id;
do {
id = CreateRandomId();
} while (id == 0);
@@ -262,8 +262,8 @@
}
double CreateRandomDouble() {
- return CreateRandomId() / (std::numeric_limits<uint32>::max() +
- std::numeric_limits<double>::epsilon());
+ return CreateRandomId() / (std::numeric_limits<uint32_t>::max() +
+ std::numeric_limits<double>::epsilon());
}
} // namespace rtc
diff --git a/webrtc/base/helpers.h b/webrtc/base/helpers.h
index e46d12a..102c08b 100644
--- a/webrtc/base/helpers.h
+++ b/webrtc/base/helpers.h
@@ -40,13 +40,13 @@
std::string* str);
// Generates a random id.
-uint32 CreateRandomId();
+uint32_t CreateRandomId();
// Generates a 64 bit random id.
-uint64 CreateRandomId64();
+uint64_t CreateRandomId64();
// Generates a random id > 0.
-uint32 CreateRandomNonZeroId();
+uint32_t CreateRandomNonZeroId();
// Generates a random double between 0.0 (inclusive) and 1.0 (exclusive).
double CreateRandomDouble();
diff --git a/webrtc/base/httpbase_unittest.cc b/webrtc/base/httpbase_unittest.cc
index d4dd775..8d8e097 100644
--- a/webrtc/base/httpbase_unittest.cc
+++ b/webrtc/base/httpbase_unittest.cc
@@ -145,7 +145,7 @@
std::string header;
EXPECT_EQ(HVER_1_1, data.version);
- EXPECT_EQ(static_cast<uint32>(HC_OK), data.scode);
+ EXPECT_EQ(static_cast<uint32_t>(HC_OK), data.scode);
EXPECT_TRUE(data.hasHeader(HH_PROXY_AUTHORIZATION, &header));
EXPECT_EQ("42", header);
EXPECT_TRUE(data.hasHeader(HH_CONNECTION, &header));
@@ -215,7 +215,7 @@
// HTTP headers haven't arrived yet
EXPECT_EQ(0U, events.size());
- EXPECT_EQ(static_cast<uint32>(HC_INTERNAL_SERVER_ERROR), data.scode);
+ EXPECT_EQ(static_cast<uint32_t>(HC_INTERNAL_SERVER_ERROR), data.scode);
LOG_F(LS_VERBOSE) << "Exit";
}
diff --git a/webrtc/base/httpcommon-inl.h b/webrtc/base/httpcommon-inl.h
index 2f525ce..d1c0bf0 100644
--- a/webrtc/base/httpcommon-inl.h
+++ b/webrtc/base/httpcommon-inl.h
@@ -52,7 +52,7 @@
host_.assign(val, colon - val);
// Note: In every case, we're guaranteed that colon is followed by a null,
// or non-numeric character.
- port_ = static_cast<uint16>(::strtoul(colon + 1, NULL, 10));
+ port_ = static_cast<uint16_t>(::strtoul(colon + 1, NULL, 10));
// TODO: Consider checking for invalid data following port number.
} else {
host_.assign(val, len);
diff --git a/webrtc/base/httpcommon.cc b/webrtc/base/httpcommon.cc
index 138ca42..0c3547e 100644
--- a/webrtc/base/httpcommon.cc
+++ b/webrtc/base/httpcommon.cc
@@ -149,12 +149,12 @@
return Enum<HttpHeader>::Parse(header, str);
}
-bool HttpCodeHasBody(uint32 code) {
+bool HttpCodeHasBody(uint32_t code) {
return !HttpCodeIsInformational(code)
&& (code != HC_NO_CONTENT) && (code != HC_NOT_MODIFIED);
}
-bool HttpCodeIsCacheable(uint32 code) {
+bool HttpCodeIsCacheable(uint32_t code) {
switch (code) {
case HC_OK:
case HC_NON_AUTHORITATIVE:
@@ -599,32 +599,29 @@
HttpData::copy(src);
}
-void
-HttpResponseData::set_success(uint32 scode) {
+void HttpResponseData::set_success(uint32_t scode) {
this->scode = scode;
message.clear();
setHeader(HH_CONTENT_LENGTH, "0", false);
}
-void
-HttpResponseData::set_success(const std::string& content_type,
- StreamInterface* document,
- uint32 scode) {
+void HttpResponseData::set_success(const std::string& content_type,
+ StreamInterface* document,
+ uint32_t scode) {
this->scode = scode;
message.erase(message.begin(), message.end());
setContent(content_type, document);
}
-void
-HttpResponseData::set_redirect(const std::string& location, uint32 scode) {
+void HttpResponseData::set_redirect(const std::string& location,
+ uint32_t scode) {
this->scode = scode;
message.clear();
setHeader(HH_LOCATION, location);
setHeader(HH_CONTENT_LENGTH, "0", false);
}
-void
-HttpResponseData::set_error(uint32 scode) {
+void HttpResponseData::set_error(uint32_t scode) {
this->scode = scode;
message.clear();
setHeader(HH_CONTENT_LENGTH, "0", false);
@@ -911,7 +908,7 @@
bool specify_credentials = !username.empty();
size_t steps = 0;
- //uint32 now = Time();
+ // uint32_t now = Time();
NegotiateAuthContext * neg = static_cast<NegotiateAuthContext *>(context);
if (neg) {
diff --git a/webrtc/base/httpcommon.h b/webrtc/base/httpcommon.h
index 7b20fac..addc1bc 100644
--- a/webrtc/base/httpcommon.h
+++ b/webrtc/base/httpcommon.h
@@ -112,8 +112,8 @@
HH_LAST = HH_WWW_AUTHENTICATE
};
-const uint16 HTTP_DEFAULT_PORT = 80;
-const uint16 HTTP_SECURE_PORT = 443;
+const uint16_t HTTP_DEFAULT_PORT = 80;
+const uint16_t HTTP_SECURE_PORT = 443;
//////////////////////////////////////////////////////////////////////
// Utility Functions
@@ -132,14 +132,24 @@
const char* ToString(HttpHeader header);
bool FromString(HttpHeader& header, const std::string& str);
-inline bool HttpCodeIsInformational(uint32 code) { return ((code / 100) == 1); }
-inline bool HttpCodeIsSuccessful(uint32 code) { return ((code / 100) == 2); }
-inline bool HttpCodeIsRedirection(uint32 code) { return ((code / 100) == 3); }
-inline bool HttpCodeIsClientError(uint32 code) { return ((code / 100) == 4); }
-inline bool HttpCodeIsServerError(uint32 code) { return ((code / 100) == 5); }
+inline bool HttpCodeIsInformational(uint32_t code) {
+ return ((code / 100) == 1);
+}
+inline bool HttpCodeIsSuccessful(uint32_t code) {
+ return ((code / 100) == 2);
+}
+inline bool HttpCodeIsRedirection(uint32_t code) {
+ return ((code / 100) == 3);
+}
+inline bool HttpCodeIsClientError(uint32_t code) {
+ return ((code / 100) == 4);
+}
+inline bool HttpCodeIsServerError(uint32_t code) {
+ return ((code / 100) == 5);
+}
-bool HttpCodeHasBody(uint32 code);
-bool HttpCodeIsCacheable(uint32 code);
+bool HttpCodeHasBody(uint32_t code);
+bool HttpCodeIsCacheable(uint32_t code);
bool HttpHeaderIsEndToEnd(HttpHeader header);
bool HttpHeaderIsCollapsible(HttpHeader header);
@@ -163,7 +173,7 @@
// Convert RFC1123 date (DoW, DD Mon YYYY HH:MM:SS TZ) to unix timestamp
bool HttpDateToSeconds(const std::string& date, time_t* seconds);
-inline uint16 HttpDefaultPort(bool secure) {
+inline uint16_t HttpDefaultPort(bool secure) {
return secure ? HTTP_SECURE_PORT : HTTP_DEFAULT_PORT;
}
@@ -196,9 +206,10 @@
static int Decode(const string& source, string& destination);
Url(const string& url) { do_set_url(url.c_str(), url.size()); }
- Url(const string& path, const string& host, uint16 port = HTTP_DEFAULT_PORT)
- : host_(host), port_(port), secure_(HTTP_SECURE_PORT == port)
- { set_full_path(path); }
+ Url(const string& path, const string& host, uint16_t port = HTTP_DEFAULT_PORT)
+ : host_(host), port_(port), secure_(HTTP_SECURE_PORT == port) {
+ set_full_path(path);
+ }
bool valid() const { return !host_.empty(); }
void clear() {
@@ -233,8 +244,8 @@
void set_host(const string& val) { host_ = val; }
const string& host() const { return host_; }
- void set_port(uint16 val) { port_ = val; }
- uint16 port() const { return port_; }
+ void set_port(uint16_t val) { port_ = val; }
+ uint16_t port() const { return port_; }
void set_secure(bool val) { secure_ = val; }
bool secure() const { return secure_; }
@@ -267,7 +278,7 @@
void do_get_full_path(string* val) const;
string host_, path_, query_;
- uint16 port_;
+ uint16_t port_;
bool secure_;
};
@@ -393,7 +404,7 @@
};
struct HttpResponseData : public HttpData {
- uint32 scode;
+ uint32_t scode;
std::string message;
HttpResponseData() : scode(HC_INTERNAL_SERVER_ERROR) { }
@@ -401,12 +412,13 @@
void copy(const HttpResponseData& src);
// Convenience methods
- void set_success(uint32 scode = HC_OK);
- void set_success(const std::string& content_type, StreamInterface* document,
- uint32 scode = HC_OK);
+ void set_success(uint32_t scode = HC_OK);
+ void set_success(const std::string& content_type,
+ StreamInterface* document,
+ uint32_t scode = HC_OK);
void set_redirect(const std::string& location,
- uint32 scode = HC_MOVED_TEMPORARILY);
- void set_error(uint32 scode);
+ uint32_t scode = HC_MOVED_TEMPORARILY);
+ void set_error(uint32_t scode);
size_t formatLeader(char* buffer, size_t size) const override;
HttpError parseLeader(const char* line, size_t len) override;
diff --git a/webrtc/base/ipaddress.cc b/webrtc/base/ipaddress.cc
index 3dd856a..316207f 100644
--- a/webrtc/base/ipaddress.cc
+++ b/webrtc/base/ipaddress.cc
@@ -43,10 +43,10 @@
bool IPAddress::strip_sensitive_ = false;
-static bool IsPrivateV4(uint32 ip);
+static bool IsPrivateV4(uint32_t ip);
static in_addr ExtractMappedAddress(const in6_addr& addr);
-uint32 IPAddress::v4AddressAsHostOrderInteger() const {
+uint32_t IPAddress::v4AddressAsHostOrderInteger() const {
if (family_ == AF_INET) {
return NetworkToHost32(u_.ip4.s_addr);
} else {
@@ -215,7 +215,7 @@
return os;
}
-bool IsPrivateV4(uint32 ip_in_host_order) {
+bool IsPrivateV4(uint32_t ip_in_host_order) {
return ((ip_in_host_order >> 24) == 127) ||
((ip_in_host_order >> 24) == 10) ||
((ip_in_host_order >> 20) == ((172 << 4) | 1)) ||
@@ -321,8 +321,8 @@
}
case AF_INET6: {
in6_addr v6addr = ip.ipv6_address();
- const uint32* v6_as_ints =
- reinterpret_cast<const uint32*>(&v6addr.s6_addr);
+ const uint32_t* v6_as_ints =
+ reinterpret_cast<const uint32_t*>(&v6addr.s6_addr);
return v6_as_ints[0] ^ v6_as_ints[1] ^ v6_as_ints[2] ^ v6_as_ints[3];
}
}
@@ -341,7 +341,7 @@
return IPAddress(INADDR_ANY);
}
int mask = (0xFFFFFFFF << (32 - length));
- uint32 host_order_ip = NetworkToHost32(ip.ipv4_address().s_addr);
+ uint32_t host_order_ip = NetworkToHost32(ip.ipv4_address().s_addr);
in_addr masked;
masked.s_addr = HostToNetwork32(host_order_ip & mask);
return IPAddress(masked);
@@ -356,12 +356,11 @@
int position = length / 32;
int inner_length = 32 - (length - (position * 32));
// Note: 64bit mask constant needed to allow possible 32-bit left shift.
- uint32 inner_mask = 0xFFFFFFFFLL << inner_length;
- uint32* v6_as_ints =
- reinterpret_cast<uint32*>(&v6addr.s6_addr);
+ uint32_t inner_mask = 0xFFFFFFFFLL << inner_length;
+ uint32_t* v6_as_ints = reinterpret_cast<uint32_t*>(&v6addr.s6_addr);
for (int i = 0; i < 4; ++i) {
if (i == position) {
- uint32 host_order_inner = NetworkToHost32(v6_as_ints[i]);
+ uint32_t host_order_inner = NetworkToHost32(v6_as_ints[i]);
v6_as_ints[i] = HostToNetwork32(host_order_inner & inner_mask);
} else if (i > position) {
v6_as_ints[i] = 0;
@@ -373,7 +372,7 @@
}
int CountIPMaskBits(IPAddress mask) {
- uint32 word_to_count = 0;
+ uint32_t word_to_count = 0;
int bits = 0;
switch (mask.family()) {
case AF_INET: {
@@ -382,8 +381,8 @@
}
case AF_INET6: {
in6_addr v6addr = mask.ipv6_address();
- const uint32* v6_as_ints =
- reinterpret_cast<const uint32*>(&v6addr.s6_addr);
+ const uint32_t* v6_as_ints =
+ reinterpret_cast<const uint32_t*>(&v6addr.s6_addr);
int i = 0;
for (; i < 4; ++i) {
if (v6_as_ints[i] != 0xFFFFFFFF) {
@@ -408,7 +407,7 @@
// http://graphics.stanford.edu/~seander/bithacks.html
// Counts the trailing 0s in the word.
unsigned int zeroes = 32;
- word_to_count &= -static_cast<int32>(word_to_count);
+ word_to_count &= -static_cast<int32_t>(word_to_count);
if (word_to_count) zeroes--;
if (word_to_count & 0x0000FFFF) zeroes -= 16;
if (word_to_count & 0x00FF00FF) zeroes -= 8;
diff --git a/webrtc/base/ipaddress.h b/webrtc/base/ipaddress.h
index 0f32d3a..fe2d6e2 100644
--- a/webrtc/base/ipaddress.h
+++ b/webrtc/base/ipaddress.h
@@ -62,7 +62,7 @@
u_.ip6 = ip6;
}
- explicit IPAddress(uint32 ip_in_host_byte_order) : family_(AF_INET) {
+ explicit IPAddress(uint32_t ip_in_host_byte_order) : family_(AF_INET) {
memset(&u_, 0, sizeof(u_));
u_.ip4.s_addr = HostToNetwork32(ip_in_host_byte_order);
}
@@ -107,7 +107,7 @@
IPAddress AsIPv6Address() const;
// For socketaddress' benefit. Returns the IP in host byte order.
- uint32 v4AddressAsHostOrderInteger() const;
+ uint32_t v4AddressAsHostOrderInteger() const;
// Whether this is an unspecified IP address.
bool IsNil() const;
diff --git a/webrtc/base/logging.cc b/webrtc/base/logging.cc
index fd5e1cd..b60a244 100644
--- a/webrtc/base/logging.cc
+++ b/webrtc/base/logging.cc
@@ -118,7 +118,7 @@
tag_(kLibjingle),
warn_slow_logs_delay_(WARN_SLOW_LOGS_DELAY) {
if (timestamp_) {
- uint32 time = TimeSince(LogStartTime());
+ uint32_t time = TimeSince(LogStartTime());
// Also ensure WallClockStartTime is initialized, so that it matches
// LogStartTime.
WallClockStartTime();
@@ -197,7 +197,7 @@
OutputToDebug(str, severity_, tag_);
}
- uint32 before = Time();
+ uint32_t before = Time();
// Must lock streams_ before accessing
CritScope cs(&crit_);
for (StreamList::iterator it = streams_.begin(); it != streams_.end(); ++it) {
@@ -205,7 +205,7 @@
it->first->OnLogMessage(str);
}
}
- uint32 delay = TimeSince(before);
+ uint32_t delay = TimeSince(before);
if (delay >= warn_slow_logs_delay_) {
rtc::LogMessage slow_log_warning(__FILE__, __LINE__, LS_WARNING);
// If our warning is slow, we don't want to warn about it, because
@@ -217,13 +217,13 @@
}
}
-uint32 LogMessage::LogStartTime() {
- static const uint32 g_start = Time();
+uint32_t LogMessage::LogStartTime() {
+ static const uint32_t g_start = Time();
return g_start;
}
-uint32 LogMessage::WallClockStartTime() {
- static const uint32 g_start_wallclock = time(NULL);
+uint32_t LogMessage::WallClockStartTime() {
+ static const uint32_t g_start_wallclock = time(NULL);
return g_start_wallclock;
}
diff --git a/webrtc/base/logging.h b/webrtc/base/logging.h
index b8f460c..71c6c53 100644
--- a/webrtc/base/logging.h
+++ b/webrtc/base/logging.h
@@ -131,7 +131,7 @@
class LogMessage {
public:
- static const uint32 WARN_SLOW_LOGS_DELAY = 50; // ms
+ static const uint32_t WARN_SLOW_LOGS_DELAY = 50; // ms
LogMessage(const char* file, int line, LoggingSeverity sev,
LogErrorContext err_ctx = ERRCTX_NONE, int err = 0,
@@ -152,11 +152,11 @@
// If this is not called externally, the LogMessage ctor also calls it, in
// which case the logging start time will be the time of the first LogMessage
// instance is created.
- static uint32 LogStartTime();
+ static uint32_t LogStartTime();
// Returns the wall clock equivalent of |LogStartTime|, in seconds from the
// epoch.
- static uint32 WallClockStartTime();
+ static uint32_t WallClockStartTime();
// LogThreads: Display the thread identifier of the current thread
static void LogThreads(bool on = true);
@@ -218,7 +218,7 @@
// If time it takes to write to stream is more than this, log one
// additional warning about it.
- uint32 warn_slow_logs_delay_;
+ uint32_t warn_slow_logs_delay_;
// Global lock for the logging subsystem
static CriticalSection crit_;
diff --git a/webrtc/base/logging_unittest.cc b/webrtc/base/logging_unittest.cc
index 58ad6b7..3719cde 100644
--- a/webrtc/base/logging_unittest.cc
+++ b/webrtc/base/logging_unittest.cc
@@ -123,7 +123,7 @@
TEST(LogTest, WallClockStartTime) {
- uint32 time = LogMessage::WallClockStartTime();
+ uint32_t time = LogMessage::WallClockStartTime();
// Expect the time to be in a sensible range, e.g. > 2012-01-01.
EXPECT_GT(time, 1325376000u);
}
@@ -139,7 +139,7 @@
stream.DisableBuffering();
LogMessage::AddLogToStream(&stream, LS_SENSITIVE);
- uint32 start = Time(), finish;
+ uint32_t start = Time(), finish;
std::string message('X', 80);
for (int i = 0; i < 1000; ++i) {
LOG(LS_SENSITIVE) << message;
diff --git a/webrtc/base/macasyncsocket.cc b/webrtc/base/macasyncsocket.cc
index ee982ff..1f12500 100644
--- a/webrtc/base/macasyncsocket.cc
+++ b/webrtc/base/macasyncsocket.cc
@@ -276,7 +276,7 @@
return 0;
}
-int MacAsyncSocket::EstimateMTU(uint16* mtu) {
+int MacAsyncSocket::EstimateMTU(uint16_t* mtu) {
ASSERT(false && "NYI");
return -1;
}
diff --git a/webrtc/base/macasyncsocket.h b/webrtc/base/macasyncsocket.h
index 7351474..5861ee3 100644
--- a/webrtc/base/macasyncsocket.h
+++ b/webrtc/base/macasyncsocket.h
@@ -49,7 +49,7 @@
int GetError() const override;
void SetError(int error) override;
ConnState GetState() const override;
- int EstimateMTU(uint16* mtu) override;
+ int EstimateMTU(uint16_t* mtu) override;
int GetOption(Option opt, int* value) override;
int SetOption(Option opt, int value) override;
diff --git a/webrtc/base/maccocoasocketserver_unittest.mm b/webrtc/base/maccocoasocketserver_unittest.mm
index 932b4a1..5401ffb 100644
--- a/webrtc/base/maccocoasocketserver_unittest.mm
+++ b/webrtc/base/maccocoasocketserver_unittest.mm
@@ -32,7 +32,7 @@
// Test that MacCocoaSocketServer::Wait works as expected.
TEST(MacCocoaSocketServer, TestWait) {
MacCocoaSocketServer server;
- uint32 start = Time();
+ uint32_t start = Time();
server.Wait(1000, true);
EXPECT_GE(TimeSince(start), 1000);
}
@@ -41,7 +41,7 @@
TEST(MacCocoaSocketServer, TestWakeup) {
MacCFSocketServer server;
WakeThread thread(&server);
- uint32 start = Time();
+ uint32_t start = Time();
thread.Start();
server.Wait(10000, true);
EXPECT_LT(TimeSince(start), 10000);
diff --git a/webrtc/base/macsocketserver_unittest.cc b/webrtc/base/macsocketserver_unittest.cc
index 97732d7..ecb9a706 100644
--- a/webrtc/base/macsocketserver_unittest.cc
+++ b/webrtc/base/macsocketserver_unittest.cc
@@ -35,7 +35,7 @@
// Test that MacCFSocketServer::Wait works as expected.
TEST(MacCFSocketServerTest, TestWait) {
MacCFSocketServer server;
- uint32 start = Time();
+ uint32_t start = Time();
server.Wait(1000, true);
EXPECT_GE(TimeSince(start), 1000);
}
@@ -44,7 +44,7 @@
TEST(MacCFSocketServerTest, TestWakeup) {
MacCFSocketServer server;
WakeThread thread(&server);
- uint32 start = Time();
+ uint32_t start = Time();
thread.Start();
server.Wait(10000, true);
EXPECT_LT(TimeSince(start), 10000);
@@ -53,7 +53,7 @@
// Test that MacCarbonSocketServer::Wait works as expected.
TEST(MacCarbonSocketServerTest, TestWait) {
MacCarbonSocketServer server;
- uint32 start = Time();
+ uint32_t start = Time();
server.Wait(1000, true);
EXPECT_GE(TimeSince(start), 1000);
}
@@ -62,7 +62,7 @@
TEST(MacCarbonSocketServerTest, TestWakeup) {
MacCarbonSocketServer server;
WakeThread thread(&server);
- uint32 start = Time();
+ uint32_t start = Time();
thread.Start();
server.Wait(10000, true);
EXPECT_LT(TimeSince(start), 10000);
@@ -71,7 +71,7 @@
// Test that MacCarbonAppSocketServer::Wait works as expected.
TEST(MacCarbonAppSocketServerTest, TestWait) {
MacCarbonAppSocketServer server;
- uint32 start = Time();
+ uint32_t start = Time();
server.Wait(1000, true);
EXPECT_GE(TimeSince(start), 1000);
}
@@ -80,7 +80,7 @@
TEST(MacCarbonAppSocketServerTest, TestWakeup) {
MacCarbonAppSocketServer server;
WakeThread thread(&server);
- uint32 start = Time();
+ uint32_t start = Time();
thread.Start();
server.Wait(10000, true);
EXPECT_LT(TimeSince(start), 10000);
diff --git a/webrtc/base/md5.cc b/webrtc/base/md5.cc
index 6d47b60..fda6ddd 100644
--- a/webrtc/base/md5.cc
+++ b/webrtc/base/md5.cc
@@ -30,7 +30,7 @@
#ifdef RTC_ARCH_CPU_LITTLE_ENDIAN
#define ByteReverse(buf, len) // Nothing.
#else // RTC_ARCH_CPU_BIG_ENDIAN
-static void ByteReverse(uint32* buf, int len) {
+static void ByteReverse(uint32_t* buf, int len) {
for (int i = 0; i < len; ++i) {
buf[i] = rtc::GetLE32(&buf[i]);
}
@@ -49,18 +49,18 @@
}
// Update context to reflect the concatenation of another buffer full of bytes.
-void MD5Update(MD5Context* ctx, const uint8* buf, size_t len) {
+void MD5Update(MD5Context* ctx, const uint8_t* buf, size_t len) {
// Update bitcount.
- uint32 t = ctx->bits[0];
- if ((ctx->bits[0] = t + (static_cast<uint32>(len) << 3)) < t) {
+ uint32_t t = ctx->bits[0];
+ if ((ctx->bits[0] = t + (static_cast<uint32_t>(len) << 3)) < t) {
ctx->bits[1]++; // Carry from low to high.
}
- ctx->bits[1] += static_cast<uint32>(len >> 29);
+ ctx->bits[1] += static_cast<uint32_t>(len >> 29);
t = (t >> 3) & 0x3f; // Bytes already in shsInfo->data.
// Handle any leading odd-sized chunks.
if (t) {
- uint8* p = reinterpret_cast<uint8*>(ctx->in) + t;
+ uint8_t* p = reinterpret_cast<uint8_t*>(ctx->in) + t;
t = 64-t;
if (len < t) {
@@ -89,13 +89,13 @@
// Final wrapup - pad to 64-byte boundary with the bit pattern.
// 1 0* (64-bit count of bits processed, MSB-first)
-void MD5Final(MD5Context* ctx, uint8 digest[16]) {
+void MD5Final(MD5Context* ctx, uint8_t digest[16]) {
// Compute number of bytes mod 64.
- uint32 count = (ctx->bits[0] >> 3) & 0x3F;
+ uint32_t count = (ctx->bits[0] >> 3) & 0x3F;
// Set the first char of padding to 0x80. This is safe since there is
// always at least one byte free.
- uint8* p = reinterpret_cast<uint8*>(ctx->in) + count;
+ uint8_t* p = reinterpret_cast<uint8_t*>(ctx->in) + count;
*p++ = 0x80;
// Bytes of padding needed to make 64 bytes.
@@ -140,11 +140,11 @@
// The core of the MD5 algorithm, this alters an existing MD5 hash to
// reflect the addition of 16 longwords of new data. MD5Update blocks
// the data and converts bytes into longwords for this routine.
-void MD5Transform(uint32 buf[4], const uint32 in[16]) {
- uint32 a = buf[0];
- uint32 b = buf[1];
- uint32 c = buf[2];
- uint32 d = buf[3];
+void MD5Transform(uint32_t buf[4], const uint32_t in[16]) {
+ uint32_t a = buf[0];
+ uint32_t b = buf[1];
+ uint32_t c = buf[2];
+ uint32_t d = buf[3];
MD5STEP(F1, a, b, c, d, in[ 0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[ 1] + 0xe8c7b756, 12);
diff --git a/webrtc/base/md5.h b/webrtc/base/md5.h
index 80294bb..45e00b7 100644
--- a/webrtc/base/md5.h
+++ b/webrtc/base/md5.h
@@ -18,24 +18,26 @@
// Changes(fbarchard): Ported to C++ and Google style guide.
// Made context first parameter in MD5Final for consistency with Sha1.
// Changes(hellner): added rtc namespace
+// Changes(pbos): Reverted types back to uint32(8)_t with _t suffix.
#ifndef WEBRTC_BASE_MD5_H_
#define WEBRTC_BASE_MD5_H_
-#include "webrtc/base/basictypes.h"
+#include <stdint.h>
+#include <stdlib.h>
namespace rtc {
struct MD5Context {
- uint32 buf[4];
- uint32 bits[2];
- uint32 in[16];
+ uint32_t buf[4];
+ uint32_t bits[2];
+ uint32_t in[16];
};
void MD5Init(MD5Context* context);
-void MD5Update(MD5Context* context, const uint8* data, size_t len);
-void MD5Final(MD5Context* context, uint8 digest[16]);
-void MD5Transform(uint32 buf[4], const uint32 in[16]);
+void MD5Update(MD5Context* context, const uint8_t* data, size_t len);
+void MD5Final(MD5Context* context, uint8_t digest[16]);
+void MD5Transform(uint32_t buf[4], const uint32_t in[16]);
} // namespace rtc
diff --git a/webrtc/base/md5digest.cc b/webrtc/base/md5digest.cc
index 1d014c3..74f6bed 100644
--- a/webrtc/base/md5digest.cc
+++ b/webrtc/base/md5digest.cc
@@ -17,14 +17,14 @@
}
void Md5Digest::Update(const void* buf, size_t len) {
- MD5Update(&ctx_, static_cast<const uint8*>(buf), len);
+ MD5Update(&ctx_, static_cast<const uint8_t*>(buf), len);
}
size_t Md5Digest::Finish(void* buf, size_t len) {
if (len < kSize) {
return 0;
}
- MD5Final(&ctx_, static_cast<uint8*>(buf));
+ MD5Final(&ctx_, static_cast<uint8_t*>(buf));
MD5Init(&ctx_); // Reset for next use.
return kSize;
}
diff --git a/webrtc/base/messagedigest.cc b/webrtc/base/messagedigest.cc
index 8af60d9..0c2b4a1 100644
--- a/webrtc/base/messagedigest.cc
+++ b/webrtc/base/messagedigest.cc
@@ -117,7 +117,7 @@
}
// Copy the key to a block-sized buffer to simplify padding.
// If the key is longer than a block, hash it and use the result instead.
- scoped_ptr<uint8[]> new_key(new uint8[block_len]);
+ scoped_ptr<uint8_t[]> new_key(new uint8_t[block_len]);
if (key_len > block_len) {
ComputeDigest(digest, key, key_len, new_key.get(), block_len);
memset(new_key.get() + digest->Size(), 0, block_len - digest->Size());
@@ -126,13 +126,14 @@
memset(new_key.get() + key_len, 0, block_len - key_len);
}
// Set up the padding from the key, salting appropriately for each padding.
- scoped_ptr<uint8[]> o_pad(new uint8[block_len]), i_pad(new uint8[block_len]);
+ scoped_ptr<uint8_t[]> o_pad(new uint8_t[block_len]);
+ scoped_ptr<uint8_t[]> i_pad(new uint8_t[block_len]);
for (size_t i = 0; i < block_len; ++i) {
o_pad[i] = 0x5c ^ new_key[i];
i_pad[i] = 0x36 ^ new_key[i];
}
// Inner hash; hash the inner padding, and then the input buffer.
- scoped_ptr<uint8[]> inner(new uint8[digest->Size()]);
+ scoped_ptr<uint8_t[]> inner(new uint8_t[digest->Size()]);
digest->Update(i_pad.get(), block_len);
digest->Update(input, in_len);
digest->Finish(inner.get(), digest->Size());
diff --git a/webrtc/base/messagequeue.cc b/webrtc/base/messagequeue.cc
index 5cf448e..857cf12 100644
--- a/webrtc/base/messagequeue.cc
+++ b/webrtc/base/messagequeue.cc
@@ -27,7 +27,7 @@
namespace rtc {
-const uint32 kMaxMsgLatency = 150; // 150 ms
+const uint32_t kMaxMsgLatency = 150; // 150 ms
//------------------------------------------------------------------
// MessageQueueManager
@@ -188,8 +188,8 @@
int cmsTotal = cmsWait;
int cmsElapsed = 0;
- uint32 msStart = Time();
- uint32 msCurrent = msStart;
+ uint32_t msStart = Time();
+ uint32_t msCurrent = msStart;
while (true) {
// Check for sent messages
ReceiveSends();
@@ -227,7 +227,7 @@
// Log a warning for time-sensitive messages that we're late to deliver.
if (pmsg->ts_sensitive) {
- int32 delay = TimeDiff(msCurrent, pmsg->ts_sensitive);
+ int32_t delay = TimeDiff(msCurrent, pmsg->ts_sensitive);
if (delay > 0) {
LOG_F(LS_WARNING) << "id: " << pmsg->message_id << " delay: "
<< (delay + kMaxMsgLatency) << "ms";
@@ -276,8 +276,10 @@
void MessageQueue::ReceiveSends() {
}
-void MessageQueue::Post(MessageHandler *phandler, uint32 id,
- MessageData *pdata, bool time_sensitive) {
+void MessageQueue::Post(MessageHandler* phandler,
+ uint32_t id,
+ MessageData* pdata,
+ bool time_sensitive) {
if (fStop_)
return;
@@ -299,20 +301,23 @@
void MessageQueue::PostDelayed(int cmsDelay,
MessageHandler* phandler,
- uint32 id,
+ uint32_t id,
MessageData* pdata) {
return DoDelayPost(cmsDelay, TimeAfter(cmsDelay), phandler, id, pdata);
}
-void MessageQueue::PostAt(uint32 tstamp,
+void MessageQueue::PostAt(uint32_t tstamp,
MessageHandler* phandler,
- uint32 id,
+ uint32_t id,
MessageData* pdata) {
return DoDelayPost(TimeUntil(tstamp), tstamp, phandler, id, pdata);
}
-void MessageQueue::DoDelayPost(int cmsDelay, uint32 tstamp,
- MessageHandler *phandler, uint32 id, MessageData* pdata) {
+void MessageQueue::DoDelayPost(int cmsDelay,
+ uint32_t tstamp,
+ MessageHandler* phandler,
+ uint32_t id,
+ MessageData* pdata) {
if (fStop_)
return;
@@ -350,7 +355,8 @@
return kForever;
}
-void MessageQueue::Clear(MessageHandler *phandler, uint32 id,
+void MessageQueue::Clear(MessageHandler* phandler,
+ uint32_t id,
MessageList* removed) {
CritScope cs(&crit_);
diff --git a/webrtc/base/messagequeue.h b/webrtc/base/messagequeue.h
index 23dbafc..c3ab3b6 100644
--- a/webrtc/base/messagequeue.h
+++ b/webrtc/base/messagequeue.h
@@ -123,8 +123,8 @@
T* data_;
};
-const uint32 MQID_ANY = static_cast<uint32>(-1);
-const uint32 MQID_DISPOSE = static_cast<uint32>(-2);
+const uint32_t MQID_ANY = static_cast<uint32_t>(-1);
+const uint32_t MQID_DISPOSE = static_cast<uint32_t>(-2);
// No destructor
@@ -132,14 +132,14 @@
Message() {
memset(this, 0, sizeof(*this));
}
- inline bool Match(MessageHandler* handler, uint32 id) const {
+ inline bool Match(MessageHandler* handler, uint32_t id) const {
return (handler == NULL || handler == phandler)
&& (id == MQID_ANY || id == message_id);
}
MessageHandler *phandler;
- uint32 message_id;
+ uint32_t message_id;
MessageData *pdata;
- uint32 ts_sensitive;
+ uint32_t ts_sensitive;
};
typedef std::list<Message> MessageList;
@@ -149,8 +149,8 @@
class DelayedMessage {
public:
- DelayedMessage(int delay, uint32 trigger, uint32 num, const Message& msg)
- : cmsDelay_(delay), msTrigger_(trigger), num_(num), msg_(msg) { }
+ DelayedMessage(int delay, uint32_t trigger, uint32_t num, const Message& msg)
+ : cmsDelay_(delay), msTrigger_(trigger), num_(num), msg_(msg) {}
bool operator< (const DelayedMessage& dmsg) const {
return (dmsg.msTrigger_ < msTrigger_)
@@ -158,8 +158,8 @@
}
int cmsDelay_; // for debugging
- uint32 msTrigger_;
- uint32 num_;
+ uint32_t msTrigger_;
+ uint32_t num_;
Message msg_;
};
@@ -190,17 +190,20 @@
virtual bool Get(Message *pmsg, int cmsWait = kForever,
bool process_io = true);
virtual bool Peek(Message *pmsg, int cmsWait = 0);
- virtual void Post(MessageHandler *phandler, uint32 id = 0,
- MessageData *pdata = NULL, bool time_sensitive = false);
+ virtual void Post(MessageHandler* phandler,
+ uint32_t id = 0,
+ MessageData* pdata = NULL,
+ bool time_sensitive = false);
virtual void PostDelayed(int cmsDelay,
MessageHandler* phandler,
- uint32 id = 0,
+ uint32_t id = 0,
MessageData* pdata = NULL);
- virtual void PostAt(uint32 tstamp,
+ virtual void PostAt(uint32_t tstamp,
MessageHandler* phandler,
- uint32 id = 0,
+ uint32_t id = 0,
MessageData* pdata = NULL);
- virtual void Clear(MessageHandler *phandler, uint32 id = MQID_ANY,
+ virtual void Clear(MessageHandler* phandler,
+ uint32_t id = MQID_ANY,
MessageList* removed = NULL);
virtual void Dispatch(Message *pmsg);
virtual void ReceiveSends();
@@ -232,8 +235,11 @@
void reheap() { make_heap(c.begin(), c.end(), comp); }
};
- void DoDelayPost(int cmsDelay, uint32 tstamp, MessageHandler *phandler,
- uint32 id, MessageData* pdata);
+ void DoDelayPost(int cmsDelay,
+ uint32_t tstamp,
+ MessageHandler* phandler,
+ uint32_t id,
+ MessageData* pdata);
// The SocketServer is not owned by MessageQueue.
SocketServer* ss_;
@@ -244,7 +250,7 @@
Message msgPeek_;
MessageList msgq_;
PriorityQueue dmsgq_;
- uint32 dmsgq_next_num_;
+ uint32_t dmsgq_next_num_;
mutable CriticalSection crit_;
private:
diff --git a/webrtc/base/natsocketfactory.cc b/webrtc/base/natsocketfactory.cc
index a23a7e8..548a80c 100644
--- a/webrtc/base/natsocketfactory.cc
+++ b/webrtc/base/natsocketfactory.cc
@@ -26,7 +26,7 @@
buf[0] = 0;
buf[1] = family;
// Writes the port.
- *(reinterpret_cast<uint16*>(&buf[2])) = HostToNetwork16(remote_addr.port());
+ *(reinterpret_cast<uint16_t*>(&buf[2])) = HostToNetwork16(remote_addr.port());
if (family == AF_INET) {
ASSERT(buf_size >= kNATEncodedIPv4AddressSize);
in_addr v4addr = ip.ipv4_address();
@@ -49,7 +49,8 @@
ASSERT(buf_size >= 8);
ASSERT(buf[0] == 0);
int family = buf[1];
- uint16 port = NetworkToHost16(*(reinterpret_cast<const uint16*>(&buf[2])));
+ uint16_t port =
+ NetworkToHost16(*(reinterpret_cast<const uint16_t*>(&buf[2])));
if (family == AF_INET) {
const in_addr* v4addr = reinterpret_cast<const in_addr*>(&buf[4]);
*remote_addr = SocketAddress(IPAddress(*v4addr), port);
@@ -220,7 +221,7 @@
ConnState GetState() const override {
return connected_ ? CS_CONNECTED : CS_CLOSED;
}
- int EstimateMTU(uint16* mtu) override { return socket_->EstimateMTU(mtu); }
+ int EstimateMTU(uint16_t* mtu) override { return socket_->EstimateMTU(mtu); }
int GetOption(Option opt, int* value) override {
return socket_->GetOption(opt, value);
}
diff --git a/webrtc/base/network.cc b/webrtc/base/network.cc
index bc7d505..bc714e3 100644
--- a/webrtc/base/network.cc
+++ b/webrtc/base/network.cc
@@ -62,8 +62,8 @@
// limit of IPv6 networks but could be changed by set_max_ipv6_networks().
const int kMaxIPv6Networks = 5;
-const uint32 kUpdateNetworksMessage = 1;
-const uint32 kSignalNetworksMessage = 2;
+const uint32_t kUpdateNetworksMessage = 1;
+const uint32_t kSignalNetworksMessage = 2;
// Fetch list of networks every two seconds.
const int kNetworksUpdateIntervalMs = 2000;
diff --git a/webrtc/base/nullsocketserver_unittest.cc b/webrtc/base/nullsocketserver_unittest.cc
index 4bb1d7f..2aa38b4 100644
--- a/webrtc/base/nullsocketserver_unittest.cc
+++ b/webrtc/base/nullsocketserver_unittest.cc
@@ -14,7 +14,7 @@
namespace rtc {
-static const uint32 kTimeout = 5000U;
+static const uint32_t kTimeout = 5000U;
class NullSocketServerTest
: public testing::Test,
@@ -38,7 +38,7 @@
}
TEST_F(NullSocketServerTest, TestWait) {
- uint32 start = Time();
+ uint32_t start = Time();
ss_.Wait(200, true);
// The actual wait time is dependent on the resolution of the timer used by
// the Event class. Allow for the event to signal ~20ms early.
diff --git a/webrtc/base/opensslstreamadapter.cc b/webrtc/base/opensslstreamadapter.cc
index c759ee5..67ed5db 100644
--- a/webrtc/base/opensslstreamadapter.cc
+++ b/webrtc/base/opensslstreamadapter.cc
@@ -384,17 +384,16 @@
// Key Extractor interface
bool OpenSSLStreamAdapter::ExportKeyingMaterial(const std::string& label,
- const uint8* context,
+ const uint8_t* context,
size_t context_len,
bool use_context,
- uint8* result,
+ uint8_t* result,
size_t result_len) {
#ifdef HAVE_DTLS_SRTP
int i;
- i = SSL_export_keying_material(ssl_, result, result_len,
- label.c_str(), label.length(),
- const_cast<uint8 *>(context),
+ i = SSL_export_keying_material(ssl_, result, result_len, label.c_str(),
+ label.length(), const_cast<uint8_t*>(context),
context_len, use_context);
if (i != 1)
diff --git a/webrtc/base/opensslstreamadapter.h b/webrtc/base/opensslstreamadapter.h
index 56bba41..0f3ded9 100644
--- a/webrtc/base/opensslstreamadapter.h
+++ b/webrtc/base/opensslstreamadapter.h
@@ -94,10 +94,10 @@
// Key Extractor interface
bool ExportKeyingMaterial(const std::string& label,
- const uint8* context,
+ const uint8_t* context,
size_t context_len,
bool use_context,
- uint8* result,
+ uint8_t* result,
size_t result_len) override;
// DTLS-SRTP interface
diff --git a/webrtc/base/pathutils.cc b/webrtc/base/pathutils.cc
index 7671bfc..b5227ec 100644
--- a/webrtc/base/pathutils.cc
+++ b/webrtc/base/pathutils.cc
@@ -225,12 +225,13 @@
}
#if defined(WEBRTC_WIN)
-bool Pathname::GetDrive(char *drive, uint32 bytes) const {
+bool Pathname::GetDrive(char* drive, uint32_t bytes) const {
return GetDrive(drive, bytes, folder_);
}
// static
-bool Pathname::GetDrive(char *drive, uint32 bytes,
+bool Pathname::GetDrive(char* drive,
+ uint32_t bytes,
const std::string& pathname) {
// need at lease 4 bytes to save c:
if (bytes < 4 || pathname.size() < 3) {
diff --git a/webrtc/base/pathutils.h b/webrtc/base/pathutils.h
index 8f07e1d..2d5819f 100644
--- a/webrtc/base/pathutils.h
+++ b/webrtc/base/pathutils.h
@@ -92,8 +92,10 @@
bool SetFilename(const std::string& filename);
#if defined(WEBRTC_WIN)
- bool GetDrive(char *drive, uint32 bytes) const;
- static bool GetDrive(char *drive, uint32 bytes,const std::string& pathname);
+ bool GetDrive(char* drive, uint32_t bytes) const;
+ static bool GetDrive(char* drive,
+ uint32_t bytes,
+ const std::string& pathname);
#endif
private:
diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc
index b9c2a07..01f0731 100644
--- a/webrtc/base/physicalsocketserver.cc
+++ b/webrtc/base/physicalsocketserver.cc
@@ -68,26 +68,26 @@
#if defined(WEBRTC_WIN)
// Standard MTUs, from RFC 1191
-const uint16 PACKET_MAXIMUMS[] = {
- 65535, // Theoretical maximum, Hyperchannel
- 32000, // Nothing
- 17914, // 16Mb IBM Token Ring
- 8166, // IEEE 802.4
- //4464, // IEEE 802.5 (4Mb max)
- 4352, // FDDI
- //2048, // Wideband Network
- 2002, // IEEE 802.5 (4Mb recommended)
- //1536, // Expermental Ethernet Networks
- //1500, // Ethernet, Point-to-Point (default)
- 1492, // IEEE 802.3
- 1006, // SLIP, ARPANET
- //576, // X.25 Networks
- //544, // DEC IP Portal
- //512, // NETBIOS
- 508, // IEEE 802/Source-Rt Bridge, ARCNET
- 296, // Point-to-Point (low delay)
- 68, // Official minimum
- 0, // End of list marker
+const uint16_t PACKET_MAXIMUMS[] = {
+ 65535, // Theoretical maximum, Hyperchannel
+ 32000, // Nothing
+ 17914, // 16Mb IBM Token Ring
+ 8166, // IEEE 802.4
+ // 4464, // IEEE 802.5 (4Mb max)
+ 4352, // FDDI
+ // 2048, // Wideband Network
+ 2002, // IEEE 802.5 (4Mb recommended)
+ // 1536, // Expermental Ethernet Networks
+ // 1500, // Ethernet, Point-to-Point (default)
+ 1492, // IEEE 802.3
+ 1006, // SLIP, ARPANET
+ // 576, // X.25 Networks
+ // 544, // DEC IP Portal
+ // 512, // NETBIOS
+ 508, // IEEE 802/Source-Rt Bridge, ARCNET
+ 296, // Point-to-Point (low delay)
+ 68, // Official minimum
+ 0, // End of list marker
};
static const int IP_HEADER_SIZE = 20u;
@@ -398,7 +398,7 @@
return err;
}
- int EstimateMTU(uint16* mtu) override {
+ int EstimateMTU(uint16_t* mtu) override {
SocketAddress addr = GetRemoteAddress();
if (addr.IsAny()) {
SetError(ENOTCONN);
@@ -420,7 +420,7 @@
}
for (int level = 0; PACKET_MAXIMUMS[level + 1] > 0; ++level) {
- int32 size = PACKET_MAXIMUMS[level] - header_size;
+ int32_t size = PACKET_MAXIMUMS[level] - header_size;
WinPing::PingResult result = ping.Ping(addr.ipaddr(), size,
ICMP_PING_TIMEOUT_MILLIS,
1, false);
@@ -541,7 +541,7 @@
PhysicalSocketServer* ss_;
SOCKET s_;
- uint8 enabled_events_;
+ uint8_t enabled_events_;
bool udp_;
int error_;
// Protects |error_| that is accessed from different threads.
@@ -572,28 +572,28 @@
virtual void Signal() {
CritScope cs(&crit_);
if (!fSignaled_) {
- const uint8 b[1] = { 0 };
+ const uint8_t b[1] = {0};
if (VERIFY(1 == write(afd_[1], b, sizeof(b)))) {
fSignaled_ = true;
}
}
}
- uint32 GetRequestedEvents() override { return DE_READ; }
+ uint32_t GetRequestedEvents() override { return DE_READ; }
- void OnPreEvent(uint32 ff) override {
+ void OnPreEvent(uint32_t ff) override {
// It is not possible to perfectly emulate an auto-resetting event with
// pipes. This simulates it by resetting before the event is handled.
CritScope cs(&crit_);
if (fSignaled_) {
- uint8 b[4]; // Allow for reading more than 1 byte, but expect 1.
+ uint8_t b[4]; // Allow for reading more than 1 byte, but expect 1.
VERIFY(1 == read(afd_[0], b, sizeof(b)));
fSignaled_ = false;
}
}
- void OnEvent(uint32 ff, int err) override { ASSERT(false); }
+ void OnEvent(uint32_t ff, int err) override { ASSERT(false); }
int GetDescriptor() override { return afd_[0]; }
@@ -661,7 +661,7 @@
// Set a flag saying we've seen this signal.
received_signal_[signum] = true;
// Notify application code that we got a signal.
- const uint8 b[1] = { 0 };
+ const uint8_t b[1] = {0};
if (-1 == write(afd_[1], b, sizeof(b))) {
// Nothing we can do here. If there's an error somehow then there's
// nothing we can safely do from a signal handler.
@@ -718,7 +718,7 @@
// will still be handled, so this isn't a problem.
// Volatile is not necessary here for correctness, but this data _is_ volatile
// so I've marked it as such.
- volatile uint8 received_signal_[kNumPosixSignals];
+ volatile uint8_t received_signal_[kNumPosixSignals];
};
class PosixSignalDispatcher : public Dispatcher {
@@ -731,12 +731,12 @@
owner_->Remove(this);
}
- uint32 GetRequestedEvents() override { return DE_READ; }
+ uint32_t GetRequestedEvents() override { return DE_READ; }
- void OnPreEvent(uint32 ff) override {
+ void OnPreEvent(uint32_t ff) override {
// Events might get grouped if signals come very fast, so we read out up to
// 16 bytes to make sure we keep the pipe empty.
- uint8 b[16];
+ uint8_t b[16];
ssize_t ret = read(GetDescriptor(), b, sizeof(b));
if (ret < 0) {
LOG_ERR(LS_WARNING) << "Error in read()";
@@ -745,7 +745,7 @@
}
}
- void OnEvent(uint32 ff, int err) override {
+ void OnEvent(uint32_t ff, int err) override {
for (int signum = 0; signum < PosixSignalHandler::kNumPosixSignals;
++signum) {
if (PosixSignalHandler::Instance()->IsSignalSet(signum)) {
@@ -856,16 +856,16 @@
}
}
- uint32 GetRequestedEvents() override { return enabled_events_; }
+ uint32_t GetRequestedEvents() override { return enabled_events_; }
- void OnPreEvent(uint32 ff) override {
+ void OnPreEvent(uint32_t ff) override {
if ((ff & DE_CONNECT) != 0)
state_ = CS_CONNECTED;
if ((ff & DE_CLOSE) != 0)
state_ = CS_CLOSED;
}
- void OnEvent(uint32 ff, int err) override {
+ void OnEvent(uint32_t ff, int err) override {
// Make sure we deliver connect/accept first. Otherwise, consumers may see
// something like a READ followed by a CONNECT, which would be odd.
if ((ff & DE_CONNECT) != 0) {
@@ -920,11 +920,11 @@
bool IsDescriptorClosed() override { return false; }
- uint32 GetRequestedEvents() override { return flags_; }
+ uint32_t GetRequestedEvents() override { return flags_; }
- void OnPreEvent(uint32 ff) override {}
+ void OnPreEvent(uint32_t ff) override {}
- void OnEvent(uint32 ff, int err) override {
+ void OnEvent(uint32_t ff, int err) override {
if ((ff & DE_READ) != 0)
SignalReadEvent(this);
if ((ff & DE_WRITE) != 0)
@@ -958,8 +958,8 @@
#endif // WEBRTC_POSIX
#if defined(WEBRTC_WIN)
-static uint32 FlagsToEvents(uint32 events) {
- uint32 ffFD = FD_CLOSE;
+static uint32_t FlagsToEvents(uint32_t events) {
+ uint32_t ffFD = FD_CLOSE;
if (events & DE_READ)
ffFD |= FD_READ;
if (events & DE_WRITE)
@@ -993,16 +993,11 @@
WSASetEvent(hev_);
}
- virtual uint32 GetRequestedEvents() {
- return 0;
- }
+ virtual uint32_t GetRequestedEvents() { return 0; }
- virtual void OnPreEvent(uint32 ff) {
- WSAResetEvent(hev_);
- }
+ virtual void OnPreEvent(uint32_t ff) { WSAResetEvent(hev_); }
- virtual void OnEvent(uint32 ff, int err) {
- }
+ virtual void OnEvent(uint32_t ff, int err) {}
virtual WSAEVENT GetWSAEvent() {
return hev_;
@@ -1077,17 +1072,15 @@
return PhysicalSocket::Close();
}
- virtual uint32 GetRequestedEvents() {
- return enabled_events_;
- }
+ virtual uint32_t GetRequestedEvents() { return enabled_events_; }
- virtual void OnPreEvent(uint32 ff) {
+ virtual void OnPreEvent(uint32_t ff) {
if ((ff & DE_CONNECT) != 0)
state_ = CS_CONNECTED;
// We set CS_CLOSED from CheckSignalClose.
}
- virtual void OnEvent(uint32 ff, int err) {
+ virtual void OnEvent(uint32_t ff, int err) {
int cache_id = id_;
// Make sure we deliver connect/accept first. Otherwise, consumers may see
// something like a READ followed by a CONNECT, which would be odd.
@@ -1154,7 +1147,7 @@
}
~Signaler() override { }
- void OnEvent(uint32 ff, int err) override {
+ void OnEvent(uint32_t ff, int err) override {
if (pf_)
*pf_ = false;
}
@@ -1312,7 +1305,7 @@
if (fd > fdmax)
fdmax = fd;
- uint32 ff = pdispatcher->GetRequestedEvents();
+ uint32_t ff = pdispatcher->GetRequestedEvents();
if (ff & (DE_READ | DE_ACCEPT))
FD_SET(fd, &fdsRead);
if (ff & (DE_WRITE | DE_CONNECT))
@@ -1345,7 +1338,7 @@
for (size_t i = 0; i < dispatchers_.size(); ++i) {
Dispatcher *pdispatcher = dispatchers_[i];
int fd = pdispatcher->GetDescriptor();
- uint32 ff = 0;
+ uint32_t ff = 0;
int errcode = 0;
// Reap any error code, which can be signaled through reads or writes.
@@ -1479,7 +1472,7 @@
bool PhysicalSocketServer::Wait(int cmsWait, bool process_io) {
int cmsTotal = cmsWait;
int cmsElapsed = 0;
- uint32 msStart = Time();
+ uint32_t msStart = Time();
fWait_ = true;
while (fWait_) {
@@ -1590,7 +1583,7 @@
}
}
#endif
- uint32 ff = 0;
+ uint32_t ff = 0;
int errcode = 0;
if (wsaEvents.lNetworkEvents & FD_READ)
ff |= DE_READ;
diff --git a/webrtc/base/physicalsocketserver.h b/webrtc/base/physicalsocketserver.h
index 15be789..af09e0b 100644
--- a/webrtc/base/physicalsocketserver.h
+++ b/webrtc/base/physicalsocketserver.h
@@ -41,9 +41,9 @@
class Dispatcher {
public:
virtual ~Dispatcher() {}
- virtual uint32 GetRequestedEvents() = 0;
- virtual void OnPreEvent(uint32 ff) = 0;
- virtual void OnEvent(uint32 ff, int err) = 0;
+ virtual uint32_t GetRequestedEvents() = 0;
+ virtual void OnPreEvent(uint32_t ff) = 0;
+ virtual void OnEvent(uint32_t ff, int err) = 0;
#if defined(WEBRTC_WIN)
virtual WSAEVENT GetWSAEvent() = 0;
virtual SOCKET GetSocket() = 0;
diff --git a/webrtc/base/profiler.cc b/webrtc/base/profiler.cc
index 9f781fb..873b198 100644
--- a/webrtc/base/profiler.cc
+++ b/webrtc/base/profiler.cc
@@ -55,7 +55,7 @@
++start_count_;
}
-void ProfilerEvent::Stop(uint64 stop_time) {
+void ProfilerEvent::Stop(uint64_t stop_time) {
--start_count_;
ASSERT(start_count_ >= 0);
if (start_count_ == 0) {
@@ -114,7 +114,7 @@
void Profiler::StopEvent(const std::string& event_name) {
// Get the time ASAP, then wait for the lock.
- uint64 stop_time = TimeNanos();
+ uint64_t stop_time = TimeNanos();
SharedScope scope(&lock_);
EventMap::iterator it = events_.find(event_name);
if (it != events_.end()) {
diff --git a/webrtc/base/profiler.h b/webrtc/base/profiler.h
index 68a35b2..419763f 100644
--- a/webrtc/base/profiler.h
+++ b/webrtc/base/profiler.h
@@ -91,7 +91,7 @@
ProfilerEvent();
void Start();
void Stop();
- void Stop(uint64 stop_time);
+ void Stop(uint64_t stop_time);
double standard_deviation() const;
double total_time() const { return total_time_; }
double mean() const { return mean_; }
@@ -101,7 +101,7 @@
bool is_started() const { return start_count_ > 0; }
private:
- uint64 current_start_time_;
+ uint64_t current_start_time_;
double total_time_;
double mean_;
double sum_of_squared_differences_;
diff --git a/webrtc/base/proxydetect.cc b/webrtc/base/proxydetect.cc
index 16bf822..b144d20 100644
--- a/webrtc/base/proxydetect.cc
+++ b/webrtc/base/proxydetect.cc
@@ -213,13 +213,13 @@
int a, b, c, d, m;
int match = sscanf(item, "%d.%d.%d.%d/%d", &a, &b, &c, &d, &m);
if (match >= 4) {
- uint32 ip = ((a & 0xFF) << 24) | ((b & 0xFF) << 16) | ((c & 0xFF) << 8) |
- (d & 0xFF);
+ uint32_t ip = ((a & 0xFF) << 24) | ((b & 0xFF) << 16) | ((c & 0xFF) << 8) |
+ (d & 0xFF);
if ((match < 5) || (m > 32))
m = 32;
else if (m < 0)
m = 0;
- uint32 mask = (m == 0) ? 0 : (~0UL) << (32 - m);
+ uint32_t mask = (m == 0) ? 0 : (~0UL) << (32 - m);
SocketAddress addr(url.host(), 0);
// TODO: Support IPv6 proxyitems. This code block is IPv4 only anyway.
return !addr.IsUnresolved() &&
@@ -289,7 +289,7 @@
ProxyType ptype;
std::string host;
- uint16 port;
+ uint16_t port;
const char* address = saddress.c_str();
while (*address) {
@@ -323,7 +323,7 @@
*colon = 0;
char * endptr;
- port = static_cast<uint16>(strtol(colon + 1, &endptr, 0));
+ port = static_cast<uint16_t>(strtol(colon + 1, &endptr, 0));
if (*endptr != 0) {
LOG(LS_WARNING) << "Proxy address with invalid port [" << buffer << "]";
continue;
@@ -397,7 +397,7 @@
return false;
}
char buffer[NAME_MAX + 1];
- if (0 != FSRefMakePath(&fr, reinterpret_cast<uint8*>(buffer),
+ if (0 != FSRefMakePath(&fr, reinterpret_cast<uint8_t*>(buffer),
ARRAY_SIZE(buffer))) {
LOG(LS_ERROR) << "FSRefMakePath failed";
return false;
diff --git a/webrtc/base/ratetracker.cc b/webrtc/base/ratetracker.cc
index 57906f7..5cb44901 100644
--- a/webrtc/base/ratetracker.cc
+++ b/webrtc/base/ratetracker.cc
@@ -19,13 +19,12 @@
namespace rtc {
-RateTracker::RateTracker(
- uint32 bucket_milliseconds, size_t bucket_count)
+RateTracker::RateTracker(uint32_t bucket_milliseconds, size_t bucket_count)
: bucket_milliseconds_(bucket_milliseconds),
- bucket_count_(bucket_count),
- sample_buckets_(new size_t[bucket_count + 1]),
- total_sample_count_(0u),
- bucket_start_time_milliseconds_(~0u) {
+ bucket_count_(bucket_count),
+ sample_buckets_(new size_t[bucket_count + 1]),
+ total_sample_count_(0u),
+ bucket_start_time_milliseconds_(~0u) {
RTC_CHECK(bucket_milliseconds > 0u);
RTC_CHECK(bucket_count > 0u);
}
@@ -35,26 +34,27 @@
}
double RateTracker::ComputeRateForInterval(
- uint32 interval_milliseconds) const {
+ uint32_t interval_milliseconds) const {
if (bucket_start_time_milliseconds_ == ~0u) {
return 0.0;
}
- uint32 current_time = Time();
+ uint32_t current_time = Time();
// Calculate which buckets to sum up given the current time. If the time
// has passed to a new bucket then we have to skip some of the oldest buckets.
- uint32 available_interval_milliseconds = std::min<uint32>(
+ uint32_t available_interval_milliseconds = std::min<uint32_t>(
interval_milliseconds,
- bucket_milliseconds_ * static_cast<uint32>(bucket_count_));
+ bucket_milliseconds_ * static_cast<uint32_t>(bucket_count_));
// number of old buckets (i.e. after the current bucket in the ring buffer)
// that are expired given our current time interval.
size_t buckets_to_skip;
// Number of milliseconds of the first bucket that are not a portion of the
// current interval.
- uint32 milliseconds_to_skip;
+ uint32_t milliseconds_to_skip;
if (current_time >
initialization_time_milliseconds_ + available_interval_milliseconds) {
- uint32 time_to_skip = current_time - bucket_start_time_milliseconds_ +
- static_cast<uint32>(bucket_count_) * bucket_milliseconds_ -
+ uint32_t time_to_skip =
+ current_time - bucket_start_time_milliseconds_ +
+ static_cast<uint32_t>(bucket_count_) * bucket_milliseconds_ -
available_interval_milliseconds;
buckets_to_skip = time_to_skip / bucket_milliseconds_;
milliseconds_to_skip = time_to_skip % bucket_milliseconds_;
@@ -91,7 +91,7 @@
if (bucket_start_time_milliseconds_ == ~0u) {
return 0.0;
}
- uint32 current_time = Time();
+ uint32_t current_time = Time();
if (TimeIsLaterOrEqual(current_time, initialization_time_milliseconds_)) {
return 0.0;
}
@@ -106,7 +106,7 @@
void RateTracker::AddSamples(size_t sample_count) {
EnsureInitialized();
- uint32 current_time = Time();
+ uint32_t current_time = Time();
// Advance the current bucket as needed for the current time, and reset
// bucket counts as we advance.
for (size_t i = 0u; i <= bucket_count_ &&
@@ -125,7 +125,7 @@
total_sample_count_ += sample_count;
}
-uint32 RateTracker::Time() const {
+uint32_t RateTracker::Time() const {
return rtc::Time();
}
diff --git a/webrtc/base/ratetracker.h b/webrtc/base/ratetracker.h
index 0e2e040..d49d7ca 100644
--- a/webrtc/base/ratetracker.h
+++ b/webrtc/base/ratetracker.h
@@ -21,19 +21,19 @@
// that over each bucket the rate was constant.
class RateTracker {
public:
- RateTracker(uint32 bucket_milliseconds, size_t bucket_count);
+ RateTracker(uint32_t bucket_milliseconds, size_t bucket_count);
virtual ~RateTracker();
// Computes the average rate over the most recent interval_milliseconds,
// or if the first sample was added within this period, computes the rate
// since the first sample was added.
- double ComputeRateForInterval(uint32 interval_milliseconds) const;
+ double ComputeRateForInterval(uint32_t interval_milliseconds) const;
// Computes the average rate over the rate tracker's recording interval
// of bucket_milliseconds * bucket_count.
double ComputeRate() const {
- return ComputeRateForInterval(
- bucket_milliseconds_ * static_cast<uint32>(bucket_count_));
+ return ComputeRateForInterval(bucket_milliseconds_ *
+ static_cast<uint32_t>(bucket_count_));
}
// Computes the average rate since the first sample was added to the
@@ -49,19 +49,19 @@
protected:
// overrideable for tests
- virtual uint32 Time() const;
+ virtual uint32_t Time() const;
private:
void EnsureInitialized();
size_t NextBucketIndex(size_t bucket_index) const;
- const uint32 bucket_milliseconds_;
+ const uint32_t bucket_milliseconds_;
const size_t bucket_count_;
size_t* sample_buckets_;
size_t total_sample_count_;
size_t current_bucket_;
- uint32 bucket_start_time_milliseconds_;
- uint32 initialization_time_milliseconds_;
+ uint32_t bucket_start_time_milliseconds_;
+ uint32_t initialization_time_milliseconds_;
};
} // namespace rtc
diff --git a/webrtc/base/ratetracker_unittest.cc b/webrtc/base/ratetracker_unittest.cc
index 043f537..2187282 100644
--- a/webrtc/base/ratetracker_unittest.cc
+++ b/webrtc/base/ratetracker_unittest.cc
@@ -16,11 +16,11 @@
class RateTrackerForTest : public RateTracker {
public:
RateTrackerForTest() : RateTracker(100u, 10u), time_(0) {}
- virtual uint32 Time() const { return time_; }
- void AdvanceTime(uint32 delta) { time_ += delta; }
+ virtual uint32_t Time() const { return time_; }
+ void AdvanceTime(uint32_t delta) { time_ += delta; }
private:
- uint32 time_;
+ uint32_t time_;
};
TEST(RateTrackerTest, Test30FPS) {
diff --git a/webrtc/base/rtccertificate.cc b/webrtc/base/rtccertificate.cc
index d912eb4..a176d90 100644
--- a/webrtc/base/rtccertificate.cc
+++ b/webrtc/base/rtccertificate.cc
@@ -28,7 +28,7 @@
RTCCertificate::~RTCCertificate() {
}
-uint64 RTCCertificate::expires_timestamp_ns() const {
+uint64_t RTCCertificate::expires_timestamp_ns() const {
// TODO(hbos): Update once SSLIdentity/SSLCertificate supports expires field.
return 0;
}
diff --git a/webrtc/base/rtccertificate.h b/webrtc/base/rtccertificate.h
index cb68355..d238938 100644
--- a/webrtc/base/rtccertificate.h
+++ b/webrtc/base/rtccertificate.h
@@ -27,7 +27,7 @@
// Takes ownership of |identity|.
static scoped_refptr<RTCCertificate> Create(scoped_ptr<SSLIdentity> identity);
- uint64 expires_timestamp_ns() const;
+ uint64_t expires_timestamp_ns() const;
bool HasExpired() const;
const SSLCertificate& ssl_certificate() const;
diff --git a/webrtc/base/sha1.cc b/webrtc/base/sha1.cc
index b2af313..5816152 100644
--- a/webrtc/base/sha1.cc
+++ b/webrtc/base/sha1.cc
@@ -96,6 +96,11 @@
* Modified 05/2015
* By Sergey Ulanov <sergeyu@chromium.org>
* Removed static buffer to make computation thread-safe.
+ *
+ * -----------------
+ * Modified 10/2015
+ * By Peter Boström <pbos@webrtc.org>
+ * Change uint32(8) back to uint32(8)_t (undoes (03/2012) change).
*/
// Enabling SHA1HANDSOFF preserves the caller's data buffer.
@@ -156,13 +161,13 @@
#endif /* VERBOSE */
// Hash a single 512-bit block. This is the core of the algorithm.
-void SHA1Transform(uint32 state[5], const uint8 buffer[64]) {
+void SHA1Transform(uint32_t state[5], const uint8_t buffer[64]) {
union CHAR64LONG16 {
- uint8 c[64];
- uint32 l[16];
+ uint8_t c[64];
+ uint32_t l[16];
};
#ifdef SHA1HANDSOFF
- uint8 workspace[64];
+ uint8_t workspace[64];
memcpy(workspace, buffer, 64);
CHAR64LONG16* block = reinterpret_cast<CHAR64LONG16*>(workspace);
#else
@@ -172,11 +177,11 @@
#endif
// Copy context->state[] to working vars.
- uint32 a = state[0];
- uint32 b = state[1];
- uint32 c = state[2];
- uint32 d = state[3];
- uint32 e = state[4];
+ uint32_t a = state[0];
+ uint32_t b = state[1];
+ uint32_t c = state[2];
+ uint32_t d = state[3];
+ uint32_t e = state[4];
// 4 rounds of 20 operations each. Loop unrolled.
// Note(fbarchard): The following has lint warnings for multiple ; on
@@ -225,7 +230,7 @@
}
// Run your data through this.
-void SHA1Update(SHA1_CTX* context, const uint8* data, size_t input_len) {
+void SHA1Update(SHA1_CTX* context, const uint8_t* data, size_t input_len) {
size_t i = 0;
#ifdef VERBOSE
@@ -236,15 +241,15 @@
size_t index = (context->count[0] >> 3) & 63;
// Update number of bits.
- // TODO: Use uint64 instead of 2 uint32 for count.
+ // TODO: Use uint64_t instead of 2 uint32_t for count.
// count[0] has low 29 bits for byte count + 3 pad 0's making 32 bits for
// bit count.
- // Add bit count to low uint32
- context->count[0] += static_cast<uint32>(input_len << 3);
- if (context->count[0] < static_cast<uint32>(input_len << 3)) {
+ // Add bit count to low uint32_t
+ context->count[0] += static_cast<uint32_t>(input_len << 3);
+ if (context->count[0] < static_cast<uint32_t>(input_len << 3)) {
++context->count[1]; // if overlow (carry), add one to high word
}
- context->count[1] += static_cast<uint32>(input_len >> 29);
+ context->count[1] += static_cast<uint32_t>(input_len >> 29);
if ((index + input_len) > 63) {
i = 64 - index;
memcpy(&context->buffer[index], data, i);
@@ -262,21 +267,21 @@
}
// Add padding and return the message digest.
-void SHA1Final(SHA1_CTX* context, uint8 digest[SHA1_DIGEST_SIZE]) {
- uint8 finalcount[8];
+void SHA1Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]) {
+ uint8_t finalcount[8];
for (int i = 0; i < 8; ++i) {
// Endian independent
- finalcount[i] = static_cast<uint8>(
- (context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8) ) & 255);
+ finalcount[i] = static_cast<uint8_t>(
+ (context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255);
}
- SHA1Update(context, reinterpret_cast<const uint8*>("\200"), 1);
+ SHA1Update(context, reinterpret_cast<const uint8_t*>("\200"), 1);
while ((context->count[0] & 504) != 448) {
- SHA1Update(context, reinterpret_cast<const uint8*>("\0"), 1);
+ SHA1Update(context, reinterpret_cast<const uint8_t*>("\0"), 1);
}
SHA1Update(context, finalcount, 8); // Should cause a SHA1Transform().
for (int i = 0; i < SHA1_DIGEST_SIZE; ++i) {
- digest[i] = static_cast<uint8>(
- (context->state[i >> 2] >> ((3 - (i & 3)) * 8) ) & 255);
+ digest[i] = static_cast<uint8_t>(
+ (context->state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255);
}
// Wipe variables.
diff --git a/webrtc/base/sha1.h b/webrtc/base/sha1.h
index 4862a00..aa5a6a5 100644
--- a/webrtc/base/sha1.h
+++ b/webrtc/base/sha1.h
@@ -5,27 +5,28 @@
*
*/
-// Ported to C++, Google style, under namespace rtc and uses basictypes.h
+// Ported to C++, Google style, under namespace rtc.
#ifndef WEBRTC_BASE_SHA1_H_
#define WEBRTC_BASE_SHA1_H_
-#include "webrtc/base/basictypes.h"
+#include <stdint.h>
+#include <stdlib.h>
namespace rtc {
struct SHA1_CTX {
- uint32 state[5];
- // TODO: Change bit count to uint64.
- uint32 count[2]; // Bit count of input.
- uint8 buffer[64];
+ uint32_t state[5];
+ // TODO: Change bit count to uint64_t.
+ uint32_t count[2]; // Bit count of input.
+ uint8_t buffer[64];
};
#define SHA1_DIGEST_SIZE 20
void SHA1Init(SHA1_CTX* context);
-void SHA1Update(SHA1_CTX* context, const uint8* data, size_t len);
-void SHA1Final(SHA1_CTX* context, uint8 digest[SHA1_DIGEST_SIZE]);
+void SHA1Update(SHA1_CTX* context, const uint8_t* data, size_t len);
+void SHA1Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]);
#endif // WEBRTC_BASE_SHA1_H_
diff --git a/webrtc/base/sha1digest.cc b/webrtc/base/sha1digest.cc
index 5ba0c54..c090a06 100644
--- a/webrtc/base/sha1digest.cc
+++ b/webrtc/base/sha1digest.cc
@@ -17,14 +17,14 @@
}
void Sha1Digest::Update(const void* buf, size_t len) {
- SHA1Update(&ctx_, static_cast<const uint8*>(buf), len);
+ SHA1Update(&ctx_, static_cast<const uint8_t*>(buf), len);
}
size_t Sha1Digest::Finish(void* buf, size_t len) {
if (len < kSize) {
return 0;
}
- SHA1Final(&ctx_, static_cast<uint8*>(buf));
+ SHA1Final(&ctx_, static_cast<uint8_t*>(buf));
SHA1Init(&ctx_); // Reset for next use.
return kSize;
}
diff --git a/webrtc/base/sharedexclusivelock_unittest.cc b/webrtc/base/sharedexclusivelock_unittest.cc
index c124db5..2857e00 100644
--- a/webrtc/base/sharedexclusivelock_unittest.cc
+++ b/webrtc/base/sharedexclusivelock_unittest.cc
@@ -20,8 +20,8 @@
namespace rtc {
-static const uint32 kMsgRead = 0;
-static const uint32 kMsgWrite = 0;
+static const uint32_t kMsgRead = 0;
+static const uint32_t kMsgWrite = 0;
static const int kNoWaitThresholdInMs = 10;
static const int kWaitThresholdInMs = 80;
static const int kProcessTimeInMs = 100;
@@ -69,7 +69,7 @@
TypedMessageData<int*>* message_data =
static_cast<TypedMessageData<int*>*>(message->pdata);
- uint32 start_time = Time();
+ uint32_t start_time = Time();
{
SharedScope ss(shared_exclusive_lock_);
waiting_time_in_ms_ = TimeDiff(Time(), start_time);
@@ -102,7 +102,7 @@
TypedMessageData<int>* message_data =
static_cast<TypedMessageData<int>*>(message->pdata);
- uint32 start_time = Time();
+ uint32_t start_time = Time();
{
ExclusiveScope es(shared_exclusive_lock_);
waiting_time_in_ms_ = TimeDiff(Time(), start_time);
diff --git a/webrtc/base/socket.h b/webrtc/base/socket.h
index 5512c5d..8d98d27 100644
--- a/webrtc/base/socket.h
+++ b/webrtc/base/socket.h
@@ -158,10 +158,10 @@
};
virtual ConnState GetState() const = 0;
- // Fills in the given uint16 with the current estimate of the MTU along the
+ // Fills in the given uint16_t with the current estimate of the MTU along the
// path to the address to which this socket is connected. NOTE: This method
// can block for up to 10 seconds on Windows.
- virtual int EstimateMTU(uint16* mtu) = 0;
+ virtual int EstimateMTU(uint16_t* mtu) = 0;
enum Option {
OPT_DONTFRAGMENT,
diff --git a/webrtc/base/socket_unittest.cc b/webrtc/base/socket_unittest.cc
index 6104eda..d078d7c 100644
--- a/webrtc/base/socket_unittest.cc
+++ b/webrtc/base/socket_unittest.cc
@@ -929,7 +929,7 @@
client->SetOption(rtc::Socket::OPT_SNDBUF, send_buffer_size);
int error = 0;
- uint32 start_ms = Time();
+ uint32_t start_ms = Time();
int sent_packet_num = 0;
int expected_error = EWOULDBLOCK;
while (start_ms + kTimeout > Time()) {
@@ -990,7 +990,7 @@
mtu_socket(
ss_->CreateAsyncSocket(loopback.family(), SOCK_DGRAM));
mtu_socket->Bind(SocketAddress(loopback, 0));
- uint16 mtu;
+ uint16_t mtu;
// should fail until we connect
ASSERT_EQ(-1, mtu_socket->EstimateMTU(&mtu));
mtu_socket->Connect(SocketAddress(loopback, 0));
diff --git a/webrtc/base/socketadapters.cc b/webrtc/base/socketadapters.cc
index b1c2a87..af2efb8 100644
--- a/webrtc/base/socketadapters.cc
+++ b/webrtc/base/socketadapters.cc
@@ -137,41 +137,41 @@
// This is a SSL v2 CLIENT_HELLO message.
// TODO: Should this have a session id? The response doesn't have a
// certificate, so the hello should have a session id.
-static const uint8 kSslClientHello[] = {
- 0x80, 0x46, // msg len
- 0x01, // CLIENT_HELLO
- 0x03, 0x01, // SSL 3.1
- 0x00, 0x2d, // ciphersuite len
- 0x00, 0x00, // session id len
- 0x00, 0x10, // challenge len
- 0x01, 0x00, 0x80, 0x03, 0x00, 0x80, 0x07, 0x00, 0xc0, // ciphersuites
- 0x06, 0x00, 0x40, 0x02, 0x00, 0x80, 0x04, 0x00, 0x80, //
- 0x00, 0x00, 0x04, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x0a, //
- 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x09, 0x00, 0x00, 0x64, //
- 0x00, 0x00, 0x62, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, //
- 0x1f, 0x17, 0x0c, 0xa6, 0x2f, 0x00, 0x78, 0xfc, // challenge
- 0x46, 0x55, 0x2e, 0xb1, 0x83, 0x39, 0xf1, 0xea //
+static const uint8_t kSslClientHello[] = {
+ 0x80, 0x46, // msg len
+ 0x01, // CLIENT_HELLO
+ 0x03, 0x01, // SSL 3.1
+ 0x00, 0x2d, // ciphersuite len
+ 0x00, 0x00, // session id len
+ 0x00, 0x10, // challenge len
+ 0x01, 0x00, 0x80, 0x03, 0x00, 0x80, 0x07, 0x00, 0xc0, // ciphersuites
+ 0x06, 0x00, 0x40, 0x02, 0x00, 0x80, 0x04, 0x00, 0x80, //
+ 0x00, 0x00, 0x04, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x0a, //
+ 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x09, 0x00, 0x00, 0x64, //
+ 0x00, 0x00, 0x62, 0x00, 0x00, 0x03, 0x00, 0x00, 0x06, //
+ 0x1f, 0x17, 0x0c, 0xa6, 0x2f, 0x00, 0x78, 0xfc, // challenge
+ 0x46, 0x55, 0x2e, 0xb1, 0x83, 0x39, 0xf1, 0xea //
};
// This is a TLSv1 SERVER_HELLO message.
-static const uint8 kSslServerHello[] = {
- 0x16, // handshake message
- 0x03, 0x01, // SSL 3.1
- 0x00, 0x4a, // message len
- 0x02, // SERVER_HELLO
- 0x00, 0x00, 0x46, // handshake len
- 0x03, 0x01, // SSL 3.1
- 0x42, 0x85, 0x45, 0xa7, 0x27, 0xa9, 0x5d, 0xa0, // server random
- 0xb3, 0xc5, 0xe7, 0x53, 0xda, 0x48, 0x2b, 0x3f, //
- 0xc6, 0x5a, 0xca, 0x89, 0xc1, 0x58, 0x52, 0xa1, //
- 0x78, 0x3c, 0x5b, 0x17, 0x46, 0x00, 0x85, 0x3f, //
- 0x20, // session id len
- 0x0e, 0xd3, 0x06, 0x72, 0x5b, 0x5b, 0x1b, 0x5f, // session id
- 0x15, 0xac, 0x13, 0xf9, 0x88, 0x53, 0x9d, 0x9b, //
- 0xe8, 0x3d, 0x7b, 0x0c, 0x30, 0x32, 0x6e, 0x38, //
- 0x4d, 0xa2, 0x75, 0x57, 0x41, 0x6c, 0x34, 0x5c, //
- 0x00, 0x04, // RSA/RC4-128/MD5
- 0x00 // null compression
+static const uint8_t kSslServerHello[] = {
+ 0x16, // handshake message
+ 0x03, 0x01, // SSL 3.1
+ 0x00, 0x4a, // message len
+ 0x02, // SERVER_HELLO
+ 0x00, 0x00, 0x46, // handshake len
+ 0x03, 0x01, // SSL 3.1
+ 0x42, 0x85, 0x45, 0xa7, 0x27, 0xa9, 0x5d, 0xa0, // server random
+ 0xb3, 0xc5, 0xe7, 0x53, 0xda, 0x48, 0x2b, 0x3f, //
+ 0xc6, 0x5a, 0xca, 0x89, 0xc1, 0x58, 0x52, 0xa1, //
+ 0x78, 0x3c, 0x5b, 0x17, 0x46, 0x00, 0x85, 0x3f, //
+ 0x20, // session id len
+ 0x0e, 0xd3, 0x06, 0x72, 0x5b, 0x5b, 0x1b, 0x5f, // session id
+ 0x15, 0xac, 0x13, 0xf9, 0x88, 0x53, 0x9d, 0x9b, //
+ 0xe8, 0x3d, 0x7b, 0x0c, 0x30, 0x32, 0x6e, 0x38, //
+ 0x4d, 0xa2, 0x75, 0x57, 0x41, 0x6c, 0x34, 0x5c, //
+ 0x00, 0x04, // RSA/RC4-128/MD5
+ 0x00 // null compression
};
AsyncSSLSocket::AsyncSSLSocket(AsyncSocket* socket)
@@ -564,7 +564,7 @@
ByteBuffer response(data, *len);
if (state_ == SS_HELLO) {
- uint8 ver, method;
+ uint8_t ver, method;
if (!response.ReadUInt8(&ver) ||
!response.ReadUInt8(&method))
return;
@@ -583,7 +583,7 @@
return;
}
} else if (state_ == SS_AUTH) {
- uint8 ver, status;
+ uint8_t ver, status;
if (!response.ReadUInt8(&ver) ||
!response.ReadUInt8(&status))
return;
@@ -595,7 +595,7 @@
SendConnect();
} else if (state_ == SS_CONNECT) {
- uint8 ver, rep, rsv, atyp;
+ uint8_t ver, rep, rsv, atyp;
if (!response.ReadUInt8(&ver) ||
!response.ReadUInt8(&rep) ||
!response.ReadUInt8(&rsv) ||
@@ -607,15 +607,15 @@
return;
}
- uint16 port;
+ uint16_t port;
if (atyp == 1) {
- uint32 addr;
+ uint32_t addr;
if (!response.ReadUInt32(&addr) ||
!response.ReadUInt16(&port))
return;
LOG(LS_VERBOSE) << "Bound on " << addr << ":" << port;
} else if (atyp == 3) {
- uint8 len;
+ uint8_t len;
std::string addr;
if (!response.ReadUInt8(&len) ||
!response.ReadString(&addr, len) ||
@@ -670,9 +670,9 @@
void AsyncSocksProxySocket::SendAuth() {
ByteBuffer request;
request.WriteUInt8(1); // Negotiation Version
- request.WriteUInt8(static_cast<uint8>(user_.size()));
+ request.WriteUInt8(static_cast<uint8_t>(user_.size()));
request.WriteString(user_); // Username
- request.WriteUInt8(static_cast<uint8>(pass_.GetLength()));
+ request.WriteUInt8(static_cast<uint8_t>(pass_.GetLength()));
size_t len = pass_.GetLength() + 1;
char * sensitive = new char[len];
pass_.CopyTo(sensitive, true);
@@ -691,7 +691,7 @@
if (dest_.IsUnresolved()) {
std::string hostname = dest_.hostname();
request.WriteUInt8(3); // DOMAINNAME
- request.WriteUInt8(static_cast<uint8>(hostname.size()));
+ request.WriteUInt8(static_cast<uint8_t>(hostname.size()));
request.WriteString(hostname); // Destination Hostname
} else {
request.WriteUInt8(1); // IPV4
@@ -738,7 +738,7 @@
}
void AsyncSocksProxyServerSocket::HandleHello(ByteBuffer* request) {
- uint8 ver, num_methods;
+ uint8_t ver, num_methods;
if (!request->ReadUInt8(&ver) ||
!request->ReadUInt8(&num_methods)) {
Error(0);
@@ -751,7 +751,7 @@
}
// Handle either no-auth (0) or user/pass auth (2)
- uint8 method = 0xFF;
+ uint8_t method = 0xFF;
if (num_methods > 0 && !request->ReadUInt8(&method)) {
Error(0);
return;
@@ -768,7 +768,7 @@
}
}
-void AsyncSocksProxyServerSocket::SendHelloReply(uint8 method) {
+void AsyncSocksProxyServerSocket::SendHelloReply(uint8_t method) {
ByteBuffer response;
response.WriteUInt8(5); // Socks Version
response.WriteUInt8(method); // Auth method
@@ -776,7 +776,7 @@
}
void AsyncSocksProxyServerSocket::HandleAuth(ByteBuffer* request) {
- uint8 ver, user_len, pass_len;
+ uint8_t ver, user_len, pass_len;
std::string user, pass;
if (!request->ReadUInt8(&ver) ||
!request->ReadUInt8(&user_len) ||
@@ -792,7 +792,7 @@
state_ = SS_CONNECT;
}
-void AsyncSocksProxyServerSocket::SendAuthReply(uint8 result) {
+void AsyncSocksProxyServerSocket::SendAuthReply(uint8_t result) {
ByteBuffer response;
response.WriteUInt8(1); // Negotiation Version
response.WriteUInt8(result);
@@ -800,9 +800,9 @@
}
void AsyncSocksProxyServerSocket::HandleConnect(ByteBuffer* request) {
- uint8 ver, command, reserved, addr_type;
- uint32 ip;
- uint16 port;
+ uint8_t ver, command, reserved, addr_type;
+ uint32_t ip;
+ uint16_t port;
if (!request->ReadUInt8(&ver) ||
!request->ReadUInt8(&command) ||
!request->ReadUInt8(&reserved) ||
diff --git a/webrtc/base/socketadapters.h b/webrtc/base/socketadapters.h
index b7d3d4b4..ece591d 100644
--- a/webrtc/base/socketadapters.h
+++ b/webrtc/base/socketadapters.h
@@ -196,9 +196,9 @@
void DirectSend(const ByteBuffer& buf);
void HandleHello(ByteBuffer* request);
- void SendHelloReply(uint8 method);
+ void SendHelloReply(uint8_t method);
void HandleAuth(ByteBuffer* request);
- void SendAuthReply(uint8 result);
+ void SendAuthReply(uint8_t result);
void HandleConnect(ByteBuffer* request);
void SendConnectResult(int result, const SocketAddress& addr) override;
diff --git a/webrtc/base/socketaddress.cc b/webrtc/base/socketaddress.cc
index b15c0c4..3f13c38 100644
--- a/webrtc/base/socketaddress.cc
+++ b/webrtc/base/socketaddress.cc
@@ -47,7 +47,7 @@
SetPort(port);
}
-SocketAddress::SocketAddress(uint32 ip_as_host_order_integer, int port) {
+SocketAddress::SocketAddress(uint32_t ip_as_host_order_integer, int port) {
SetIP(IPAddress(ip_as_host_order_integer));
SetPort(port);
}
@@ -86,7 +86,7 @@
return *this;
}
-void SocketAddress::SetIP(uint32 ip_as_host_order_integer) {
+void SocketAddress::SetIP(uint32_t ip_as_host_order_integer) {
hostname_.clear();
literal_ = false;
ip_ = IPAddress(ip_as_host_order_integer);
@@ -109,7 +109,7 @@
scope_id_ = 0;
}
-void SocketAddress::SetResolvedIP(uint32 ip_as_host_order_integer) {
+void SocketAddress::SetResolvedIP(uint32_t ip_as_host_order_integer) {
ip_ = IPAddress(ip_as_host_order_integer);
scope_id_ = 0;
}
@@ -121,10 +121,10 @@
void SocketAddress::SetPort(int port) {
ASSERT((0 <= port) && (port < 65536));
- port_ = static_cast<uint16>(port);
+ port_ = static_cast<uint16_t>(port);
}
-uint32 SocketAddress::ip() const {
+uint32_t SocketAddress::ip() const {
return ip_.v4AddressAsHostOrderInteger();
}
@@ -132,7 +132,7 @@
return ip_;
}
-uint16 SocketAddress::port() const {
+uint16_t SocketAddress::port() const {
return port_;
}
@@ -279,7 +279,9 @@
}
static size_t ToSockAddrStorageHelper(sockaddr_storage* addr,
- IPAddress ip, uint16 port, int scope_id) {
+ IPAddress ip,
+ uint16_t port,
+ int scope_id) {
memset(addr, 0, sizeof(sockaddr_storage));
addr->ss_family = static_cast<unsigned short>(ip.family());
if (addr->ss_family == AF_INET6) {
@@ -305,15 +307,15 @@
return ToSockAddrStorageHelper(addr, ip_, port_, scope_id_);
}
-std::string SocketAddress::IPToString(uint32 ip_as_host_order_integer) {
+std::string SocketAddress::IPToString(uint32_t ip_as_host_order_integer) {
return IPAddress(ip_as_host_order_integer).ToString();
}
-std::string IPToSensitiveString(uint32 ip_as_host_order_integer) {
+std::string IPToSensitiveString(uint32_t ip_as_host_order_integer) {
return IPAddress(ip_as_host_order_integer).ToSensitiveString();
}
-bool SocketAddress::StringToIP(const std::string& hostname, uint32* ip) {
+bool SocketAddress::StringToIP(const std::string& hostname, uint32_t* ip) {
in_addr addr;
if (rtc::inet_pton(AF_INET, hostname.c_str(), &addr) == 0)
return false;
@@ -340,8 +342,8 @@
return false;
}
-uint32 SocketAddress::StringToIP(const std::string& hostname) {
- uint32 ip = 0;
+uint32_t SocketAddress::StringToIP(const std::string& hostname) {
+ uint32_t ip = 0;
StringToIP(hostname, &ip);
return ip;
}
diff --git a/webrtc/base/socketaddress.h b/webrtc/base/socketaddress.h
index f8256fc..44183f3 100644
--- a/webrtc/base/socketaddress.h
+++ b/webrtc/base/socketaddress.h
@@ -36,7 +36,7 @@
// Creates the address with the given IP and port.
// IP is given as an integer in host byte order. V4 only, to be deprecated.
- SocketAddress(uint32 ip_as_host_order_integer, int port);
+ SocketAddress(uint32_t ip_as_host_order_integer, int port);
// Creates the address with the given IP and port.
SocketAddress(const IPAddress& ip, int port);
@@ -58,7 +58,7 @@
// Changes the IP of this address to the given one, and clears the hostname
// IP is given as an integer in host byte order. V4 only, to be deprecated..
- void SetIP(uint32 ip_as_host_order_integer);
+ void SetIP(uint32_t ip_as_host_order_integer);
// Changes the IP of this address to the given one, and clears the hostname.
void SetIP(const IPAddress& ip);
@@ -70,7 +70,7 @@
// Sets the IP address while retaining the hostname. Useful for bypassing
// DNS for a pre-resolved IP.
// IP is given as an integer in host byte order. V4 only, to be deprecated.
- void SetResolvedIP(uint32 ip_as_host_order_integer);
+ void SetResolvedIP(uint32_t ip_as_host_order_integer);
// Sets the IP address while retaining the hostname. Useful for bypassing
// DNS for a pre-resolved IP.
@@ -84,14 +84,14 @@
// Returns the IP address as a host byte order integer.
// Returns 0 for non-v4 addresses.
- uint32 ip() const;
+ uint32_t ip() const;
const IPAddress& ipaddr() const;
int family() const {return ip_.family(); }
// Returns the port part of this address.
- uint16 port() const;
+ uint16_t port() const;
// Returns the scope ID associated with this address. Scope IDs are a
// necessary addition to IPv6 link-local addresses, with different network
@@ -181,18 +181,18 @@
// Converts the IP address given in 'compact form' into dotted form.
// IP is given as an integer in host byte order. V4 only, to be deprecated.
// TODO: Deprecate this.
- static std::string IPToString(uint32 ip_as_host_order_integer);
+ static std::string IPToString(uint32_t ip_as_host_order_integer);
// Same as IPToString but anonymizes it by hiding the last part.
// TODO: Deprecate this.
- static std::string IPToSensitiveString(uint32 ip_as_host_order_integer);
+ static std::string IPToSensitiveString(uint32_t ip_as_host_order_integer);
// Converts the IP address given in dotted form into compact form.
// Only dotted names (A.B.C.D) are converted.
// Output integer is returned in host byte order.
// TODO: Deprecate, replace wth agnostic versions.
- static bool StringToIP(const std::string& str, uint32* ip);
- static uint32 StringToIP(const std::string& str);
+ static bool StringToIP(const std::string& str, uint32_t* ip);
+ static uint32_t StringToIP(const std::string& str);
// Converts the IP address given in printable form into an IPAddress.
static bool StringToIP(const std::string& str, IPAddress* ip);
@@ -200,7 +200,7 @@
private:
std::string hostname_;
IPAddress ip_;
- uint16 port_;
+ uint16_t port_;
int scope_id_;
bool literal_; // Indicates that 'hostname_' contains a literal IP string.
};
diff --git a/webrtc/base/sslfingerprint.cc b/webrtc/base/sslfingerprint.cc
index a610181..1939b4f 100644
--- a/webrtc/base/sslfingerprint.cc
+++ b/webrtc/base/sslfingerprint.cc
@@ -30,7 +30,7 @@
SSLFingerprint* SSLFingerprint::Create(
const std::string& algorithm, const rtc::SSLCertificate* cert) {
- uint8 digest_val[64];
+ uint8_t digest_val[64];
size_t digest_len;
bool ret = cert->ComputeDigest(
algorithm, digest_val, sizeof(digest_val), &digest_len);
@@ -58,13 +58,13 @@
if (!value_len)
return NULL;
- return new SSLFingerprint(algorithm,
- reinterpret_cast<uint8*>(value),
+ return new SSLFingerprint(algorithm, reinterpret_cast<uint8_t*>(value),
value_len);
}
-SSLFingerprint::SSLFingerprint(
- const std::string& algorithm, const uint8* digest_in, size_t digest_len)
+SSLFingerprint::SSLFingerprint(const std::string& algorithm,
+ const uint8_t* digest_in,
+ size_t digest_len)
: algorithm(algorithm) {
digest.SetData(digest_in, digest_len);
}
diff --git a/webrtc/base/sslfingerprint.h b/webrtc/base/sslfingerprint.h
index 355c6ba..735238d 100644
--- a/webrtc/base/sslfingerprint.h
+++ b/webrtc/base/sslfingerprint.h
@@ -31,7 +31,8 @@
static SSLFingerprint* CreateFromRfc4572(const std::string& algorithm,
const std::string& fingerprint);
- SSLFingerprint(const std::string& algorithm, const uint8* digest_in,
+ SSLFingerprint(const std::string& algorithm,
+ const uint8_t* digest_in,
size_t digest_len);
SSLFingerprint(const SSLFingerprint& from);
diff --git a/webrtc/base/sslstreamadapter.cc b/webrtc/base/sslstreamadapter.cc
index 0ce49d1..9d52975 100644
--- a/webrtc/base/sslstreamadapter.cc
+++ b/webrtc/base/sslstreamadapter.cc
@@ -57,10 +57,10 @@
}
bool SSLStreamAdapter::ExportKeyingMaterial(const std::string& label,
- const uint8* context,
+ const uint8_t* context,
size_t context_len,
bool use_context,
- uint8* result,
+ uint8_t* result,
size_t result_len) {
return false; // Default is unsupported
}
diff --git a/webrtc/base/sslstreamadapter.h b/webrtc/base/sslstreamadapter.h
index fa49651..65a7729 100644
--- a/webrtc/base/sslstreamadapter.h
+++ b/webrtc/base/sslstreamadapter.h
@@ -167,10 +167,10 @@
// result -- where to put the computed value
// result_len -- the length of the computed value
virtual bool ExportKeyingMaterial(const std::string& label,
- const uint8* context,
+ const uint8_t* context,
size_t context_len,
bool use_context,
- uint8* result,
+ uint8_t* result,
size_t result_len);
// DTLS-SRTP interface
diff --git a/webrtc/base/sslstreamadapter_unittest.cc b/webrtc/base/sslstreamadapter_unittest.cc
index 386fe4f..c65bb63 100644
--- a/webrtc/base/sslstreamadapter_unittest.cc
+++ b/webrtc/base/sslstreamadapter_unittest.cc
@@ -334,7 +334,7 @@
size_t data_len, size_t *written,
int *error) {
// Randomly drop loss_ percent of packets
- if (rtc::CreateRandomId() % 100 < static_cast<uint32>(loss_)) {
+ if (rtc::CreateRandomId() % 100 < static_cast<uint32_t>(loss_)) {
LOG(LS_INFO) << "Randomly dropping packet, size=" << data_len;
*written = data_len;
return rtc::SR_SUCCESS;
diff --git a/webrtc/base/systeminfo.cc b/webrtc/base/systeminfo.cc
index 540de82..bfc96b3 100644
--- a/webrtc/base/systeminfo.cc
+++ b/webrtc/base/systeminfo.cc
@@ -161,8 +161,8 @@
// Returns the amount of installed physical memory in Bytes. Cacheable.
// Returns -1 on error.
-int64 SystemInfo::GetMemorySize() {
- int64 memory = -1;
+int64_t SystemInfo::GetMemorySize() {
+ int64_t memory = -1;
#if defined(WEBRTC_WIN)
MEMORYSTATUSEX status = {0};
@@ -180,8 +180,8 @@
if (error || memory == 0)
memory = -1;
#elif defined(WEBRTC_LINUX)
- memory = static_cast<int64>(sysconf(_SC_PHYS_PAGES)) *
- static_cast<int64>(sysconf(_SC_PAGESIZE));
+ memory = static_cast<int64_t>(sysconf(_SC_PHYS_PAGES)) *
+ static_cast<int64_t>(sysconf(_SC_PAGESIZE));
if (memory < 0) {
LOG(LS_WARNING) << "sysconf(_SC_PHYS_PAGES) failed."
<< "sysconf(_SC_PHYS_PAGES) " << sysconf(_SC_PHYS_PAGES)
diff --git a/webrtc/base/systeminfo.h b/webrtc/base/systeminfo.h
index e223702..99d18b2 100644
--- a/webrtc/base/systeminfo.h
+++ b/webrtc/base/systeminfo.h
@@ -36,7 +36,7 @@
Architecture GetCpuArchitecture();
std::string GetCpuVendor();
// Total amount of physical memory, in bytes.
- int64 GetMemorySize();
+ int64_t GetMemorySize();
// The model name of the machine, e.g. "MacBookAir1,1"
std::string GetMachineModel();
diff --git a/webrtc/base/task.cc b/webrtc/base/task.cc
index d81a6d2..bdf8f1d 100644
--- a/webrtc/base/task.cc
+++ b/webrtc/base/task.cc
@@ -14,7 +14,7 @@
namespace rtc {
-int32 Task::unique_id_seed_ = 0;
+int32_t Task::unique_id_seed_ = 0;
Task::Task(TaskParent *parent)
: TaskParent(this, parent),
@@ -48,11 +48,11 @@
}
}
-int64 Task::CurrentTime() {
+int64_t Task::CurrentTime() {
return GetRunner()->CurrentTime();
}
-int64 Task::ElapsedTime() {
+int64_t Task::ElapsedTime() {
return CurrentTime() - start_time_;
}
@@ -240,7 +240,7 @@
}
void Task::ResetTimeout() {
- int64 previous_timeout_time = timeout_time_;
+ int64_t previous_timeout_time = timeout_time_;
bool timeout_allowed = (state_ != STATE_INIT)
&& (state_ != STATE_DONE)
&& (state_ != STATE_ERROR);
@@ -254,7 +254,7 @@
}
void Task::ClearTimeout() {
- int64 previous_timeout_time = timeout_time_;
+ int64_t previous_timeout_time = timeout_time_;
timeout_time_ = 0;
GetRunner()->UpdateTaskTimeout(this, previous_timeout_time);
}
diff --git a/webrtc/base/task.h b/webrtc/base/task.h
index 3e43e11..28702e4 100644
--- a/webrtc/base/task.h
+++ b/webrtc/base/task.h
@@ -95,7 +95,7 @@
Task(TaskParent *parent);
~Task() override;
- int32 unique_id() { return unique_id_; }
+ int32_t unique_id() { return unique_id_; }
void Start();
void Step();
@@ -103,14 +103,14 @@
bool HasError() const { return (GetState() == STATE_ERROR); }
bool Blocked() const { return blocked_; }
bool IsDone() const { return done_; }
- int64 ElapsedTime();
+ int64_t ElapsedTime();
// Called from outside to stop task without any more callbacks
void Abort(bool nowake = false);
bool TimedOut();
- int64 timeout_time() const { return timeout_time_; }
+ int64_t timeout_time() const { return timeout_time_; }
int timeout_seconds() const { return timeout_seconds_; }
void set_timeout_seconds(int timeout_seconds);
@@ -134,7 +134,7 @@
// Called inside to advise that the task should wake and signal an error
void Error();
- int64 CurrentTime();
+ int64_t CurrentTime();
virtual std::string GetStateName(int state) const;
virtual int Process(int state);
@@ -160,13 +160,13 @@
bool aborted_;
bool busy_;
bool error_;
- int64 start_time_;
- int64 timeout_time_;
+ int64_t start_time_;
+ int64_t timeout_time_;
int timeout_seconds_;
bool timeout_suspended_;
- int32 unique_id_;
-
- static int32 unique_id_seed_;
+ int32_t unique_id_;
+
+ static int32_t unique_id_seed_;
};
} // namespace rtc
diff --git a/webrtc/base/task_unittest.cc b/webrtc/base/task_unittest.cc
index 1135a73..7f67841 100644
--- a/webrtc/base/task_unittest.cc
+++ b/webrtc/base/task_unittest.cc
@@ -31,8 +31,8 @@
namespace rtc {
-static int64 GetCurrentTime() {
- return static_cast<int64>(Time()) * 10000;
+static int64_t GetCurrentTime() {
+ return static_cast<int64_t>(Time()) * 10000;
}
// feel free to change these numbers. Note that '0' won't work, though
@@ -98,9 +98,7 @@
class MyTaskRunner : public TaskRunner {
public:
virtual void WakeTasks() { RunTasks(); }
- virtual int64 CurrentTime() {
- return GetCurrentTime();
- }
+ virtual int64_t CurrentTime() { return GetCurrentTime(); }
bool timeout_change() const {
return timeout_change_;
@@ -490,9 +488,7 @@
DeleteTestTaskRunner() {
}
virtual void WakeTasks() { }
- virtual int64 CurrentTime() {
- return GetCurrentTime();
- }
+ virtual int64_t CurrentTime() { return GetCurrentTime(); }
private:
RTC_DISALLOW_COPY_AND_ASSIGN(DeleteTestTaskRunner);
};
diff --git a/webrtc/base/taskrunner.cc b/webrtc/base/taskrunner.cc
index bc4ab5e..e7278f1 100644
--- a/webrtc/base/taskrunner.cc
+++ b/webrtc/base/taskrunner.cc
@@ -64,7 +64,7 @@
tasks_running_ = true;
- int64 previous_timeout_time = next_task_timeout();
+ int64_t previous_timeout_time = next_task_timeout();
int did_run = true;
while (did_run) {
@@ -135,7 +135,7 @@
}
}
-int64 TaskRunner::next_task_timeout() const {
+int64_t TaskRunner::next_task_timeout() const {
if (next_timeout_task_) {
return next_timeout_task_->timeout_time();
}
@@ -150,9 +150,9 @@
// effectively making the task scheduler O-1 instead of O-N
void TaskRunner::UpdateTaskTimeout(Task* task,
- int64 previous_task_timeout_time) {
+ int64_t previous_task_timeout_time) {
ASSERT(task != NULL);
- int64 previous_timeout_time = next_task_timeout();
+ int64_t previous_timeout_time = next_task_timeout();
bool task_is_timeout_task = next_timeout_task_ != NULL &&
task->unique_id() == next_timeout_task_->unique_id();
if (task_is_timeout_task) {
@@ -190,7 +190,7 @@
// we're not excluding it
// it has the closest timeout time
- int64 next_timeout_time = 0;
+ int64_t next_timeout_time = 0;
next_timeout_task_ = NULL;
for (size_t i = 0; i < tasks_.size(); ++i) {
@@ -210,8 +210,8 @@
}
}
-void TaskRunner::CheckForTimeoutChange(int64 previous_timeout_time) {
- int64 next_timeout = next_task_timeout();
+void TaskRunner::CheckForTimeoutChange(int64_t previous_timeout_time) {
+ int64_t next_timeout = next_task_timeout();
bool timeout_change = (previous_timeout_time == 0 && next_timeout != 0) ||
next_timeout < previous_timeout_time ||
(previous_timeout_time <= CurrentTime() &&
diff --git a/webrtc/base/taskrunner.h b/webrtc/base/taskrunner.h
index bdcebc4..9a43aac0 100644
--- a/webrtc/base/taskrunner.h
+++ b/webrtc/base/taskrunner.h
@@ -20,9 +20,9 @@
namespace rtc {
class Task;
-const int64 kSecToMsec = 1000;
-const int64 kMsecTo100ns = 10000;
-const int64 kSecTo100ns = kSecToMsec * kMsecTo100ns;
+const int64_t kSecToMsec = 1000;
+const int64_t kMsecTo100ns = 10000;
+const int64_t kSecTo100ns = kSecToMsec * kMsecTo100ns;
class TaskRunner : public TaskParent, public sigslot::has_slots<> {
public:
@@ -36,13 +36,13 @@
// the units and that rollover while the computer is running.
//
// On Windows, GetSystemTimeAsFileTime is the typical implementation.
- virtual int64 CurrentTime() = 0 ;
+ virtual int64_t CurrentTime() = 0;
void StartTask(Task *task);
void RunTasks();
void PollTasks();
- void UpdateTaskTimeout(Task *task, int64 previous_task_timeout_time);
+ void UpdateTaskTimeout(Task* task, int64_t previous_task_timeout_time);
#ifdef _DEBUG
bool is_ok_to_delete(Task* task) {
@@ -60,7 +60,7 @@
// Returns the next absolute time when a task times out
// OR "0" if there is no next timeout.
- int64 next_task_timeout() const;
+ int64_t next_task_timeout() const;
protected:
// The primary usage of this method is to know if
@@ -82,7 +82,7 @@
private:
void InternalRunTasks(bool in_destructor);
- void CheckForTimeoutChange(int64 previous_timeout_time);
+ void CheckForTimeoutChange(int64_t previous_timeout_time);
std::vector<Task *> tasks_;
Task *next_timeout_task_;
diff --git a/webrtc/base/testclient.cc b/webrtc/base/testclient.cc
index 8483c4e..c7484fa 100644
--- a/webrtc/base/testclient.cc
+++ b/webrtc/base/testclient.cc
@@ -34,7 +34,7 @@
bool TestClient::CheckConnState(AsyncPacketSocket::State state) {
// Wait for our timeout value until the socket reaches the desired state.
- uint32 end = TimeAfter(kTimeoutMs);
+ uint32_t end = TimeAfter(kTimeoutMs);
while (socket_->GetState() != state && TimeUntil(end) > 0)
Thread::Current()->ProcessMessages(1);
return (socket_->GetState() == state);
@@ -63,7 +63,7 @@
// Pumping another thread's queue could lead to messages being dispatched from
// the wrong thread to non-thread-safe objects.
- uint32 end = TimeAfter(timeout_ms);
+ uint32_t end = TimeAfter(timeout_ms);
while (TimeUntil(end) > 0) {
{
CritScope cs(&crit_);
diff --git a/webrtc/base/testutils.h b/webrtc/base/testutils.h
index 4c978e7..e56895d 100644
--- a/webrtc/base/testutils.h
+++ b/webrtc/base/testutils.h
@@ -542,29 +542,33 @@
// order
///////////////////////////////////////////////////////////////////////////////
-#define BYTE_CAST(x) static_cast<uint8>((x) & 0xFF)
+#define BYTE_CAST(x) static_cast<uint8_t>((x)&0xFF)
// Declare a N-bit integer as a little-endian sequence of bytes
-#define LE16(x) BYTE_CAST(((uint16)x) >> 0), BYTE_CAST(((uint16)x) >> 8)
+#define LE16(x) BYTE_CAST(((uint16_t)x) >> 0), BYTE_CAST(((uint16_t)x) >> 8)
-#define LE32(x) BYTE_CAST(((uint32)x) >> 0), BYTE_CAST(((uint32)x) >> 8), \
- BYTE_CAST(((uint32)x) >> 16), BYTE_CAST(((uint32)x) >> 24)
+#define LE32(x) \
+ BYTE_CAST(((uint32_t)x) >> 0), BYTE_CAST(((uint32_t)x) >> 8), \
+ BYTE_CAST(((uint32_t)x) >> 16), BYTE_CAST(((uint32_t)x) >> 24)
-#define LE64(x) BYTE_CAST(((uint64)x) >> 0), BYTE_CAST(((uint64)x) >> 8), \
- BYTE_CAST(((uint64)x) >> 16), BYTE_CAST(((uint64)x) >> 24), \
- BYTE_CAST(((uint64)x) >> 32), BYTE_CAST(((uint64)x) >> 40), \
- BYTE_CAST(((uint64)x) >> 48), BYTE_CAST(((uint64)x) >> 56)
+#define LE64(x) \
+ BYTE_CAST(((uint64_t)x) >> 0), BYTE_CAST(((uint64_t)x) >> 8), \
+ BYTE_CAST(((uint64_t)x) >> 16), BYTE_CAST(((uint64_t)x) >> 24), \
+ BYTE_CAST(((uint64_t)x) >> 32), BYTE_CAST(((uint64_t)x) >> 40), \
+ BYTE_CAST(((uint64_t)x) >> 48), BYTE_CAST(((uint64_t)x) >> 56)
// Declare a N-bit integer as a big-endian (Internet) sequence of bytes
-#define BE16(x) BYTE_CAST(((uint16)x) >> 8), BYTE_CAST(((uint16)x) >> 0)
+#define BE16(x) BYTE_CAST(((uint16_t)x) >> 8), BYTE_CAST(((uint16_t)x) >> 0)
-#define BE32(x) BYTE_CAST(((uint32)x) >> 24), BYTE_CAST(((uint32)x) >> 16), \
- BYTE_CAST(((uint32)x) >> 8), BYTE_CAST(((uint32)x) >> 0)
+#define BE32(x) \
+ BYTE_CAST(((uint32_t)x) >> 24), BYTE_CAST(((uint32_t)x) >> 16), \
+ BYTE_CAST(((uint32_t)x) >> 8), BYTE_CAST(((uint32_t)x) >> 0)
-#define BE64(x) BYTE_CAST(((uint64)x) >> 56), BYTE_CAST(((uint64)x) >> 48), \
- BYTE_CAST(((uint64)x) >> 40), BYTE_CAST(((uint64)x) >> 32), \
- BYTE_CAST(((uint64)x) >> 24), BYTE_CAST(((uint64)x) >> 16), \
- BYTE_CAST(((uint64)x) >> 8), BYTE_CAST(((uint64)x) >> 0)
+#define BE64(x) \
+ BYTE_CAST(((uint64_t)x) >> 56), BYTE_CAST(((uint64_t)x) >> 48), \
+ BYTE_CAST(((uint64_t)x) >> 40), BYTE_CAST(((uint64_t)x) >> 32), \
+ BYTE_CAST(((uint64_t)x) >> 24), BYTE_CAST(((uint64_t)x) >> 16), \
+ BYTE_CAST(((uint64_t)x) >> 8), BYTE_CAST(((uint64_t)x) >> 0)
// Declare a N-bit integer as a this-endian (local machine) sequence of bytes
#ifndef BIG_ENDIAN
diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc
index 48a9144..8ab381f 100644
--- a/webrtc/base/thread.cc
+++ b/webrtc/base/thread.cc
@@ -385,7 +385,7 @@
Join();
}
-void Thread::Send(MessageHandler *phandler, uint32 id, MessageData *pdata) {
+void Thread::Send(MessageHandler* phandler, uint32_t id, MessageData* pdata) {
if (fStop_)
return;
@@ -495,7 +495,8 @@
TRACE_EVENT_END0("webrtc", "Thread::Invoke");
}
-void Thread::Clear(MessageHandler *phandler, uint32 id,
+void Thread::Clear(MessageHandler* phandler,
+ uint32_t id,
MessageList* removed) {
CritScope cs(&crit_);
@@ -524,7 +525,7 @@
}
bool Thread::ProcessMessages(int cmsLoop) {
- uint32 msEnd = (kForever == cmsLoop) ? 0 : TimeAfter(cmsLoop);
+ uint32_t msEnd = (kForever == cmsLoop) ? 0 : TimeAfter(cmsLoop);
int cmsNext = cmsLoop;
while (true) {
diff --git a/webrtc/base/thread.h b/webrtc/base/thread.h
index 1a04de5..9cbe8ec 100644
--- a/webrtc/base/thread.h
+++ b/webrtc/base/thread.h
@@ -155,8 +155,9 @@
// ProcessMessages occasionally.
virtual void Run();
- virtual void Send(MessageHandler *phandler, uint32 id = 0,
- MessageData *pdata = NULL);
+ virtual void Send(MessageHandler* phandler,
+ uint32_t id = 0,
+ MessageData* pdata = NULL);
// Convenience method to invoke a functor on another thread. Caller must
// provide the |ReturnT| template argument, which cannot (easily) be deduced.
@@ -176,7 +177,7 @@
// From MessageQueue
void Clear(MessageHandler* phandler,
- uint32 id = MQID_ANY,
+ uint32_t id = MQID_ANY,
MessageList* removed = NULL) override;
void ReceiveSends() override;
diff --git a/webrtc/base/thread_unittest.cc b/webrtc/base/thread_unittest.cc
index 7b9481e..e50e45c 100644
--- a/webrtc/base/thread_unittest.cc
+++ b/webrtc/base/thread_unittest.cc
@@ -66,9 +66,9 @@
void OnPacket(AsyncPacketSocket* socket, const char* buf, size_t size,
const SocketAddress& remote_addr,
const PacketTime& packet_time) {
- EXPECT_EQ(size, sizeof(uint32));
- uint32 prev = reinterpret_cast<const uint32*>(buf)[0];
- uint32 result = Next(prev);
+ EXPECT_EQ(size, sizeof(uint32_t));
+ uint32_t prev = reinterpret_cast<const uint32_t*>(buf)[0];
+ uint32_t result = Next(prev);
post_thread_->PostDelayed(200, post_handler_, 0, new TestMessage(result));
}
diff --git a/webrtc/base/timeutils.cc b/webrtc/base/timeutils.cc
index ffaf326..fac5b66 100644
--- a/webrtc/base/timeutils.cc
+++ b/webrtc/base/timeutils.cc
@@ -32,10 +32,10 @@
namespace rtc {
-const uint32 HALF = 0x80000000;
+const uint32_t HALF = 0x80000000;
-uint64 TimeNanos() {
- int64 ticks = 0;
+uint64_t TimeNanos() {
+ int64_t ticks = 0;
#if defined(WEBRTC_MAC)
static mach_timebase_info_data_t timebase;
if (timebase.denom == 0) {
@@ -52,11 +52,11 @@
// TODO: Do we need to handle the case when CLOCK_MONOTONIC
// is not supported?
clock_gettime(CLOCK_MONOTONIC, &ts);
- ticks = kNumNanosecsPerSec * static_cast<int64>(ts.tv_sec) +
- static_cast<int64>(ts.tv_nsec);
+ ticks = kNumNanosecsPerSec * static_cast<int64_t>(ts.tv_sec) +
+ static_cast<int64_t>(ts.tv_nsec);
#elif defined(WEBRTC_WIN)
static volatile LONG last_timegettime = 0;
- static volatile int64 num_wrap_timegettime = 0;
+ static volatile int64_t num_wrap_timegettime = 0;
volatile LONG* last_timegettime_ptr = &last_timegettime;
DWORD now = timeGetTime();
// Atomically update the last gotten time
@@ -78,16 +78,16 @@
return ticks;
}
-uint32 Time() {
- return static_cast<uint32>(TimeNanos() / kNumNanosecsPerMillisec);
+uint32_t Time() {
+ return static_cast<uint32_t>(TimeNanos() / kNumNanosecsPerMillisec);
}
-uint64 TimeMicros() {
- return static_cast<uint64>(TimeNanos() / kNumNanosecsPerMicrosec);
+uint64_t TimeMicros() {
+ return static_cast<uint64_t>(TimeNanos() / kNumNanosecsPerMicrosec);
}
#if defined(WEBRTC_WIN)
-static const uint64 kFileTimeToUnixTimeEpochOffset = 116444736000000000ULL;
+static const uint64_t kFileTimeToUnixTimeEpochOffset = 116444736000000000ULL;
struct timeval {
long tv_sec, tv_usec; // NOLINT
@@ -105,7 +105,7 @@
li.HighPart = ft.dwHighDateTime;
// Convert to seconds and microseconds since Unix time Epoch.
- int64 micros = (li.QuadPart - kFileTimeToUnixTimeEpochOffset) / 10;
+ int64_t micros = (li.QuadPart - kFileTimeToUnixTimeEpochOffset) / 10;
tv->tv_sec = static_cast<long>(micros / kNumMicrosecsPerSec); // NOLINT
tv->tv_usec = static_cast<long>(micros % kNumMicrosecsPerSec); // NOLINT
@@ -135,13 +135,13 @@
*microseconds = timeval.tv_usec;
}
-uint32 TimeAfter(int32 elapsed) {
+uint32_t TimeAfter(int32_t elapsed) {
RTC_DCHECK_GE(elapsed, 0);
- RTC_DCHECK_LT(static_cast<uint32>(elapsed), HALF);
+ RTC_DCHECK_LT(static_cast<uint32_t>(elapsed), HALF);
return Time() + elapsed;
}
-bool TimeIsBetween(uint32 earlier, uint32 middle, uint32 later) {
+bool TimeIsBetween(uint32_t earlier, uint32_t middle, uint32_t later) {
if (earlier <= later) {
return ((earlier <= middle) && (middle <= later));
} else {
@@ -149,27 +149,27 @@
}
}
-bool TimeIsLaterOrEqual(uint32 earlier, uint32 later) {
+bool TimeIsLaterOrEqual(uint32_t earlier, uint32_t later) {
#if EFFICIENT_IMPLEMENTATION
- int32 diff = later - earlier;
- return (diff >= 0 && static_cast<uint32>(diff) < HALF);
+ int32_t diff = later - earlier;
+ return (diff >= 0 && static_cast<uint32_t>(diff) < HALF);
#else
const bool later_or_equal = TimeIsBetween(earlier, later, earlier + HALF);
return later_or_equal;
#endif
}
-bool TimeIsLater(uint32 earlier, uint32 later) {
+bool TimeIsLater(uint32_t earlier, uint32_t later) {
#if EFFICIENT_IMPLEMENTATION
- int32 diff = later - earlier;
- return (diff > 0 && static_cast<uint32>(diff) < HALF);
+ int32_t diff = later - earlier;
+ return (diff > 0 && static_cast<uint32_t>(diff) < HALF);
#else
const bool earlier_or_equal = TimeIsBetween(later, earlier, later + HALF);
return !earlier_or_equal;
#endif
}
-int32 TimeDiff(uint32 later, uint32 earlier) {
+int32_t TimeDiff(uint32_t later, uint32_t earlier) {
#if EFFICIENT_IMPLEMENTATION
return later - earlier;
#else
@@ -193,7 +193,7 @@
TimestampWrapAroundHandler::TimestampWrapAroundHandler()
: last_ts_(0), num_wrap_(0) {}
-int64 TimestampWrapAroundHandler::Unwrap(uint32 ts) {
+int64_t TimestampWrapAroundHandler::Unwrap(uint32_t ts) {
if (ts < last_ts_) {
if (last_ts_ > 0xf0000000 && ts < 0x0fffffff) {
++num_wrap_;
diff --git a/webrtc/base/timeutils.h b/webrtc/base/timeutils.h
index ca041a7..bdeccc3 100644
--- a/webrtc/base/timeutils.h
+++ b/webrtc/base/timeutils.h
@@ -17,66 +17,68 @@
namespace rtc {
-static const int64 kNumMillisecsPerSec = INT64_C(1000);
-static const int64 kNumMicrosecsPerSec = INT64_C(1000000);
-static const int64 kNumNanosecsPerSec = INT64_C(1000000000);
+static const int64_t kNumMillisecsPerSec = INT64_C(1000);
+static const int64_t kNumMicrosecsPerSec = INT64_C(1000000);
+static const int64_t kNumNanosecsPerSec = INT64_C(1000000000);
-static const int64 kNumMicrosecsPerMillisec = kNumMicrosecsPerSec /
- kNumMillisecsPerSec;
-static const int64 kNumNanosecsPerMillisec = kNumNanosecsPerSec /
- kNumMillisecsPerSec;
-static const int64 kNumNanosecsPerMicrosec = kNumNanosecsPerSec /
- kNumMicrosecsPerSec;
+static const int64_t kNumMicrosecsPerMillisec =
+ kNumMicrosecsPerSec / kNumMillisecsPerSec;
+static const int64_t kNumNanosecsPerMillisec =
+ kNumNanosecsPerSec / kNumMillisecsPerSec;
+static const int64_t kNumNanosecsPerMicrosec =
+ kNumNanosecsPerSec / kNumMicrosecsPerSec;
// January 1970, in NTP milliseconds.
-static const int64 kJan1970AsNtpMillisecs = INT64_C(2208988800000);
+static const int64_t kJan1970AsNtpMillisecs = INT64_C(2208988800000);
-typedef uint32 TimeStamp;
+typedef uint32_t TimeStamp;
// Returns the current time in milliseconds.
-uint32 Time();
+uint32_t Time();
// Returns the current time in microseconds.
-uint64 TimeMicros();
+uint64_t TimeMicros();
// Returns the current time in nanoseconds.
-uint64 TimeNanos();
+uint64_t TimeNanos();
// Stores current time in *tm and microseconds in *microseconds.
void CurrentTmTime(struct tm *tm, int *microseconds);
// Returns a future timestamp, 'elapsed' milliseconds from now.
-uint32 TimeAfter(int32 elapsed);
+uint32_t TimeAfter(int32_t elapsed);
// Comparisons between time values, which can wrap around.
-bool TimeIsBetween(uint32 earlier, uint32 middle, uint32 later); // Inclusive
-bool TimeIsLaterOrEqual(uint32 earlier, uint32 later); // Inclusive
-bool TimeIsLater(uint32 earlier, uint32 later); // Exclusive
+bool TimeIsBetween(uint32_t earlier,
+ uint32_t middle,
+ uint32_t later); // Inclusive
+bool TimeIsLaterOrEqual(uint32_t earlier, uint32_t later); // Inclusive
+bool TimeIsLater(uint32_t earlier, uint32_t later); // Exclusive
// Returns the later of two timestamps.
-inline uint32 TimeMax(uint32 ts1, uint32 ts2) {
+inline uint32_t TimeMax(uint32_t ts1, uint32_t ts2) {
return TimeIsLaterOrEqual(ts1, ts2) ? ts2 : ts1;
}
// Returns the earlier of two timestamps.
-inline uint32 TimeMin(uint32 ts1, uint32 ts2) {
+inline uint32_t TimeMin(uint32_t ts1, uint32_t ts2) {
return TimeIsLaterOrEqual(ts1, ts2) ? ts1 : ts2;
}
// Number of milliseconds that would elapse between 'earlier' and 'later'
// timestamps. The value is negative if 'later' occurs before 'earlier'.
-int32 TimeDiff(uint32 later, uint32 earlier);
+int32_t TimeDiff(uint32_t later, uint32_t earlier);
// The number of milliseconds that have elapsed since 'earlier'.
-inline int32 TimeSince(uint32 earlier) {
+inline int32_t TimeSince(uint32_t earlier) {
return TimeDiff(Time(), earlier);
}
// The number of milliseconds that will elapse between now and 'later'.
-inline int32 TimeUntil(uint32 later) {
+inline int32_t TimeUntil(uint32_t later) {
return TimeDiff(later, Time());
}
// Converts a unix timestamp in nanoseconds to an NTP timestamp in ms.
-inline int64 UnixTimestampNanosecsToNtpMillisecs(int64 unix_ts_ns) {
+inline int64_t UnixTimestampNanosecsToNtpMillisecs(int64_t unix_ts_ns) {
return unix_ts_ns / kNumNanosecsPerMillisec + kJan1970AsNtpMillisecs;
}
@@ -84,11 +86,11 @@
public:
TimestampWrapAroundHandler();
- int64 Unwrap(uint32 ts);
+ int64_t Unwrap(uint32_t ts);
private:
- uint32 last_ts_;
- int64 num_wrap_;
+ uint32_t last_ts_;
+ int64_t num_wrap_;
};
} // namespace rtc
diff --git a/webrtc/base/timeutils_unittest.cc b/webrtc/base/timeutils_unittest.cc
index 087fb0c..d1b9ad4 100644
--- a/webrtc/base/timeutils_unittest.cc
+++ b/webrtc/base/timeutils_unittest.cc
@@ -16,9 +16,9 @@
namespace rtc {
TEST(TimeTest, TimeInMs) {
- uint32 ts_earlier = Time();
+ uint32_t ts_earlier = Time();
Thread::SleepMs(100);
- uint32 ts_now = Time();
+ uint32_t ts_now = Time();
// Allow for the thread to wakeup ~20ms early.
EXPECT_GE(ts_now, ts_earlier + 80);
// Make sure the Time is not returning in smaller unit like microseconds.
@@ -152,8 +152,8 @@
};
TEST_F(TimestampWrapAroundHandlerTest, Unwrap) {
- uint32 ts = 0xfffffff2;
- int64 unwrapped_ts = ts;
+ uint32_t ts = 0xfffffff2;
+ int64_t unwrapped_ts = ts;
EXPECT_EQ(ts, wraparound_handler_.Unwrap(ts));
ts = 2;
unwrapped_ts += 0x10;
diff --git a/webrtc/base/unixfilesystem.cc b/webrtc/base/unixfilesystem.cc
index 081d561..30d6e78 100644
--- a/webrtc/base/unixfilesystem.cc
+++ b/webrtc/base/unixfilesystem.cc
@@ -502,7 +502,8 @@
#endif
}
-bool UnixFilesystem::GetDiskFreeSpace(const Pathname& path, int64 *freebytes) {
+bool UnixFilesystem::GetDiskFreeSpace(const Pathname& path,
+ int64_t* freebytes) {
#ifdef __native_client__
return false;
#else // __native_client__
@@ -526,9 +527,9 @@
return false;
#endif // WEBRTC_ANDROID
#if defined(WEBRTC_LINUX)
- *freebytes = static_cast<int64>(vfs.f_bsize) * vfs.f_bavail;
+ *freebytes = static_cast<int64_t>(vfs.f_bsize) * vfs.f_bavail;
#elif defined(WEBRTC_MAC)
- *freebytes = static_cast<int64>(vfs.f_frsize) * vfs.f_bavail;
+ *freebytes = static_cast<int64_t>(vfs.f_frsize) * vfs.f_bavail;
#endif
return true;
diff --git a/webrtc/base/unixfilesystem.h b/webrtc/base/unixfilesystem.h
index e220911..dbfbaf0 100644
--- a/webrtc/base/unixfilesystem.h
+++ b/webrtc/base/unixfilesystem.h
@@ -107,7 +107,7 @@
// Get a temporary folder that is unique to the current user and application.
bool GetAppTempFolder(Pathname* path) override;
- bool GetDiskFreeSpace(const Pathname& path, int64* freebytes) override;
+ bool GetDiskFreeSpace(const Pathname& path, int64_t* freebytes) override;
// Returns the absolute path of the current directory.
Pathname GetCurrentDirectory() override;
diff --git a/webrtc/base/virtualsocket_unittest.cc b/webrtc/base/virtualsocket_unittest.cc
index a656691..694b154 100644
--- a/webrtc/base/virtualsocket_unittest.cc
+++ b/webrtc/base/virtualsocket_unittest.cc
@@ -27,15 +27,18 @@
// Sends at a constant rate but with random packet sizes.
struct Sender : public MessageHandler {
- Sender(Thread* th, AsyncSocket* s, uint32 rt)
- : thread(th), socket(new AsyncUDPSocket(s)),
- done(false), rate(rt), count(0) {
+ Sender(Thread* th, AsyncSocket* s, uint32_t rt)
+ : thread(th),
+ socket(new AsyncUDPSocket(s)),
+ done(false),
+ rate(rt),
+ count(0) {
last_send = rtc::Time();
thread->PostDelayed(NextDelay(), this, 1);
}
- uint32 NextDelay() {
- uint32 size = (rand() % 4096) + 1;
+ uint32_t NextDelay() {
+ uint32_t size = (rand() % 4096) + 1;
return 1000 * size / rate;
}
@@ -45,11 +48,11 @@
if (done)
return;
- uint32 cur_time = rtc::Time();
- uint32 delay = cur_time - last_send;
- uint32 size = rate * delay / 1000;
- size = std::min<uint32>(size, 4096);
- size = std::max<uint32>(size, sizeof(uint32));
+ uint32_t cur_time = rtc::Time();
+ uint32_t delay = cur_time - last_send;
+ uint32_t size = rate * delay / 1000;
+ size = std::min<uint32_t>(size, 4096);
+ size = std::max<uint32_t>(size, sizeof(uint32_t));
count += size;
memcpy(dummy, &cur_time, sizeof(cur_time));
@@ -63,16 +66,23 @@
scoped_ptr<AsyncUDPSocket> socket;
rtc::PacketOptions options;
bool done;
- uint32 rate; // bytes per second
- uint32 count;
- uint32 last_send;
+ uint32_t rate; // bytes per second
+ uint32_t count;
+ uint32_t last_send;
char dummy[4096];
};
struct Receiver : public MessageHandler, public sigslot::has_slots<> {
- Receiver(Thread* th, AsyncSocket* s, uint32 bw)
- : thread(th), socket(new AsyncUDPSocket(s)), bandwidth(bw), done(false),
- count(0), sec_count(0), sum(0), sum_sq(0), samples(0) {
+ Receiver(Thread* th, AsyncSocket* s, uint32_t bw)
+ : thread(th),
+ socket(new AsyncUDPSocket(s)),
+ bandwidth(bw),
+ done(false),
+ count(0),
+ sec_count(0),
+ sum(0),
+ sum_sq(0),
+ samples(0) {
socket->SignalReadPacket.connect(this, &Receiver::OnReadPacket);
thread->PostDelayed(1000, this, 1);
}
@@ -90,9 +100,9 @@
count += size;
sec_count += size;
- uint32 send_time = *reinterpret_cast<const uint32*>(data);
- uint32 recv_time = rtc::Time();
- uint32 delay = recv_time - send_time;
+ uint32_t send_time = *reinterpret_cast<const uint32_t*>(data);
+ uint32_t recv_time = rtc::Time();
+ uint32_t delay = recv_time - send_time;
sum += delay;
sum_sq += delay * delay;
samples += 1;
@@ -114,13 +124,13 @@
Thread* thread;
scoped_ptr<AsyncUDPSocket> socket;
- uint32 bandwidth;
+ uint32_t bandwidth;
bool done;
size_t count;
size_t sec_count;
double sum;
double sum_sq;
- uint32 samples;
+ uint32_t samples;
};
class VirtualSocketServerTest : public testing::Test {
@@ -143,8 +153,8 @@
} else if (post_ip.family() == AF_INET6) {
in6_addr post_ip6 = post_ip.ipv6_address();
in6_addr pre_ip6 = pre_ip.ipv6_address();
- uint32* post_as_ints = reinterpret_cast<uint32*>(&post_ip6.s6_addr);
- uint32* pre_as_ints = reinterpret_cast<uint32*>(&pre_ip6.s6_addr);
+ uint32_t* post_as_ints = reinterpret_cast<uint32_t*>(&post_ip6.s6_addr);
+ uint32_t* pre_as_ints = reinterpret_cast<uint32_t*>(&pre_ip6.s6_addr);
EXPECT_EQ(post_as_ints[3], pre_as_ints[3]);
}
}
@@ -620,8 +630,8 @@
}
// Next, deliver packets at random intervals
- const uint32 mean = 50;
- const uint32 stddev = 50;
+ const uint32_t mean = 50;
+ const uint32_t stddev = 50;
ss_->set_delay_mean(mean);
ss_->set_delay_stddev(stddev);
@@ -654,7 +664,7 @@
EXPECT_EQ(recv_socket->GetLocalAddress().family(), initial_addr.family());
ASSERT_EQ(0, send_socket->Connect(recv_socket->GetLocalAddress()));
- uint32 bandwidth = 64 * 1024;
+ uint32_t bandwidth = 64 * 1024;
ss_->set_bandwidth(bandwidth);
Thread* pthMain = Thread::Current();
@@ -679,8 +689,8 @@
LOG(LS_VERBOSE) << "seed = " << seed;
srand(static_cast<unsigned int>(seed));
- const uint32 mean = 2000;
- const uint32 stddev = 500;
+ const uint32_t mean = 2000;
+ const uint32_t stddev = 500;
ss_->set_delay_mean(mean);
ss_->set_delay_stddev(stddev);
@@ -1008,16 +1018,16 @@
}
TEST_F(VirtualSocketServerTest, CreatesStandardDistribution) {
- const uint32 kTestMean[] = { 10, 100, 333, 1000 };
+ const uint32_t kTestMean[] = {10, 100, 333, 1000};
const double kTestDev[] = { 0.25, 0.1, 0.01 };
// TODO: The current code only works for 1000 data points or more.
- const uint32 kTestSamples[] = { /*10, 100,*/ 1000 };
+ const uint32_t kTestSamples[] = {/*10, 100,*/ 1000};
for (size_t midx = 0; midx < ARRAY_SIZE(kTestMean); ++midx) {
for (size_t didx = 0; didx < ARRAY_SIZE(kTestDev); ++didx) {
for (size_t sidx = 0; sidx < ARRAY_SIZE(kTestSamples); ++sidx) {
ASSERT_LT(0u, kTestSamples[sidx]);
- const uint32 kStdDev =
- static_cast<uint32>(kTestDev[didx] * kTestMean[midx]);
+ const uint32_t kStdDev =
+ static_cast<uint32_t>(kTestDev[didx] * kTestMean[midx]);
VirtualSocketServer::Function* f =
VirtualSocketServer::CreateDistribution(kTestMean[midx],
kStdDev,
@@ -1025,12 +1035,12 @@
ASSERT_TRUE(NULL != f);
ASSERT_EQ(kTestSamples[sidx], f->size());
double sum = 0;
- for (uint32 i = 0; i < f->size(); ++i) {
+ for (uint32_t i = 0; i < f->size(); ++i) {
sum += (*f)[i].second;
}
const double mean = sum / f->size();
double sum_sq_dev = 0;
- for (uint32 i = 0; i < f->size(); ++i) {
+ for (uint32_t i = 0; i < f->size(); ++i) {
double dev = (*f)[i].second - mean;
sum_sq_dev += dev * dev;
}
diff --git a/webrtc/base/virtualsocketserver.cc b/webrtc/base/virtualsocketserver.cc
index 4568bf2..867aeec 100644
--- a/webrtc/base/virtualsocketserver.cc
+++ b/webrtc/base/virtualsocketserver.cc
@@ -37,15 +37,16 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2
} } };
-const uint16 kFirstEphemeralPort = 49152;
-const uint16 kLastEphemeralPort = 65535;
-const uint16 kEphemeralPortCount = kLastEphemeralPort - kFirstEphemeralPort + 1;
-const uint32 kDefaultNetworkCapacity = 64 * 1024;
-const uint32 kDefaultTcpBufferSize = 32 * 1024;
+const uint16_t kFirstEphemeralPort = 49152;
+const uint16_t kLastEphemeralPort = 65535;
+const uint16_t kEphemeralPortCount =
+ kLastEphemeralPort - kFirstEphemeralPort + 1;
+const uint32_t kDefaultNetworkCapacity = 64 * 1024;
+const uint32_t kDefaultTcpBufferSize = 32 * 1024;
-const uint32 UDP_HEADER_SIZE = 28; // IP + UDP headers
-const uint32 TCP_HEADER_SIZE = 40; // IP + TCP headers
-const uint32 TCP_MSS = 1400; // Maximum segment size
+const uint32_t UDP_HEADER_SIZE = 28; // IP + UDP headers
+const uint32_t TCP_HEADER_SIZE = 40; // IP + TCP headers
+const uint32_t TCP_MSS = 1400; // Maximum segment size
// Note: The current algorithm doesn't work for sample sizes smaller than this.
const int NUM_SAMPLES = 1000;
@@ -375,7 +376,7 @@
return 0; // 0 is success to emulate setsockopt()
}
-int VirtualSocket::EstimateMTU(uint16* mtu) {
+int VirtualSocket::EstimateMTU(uint16_t* mtu) {
if (CS_CONNECTED != state_)
return ENOTCONN;
else
@@ -532,15 +533,15 @@
return next_ip;
} else if (family == AF_INET6) {
IPAddress next_ip(next_ipv6_);
- uint32* as_ints = reinterpret_cast<uint32*>(&next_ipv6_.s6_addr);
+ uint32_t* as_ints = reinterpret_cast<uint32_t*>(&next_ipv6_.s6_addr);
as_ints[3] += 1;
return next_ip;
}
return IPAddress();
}
-uint16 VirtualSocketServer::GetNextPort() {
- uint16 port = next_port_;
+uint16_t VirtualSocketServer::GetNextPort() {
+ uint16_t port = next_port_;
if (next_port_ < kLastEphemeralPort) {
++next_port_;
} else {
@@ -602,7 +603,7 @@
return !msg_queue_->IsQuitting();
}
-void VirtualSocketServer::SetNextPortForTesting(uint16 port) {
+void VirtualSocketServer::SetNextPortForTesting(uint16_t port) {
next_port_ = port;
}
@@ -731,7 +732,7 @@
int VirtualSocketServer::Connect(VirtualSocket* socket,
const SocketAddress& remote_addr,
bool use_delay) {
- uint32 delay = use_delay ? GetRandomTransitDelay() : 0;
+ uint32_t delay = use_delay ? GetRandomTransitDelay() : 0;
VirtualSocket* remote = LookupBinding(remote_addr);
if (!CanInteractWith(socket, remote)) {
LOG(LS_INFO) << "Address family mismatch between "
@@ -790,7 +791,7 @@
CritScope cs(&socket->crit_);
- uint32 cur_time = Time();
+ uint32_t cur_time = Time();
PurgeNetworkPackets(socket, cur_time);
// Determine whether we have enough bandwidth to accept this packet. To do
@@ -830,7 +831,7 @@
CritScope cs(&socket->crit_);
- uint32 cur_time = Time();
+ uint32_t cur_time = Time();
PurgeNetworkPackets(socket, cur_time);
while (true) {
@@ -865,7 +866,7 @@
void VirtualSocketServer::AddPacketToNetwork(VirtualSocket* sender,
VirtualSocket* recipient,
- uint32 cur_time,
+ uint32_t cur_time,
const char* data,
size_t data_size,
size_t header_size,
@@ -874,12 +875,12 @@
entry.size = data_size + header_size;
sender->network_size_ += entry.size;
- uint32 send_delay = SendDelay(static_cast<uint32>(sender->network_size_));
+ uint32_t send_delay = SendDelay(static_cast<uint32_t>(sender->network_size_));
entry.done_time = cur_time + send_delay;
sender->network_.push_back(entry);
// Find the delay for crossing the many virtual hops of the network.
- uint32 transit_delay = GetRandomTransitDelay();
+ uint32_t transit_delay = GetRandomTransitDelay();
// When the incoming packet is from a binding of the any address, translate it
// to the default route here such that the recipient will see the default
@@ -893,7 +894,7 @@
// Post the packet as a message to be delivered (on our own thread)
Packet* p = new Packet(data, data_size, sender_addr);
- uint32 ts = TimeAfter(send_delay + transit_delay);
+ uint32_t ts = TimeAfter(send_delay + transit_delay);
if (ordered) {
// Ensure that new packets arrive after previous ones
// TODO: consider ordering on a per-socket basis, since this
@@ -905,7 +906,7 @@
}
void VirtualSocketServer::PurgeNetworkPackets(VirtualSocket* socket,
- uint32 cur_time) {
+ uint32_t cur_time) {
while (!socket->network_.empty() &&
(socket->network_.front().done_time <= cur_time)) {
ASSERT(socket->network_size_ >= socket->network_.front().size);
@@ -914,7 +915,7 @@
}
}
-uint32 VirtualSocketServer::SendDelay(uint32 size) {
+uint32_t VirtualSocketServer::SendDelay(uint32_t size) {
if (bandwidth_ == 0)
return 0;
else
@@ -925,14 +926,14 @@
void PrintFunction(std::vector<std::pair<double, double> >* f) {
return;
double sum = 0;
- for (uint32 i = 0; i < f->size(); ++i) {
+ for (uint32_t i = 0; i < f->size(); ++i) {
std::cout << (*f)[i].first << '\t' << (*f)[i].second << std::endl;
sum += (*f)[i].second;
}
if (!f->empty()) {
const double mean = sum / f->size();
double sum_sq_dev = 0;
- for (uint32 i = 0; i < f->size(); ++i) {
+ for (uint32_t i = 0; i < f->size(); ++i) {
double dev = (*f)[i].second - mean;
sum_sq_dev += dev * dev;
}
@@ -970,7 +971,9 @@
#endif
VirtualSocketServer::Function* VirtualSocketServer::CreateDistribution(
- uint32 mean, uint32 stddev, uint32 samples) {
+ uint32_t mean,
+ uint32_t stddev,
+ uint32_t samples) {
Function* f = new Function();
if (0 == stddev) {
@@ -981,7 +984,7 @@
start = mean - 4 * static_cast<double>(stddev);
double end = mean + 4 * static_cast<double>(stddev);
- for (uint32 i = 0; i < samples; i++) {
+ for (uint32_t i = 0; i < samples; i++) {
double x = start + (end - start) * i / (samples - 1);
double y = Normal(x, mean, stddev);
f->push_back(Point(x, y));
@@ -990,11 +993,11 @@
return Resample(Invert(Accumulate(f)), 0, 1, samples);
}
-uint32 VirtualSocketServer::GetRandomTransitDelay() {
+uint32_t VirtualSocketServer::GetRandomTransitDelay() {
size_t index = rand() % delay_dist_->size();
double delay = (*delay_dist_)[index].second;
//LOG_F(LS_INFO) << "random[" << index << "] = " << delay;
- return static_cast<uint32>(delay);
+ return static_cast<uint32_t>(delay);
}
struct FunctionDomainCmp {
@@ -1031,8 +1034,10 @@
return f;
}
-VirtualSocketServer::Function* VirtualSocketServer::Resample(
- Function* f, double x1, double x2, uint32 samples) {
+VirtualSocketServer::Function* VirtualSocketServer::Resample(Function* f,
+ double x1,
+ double x2,
+ uint32_t samples) {
Function* g = new Function();
for (size_t i = 0; i < samples; i++) {
diff --git a/webrtc/base/virtualsocketserver.h b/webrtc/base/virtualsocketserver.h
index f1f5d6d..daf0145 100644
--- a/webrtc/base/virtualsocketserver.h
+++ b/webrtc/base/virtualsocketserver.h
@@ -45,39 +45,35 @@
// Limits the network bandwidth (maximum bytes per second). Zero means that
// all sends occur instantly. Defaults to 0.
- uint32 bandwidth() const { return bandwidth_; }
- void set_bandwidth(uint32 bandwidth) { bandwidth_ = bandwidth; }
+ uint32_t bandwidth() const { return bandwidth_; }
+ void set_bandwidth(uint32_t bandwidth) { bandwidth_ = bandwidth; }
// Limits the amount of data which can be in flight on the network without
// packet loss (on a per sender basis). Defaults to 64 KB.
- uint32 network_capacity() const { return network_capacity_; }
- void set_network_capacity(uint32 capacity) {
- network_capacity_ = capacity;
- }
+ uint32_t network_capacity() const { return network_capacity_; }
+ void set_network_capacity(uint32_t capacity) { network_capacity_ = capacity; }
// The amount of data which can be buffered by tcp on the sender's side
- uint32 send_buffer_capacity() const { return send_buffer_capacity_; }
- void set_send_buffer_capacity(uint32 capacity) {
+ uint32_t send_buffer_capacity() const { return send_buffer_capacity_; }
+ void set_send_buffer_capacity(uint32_t capacity) {
send_buffer_capacity_ = capacity;
}
// The amount of data which can be buffered by tcp on the receiver's side
- uint32 recv_buffer_capacity() const { return recv_buffer_capacity_; }
- void set_recv_buffer_capacity(uint32 capacity) {
+ uint32_t recv_buffer_capacity() const { return recv_buffer_capacity_; }
+ void set_recv_buffer_capacity(uint32_t capacity) {
recv_buffer_capacity_ = capacity;
}
// Controls the (transit) delay for packets sent in the network. This does
// not inclue the time required to sit in the send queue. Both of these
// values are measured in milliseconds. Defaults to no delay.
- uint32 delay_mean() const { return delay_mean_; }
- uint32 delay_stddev() const { return delay_stddev_; }
- uint32 delay_samples() const { return delay_samples_; }
- void set_delay_mean(uint32 delay_mean) { delay_mean_ = delay_mean; }
- void set_delay_stddev(uint32 delay_stddev) {
- delay_stddev_ = delay_stddev;
- }
- void set_delay_samples(uint32 delay_samples) {
+ uint32_t delay_mean() const { return delay_mean_; }
+ uint32_t delay_stddev() const { return delay_stddev_; }
+ uint32_t delay_samples() const { return delay_samples_; }
+ void set_delay_mean(uint32_t delay_mean) { delay_mean_ = delay_mean; }
+ void set_delay_stddev(uint32_t delay_stddev) { delay_stddev_ = delay_stddev; }
+ void set_delay_samples(uint32_t delay_samples) {
delay_samples_ = delay_samples;
}
@@ -108,8 +104,9 @@
typedef std::pair<double, double> Point;
typedef std::vector<Point> Function;
- static Function* CreateDistribution(uint32 mean, uint32 stddev,
- uint32 samples);
+ static Function* CreateDistribution(uint32_t mean,
+ uint32_t stddev,
+ uint32_t samples);
// Similar to Thread::ProcessMessages, but it only processes messages until
// there are no immediate messages or pending network traffic. Returns false
@@ -117,7 +114,7 @@
bool ProcessMessagesUntilIdle();
// Sets the next port number to use for testing.
- void SetNextPortForTesting(uint16 port);
+ void SetNextPortForTesting(uint16_t port);
// Close a pair of Tcp connections by addresses. Both connections will have
// its own OnClose invoked.
@@ -127,7 +124,7 @@
protected:
// Returns a new IP not used before in this network.
IPAddress GetNextIP(int family);
- uint16 GetNextPort();
+ uint16_t GetNextPort();
VirtualSocket* CreateSocketInternal(int family, int type);
@@ -169,24 +166,31 @@
void SendTcp(VirtualSocket* socket);
// Places a packet on the network.
- void AddPacketToNetwork(VirtualSocket* socket, VirtualSocket* recipient,
- uint32 cur_time, const char* data, size_t data_size,
- size_t header_size, bool ordered);
+ void AddPacketToNetwork(VirtualSocket* socket,
+ VirtualSocket* recipient,
+ uint32_t cur_time,
+ const char* data,
+ size_t data_size,
+ size_t header_size,
+ bool ordered);
// Removes stale packets from the network
- void PurgeNetworkPackets(VirtualSocket* socket, uint32 cur_time);
+ void PurgeNetworkPackets(VirtualSocket* socket, uint32_t cur_time);
// Computes the number of milliseconds required to send a packet of this size.
- uint32 SendDelay(uint32 size);
+ uint32_t SendDelay(uint32_t size);
// Returns a random transit delay chosen from the appropriate distribution.
- uint32 GetRandomTransitDelay();
+ uint32_t GetRandomTransitDelay();
// Basic operations on functions. Those that return a function also take
// ownership of the function given (and hence, may modify or delete it).
static Function* Accumulate(Function* f);
static Function* Invert(Function* f);
- static Function* Resample(Function* f, double x1, double x2, uint32 samples);
+ static Function* Resample(Function* f,
+ double x1,
+ double x2,
+ uint32_t samples);
static double Evaluate(Function* f, double x);
// NULL out our message queue if it goes away. Necessary in the case where
@@ -222,23 +226,23 @@
bool server_owned_;
MessageQueue* msg_queue_;
bool stop_on_idle_;
- uint32 network_delay_;
+ uint32_t network_delay_;
in_addr next_ipv4_;
in6_addr next_ipv6_;
- uint16 next_port_;
+ uint16_t next_port_;
AddressMap* bindings_;
ConnectionMap* connections_;
IPAddress default_route_v4_;
IPAddress default_route_v6_;
- uint32 bandwidth_;
- uint32 network_capacity_;
- uint32 send_buffer_capacity_;
- uint32 recv_buffer_capacity_;
- uint32 delay_mean_;
- uint32 delay_stddev_;
- uint32 delay_samples_;
+ uint32_t bandwidth_;
+ uint32_t network_capacity_;
+ uint32_t send_buffer_capacity_;
+ uint32_t recv_buffer_capacity_;
+ uint32_t delay_mean_;
+ uint32_t delay_stddev_;
+ uint32_t delay_samples_;
Function* delay_dist_;
CriticalSection delay_crit_;
@@ -276,7 +280,7 @@
ConnState GetState() const override;
int GetOption(Option opt, int* value) override;
int SetOption(Option opt, int value) override;
- int EstimateMTU(uint16* mtu) override;
+ int EstimateMTU(uint16_t* mtu) override;
void OnMessage(Message* pmsg) override;
bool was_any() { return was_any_; }
@@ -288,7 +292,7 @@
private:
struct NetworkEntry {
size_t size;
- uint32 done_time;
+ uint32_t done_time;
};
typedef std::deque<SocketAddress> ListenQueue;
diff --git a/webrtc/base/win32.cc b/webrtc/base/win32.cc
index 1f32e48..6e09829 100644
--- a/webrtc/base/win32.cc
+++ b/webrtc/base/win32.cc
@@ -82,8 +82,7 @@
if (size < INET6_ADDRSTRLEN) {
return NULL;
}
- const uint16* as_shorts =
- reinterpret_cast<const uint16*>(src);
+ const uint16_t* as_shorts = reinterpret_cast<const uint16_t*>(src);
int runpos[8];
int current = 1;
int max = 0;
@@ -214,8 +213,8 @@
struct in6_addr an_addr;
memset(&an_addr, 0, sizeof(an_addr));
- uint16* addr_cursor = reinterpret_cast<uint16*>(&an_addr.s6_addr[0]);
- uint16* addr_end = reinterpret_cast<uint16*>(&an_addr.s6_addr[16]);
+ uint16_t* addr_cursor = reinterpret_cast<uint16_t*>(&an_addr.s6_addr[0]);
+ uint16_t* addr_end = reinterpret_cast<uint16_t*>(&an_addr.s6_addr[16]);
bool seencompressed = false;
// Addresses that start with "::" (i.e., a run of initial zeros) or
@@ -228,7 +227,7 @@
if (rtc::strchr(addrstart, ".")) {
const char* colon = rtc::strchr(addrstart, "::");
if (colon) {
- uint16 a_short;
+ uint16_t a_short;
int bytesread = 0;
if (sscanf(addrstart, "%hx%n", &a_short, &bytesread) != 1 ||
a_short != 0xFFFF || bytesread != 4) {
@@ -283,7 +282,7 @@
++readcursor;
}
} else {
- uint16 word;
+ uint16_t word;
int bytesread = 0;
if (sscanf(readcursor, "%hx%n", &word, &bytesread) != 1) {
return 0;
@@ -362,7 +361,7 @@
// base date value.
const ULONGLONG RATIO = 10000000;
ULARGE_INTEGER current_ul;
- current_ul.QuadPart = base_ul.QuadPart + static_cast<int64>(ut) * RATIO;
+ current_ul.QuadPart = base_ul.QuadPart + static_cast<int64_t>(ut) * RATIO;
memcpy(ft, ¤t_ul, sizeof(FILETIME));
}
diff --git a/webrtc/base/win32.h b/webrtc/base/win32.h
index 9824f6b..dba9b77 100644
--- a/webrtc/base/win32.h
+++ b/webrtc/base/win32.h
@@ -85,7 +85,7 @@
bool Utf8ToWindowsFilename(const std::string& utf8, std::wstring* filename);
// Convert a FILETIME to a UInt64
-inline uint64 ToUInt64(const FILETIME& ft) {
+inline uint64_t ToUInt64(const FILETIME& ft) {
ULARGE_INTEGER r = {{ft.dwLowDateTime, ft.dwHighDateTime}};
return r.QuadPart;
}
diff --git a/webrtc/base/win32_unittest.cc b/webrtc/base/win32_unittest.cc
index 2bd93ac..15b2614 100644
--- a/webrtc/base/win32_unittest.cc
+++ b/webrtc/base/win32_unittest.cc
@@ -32,7 +32,7 @@
ft.dwHighDateTime = 0xBAADF00D;
ft.dwLowDateTime = 0xFEED3456;
- uint64 expected = 0xBAADF00DFEED3456;
+ uint64_t expected = 0xBAADF00DFEED3456;
EXPECT_EQ(expected, ToUInt64(ft));
}
diff --git a/webrtc/base/win32filesystem.cc b/webrtc/base/win32filesystem.cc
index 9ca4c99..8ac918f 100644
--- a/webrtc/base/win32filesystem.cc
+++ b/webrtc/base/win32filesystem.cc
@@ -379,7 +379,7 @@
}
bool Win32Filesystem::GetDiskFreeSpace(const Pathname& path,
- int64 *free_bytes) {
+ int64_t* free_bytes) {
if (!free_bytes) {
return false;
}
@@ -405,11 +405,11 @@
return false;
}
- int64 total_number_of_bytes; // receives the number of bytes on disk
- int64 total_number_of_free_bytes; // receives the free bytes on disk
+ int64_t total_number_of_bytes; // receives the number of bytes on disk
+ int64_t total_number_of_free_bytes; // receives the free bytes on disk
// make sure things won't change in 64 bit machine
// TODO replace with compile time assert
- ASSERT(sizeof(ULARGE_INTEGER) == sizeof(uint64)); //NOLINT
+ ASSERT(sizeof(ULARGE_INTEGER) == sizeof(uint64_t)); // NOLINT
if (::GetDiskFreeSpaceEx(target_drive,
(PULARGE_INTEGER)free_bytes,
(PULARGE_INTEGER)&total_number_of_bytes,
diff --git a/webrtc/base/win32filesystem.h b/webrtc/base/win32filesystem.h
index 0ae9218..439b2c6 100644
--- a/webrtc/base/win32filesystem.h
+++ b/webrtc/base/win32filesystem.h
@@ -91,7 +91,7 @@
// Get a temporary folder that is unique to the current user and application.
virtual bool GetAppTempFolder(Pathname* path);
- virtual bool GetDiskFreeSpace(const Pathname& path, int64 *free_bytes);
+ virtual bool GetDiskFreeSpace(const Pathname& path, int64_t* free_bytes);
virtual Pathname GetCurrentDirectory();
};
diff --git a/webrtc/base/win32regkey.cc b/webrtc/base/win32regkey.cc
index 1ed0d4e..ccf931c 100644
--- a/webrtc/base/win32regkey.cc
+++ b/webrtc/base/win32regkey.cc
@@ -100,22 +100,22 @@
HRESULT RegKey::SetValue(const wchar_t* full_key_name,
const wchar_t* value_name,
- const uint8* value,
+ const uint8_t* value,
DWORD byte_count) {
ASSERT(full_key_name != NULL);
return SetValueStaticHelper(full_key_name, value_name, REG_BINARY,
- const_cast<uint8*>(value), byte_count);
+ const_cast<uint8_t*>(value), byte_count);
}
HRESULT RegKey::SetValueMultiSZ(const wchar_t* full_key_name,
const wchar_t* value_name,
- const uint8* value,
+ const uint8_t* value,
DWORD byte_count) {
ASSERT(full_key_name != NULL);
return SetValueStaticHelper(full_key_name, value_name, REG_MULTI_SZ,
- const_cast<uint8*>(value), byte_count);
+ const_cast<uint8_t*>(value), byte_count);
}
HRESULT RegKey::GetValue(const wchar_t* full_key_name,
@@ -208,7 +208,7 @@
HRESULT RegKey::GetValue(const wchar_t* full_key_name,
const wchar_t* value_name,
- uint8** value,
+ uint8_t** value,
DWORD* byte_count) {
ASSERT(full_key_name != NULL);
ASSERT(value != NULL);
@@ -407,11 +407,11 @@
hr = key.SetValue(value_name, static_cast<const wchar_t*>(value));
break;
case REG_BINARY:
- hr = key.SetValue(value_name, static_cast<const uint8*>(value),
+ hr = key.SetValue(value_name, static_cast<const uint8_t*>(value),
byte_count);
break;
case REG_MULTI_SZ:
- hr = key.SetValue(value_name, static_cast<const uint8*>(value),
+ hr = key.SetValue(value_name, static_cast<const uint8_t*>(value),
byte_count, type);
break;
default:
@@ -461,7 +461,7 @@
std::vector<std::wstring>*>(value));
break;
case REG_BINARY:
- hr = key.GetValue(value_name, reinterpret_cast<uint8**>(value),
+ hr = key.GetValue(value_name, reinterpret_cast<uint8_t**>(value),
byte_count);
break;
default:
@@ -482,7 +482,7 @@
// GET helper
HRESULT RegKey::GetValueHelper(const wchar_t* value_name,
DWORD* type,
- uint8** value,
+ uint8_t** value,
DWORD* byte_count) const {
ASSERT(byte_count != NULL);
ASSERT(value != NULL);
@@ -608,7 +608,7 @@
}
// convert REG_MULTI_SZ bytes to string array
-HRESULT RegKey::MultiSZBytesToStringArray(const uint8* buffer,
+HRESULT RegKey::MultiSZBytesToStringArray(const uint8_t* buffer,
DWORD byte_count,
std::vector<std::wstring>* value) {
ASSERT(buffer != NULL);
@@ -640,7 +640,7 @@
DWORD byte_count = 0;
DWORD type = 0;
- uint8* buffer = 0;
+ uint8_t* buffer = 0;
// first get the size of the buffer
HRESULT hr = GetValueHelper(value_name, &type, &buffer, &byte_count);
@@ -655,7 +655,7 @@
// Binary data Get
HRESULT RegKey::GetValue(const wchar_t* value_name,
- uint8** value,
+ uint8_t** value,
DWORD* byte_count) const {
ASSERT(byte_count != NULL);
ASSERT(value != NULL);
@@ -668,9 +668,9 @@
// Raw data get
HRESULT RegKey::GetValue(const wchar_t* value_name,
- uint8** value,
+ uint8_t** value,
DWORD* byte_count,
- DWORD*type) const {
+ DWORD* type) const {
ASSERT(type != NULL);
ASSERT(byte_count != NULL);
ASSERT(value != NULL);
@@ -682,9 +682,9 @@
HRESULT RegKey::SetValue(const wchar_t* value_name, DWORD value) const {
ASSERT(h_key_ != NULL);
- LONG res = ::RegSetValueEx(h_key_, value_name, NULL, REG_DWORD,
- reinterpret_cast<const uint8*>(&value),
- sizeof(DWORD));
+ LONG res =
+ ::RegSetValueEx(h_key_, value_name, NULL, REG_DWORD,
+ reinterpret_cast<const uint8_t*>(&value), sizeof(DWORD));
return HRESULT_FROM_WIN32(res);
}
@@ -693,7 +693,7 @@
ASSERT(h_key_ != NULL);
LONG res = ::RegSetValueEx(h_key_, value_name, NULL, REG_QWORD,
- reinterpret_cast<const uint8*>(&value),
+ reinterpret_cast<const uint8_t*>(&value),
sizeof(DWORD64));
return HRESULT_FROM_WIN32(res);
}
@@ -705,14 +705,14 @@
ASSERT(h_key_ != NULL);
LONG res = ::RegSetValueEx(h_key_, value_name, NULL, REG_SZ,
- reinterpret_cast<const uint8*>(value),
+ reinterpret_cast<const uint8_t*>(value),
(lstrlen(value) + 1) * sizeof(wchar_t));
return HRESULT_FROM_WIN32(res);
}
// Binary data set
HRESULT RegKey::SetValue(const wchar_t* value_name,
- const uint8* value,
+ const uint8_t* value,
DWORD byte_count) const {
ASSERT(h_key_ != NULL);
@@ -728,7 +728,7 @@
// Raw data set
HRESULT RegKey::SetValue(const wchar_t* value_name,
- const uint8* value,
+ const uint8_t* value,
DWORD byte_count,
DWORD type) const {
ASSERT(value != NULL);
@@ -964,7 +964,7 @@
}
// get the number of values for this key
-uint32 RegKey::GetValueCount() {
+uint32_t RegKey::GetValueCount() {
DWORD num_values = 0;
if (ERROR_SUCCESS != ::RegQueryInfoKey(
@@ -1007,7 +1007,7 @@
return HRESULT_FROM_WIN32(res);
}
-uint32 RegKey::GetSubkeyCount() {
+uint32_t RegKey::GetSubkeyCount() {
// number of values for key
DWORD num_subkeys = 0;
diff --git a/webrtc/base/win32regkey.h b/webrtc/base/win32regkey.h
index 5508ea7..d5c51b9 100644
--- a/webrtc/base/win32regkey.h
+++ b/webrtc/base/win32regkey.h
@@ -64,7 +64,7 @@
bool HasValue(const wchar_t* value_name) const;
// get the number of values for this key
- uint32 GetValueCount();
+ uint32_t GetValueCount();
// Called to get the value name for the given value name index
// Use GetValueCount() to get the total value_name count for this key
@@ -80,7 +80,7 @@
bool HasSubkey(const wchar_t* key_name) const;
// get the number of subkeys for this key
- uint32 GetSubkeyCount();
+ uint32_t GetSubkeyCount();
// Called to get the key name for the given key index
// Use GetSubkeyCount() to get the total count for this key
@@ -92,10 +92,10 @@
// SETTERS
- // set an int32 value - use when reading multiple values from a key
+ // set an int32_t value - use when reading multiple values from a key
HRESULT SetValue(const wchar_t* value_name, DWORD value) const;
- // set an int64 value
+ // set an int64_t value
HRESULT SetValue(const wchar_t* value_name, DWORD64 value) const;
// set a string value
@@ -103,21 +103,21 @@
// set binary data
HRESULT SetValue(const wchar_t* value_name,
- const uint8* value,
+ const uint8_t* value,
DWORD byte_count) const;
// set raw data, including type
HRESULT SetValue(const wchar_t* value_name,
- const uint8* value,
+ const uint8_t* value,
DWORD byte_count,
DWORD type) const;
// GETTERS
- // get an int32 value
+ // get an int32_t value
HRESULT GetValue(const wchar_t* value_name, DWORD* value) const;
- // get an int64 value
+ // get an int64_t value
HRESULT GetValue(const wchar_t* value_name, DWORD64* value) const;
// get a string value - the caller must free the return buffer
@@ -132,12 +132,12 @@
// get binary data - the caller must free the return buffer
HRESULT GetValue(const wchar_t* value_name,
- uint8** value,
+ uint8_t** value,
DWORD* byte_count) const;
// get raw data, including type - the caller must free the return buffer
HRESULT GetValue(const wchar_t* value_name,
- uint8** value,
+ uint8_t** value,
DWORD* byte_count,
DWORD* type) const;
@@ -154,12 +154,12 @@
// SETTERS
- // STATIC int32 set
+ // STATIC int32_t set
static HRESULT SetValue(const wchar_t* full_key_name,
const wchar_t* value_name,
DWORD value);
- // STATIC int64 set
+ // STATIC int64_t set
static HRESULT SetValue(const wchar_t* full_key_name,
const wchar_t* value_name,
DWORD64 value);
@@ -182,23 +182,23 @@
// STATIC binary data set
static HRESULT SetValue(const wchar_t* full_key_name,
const wchar_t* value_name,
- const uint8* value,
+ const uint8_t* value,
DWORD byte_count);
// STATIC multi-string set
static HRESULT SetValueMultiSZ(const wchar_t* full_key_name,
const TCHAR* value_name,
- const uint8* value,
+ const uint8_t* value,
DWORD byte_count);
// GETTERS
- // STATIC int32 get
+ // STATIC int32_t get
static HRESULT GetValue(const wchar_t* full_key_name,
const wchar_t* value_name,
DWORD* value);
- // STATIC int64 get
+ // STATIC int64_t get
//
// Note: if you are using time64 you should
// likely use GetLimitedTimeValue (util.h) instead of this method.
@@ -233,7 +233,7 @@
// STATIC get binary data - the caller must free the return buffer
static HRESULT GetValue(const wchar_t* full_key_name,
const wchar_t* value_name,
- uint8** value,
+ uint8_t** value,
DWORD* byte_count);
// Get type of a registry value
@@ -297,7 +297,8 @@
// helper function to get any value from the registry
// used when the size of the data is unknown
HRESULT GetValueHelper(const wchar_t* value_name,
- DWORD* type, uint8** value,
+ DWORD* type,
+ uint8_t** value,
DWORD* byte_count) const;
// helper function to get the parent key name and the subkey from a string
@@ -320,7 +321,7 @@
DWORD* byte_count = NULL);
// convert REG_MULTI_SZ bytes to string array
- static HRESULT MultiSZBytesToStringArray(const uint8* buffer,
+ static HRESULT MultiSZBytesToStringArray(const uint8_t* buffer,
DWORD byte_count,
std::vector<std::wstring>* value);
diff --git a/webrtc/base/win32regkey_unittest.cc b/webrtc/base/win32regkey_unittest.cc
index d263051..389c3a2 100644
--- a/webrtc/base/win32regkey_unittest.cc
+++ b/webrtc/base/win32regkey_unittest.cc
@@ -150,18 +150,18 @@
std::vector<std::wstring> result;
EXPECT_SUCCEEDED(RegKey::MultiSZBytesToStringArray(
- reinterpret_cast<const uint8*>(kMultiSZ), sizeof(kMultiSZ), &result));
+ reinterpret_cast<const uint8_t*>(kMultiSZ), sizeof(kMultiSZ), &result));
EXPECT_EQ(result.size(), 3);
EXPECT_STREQ(result[0].c_str(), L"abc");
EXPECT_STREQ(result[1].c_str(), L"def");
EXPECT_STREQ(result[2].c_str(), L"P12345");
EXPECT_SUCCEEDED(RegKey::MultiSZBytesToStringArray(
- reinterpret_cast<const uint8*>(kEmptyMultiSZ),
- sizeof(kEmptyMultiSZ), &result));
+ reinterpret_cast<const uint8_t*>(kEmptyMultiSZ), sizeof(kEmptyMultiSZ),
+ &result));
EXPECT_EQ(result.size(), 0);
EXPECT_FALSE(SUCCEEDED(RegKey::MultiSZBytesToStringArray(
- reinterpret_cast<const uint8*>(kInvalidMultiSZ),
+ reinterpret_cast<const uint8_t*>(kInvalidMultiSZ),
sizeof(kInvalidMultiSZ), &result)));
}
@@ -173,7 +173,7 @@
DWORD int_val = 0;
DWORD64 int64_val = 0;
wchar_t* str_val = NULL;
- uint8* binary_val = NULL;
+ uint8_t* binary_val = NULL;
DWORD uint8_count = 0;
// Just in case...
@@ -265,7 +265,8 @@
// set a binary value
EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary,
- reinterpret_cast<const uint8*>(kBinaryVal), sizeof(kBinaryVal) - 1));
+ reinterpret_cast<const uint8_t*>(kBinaryVal),
+ sizeof(kBinaryVal) - 1));
// check that the value exists
EXPECT_TRUE(r_key.HasValue(kValNameBinary));
@@ -277,7 +278,8 @@
// set it again
EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary,
- reinterpret_cast<const uint8*>(kBinaryVal2), sizeof(kBinaryVal) - 1));
+ reinterpret_cast<const uint8_t*>(kBinaryVal2),
+ sizeof(kBinaryVal) - 1));
// read it again
EXPECT_SUCCEEDED(r_key.GetValue(kValNameBinary, &binary_val, &uint8_count));
@@ -303,10 +305,11 @@
// set a binary value
EXPECT_SUCCEEDED(r_key.SetValue(kValNameBinary,
- reinterpret_cast<const uint8*>(kBinaryVal), sizeof(kBinaryVal) - 1));
+ reinterpret_cast<const uint8_t*>(kBinaryVal),
+ sizeof(kBinaryVal) - 1));
// get the value count
- uint32 value_count = r_key.GetValueCount();
+ uint32_t value_count = r_key.GetValueCount();
EXPECT_EQ(value_count, 4);
// check the value names
@@ -332,7 +335,7 @@
// check that there are no more values
EXPECT_FAILED(r_key.GetValueNameAt(4, &value_name, &type));
- uint32 subkey_count = r_key.GetSubkeyCount();
+ uint32_t subkey_count = r_key.GetSubkeyCount();
EXPECT_EQ(subkey_count, 0);
// now create a subkey and make sure we can get the name
@@ -366,7 +369,7 @@
double double_val = 0;
wchar_t* str_val = NULL;
std::wstring wstr_val;
- uint8* binary_val = NULL;
+ uint8_t* binary_val = NULL;
DWORD uint8_count = 0;
// Just in case...
@@ -377,7 +380,7 @@
EXPECT_EQ(RegKey::GetValue(kFullRkey1, kValNameInt, &int_val),
HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
- // set int32
+ // set int32_t
EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameInt, kIntVal));
// check that the value exists
@@ -397,7 +400,7 @@
// check that the value is gone
EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameInt));
- // set int64
+ // set int64_t
EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameInt64, kIntVal64));
// check that the value exists
@@ -473,8 +476,9 @@
EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameStr));
// set binary
- EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameBinary,
- reinterpret_cast<const uint8*>(kBinaryVal), sizeof(kBinaryVal)-1));
+ EXPECT_SUCCEEDED(RegKey::SetValue(
+ kFullRkey1, kValNameBinary, reinterpret_cast<const uint8_t*>(kBinaryVal),
+ sizeof(kBinaryVal) - 1));
// check that the value exists
EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameBinary));
@@ -492,8 +496,9 @@
EXPECT_FALSE(RegKey::HasValue(kFullRkey1, kValNameBinary));
// special case - set a binary value with length 0
- EXPECT_SUCCEEDED(RegKey::SetValue(kFullRkey1, kValNameBinary,
- reinterpret_cast<const uint8*>(kBinaryVal), 0));
+ EXPECT_SUCCEEDED(
+ RegKey::SetValue(kFullRkey1, kValNameBinary,
+ reinterpret_cast<const uint8_t*>(kBinaryVal), 0));
// check that the value exists
EXPECT_TRUE(RegKey::HasValue(kFullRkey1, kValNameBinary));
@@ -532,20 +537,24 @@
// test read/write REG_MULTI_SZ value
std::vector<std::wstring> result;
- EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(kFullRkey1, kValNameMultiStr,
- reinterpret_cast<const uint8*>(kMultiSZ), sizeof(kMultiSZ)));
+ EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(
+ kFullRkey1, kValNameMultiStr, reinterpret_cast<const uint8_t*>(kMultiSZ),
+ sizeof(kMultiSZ)));
EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result));
EXPECT_EQ(result.size(), 3);
EXPECT_STREQ(result[0].c_str(), L"abc");
EXPECT_STREQ(result[1].c_str(), L"def");
EXPECT_STREQ(result[2].c_str(), L"P12345");
- EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(kFullRkey1, kValNameMultiStr,
- reinterpret_cast<const uint8*>(kEmptyMultiSZ), sizeof(kEmptyMultiSZ)));
+ EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(
+ kFullRkey1, kValNameMultiStr,
+ reinterpret_cast<const uint8_t*>(kEmptyMultiSZ), sizeof(kEmptyMultiSZ)));
EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result));
EXPECT_EQ(result.size(), 0);
// writing REG_MULTI_SZ value will automatically add ending null characters
- EXPECT_SUCCEEDED(RegKey::SetValueMultiSZ(kFullRkey1, kValNameMultiStr,
- reinterpret_cast<const uint8*>(kInvalidMultiSZ), sizeof(kInvalidMultiSZ)));
+ EXPECT_SUCCEEDED(
+ RegKey::SetValueMultiSZ(kFullRkey1, kValNameMultiStr,
+ reinterpret_cast<const uint8_t*>(kInvalidMultiSZ),
+ sizeof(kInvalidMultiSZ)));
EXPECT_SUCCEEDED(RegKey::GetValue(kFullRkey1, kValNameMultiStr, &result));
EXPECT_EQ(result.size(), 1);
EXPECT_STREQ(result[0].c_str(), L"678");
diff --git a/webrtc/base/win32socketserver.cc b/webrtc/base/win32socketserver.cc
index 2adb0d3..743f8c0 100644
--- a/webrtc/base/win32socketserver.cc
+++ b/webrtc/base/win32socketserver.cc
@@ -28,26 +28,26 @@
// TODO: Move this to a common place where PhysicalSocketServer can
// share it.
// Standard MTUs
-static const uint16 PACKET_MAXIMUMS[] = {
- 65535, // Theoretical maximum, Hyperchannel
- 32000, // Nothing
- 17914, // 16Mb IBM Token Ring
- 8166, // IEEE 802.4
- // 4464 // IEEE 802.5 (4Mb max)
- 4352, // FDDI
- // 2048, // Wideband Network
- 2002, // IEEE 802.5 (4Mb recommended)
- // 1536, // Expermental Ethernet Networks
- // 1500, // Ethernet, Point-to-Point (default)
- 1492, // IEEE 802.3
- 1006, // SLIP, ARPANET
- // 576, // X.25 Networks
- // 544, // DEC IP Portal
- // 512, // NETBIOS
- 508, // IEEE 802/Source-Rt Bridge, ARCNET
- 296, // Point-to-Point (low delay)
- 68, // Official minimum
- 0, // End of list marker
+static const uint16_t PACKET_MAXIMUMS[] = {
+ 65535, // Theoretical maximum, Hyperchannel
+ 32000, // Nothing
+ 17914, // 16Mb IBM Token Ring
+ 8166, // IEEE 802.4
+ // 4464 // IEEE 802.5 (4Mb max)
+ 4352, // FDDI
+ // 2048, // Wideband Network
+ 2002, // IEEE 802.5 (4Mb recommended)
+ // 1536, // Expermental Ethernet Networks
+ // 1500, // Ethernet, Point-to-Point (default)
+ 1492, // IEEE 802.3
+ 1006, // SLIP, ARPANET
+ // 576, // X.25 Networks
+ // 544, // DEC IP Portal
+ // 512, // NETBIOS
+ 508, // IEEE 802/Source-Rt Bridge, ARCNET
+ 296, // Point-to-Point (low delay)
+ 68, // Official minimum
+ 0, // End of list marker
};
static const int IP_HEADER_SIZE = 20u;
@@ -143,7 +143,7 @@
struct Win32Socket::DnsLookup {
HANDLE handle;
- uint16 port;
+ uint16_t port;
char buffer[MAXGETHOSTSTRUCT];
};
@@ -512,7 +512,7 @@
return err;
}
-int Win32Socket::EstimateMTU(uint16* mtu) {
+int Win32Socket::EstimateMTU(uint16_t* mtu) {
SocketAddress addr = GetRemoteAddress();
if (addr.IsAny()) {
error_ = ENOTCONN;
@@ -526,7 +526,7 @@
}
for (int level = 0; PACKET_MAXIMUMS[level + 1] > 0; ++level) {
- int32 size = PACKET_MAXIMUMS[level] - IP_HEADER_SIZE - ICMP_HEADER_SIZE;
+ int32_t size = PACKET_MAXIMUMS[level] - IP_HEADER_SIZE - ICMP_HEADER_SIZE;
WinPing::PingResult result = ping.Ping(addr.ipaddr(), size,
ICMP_PING_TIMEOUT_MILLIS, 1, false);
if (result == WinPing::PING_FAIL) {
@@ -627,7 +627,7 @@
if (error != ERROR_SUCCESS) {
ReportWSAError("WSAAsync:connect notify", error, addr_);
#ifdef _DEBUG
- int32 duration = TimeSince(connect_time_);
+ int32_t duration = TimeSince(connect_time_);
LOG(LS_INFO) << "WSAAsync:connect error (" << duration
<< " ms), faking close";
#endif
@@ -640,7 +640,7 @@
SignalCloseEvent(this, error);
} else {
#ifdef _DEBUG
- int32 duration = TimeSince(connect_time_);
+ int32_t duration = TimeSince(connect_time_);
LOG(LS_INFO) << "WSAAsync:connect (" << duration << " ms)";
#endif
state_ = CS_CONNECTED;
@@ -679,10 +679,10 @@
if (!dns_ || dns_->handle != task)
return;
- uint32 ip = 0;
+ uint32_t ip = 0;
if (error == 0) {
hostent* pHost = reinterpret_cast<hostent*>(dns_->buffer);
- uint32 net_ip = *reinterpret_cast<uint32*>(pHost->h_addr_list[0]);
+ uint32_t net_ip = *reinterpret_cast<uint32_t*>(pHost->h_addr_list[0]);
ip = NetworkToHost32(net_ip);
}
@@ -762,7 +762,7 @@
if (process_io) {
// Spin the Win32 message pump at least once, and as long as requested.
// This is the Thread::ProcessMessages case.
- uint32 start = Time();
+ uint32_t start = Time();
do {
MSG msg;
SetTimer(wnd_.handle(), 0, cms, NULL);
diff --git a/webrtc/base/win32socketserver.h b/webrtc/base/win32socketserver.h
index a03f6c0..b468cfd 100644
--- a/webrtc/base/win32socketserver.h
+++ b/webrtc/base/win32socketserver.h
@@ -52,7 +52,7 @@
virtual int GetError() const;
virtual void SetError(int error);
virtual ConnState GetState() const;
- virtual int EstimateMTU(uint16* mtu);
+ virtual int EstimateMTU(uint16_t* mtu);
virtual int GetOption(Option opt, int* value);
virtual int SetOption(Option opt, int value);
@@ -72,7 +72,7 @@
int error_;
ConnState state_;
SocketAddress addr_; // address that we connected to (see DoConnect)
- uint32 connect_time_;
+ uint32_t connect_time_;
bool closing_;
int close_error_;
diff --git a/webrtc/base/win32socketserver_unittest.cc b/webrtc/base/win32socketserver_unittest.cc
index 1d3ef2e..daf9e70 100644
--- a/webrtc/base/win32socketserver_unittest.cc
+++ b/webrtc/base/win32socketserver_unittest.cc
@@ -17,7 +17,7 @@
// Test that Win32SocketServer::Wait works as expected.
TEST(Win32SocketServerTest, TestWait) {
Win32SocketServer server(NULL);
- uint32 start = Time();
+ uint32_t start = Time();
server.Wait(1000, true);
EXPECT_GE(TimeSince(start), 1000);
}
diff --git a/webrtc/base/window.h b/webrtc/base/window.h
index 9f4381a..b1f1724 100644
--- a/webrtc/base/window.h
+++ b/webrtc/base/window.h
@@ -40,7 +40,7 @@
typedef unsigned int WindowT;
#endif
- static WindowId Cast(uint64 id) {
+ static WindowId Cast(uint64_t id) {
#if defined(WEBRTC_WIN)
return WindowId(reinterpret_cast<WindowId::WindowT>(id));
#else
@@ -48,11 +48,11 @@
#endif
}
- static uint64 Format(const WindowT& id) {
+ static uint64_t Format(const WindowT& id) {
#if defined(WEBRTC_WIN)
- return static_cast<uint64>(reinterpret_cast<uintptr_t>(id));
+ return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(id));
#else
- return static_cast<uint64>(id);
+ return static_cast<uint64_t>(id);
#endif
}
diff --git a/webrtc/base/winping.cc b/webrtc/base/winping.cc
index fa8dfc2..be436c3 100644
--- a/webrtc/base/winping.cc
+++ b/webrtc/base/winping.cc
@@ -126,11 +126,11 @@
const char * const ICMP6_CREATE_FUNC = "Icmp6CreateFile";
const char * const ICMP6_SEND_FUNC = "Icmp6SendEcho2";
-inline uint32 ReplySize(uint32 data_size, int family) {
+inline uint32_t ReplySize(uint32_t data_size, int family) {
if (family == AF_INET) {
// A ping error message is 8 bytes long, so make sure we allow for at least
// 8 bytes of reply data.
- return sizeof(ICMP_ECHO_REPLY) + std::max<uint32>(8, data_size);
+ return sizeof(ICMP_ECHO_REPLY) + std::max<uint32_t>(8, data_size);
} else if (family == AF_INET6) {
// Per MSDN, Send6IcmpEcho2 needs at least one ICMPV6_ECHO_REPLY,
// 8 bytes for ICMP header, _and_ an IO_BLOCK_STATUS (2 pointers),
@@ -208,10 +208,11 @@
delete[] reply_;
}
-WinPing::PingResult WinPing::Ping(
- IPAddress ip, uint32 data_size, uint32 timeout, uint8 ttl,
- bool allow_fragments) {
-
+WinPing::PingResult WinPing::Ping(IPAddress ip,
+ uint32_t data_size,
+ uint32_t timeout,
+ uint8_t ttl,
+ bool allow_fragments) {
if (data_size == 0 || timeout == 0 || ttl == 0) {
LOG(LERROR) << "IcmpSendEcho: data_size/timeout/ttl is 0.";
return PING_INVALID_PARAMS;
@@ -225,7 +226,7 @@
ipopt.Flags |= IP_FLAG_DF;
ipopt.Ttl = ttl;
- uint32 reply_size = ReplySize(data_size, ip.family());
+ uint32_t reply_size = ReplySize(data_size, ip.family());
if (data_size > dlen_) {
delete [] data_;
@@ -241,19 +242,16 @@
}
DWORD result = 0;
if (ip.family() == AF_INET) {
- result = send_(hping_, ip.ipv4_address().S_un.S_addr,
- data_, uint16(data_size), &ipopt,
- reply_, reply_size, timeout);
+ result = send_(hping_, ip.ipv4_address().S_un.S_addr, data_,
+ uint16_t(data_size), &ipopt, reply_, reply_size, timeout);
} else if (ip.family() == AF_INET6) {
sockaddr_in6 src = {0};
sockaddr_in6 dst = {0};
src.sin6_family = AF_INET6;
dst.sin6_family = AF_INET6;
dst.sin6_addr = ip.ipv6_address();
- result = send6_(hping6_, NULL, NULL, NULL,
- &src, &dst,
- data_, int16(data_size), &ipopt,
- reply_, reply_size, timeout);
+ result = send6_(hping6_, NULL, NULL, NULL, &src, &dst, data_,
+ int16_t(data_size), &ipopt, reply_, reply_size, timeout);
}
if (result == 0) {
DWORD error = GetLastError();
diff --git a/webrtc/base/winping.h b/webrtc/base/winping.h
index 75f82b7..ddaefc5 100644
--- a/webrtc/base/winping.h
+++ b/webrtc/base/winping.h
@@ -76,9 +76,11 @@
// Attempts to send a ping with the given parameters.
enum PingResult { PING_FAIL, PING_INVALID_PARAMS,
PING_TOO_LARGE, PING_TIMEOUT, PING_SUCCESS };
- PingResult Ping(
- IPAddress ip, uint32 data_size, uint32 timeout_millis, uint8 ttl,
- bool allow_fragments);
+ PingResult Ping(IPAddress ip,
+ uint32_t data_size,
+ uint32_t timeout_millis,
+ uint8_t ttl,
+ bool allow_fragments);
private:
HMODULE dll_;
@@ -90,9 +92,9 @@
PIcmp6CreateFile create6_;
PIcmp6SendEcho2 send6_;
char* data_;
- uint32 dlen_;
+ uint32_t dlen_;
char* reply_;
- uint32 rlen_;
+ uint32_t rlen_;
bool valid_;
};
diff --git a/webrtc/base/x11windowpicker.cc b/webrtc/base/x11windowpicker.cc
index f7c7911..21f71c6 100644
--- a/webrtc/base/x11windowpicker.cc
+++ b/webrtc/base/x11windowpicker.cc
@@ -277,7 +277,7 @@
return true;
}
- uint8* GetWindowIcon(const WindowId& id, int* width, int* height) {
+ uint8_t* GetWindowIcon(const WindowId& id, int* width, int* height) {
if (!Init()) {
return NULL;
}
@@ -297,14 +297,14 @@
LOG(LS_ERROR) << "Failed to get size of the icon.";
return NULL;
}
- // Get the icon data, the format is one uint32 each for width and height,
+ // Get the icon data, the format is one uint32_t each for width and height,
// followed by the actual pixel data.
if (size >= 2 &&
XGetWindowProperty(
display_, id.id(), net_wm_icon_, 0, size, False, XA_CARDINAL,
&ret_type, &format, &length, &bytes_after, &data) == Success &&
data) {
- uint32* data_ptr = reinterpret_cast<uint32*>(data);
+ uint32_t* data_ptr = reinterpret_cast<uint32_t*>(data);
int w, h;
w = data_ptr[0];
h = data_ptr[1];
@@ -313,8 +313,7 @@
LOG(LS_ERROR) << "Not a vaild icon.";
return NULL;
}
- uint8* rgba =
- ArgbToRgba(&data_ptr[2], 0, 0, w, h, w, h, true);
+ uint8_t* rgba = ArgbToRgba(&data_ptr[2], 0, 0, w, h, w, h, true);
XFree(data);
*width = w;
*height = h;
@@ -325,7 +324,7 @@
}
}
- uint8* GetWindowThumbnail(const WindowId& id, int width, int height) {
+ uint8_t* GetWindowThumbnail(const WindowId& id, int width, int height) {
if (!Init()) {
return NULL;
}
@@ -390,12 +389,8 @@
return NULL;
}
- uint8* data = GetDrawableThumbnail(src_pixmap,
- attr.visual,
- src_width,
- src_height,
- width,
- height);
+ uint8_t* data = GetDrawableThumbnail(src_pixmap, attr.visual, src_width,
+ src_height, width, height);
XFreePixmap(display_, src_pixmap);
return data;
}
@@ -408,7 +403,7 @@
return XScreenCount(display_);
}
- uint8* GetDesktopThumbnail(const DesktopId& id, int width, int height) {
+ uint8_t* GetDesktopThumbnail(const DesktopId& id, int width, int height) {
if (!Init()) {
return NULL;
}
@@ -445,12 +440,12 @@
}
private:
- uint8* GetDrawableThumbnail(Drawable src_drawable,
- Visual* visual,
- int src_width,
- int src_height,
- int dst_width,
- int dst_height) {
+ uint8_t* GetDrawableThumbnail(Drawable src_drawable,
+ Visual* visual,
+ int src_width,
+ int src_height,
+ int dst_width,
+ int dst_height) {
if (!has_render_extension_) {
// Without the Xrender extension we would have to read the full window and
// scale it down in our process. Xrender is over a decade old so we aren't
@@ -561,14 +556,9 @@
dst_width,
dst_height,
AllPlanes, ZPixmap);
- uint8* data = ArgbToRgba(reinterpret_cast<uint32*>(image->data),
- centered_x,
- centered_y,
- scaled_width,
- scaled_height,
- dst_width,
- dst_height,
- false);
+ uint8_t* data = ArgbToRgba(reinterpret_cast<uint32_t*>(image->data),
+ centered_x, centered_y, scaled_width,
+ scaled_height, dst_width, dst_height, false);
XDestroyImage(image);
XRenderFreePicture(display_, dst);
XFreePixmap(display_, dst_pixmap);
@@ -576,17 +566,23 @@
return data;
}
- uint8* ArgbToRgba(uint32* argb_data, int x, int y, int w, int h,
- int stride_x, int stride_y, bool has_alpha) {
- uint8* p;
+ uint8_t* ArgbToRgba(uint32_t* argb_data,
+ int x,
+ int y,
+ int w,
+ int h,
+ int stride_x,
+ int stride_y,
+ bool has_alpha) {
+ uint8_t* p;
int len = stride_x * stride_y * 4;
- uint8* data = new uint8[len];
+ uint8_t* data = new uint8_t[len];
memset(data, 0, len);
p = data + 4 * (y * stride_x + x);
for (int i = 0; i < h; ++i) {
for (int j = 0; j < w; ++j) {
- uint32 argb;
- uint32 rgba;
+ uint32_t argb;
+ uint32_t rgba;
argb = argb_data[stride_x * (y + i) + x + j];
rgba = (argb << 8) | (argb >> 24);
*p = rgba >> 24;
@@ -691,7 +687,7 @@
return 0;
}
if (type != None) {
- int64 state = static_cast<int64>(*data);
+ int64_t state = static_cast<int64_t>(*data);
XFree(data);
return state == NormalState ? window : 0;
}
@@ -789,13 +785,14 @@
return enumerator_->MoveToFront(id);
}
-
-uint8* X11WindowPicker::GetWindowIcon(const WindowId& id, int* width,
+uint8_t* X11WindowPicker::GetWindowIcon(const WindowId& id,
+ int* width,
int* height) {
return enumerator_->GetWindowIcon(id, width, height);
}
-uint8* X11WindowPicker::GetWindowThumbnail(const WindowId& id, int width,
+uint8_t* X11WindowPicker::GetWindowThumbnail(const WindowId& id,
+ int width,
int height) {
return enumerator_->GetWindowThumbnail(id, width, height);
}
@@ -804,7 +801,7 @@
return enumerator_->GetNumDesktops();
}
-uint8* X11WindowPicker::GetDesktopThumbnail(const DesktopId& id,
+uint8_t* X11WindowPicker::GetDesktopThumbnail(const DesktopId& id,
int width,
int height) {
return enumerator_->GetDesktopThumbnail(id, width, height);
diff --git a/webrtc/base/x11windowpicker.h b/webrtc/base/x11windowpicker.h
index b340b88..501adf5 100644
--- a/webrtc/base/x11windowpicker.h
+++ b/webrtc/base/x11windowpicker.h
@@ -38,10 +38,10 @@
bool GetDesktopDimensions(const DesktopId& id,
int* width,
int* height) override;
- uint8* GetWindowIcon(const WindowId& id, int* width, int* height);
- uint8* GetWindowThumbnail(const WindowId& id, int width, int height);
+ uint8_t* GetWindowIcon(const WindowId& id, int* width, int* height);
+ uint8_t* GetWindowThumbnail(const WindowId& id, int width, int height);
int GetNumDesktops();
- uint8* GetDesktopThumbnail(const DesktopId& id, int width, int height);
+ uint8_t* GetDesktopThumbnail(const DesktopId& id, int width, int height);
private:
scoped_ptr<XWindowEnumerator> enumerator_;
diff --git a/webrtc/examples/android/media_demo/jni/jni_helpers.h b/webrtc/examples/android/media_demo/jni/jni_helpers.h
index c3f2b5d..3d8ff48 100644
--- a/webrtc/examples/android/media_demo/jni/jni_helpers.h
+++ b/webrtc/examples/android/media_demo/jni/jni_helpers.h
@@ -51,7 +51,7 @@
const char* signature);
// Return a |jlong| that will automatically convert back to |ptr| when assigned
-// to a |uint64|
+// to a |uint64_t|
jlong jlongFromPointer(void* ptr);
// Given a (UTF-16) jstring return a new UTF-8 native string.
diff --git a/webrtc/examples/peerconnection/client/defaults.cc b/webrtc/examples/peerconnection/client/defaults.cc
index b686cd7..3090c15 100644
--- a/webrtc/examples/peerconnection/client/defaults.cc
+++ b/webrtc/examples/peerconnection/client/defaults.cc
@@ -24,7 +24,7 @@
const char kAudioLabel[] = "audio_label";
const char kVideoLabel[] = "video_label";
const char kStreamLabel[] = "stream_label";
-const uint16 kDefaultServerPort = 8888;
+const uint16_t kDefaultServerPort = 8888;
std::string GetEnvVarOrDefault(const char* env_var_name,
const char* default_value) {
diff --git a/webrtc/examples/peerconnection/client/defaults.h b/webrtc/examples/peerconnection/client/defaults.h
index ab8276b..7b50397 100644
--- a/webrtc/examples/peerconnection/client/defaults.h
+++ b/webrtc/examples/peerconnection/client/defaults.h
@@ -19,7 +19,7 @@
extern const char kAudioLabel[];
extern const char kVideoLabel[];
extern const char kStreamLabel[];
-extern const uint16 kDefaultServerPort;
+extern const uint16_t kDefaultServerPort;
std::string GetEnvVarOrDefault(const char* env_var_name,
const char* default_value);
diff --git a/webrtc/examples/peerconnection/client/flagdefs.h b/webrtc/examples/peerconnection/client/flagdefs.h
index 00e134d..0cffffb 100644
--- a/webrtc/examples/peerconnection/client/flagdefs.h
+++ b/webrtc/examples/peerconnection/client/flagdefs.h
@@ -14,7 +14,7 @@
#include "webrtc/base/flags.h"
-extern const uint16 kDefaultServerPort; // From defaults.[h|cc]
+extern const uint16_t kDefaultServerPort; // From defaults.[h|cc]
// Define flags for the peerconnect_client testing tool, in a separate
// header file so that they can be shared across the different main.cc's
diff --git a/webrtc/examples/peerconnection/client/linux/main_wnd.cc b/webrtc/examples/peerconnection/client/linux/main_wnd.cc
index 02b6e32..254fb94 100644
--- a/webrtc/examples/peerconnection/client/linux/main_wnd.cc
+++ b/webrtc/examples/peerconnection/client/linux/main_wnd.cc
@@ -394,20 +394,20 @@
if (!draw_buffer_.get()) {
draw_buffer_size_ = (width * height * 4) * 4;
- draw_buffer_.reset(new uint8[draw_buffer_size_]);
+ draw_buffer_.reset(new uint8_t[draw_buffer_size_]);
gtk_widget_set_size_request(draw_area_, width * 2, height * 2);
}
- const uint32* image = reinterpret_cast<const uint32*>(
- remote_renderer->image());
- uint32* scaled = reinterpret_cast<uint32*>(draw_buffer_.get());
+ const uint32_t* image =
+ reinterpret_cast<const uint32_t*>(remote_renderer->image());
+ uint32_t* scaled = reinterpret_cast<uint32_t*>(draw_buffer_.get());
for (int r = 0; r < height; ++r) {
for (int c = 0; c < width; ++c) {
int x = c * 2;
scaled[x] = scaled[x + 1] = image[c];
}
- uint32* prev_line = scaled;
+ uint32_t* prev_line = scaled;
scaled += width * 2;
memcpy(scaled, prev_line, (width * 2) * 4);
@@ -417,8 +417,8 @@
VideoRenderer* local_renderer = local_renderer_.get();
if (local_renderer && local_renderer->image()) {
- image = reinterpret_cast<const uint32*>(local_renderer->image());
- scaled = reinterpret_cast<uint32*>(draw_buffer_.get());
+ image = reinterpret_cast<const uint32_t*>(local_renderer->image());
+ scaled = reinterpret_cast<uint32_t*>(draw_buffer_.get());
// Position the local preview on the right side.
scaled += (width * 2) - (local_renderer->width() / 2);
// right margin...
@@ -474,7 +474,7 @@
width_ = width;
height_ = height;
- image_.reset(new uint8[width * height * 4]);
+ image_.reset(new uint8_t[width * height * 4]);
gdk_threads_leave();
}
@@ -495,8 +495,8 @@
width_ * 4);
// Convert the B,G,R,A frame to R,G,B,A, which is accepted by GTK.
// The 'A' is just padding for GTK, so we can use it as temp.
- uint8* pix = image_.get();
- uint8* end = image_.get() + size;
+ uint8_t* pix = image_.get();
+ uint8_t* end = image_.get() + size;
while (pix < end) {
pix[3] = pix[0]; // Save B to A.
pix[0] = pix[2]; // Set Red.
diff --git a/webrtc/examples/peerconnection/client/linux/main_wnd.h b/webrtc/examples/peerconnection/client/linux/main_wnd.h
index cfb2376..1a91082 100644
--- a/webrtc/examples/peerconnection/client/linux/main_wnd.h
+++ b/webrtc/examples/peerconnection/client/linux/main_wnd.h
@@ -79,9 +79,7 @@
virtual void SetSize(int width, int height);
virtual void RenderFrame(const cricket::VideoFrame* frame);
- const uint8* image() const {
- return image_.get();
- }
+ const uint8_t* image() const { return image_.get(); }
int width() const {
return width_;
@@ -92,7 +90,7 @@
}
protected:
- rtc::scoped_ptr<uint8[]> image_;
+ rtc::scoped_ptr<uint8_t[]> image_;
int width_;
int height_;
GtkMainWnd* main_wnd_;
@@ -113,7 +111,7 @@
bool autocall_;
rtc::scoped_ptr<VideoRenderer> local_renderer_;
rtc::scoped_ptr<VideoRenderer> remote_renderer_;
- rtc::scoped_ptr<uint8> draw_buffer_;
+ rtc::scoped_ptr<uint8_t[]> draw_buffer_;
int draw_buffer_size_;
};
diff --git a/webrtc/examples/peerconnection/client/main_wnd.cc b/webrtc/examples/peerconnection/client/main_wnd.cc
index fa356ff..30b12a8 100644
--- a/webrtc/examples/peerconnection/client/main_wnd.cc
+++ b/webrtc/examples/peerconnection/client/main_wnd.cc
@@ -234,7 +234,7 @@
int height = abs(bmi.bmiHeader.biHeight);
int width = bmi.bmiHeader.biWidth;
- const uint8* image = remote_renderer->image();
+ const uint8_t* image = remote_renderer->image();
if (image != NULL) {
HDC dc_mem = ::CreateCompatibleDC(ps.hdc);
::SetStretchBltMode(dc_mem, HALFTONE);
@@ -594,7 +594,7 @@
bmi_.bmiHeader.biHeight = -height;
bmi_.bmiHeader.biSizeImage = width * height *
(bmi_.bmiHeader.biBitCount >> 3);
- image_.reset(new uint8[bmi_.bmiHeader.biSizeImage]);
+ image_.reset(new uint8_t[bmi_.bmiHeader.biSizeImage]);
}
void MainWnd::VideoRenderer::RenderFrame(
diff --git a/webrtc/examples/peerconnection/client/main_wnd.h b/webrtc/examples/peerconnection/client/main_wnd.h
index c11e94d..9f61a56 100644
--- a/webrtc/examples/peerconnection/client/main_wnd.h
+++ b/webrtc/examples/peerconnection/client/main_wnd.h
@@ -120,7 +120,7 @@
virtual void RenderFrame(const cricket::VideoFrame* frame);
const BITMAPINFO& bmi() const { return bmi_; }
- const uint8* image() const { return image_.get(); }
+ const uint8_t* image() const { return image_.get(); }
protected:
enum {
@@ -130,7 +130,7 @@
HWND wnd_;
BITMAPINFO bmi_;
- rtc::scoped_ptr<uint8[]> image_;
+ rtc::scoped_ptr<uint8_t[]> image_;
CRITICAL_SECTION buffer_lock_;
rtc::scoped_refptr<webrtc::VideoTrackInterface> rendered_track_;
};
diff --git a/webrtc/libjingle/xmpp/pingtask.cc b/webrtc/libjingle/xmpp/pingtask.cc
index d44a6d1..479dc23 100644
--- a/webrtc/libjingle/xmpp/pingtask.cc
+++ b/webrtc/libjingle/xmpp/pingtask.cc
@@ -18,8 +18,8 @@
PingTask::PingTask(buzz::XmppTaskParentInterface* parent,
rtc::MessageQueue* message_queue,
- uint32 ping_period_millis,
- uint32 ping_timeout_millis)
+ uint32_t ping_period_millis,
+ uint32_t ping_timeout_millis)
: buzz::XmppTask(parent, buzz::XmppEngine::HL_SINGLE),
message_queue_(message_queue),
ping_period_millis_(ping_period_millis),
@@ -56,7 +56,7 @@
ping_response_deadline_ = 0;
}
- uint32 now = rtc::Time();
+ uint32_t now = rtc::Time();
// If the ping timed out, signal.
if (ping_response_deadline_ != 0 && now >= ping_response_deadline_) {
diff --git a/webrtc/libjingle/xmpp/pingtask.h b/webrtc/libjingle/xmpp/pingtask.h
index 9ea905b..22fd94d 100644
--- a/webrtc/libjingle/xmpp/pingtask.h
+++ b/webrtc/libjingle/xmpp/pingtask.h
@@ -28,8 +28,9 @@
class PingTask : public buzz::XmppTask, private rtc::MessageHandler {
public:
PingTask(buzz::XmppTaskParentInterface* parent,
- rtc::MessageQueue* message_queue, uint32 ping_period_millis,
- uint32 ping_timeout_millis);
+ rtc::MessageQueue* message_queue,
+ uint32_t ping_period_millis,
+ uint32_t ping_timeout_millis);
virtual bool HandleStanza(const buzz::XmlElement* stanza);
virtual int ProcessStart();
@@ -43,10 +44,10 @@
virtual void OnMessage(rtc::Message* msg);
rtc::MessageQueue* message_queue_;
- uint32 ping_period_millis_;
- uint32 ping_timeout_millis_;
- uint32 next_ping_time_;
- uint32 ping_response_deadline_; // 0 if the response has been received
+ uint32_t ping_period_millis_;
+ uint32_t ping_timeout_millis_;
+ uint32_t next_ping_time_;
+ uint32_t ping_response_deadline_; // 0 if the response has been received
};
} // namespace buzz
diff --git a/webrtc/libjingle/xmpp/pingtask_unittest.cc b/webrtc/libjingle/xmpp/pingtask_unittest.cc
index 08a5770..b9aab6b 100644
--- a/webrtc/libjingle/xmpp/pingtask_unittest.cc
+++ b/webrtc/libjingle/xmpp/pingtask_unittest.cc
@@ -74,7 +74,7 @@
}
TEST_F(PingTaskTest, TestSuccess) {
- uint32 ping_period_millis = 100;
+ uint32_t ping_period_millis = 100;
buzz::PingTask* task = new buzz::PingTask(xmpp_client,
rtc::Thread::Current(),
ping_period_millis, ping_period_millis / 10);
@@ -89,7 +89,7 @@
TEST_F(PingTaskTest, TestTimeout) {
respond_to_pings = false;
- uint32 ping_timeout_millis = 200;
+ uint32_t ping_timeout_millis = 200;
buzz::PingTask* task = new buzz::PingTask(xmpp_client,
rtc::Thread::Current(),
ping_timeout_millis * 10, ping_timeout_millis);
diff --git a/webrtc/libjingle/xmpp/xmpppump.cc b/webrtc/libjingle/xmpp/xmpppump.cc
index 45259b1..a428ffa 100644
--- a/webrtc/libjingle/xmpp/xmpppump.cc
+++ b/webrtc/libjingle/xmpp/xmpppump.cc
@@ -49,8 +49,8 @@
rtc::Thread::Current()->Post(this);
}
-int64 XmppPump::CurrentTime() {
- return (int64)rtc::Time();
+int64_t XmppPump::CurrentTime() {
+ return (int64_t)rtc::Time();
}
void XmppPump::OnMessage(rtc::Message *pmsg) {
diff --git a/webrtc/libjingle/xmpp/xmpppump.h b/webrtc/libjingle/xmpp/xmpppump.h
index 8163298..bd1b562 100644
--- a/webrtc/libjingle/xmpp/xmpppump.h
+++ b/webrtc/libjingle/xmpp/xmpppump.h
@@ -44,7 +44,7 @@
void WakeTasks();
- int64 CurrentTime();
+ int64_t CurrentTime();
void OnMessage(rtc::Message *pmsg);
diff --git a/webrtc/libjingle/xmpp/xmppthread.cc b/webrtc/libjingle/xmpp/xmppthread.cc
index faf2164..f492cdf 100644
--- a/webrtc/libjingle/xmpp/xmppthread.cc
+++ b/webrtc/libjingle/xmpp/xmppthread.cc
@@ -16,8 +16,8 @@
namespace buzz {
namespace {
-const uint32 MSG_LOGIN = 1;
-const uint32 MSG_DISCONNECT = 2;
+const uint32_t MSG_LOGIN = 1;
+const uint32_t MSG_DISCONNECT = 2;
struct LoginData: public rtc::MessageData {
LoginData(const buzz::XmppClientSettings& s) : xcs(s) {}
diff --git a/webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc b/webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc
index dfbb6b7..b78b96d 100644
--- a/webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc
+++ b/webrtc/modules/rtp_rtcp/source/h264_bitstream_parser.cc
@@ -90,11 +90,9 @@
return false; \
}
-H264BitstreamParser::PpsState::PpsState() {
-}
+H264BitstreamParser::PpsState::PpsState() {}
-H264BitstreamParser::SpsState::SpsState() {
-}
+H264BitstreamParser::SpsState::SpsState() {}
// These functions are similar to webrtc::H264SpsParser::Parse, and based on the
// same version of the H.264 standard. You can find it here:
@@ -107,7 +105,7 @@
// copy. We'll eventually write this back.
rtc::scoped_ptr<rtc::ByteBuffer> sps_rbsp(
ParseRbsp(sps + kNaluHeaderAndTypeSize, length - kNaluHeaderAndTypeSize));
- rtc::BitBuffer sps_parser(reinterpret_cast<const uint8*>(sps_rbsp->Data()),
+ rtc::BitBuffer sps_parser(reinterpret_cast<const uint8_t*>(sps_rbsp->Data()),
sps_rbsp->Length());
uint8_t byte_tmp;
@@ -115,7 +113,7 @@
uint32_t bits_tmp;
// profile_idc: u(8).
- uint8 profile_idc;
+ uint8_t profile_idc;
RETURN_FALSE_ON_FAIL(sps_parser.ReadUInt8(&profile_idc));
// constraint_set0_flag through constraint_set5_flag + reserved_zero_2bits
// 1 bit each for the flags + 2 bits = 8 bits = 1 byte.
@@ -131,7 +129,7 @@
profile_idc == 86 || profile_idc == 118 || profile_idc == 128 ||
profile_idc == 138 || profile_idc == 139 || profile_idc == 134) {
// chroma_format_idc: ue(v)
- uint32 chroma_format_idc;
+ uint32_t chroma_format_idc;
RETURN_FALSE_ON_FAIL(sps_parser.ReadExponentialGolomb(&chroma_format_idc));
if (chroma_format_idc == 3) {
// separate_colour_plane_flag: u(1)
@@ -213,7 +211,7 @@
pps_parsed_ = false;
rtc::scoped_ptr<rtc::ByteBuffer> buffer(
ParseRbsp(pps + kNaluHeaderAndTypeSize, length - kNaluHeaderAndTypeSize));
- rtc::BitBuffer parser(reinterpret_cast<const uint8*>(buffer->Data()),
+ rtc::BitBuffer parser(reinterpret_cast<const uint8_t*>(buffer->Data()),
buffer->Length());
uint32_t bits_tmp;
@@ -322,7 +320,8 @@
rtc::scoped_ptr<rtc::ByteBuffer> slice_rbsp(ParseRbsp(
source + kNaluHeaderAndTypeSize, source_length - kNaluHeaderAndTypeSize));
rtc::BitBuffer slice_reader(
- reinterpret_cast<const uint8*>(slice_rbsp->Data()), slice_rbsp->Length());
+ reinterpret_cast<const uint8_t*>(slice_rbsp->Data()),
+ slice_rbsp->Length());
// Check to see if this is an IDR slice, which has an extra field to parse
// out.
bool is_idr = (source[kNaluHeaderSize] & 0x0F) == kNaluIdr;
@@ -349,7 +348,7 @@
// Represented by log2_max_frame_num_minus4 + 4 bits.
RETURN_FALSE_ON_FAIL(
slice_reader.ReadBits(&bits_tmp, sps_.log2_max_frame_num_minus4 + 4));
- uint32 field_pic_flag = 0;
+ uint32_t field_pic_flag = 0;
if (sps_.frame_mbs_only_flag == 0) {
// field_pic_flag: u(1)
RETURN_FALSE_ON_FAIL(slice_reader.ReadBits(&field_pic_flag, 1));
diff --git a/webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc b/webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc
index d8f9afd..00ab9d4 100644
--- a/webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc
+++ b/webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc
@@ -21,7 +21,7 @@
namespace webrtc {
-H264SpsParser::H264SpsParser(const uint8* sps, size_t byte_length)
+H264SpsParser::H264SpsParser(const uint8_t* sps, size_t byte_length)
: sps_(sps), byte_length_(byte_length), width_(), height_() {
}
@@ -62,22 +62,22 @@
// chroma_format_idc -> affects crop units
// pic_{width,height}_* -> resolution of the frame in macroblocks (16x16).
// frame_crop_*_offset -> crop information
- rtc::BitBuffer parser(reinterpret_cast<const uint8*>(rbsp_buffer.Data()),
+ rtc::BitBuffer parser(reinterpret_cast<const uint8_t*>(rbsp_buffer.Data()),
rbsp_buffer.Length());
// The golomb values we have to read, not just consume.
- uint32 golomb_ignored;
+ uint32_t golomb_ignored;
// separate_colour_plane_flag is optional (assumed 0), but has implications
// about the ChromaArrayType, which modifies how we treat crop coordinates.
- uint32 separate_colour_plane_flag = 0;
+ uint32_t separate_colour_plane_flag = 0;
// chroma_format_idc will be ChromaArrayType if separate_colour_plane_flag is
// 0. It defaults to 1, when not specified.
- uint32 chroma_format_idc = 1;
+ uint32_t chroma_format_idc = 1;
// profile_idc: u(8). We need it to determine if we need to read/skip chroma
// formats.
- uint8 profile_idc;
+ uint8_t profile_idc;
RETURN_FALSE_ON_FAIL(parser.ReadUInt8(&profile_idc));
// constraint_set0_flag through constraint_set5_flag + reserved_zero_2bits
// 1 bit each for the flags + 2 bits = 8 bits = 1 byte.
@@ -104,12 +104,12 @@
// qpprime_y_zero_transform_bypass_flag: u(1)
RETURN_FALSE_ON_FAIL(parser.ConsumeBits(1));
// seq_scaling_matrix_present_flag: u(1)
- uint32 seq_scaling_matrix_present_flag;
+ uint32_t seq_scaling_matrix_present_flag;
RETURN_FALSE_ON_FAIL(parser.ReadBits(&seq_scaling_matrix_present_flag, 1));
if (seq_scaling_matrix_present_flag) {
// seq_scaling_list_present_flags. Either 8 or 12, depending on
// chroma_format_idc.
- uint32 seq_scaling_list_present_flags;
+ uint32_t seq_scaling_list_present_flags;
if (chroma_format_idc != 3) {
RETURN_FALSE_ON_FAIL(
parser.ReadBits(&seq_scaling_list_present_flags, 8));
@@ -129,7 +129,7 @@
// log2_max_frame_num_minus4: ue(v)
RETURN_FALSE_ON_FAIL(parser.ReadExponentialGolomb(&golomb_ignored));
// pic_order_cnt_type: ue(v)
- uint32 pic_order_cnt_type;
+ uint32_t pic_order_cnt_type;
RETURN_FALSE_ON_FAIL(parser.ReadExponentialGolomb(&pic_order_cnt_type));
if (pic_order_cnt_type == 0) {
// log2_max_pic_order_cnt_lsb_minus4: ue(v)
@@ -142,7 +142,7 @@
// offset_for_top_to_bottom_field: se(v)
RETURN_FALSE_ON_FAIL(parser.ReadExponentialGolomb(&golomb_ignored));
// num_ref_frames_in_pic_order_cnt_cycle: ue(v)
- uint32 num_ref_frames_in_pic_order_cnt_cycle;
+ uint32_t num_ref_frames_in_pic_order_cnt_cycle;
RETURN_FALSE_ON_FAIL(
parser.ReadExponentialGolomb(&num_ref_frames_in_pic_order_cnt_cycle));
for (size_t i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; ++i) {
@@ -161,14 +161,14 @@
// to signify resolutions that aren't multiples of 16.
//
// pic_width_in_mbs_minus1: ue(v)
- uint32 pic_width_in_mbs_minus1;
+ uint32_t pic_width_in_mbs_minus1;
RETURN_FALSE_ON_FAIL(parser.ReadExponentialGolomb(&pic_width_in_mbs_minus1));
// pic_height_in_map_units_minus1: ue(v)
- uint32 pic_height_in_map_units_minus1;
+ uint32_t pic_height_in_map_units_minus1;
RETURN_FALSE_ON_FAIL(
parser.ReadExponentialGolomb(&pic_height_in_map_units_minus1));
// frame_mbs_only_flag: u(1)
- uint32 frame_mbs_only_flag;
+ uint32_t frame_mbs_only_flag;
RETURN_FALSE_ON_FAIL(parser.ReadBits(&frame_mbs_only_flag, 1));
if (!frame_mbs_only_flag) {
// mb_adaptive_frame_field_flag: u(1)
@@ -180,11 +180,11 @@
// MORE IMPORTANT ONES! Now we're at the frame crop information.
//
// frame_cropping_flag: u(1)
- uint32 frame_cropping_flag;
- uint32 frame_crop_left_offset = 0;
- uint32 frame_crop_right_offset = 0;
- uint32 frame_crop_top_offset = 0;
- uint32 frame_crop_bottom_offset = 0;
+ uint32_t frame_cropping_flag;
+ uint32_t frame_crop_left_offset = 0;
+ uint32_t frame_crop_right_offset = 0;
+ uint32_t frame_crop_top_offset = 0;
+ uint32_t frame_crop_bottom_offset = 0;
RETURN_FALSE_ON_FAIL(parser.ReadBits(&frame_cropping_flag, 1));
if (frame_cropping_flag) {
// frame_crop_{left, right, top, bottom}_offset: ue(v)
diff --git a/webrtc/modules/rtp_rtcp/source/h264_sps_parser.h b/webrtc/modules/rtp_rtcp/source/h264_sps_parser.h
index ab8cca3..c05ee67 100644
--- a/webrtc/modules/rtp_rtcp/source/h264_sps_parser.h
+++ b/webrtc/modules/rtp_rtcp/source/h264_sps_parser.h
@@ -19,18 +19,18 @@
// Currently, only resolution is read without being ignored.
class H264SpsParser {
public:
- H264SpsParser(const uint8* sps, size_t byte_length);
+ H264SpsParser(const uint8_t* sps, size_t byte_length);
// Parses the SPS to completion. Returns true if the SPS was parsed correctly.
bool Parse();
- uint16 width() { return width_; }
- uint16 height() { return height_; }
+ uint16_t width() { return width_; }
+ uint16_t height() { return height_; }
private:
- const uint8* const sps_;
+ const uint8_t* const sps_;
const size_t byte_length_;
- uint16 width_;
- uint16 height_;
+ uint16_t width_;
+ uint16_t height_;
};
} // namespace webrtc
diff --git a/webrtc/modules/rtp_rtcp/source/h264_sps_parser_unittest.cc b/webrtc/modules/rtp_rtcp/source/h264_sps_parser_unittest.cc
index 621db10..ceadf4c 100644
--- a/webrtc/modules/rtp_rtcp/source/h264_sps_parser_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/h264_sps_parser_unittest.cc
@@ -38,8 +38,8 @@
// The fake SPS that this generates also always has at least one emulation byte
// at offset 2, since the first two bytes are always 0, and has a 0x3 as the
// level_idc, to make sure the parser doesn't eat all 0x3 bytes.
-void GenerateFakeSps(uint16 width, uint16 height, uint8 buffer[]) {
- uint8 rbsp[kSpsBufferMaxSize] = {0};
+void GenerateFakeSps(uint16_t width, uint16_t height, uint8_t buffer[]) {
+ uint8_t rbsp[kSpsBufferMaxSize] = {0};
rtc::BitBufferWriter writer(rbsp, kSpsBufferMaxSize);
// Profile byte.
writer.WriteUInt8(0);
@@ -63,11 +63,11 @@
// gaps_in_frame_num_value_allowed_flag: u(1).
writer.WriteBits(0, 1);
// Next are width/height. First, calculate the mbs/map_units versions.
- uint16 width_in_mbs_minus1 = (width + 15) / 16 - 1;
+ uint16_t width_in_mbs_minus1 = (width + 15) / 16 - 1;
// For the height, we're going to define frame_mbs_only_flag, so we need to
// divide by 2. See the parser for the full calculation.
- uint16 height_in_map_units_minus1 = ((height + 15) / 16 - 1) / 2;
+ uint16_t height_in_map_units_minus1 = ((height + 15) / 16 - 1) / 2;
// Write each as ue(v).
writer.WriteExponentialGolomb(width_in_mbs_minus1);
writer.WriteExponentialGolomb(height_in_map_units_minus1);
@@ -118,9 +118,9 @@
TEST(H264SpsParserTest, TestSampleSPSHdLandscape) {
// SPS for a 1280x720 camera capture from ffmpeg on osx. Contains
// emulation bytes but no cropping.
- const uint8 buffer[] = {0x7A, 0x00, 0x1F, 0xBC, 0xD9, 0x40, 0x50, 0x05,
- 0xBA, 0x10, 0x00, 0x00, 0x03, 0x00, 0xC0, 0x00,
- 0x00, 0x2A, 0xE0, 0xF1, 0x83, 0x19, 0x60};
+ const uint8_t buffer[] = {0x7A, 0x00, 0x1F, 0xBC, 0xD9, 0x40, 0x50, 0x05,
+ 0xBA, 0x10, 0x00, 0x00, 0x03, 0x00, 0xC0, 0x00,
+ 0x00, 0x2A, 0xE0, 0xF1, 0x83, 0x19, 0x60};
H264SpsParser parser = H264SpsParser(buffer, ARRAY_SIZE(buffer));
EXPECT_TRUE(parser.Parse());
EXPECT_EQ(1280u, parser.width());
@@ -130,9 +130,9 @@
TEST(H264SpsParserTest, TestSampleSPSVgaLandscape) {
// SPS for a 640x360 camera capture from ffmpeg on osx. Contains emulation
// bytes and cropping (360 isn't divisible by 16).
- const uint8 buffer[] = {0x7A, 0x00, 0x1E, 0xBC, 0xD9, 0x40, 0xA0, 0x2F,
- 0xF8, 0x98, 0x40, 0x00, 0x00, 0x03, 0x01, 0x80,
- 0x00, 0x00, 0x56, 0x83, 0xC5, 0x8B, 0x65, 0x80};
+ const uint8_t buffer[] = {0x7A, 0x00, 0x1E, 0xBC, 0xD9, 0x40, 0xA0, 0x2F,
+ 0xF8, 0x98, 0x40, 0x00, 0x00, 0x03, 0x01, 0x80,
+ 0x00, 0x00, 0x56, 0x83, 0xC5, 0x8B, 0x65, 0x80};
H264SpsParser parser = H264SpsParser(buffer, ARRAY_SIZE(buffer));
EXPECT_TRUE(parser.Parse());
EXPECT_EQ(640u, parser.width());
@@ -142,9 +142,9 @@
TEST(H264SpsParserTest, TestSampleSPSWeirdResolution) {
// SPS for a 200x400 camera capture from ffmpeg on osx. Horizontal and
// veritcal crop (neither dimension is divisible by 16).
- const uint8 buffer[] = {0x7A, 0x00, 0x0D, 0xBC, 0xD9, 0x43, 0x43, 0x3E,
- 0x5E, 0x10, 0x00, 0x00, 0x03, 0x00, 0x60, 0x00,
- 0x00, 0x15, 0xA0, 0xF1, 0x42, 0x99, 0x60};
+ const uint8_t buffer[] = {0x7A, 0x00, 0x0D, 0xBC, 0xD9, 0x43, 0x43, 0x3E,
+ 0x5E, 0x10, 0x00, 0x00, 0x03, 0x00, 0x60, 0x00,
+ 0x00, 0x15, 0xA0, 0xF1, 0x42, 0x99, 0x60};
H264SpsParser parser = H264SpsParser(buffer, ARRAY_SIZE(buffer));
EXPECT_TRUE(parser.Parse());
EXPECT_EQ(200u, parser.width());
@@ -152,7 +152,7 @@
}
TEST(H264SpsParserTest, TestSyntheticSPSQvgaLandscape) {
- uint8 buffer[kSpsBufferMaxSize] = {0};
+ uint8_t buffer[kSpsBufferMaxSize] = {0};
GenerateFakeSps(320u, 180u, buffer);
H264SpsParser parser = H264SpsParser(buffer, ARRAY_SIZE(buffer));
EXPECT_TRUE(parser.Parse());
@@ -161,7 +161,7 @@
}
TEST(H264SpsParserTest, TestSyntheticSPSWeirdResolution) {
- uint8 buffer[kSpsBufferMaxSize] = {0};
+ uint8_t buffer[kSpsBufferMaxSize] = {0};
GenerateFakeSps(156u, 122u, buffer);
H264SpsParser parser = H264SpsParser(buffer, ARRAY_SIZE(buffer));
EXPECT_TRUE(parser.Parse());
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_decoder.cc b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_decoder.cc
index 36646a9..61ef80b 100644
--- a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_decoder.cc
+++ b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_decoder.cc
@@ -56,10 +56,10 @@
rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer =
new rtc::RefCountedObject<webrtc::I420Buffer>(width, height);
CVPixelBufferLockBaseAddress(pixel_buffer, kCVPixelBufferLock_ReadOnly);
- const uint8* src_y = reinterpret_cast<const uint8*>(
+ const uint8_t* src_y = reinterpret_cast<const uint8_t*>(
CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0));
int src_y_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0);
- const uint8* src_uv = reinterpret_cast<const uint8*>(
+ const uint8_t* src_uv = reinterpret_cast<const uint8_t*>(
CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1));
int src_uv_stride = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1);
int ret = libyuv::NV12ToI420(
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc
index fec3226..69e52a5 100644
--- a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc
+++ b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.cc
@@ -136,10 +136,10 @@
LOG(LS_ERROR) << "Failed to lock base address: " << cvRet;
return false;
}
- uint8* dst_y = reinterpret_cast<uint8*>(
+ uint8_t* dst_y = reinterpret_cast<uint8_t*>(
CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 0));
int dst_stride_y = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 0);
- uint8* dst_uv = reinterpret_cast<uint8*>(
+ uint8_t* dst_uv = reinterpret_cast<uint8_t*>(
CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, 1));
int dst_stride_uv = CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, 1);
// Convert I420 to NV12.
diff --git a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc
index 43a7de0..caca96d 100644
--- a/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc
+++ b/webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.cc
@@ -123,7 +123,7 @@
// Read the length of the next packet of data. Must convert from big endian
// to host endian.
RTC_DCHECK_GE(bytes_remaining, (size_t)nalu_header_size);
- uint32_t* uint32_data_ptr = reinterpret_cast<uint32*>(data_ptr);
+ uint32_t* uint32_data_ptr = reinterpret_cast<uint32_t*>(data_ptr);
uint32_t packet_size = CFSwapInt32BigToHost(*uint32_data_ptr);
// Update buffer.
annexb_buffer->AppendData(kAnnexBHeaderBytes, sizeof(kAnnexBHeaderBytes));
diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h b/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h
index f1a069d..672fa3a 100644
--- a/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h
+++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h
@@ -848,7 +848,7 @@
// 3rd stream: -1, -1, -1, -1, ....
// Regarding the 3rd stream, note that a stream/encoder with 1 temporal layer
// should always have temporal layer idx set to kNoTemporalIdx = -1.
- // Since CodecSpecificInfoVP8.temporalIdx is uint8, this will wrap to 255.
+ // Since CodecSpecificInfoVP8.temporalIdx is uint8_t, this will wrap to 255.
// TODO(marpan): Although this seems safe for now, we should fix this.
void TestSpatioTemporalLayers321PatternEncoder() {
int temporal_layer_profile[3] = {3, 2, 1};
diff --git a/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc b/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc
index ce600ec..239ced8 100644
--- a/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc
+++ b/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.cc
@@ -98,9 +98,9 @@
}
// static
-int32 Vp9FrameBufferPool::VpxGetFrameBuffer(void* user_priv,
- size_t min_size,
- vpx_codec_frame_buffer* fb) {
+int32_t Vp9FrameBufferPool::VpxGetFrameBuffer(void* user_priv,
+ size_t min_size,
+ vpx_codec_frame_buffer* fb) {
RTC_DCHECK(user_priv);
RTC_DCHECK(fb);
Vp9FrameBufferPool* pool = static_cast<Vp9FrameBufferPool*>(user_priv);
@@ -118,8 +118,8 @@
}
// static
-int32 Vp9FrameBufferPool::VpxReleaseFrameBuffer(void* user_priv,
- vpx_codec_frame_buffer* fb) {
+int32_t Vp9FrameBufferPool::VpxReleaseFrameBuffer(void* user_priv,
+ vpx_codec_frame_buffer* fb) {
RTC_DCHECK(user_priv);
RTC_DCHECK(fb);
Vp9FrameBuffer* buffer = static_cast<Vp9FrameBuffer*>(fb->priv);
diff --git a/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h b/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h
index 1ee5124..97ed41a 100644
--- a/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h
+++ b/webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h
@@ -88,9 +88,9 @@
// |fb| Pointer to the libvpx frame buffer object, this is updated to
// use the pool's buffer.
// Returns 0 on success. Returns < 0 on failure.
- static int32 VpxGetFrameBuffer(void* user_priv,
- size_t min_size,
- vpx_codec_frame_buffer* fb);
+ static int32_t VpxGetFrameBuffer(void* user_priv,
+ size_t min_size,
+ vpx_codec_frame_buffer* fb);
// InitializeVpxUsePool configures libvpx to call this function when it has
// finished using one of the pool's frame buffer. Parameters:
@@ -98,8 +98,8 @@
// to be a pointer to the pool.
// |fb| Pointer to the libvpx frame buffer object, its |priv| will be
// a pointer to one of the pool's Vp9FrameBuffer.
- static int32 VpxReleaseFrameBuffer(void* user_priv,
- vpx_codec_frame_buffer* fb);
+ static int32_t VpxReleaseFrameBuffer(void* user_priv,
+ vpx_codec_frame_buffer* fb);
private:
// Protects |allocated_buffers_|.
diff --git a/webrtc/p2p/base/asyncstuntcpsocket.cc b/webrtc/p2p/base/asyncstuntcpsocket.cc
index 2b1b693..444f061 100644
--- a/webrtc/p2p/base/asyncstuntcpsocket.cc
+++ b/webrtc/p2p/base/asyncstuntcpsocket.cc
@@ -20,13 +20,13 @@
static const size_t kMaxPacketSize = 64 * 1024;
-typedef uint16 PacketLength;
+typedef uint16_t PacketLength;
static const size_t kPacketLenSize = sizeof(PacketLength);
static const size_t kPacketLenOffset = 2;
static const size_t kBufSize = kMaxPacketSize + kStunHeaderSize;
static const size_t kTurnChannelDataHdrSize = 4;
-inline bool IsStunMessage(uint16 msg_type) {
+inline bool IsStunMessage(uint16_t msg_type) {
// The first two bits of a channel data message are 0b01.
return (msg_type & 0xC000) ? false : true;
}
@@ -129,7 +129,7 @@
PacketLength pkt_len =
rtc::GetBE16(static_cast<const char*>(data) + kPacketLenOffset);
size_t expected_pkt_len;
- uint16 msg_type = rtc::GetBE16(data);
+ uint16_t msg_type = rtc::GetBE16(data);
if (IsStunMessage(msg_type)) {
// STUN message.
expected_pkt_len = kStunHeaderSize + pkt_len;
diff --git a/webrtc/p2p/base/basicpacketsocketfactory.cc b/webrtc/p2p/base/basicpacketsocketfactory.cc
index 9b12e78d..697518d 100644
--- a/webrtc/p2p/base/basicpacketsocketfactory.cc
+++ b/webrtc/p2p/base/basicpacketsocketfactory.cc
@@ -44,7 +44,9 @@
}
AsyncPacketSocket* BasicPacketSocketFactory::CreateUdpSocket(
- const SocketAddress& address, uint16 min_port, uint16 max_port) {
+ const SocketAddress& address,
+ uint16_t min_port,
+ uint16_t max_port) {
// UDP sockets are simple.
rtc::AsyncSocket* socket =
socket_factory()->CreateAsyncSocket(
@@ -62,9 +64,10 @@
}
AsyncPacketSocket* BasicPacketSocketFactory::CreateServerTcpSocket(
- const SocketAddress& local_address, uint16 min_port, uint16 max_port,
+ const SocketAddress& local_address,
+ uint16_t min_port,
+ uint16_t max_port,
int opts) {
-
// Fail if TLS is required.
if (opts & PacketSocketFactory::OPT_TLS) {
LOG(LS_ERROR) << "TLS support currently is not available.";
@@ -176,9 +179,10 @@
return new rtc::AsyncResolver();
}
-int BasicPacketSocketFactory::BindSocket(
- AsyncSocket* socket, const SocketAddress& local_address,
- uint16 min_port, uint16 max_port) {
+int BasicPacketSocketFactory::BindSocket(AsyncSocket* socket,
+ const SocketAddress& local_address,
+ uint16_t min_port,
+ uint16_t max_port) {
int ret = -1;
if (min_port == 0 && max_port == 0) {
// If there's no port range, let the OS pick a port for us.
diff --git a/webrtc/p2p/base/basicpacketsocketfactory.h b/webrtc/p2p/base/basicpacketsocketfactory.h
index b23a677..5046e0f 100644
--- a/webrtc/p2p/base/basicpacketsocketfactory.h
+++ b/webrtc/p2p/base/basicpacketsocketfactory.h
@@ -27,11 +27,11 @@
~BasicPacketSocketFactory() override;
AsyncPacketSocket* CreateUdpSocket(const SocketAddress& local_address,
- uint16 min_port,
- uint16 max_port) override;
+ uint16_t min_port,
+ uint16_t max_port) override;
AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
int opts) override;
AsyncPacketSocket* CreateClientTcpSocket(const SocketAddress& local_address,
const SocketAddress& remote_address,
@@ -44,8 +44,8 @@
private:
int BindSocket(AsyncSocket* socket,
const SocketAddress& local_address,
- uint16 min_port,
- uint16 max_port);
+ uint16_t min_port,
+ uint16_t max_port);
SocketFactory* socket_factory();
diff --git a/webrtc/p2p/base/candidate.h b/webrtc/p2p/base/candidate.h
index 2655c1b..3f0ea43 100644
--- a/webrtc/p2p/base/candidate.h
+++ b/webrtc/p2p/base/candidate.h
@@ -43,11 +43,11 @@
Candidate(int component,
const std::string& protocol,
const rtc::SocketAddress& address,
- uint32 priority,
+ uint32_t priority,
const std::string& username,
const std::string& password,
const std::string& type,
- uint32 generation,
+ uint32_t generation,
const std::string& foundation)
: id_(rtc::CreateRandomString(8)),
component_(component),
@@ -81,8 +81,8 @@
address_ = address;
}
- uint32 priority() const { return priority_; }
- void set_priority(const uint32 priority) { priority_ = priority; }
+ uint32_t priority() const { return priority_; }
+ void set_priority(const uint32_t priority) { priority_ = priority; }
// TODO(pthatcher): Remove once Chromium's jingle/glue/utils.cc
// doesn't use it.
@@ -98,11 +98,11 @@
// TODO(pthatcher): Remove once Chromium's jingle/glue/utils.cc
// doesn't use it.
void set_preference(float preference) {
- // Limiting priority to UINT_MAX when value exceeds uint32 max.
+ // Limiting priority to UINT_MAX when value exceeds uint32_t max.
// This can happen for e.g. when preference = 3.
- uint64 prio_val = static_cast<uint64>(preference * 127) << 24;
- priority_ =
- static_cast<uint32>(std::min(prio_val, static_cast<uint64>(UINT_MAX)));
+ uint64_t prio_val = static_cast<uint64_t>(preference * 127) << 24;
+ priority_ = static_cast<uint32_t>(
+ std::min(prio_val, static_cast<uint64_t>(UINT_MAX)));
}
const std::string & username() const { return username_; }
@@ -125,8 +125,8 @@
}
// Candidates in a new generation replace those in the old generation.
- uint32 generation() const { return generation_; }
- void set_generation(uint32 generation) { generation_ = generation; }
+ uint32_t generation() const { return generation_; }
+ void set_generation(uint32_t generation) { generation_ = generation; }
const std::string generation_str() const {
std::ostringstream ost;
ost << generation_;
@@ -177,9 +177,9 @@
return ToStringInternal(true);
}
- uint32 GetPriority(uint32 type_preference,
- int network_adapter_preference,
- int relay_preference) const {
+ uint32_t GetPriority(uint32_t type_preference,
+ int network_adapter_preference,
+ int relay_preference) const {
// RFC 5245 - 4.1.2.1.
// priority = (2^24)*(type preference) +
// (2^8)*(local preference) +
@@ -222,13 +222,13 @@
std::string protocol_;
std::string relay_protocol_;
rtc::SocketAddress address_;
- uint32 priority_;
+ uint32_t priority_;
std::string username_;
std::string password_;
std::string type_;
std::string network_name_;
rtc::AdapterType network_type_;
- uint32 generation_;
+ uint32_t generation_;
std::string foundation_;
rtc::SocketAddress related_address_;
std::string tcptype_;
diff --git a/webrtc/p2p/base/dtlstransport.h b/webrtc/p2p/base/dtlstransport.h
index c448eb1..e9a1ae2 100644
--- a/webrtc/p2p/base/dtlstransport.h
+++ b/webrtc/p2p/base/dtlstransport.h
@@ -229,10 +229,10 @@
error_desc);
}
// Apply remote fingerprint.
- if (!channel->SetRemoteFingerprint(
- remote_fingerprint_->algorithm,
- reinterpret_cast<const uint8*>(remote_fingerprint_->digest.data()),
- remote_fingerprint_->digest.size())) {
+ if (!channel->SetRemoteFingerprint(remote_fingerprint_->algorithm,
+ reinterpret_cast<const uint8_t*>(
+ remote_fingerprint_->digest.data()),
+ remote_fingerprint_->digest.size())) {
return BadTransportDescription("Failed to apply remote fingerprint.",
error_desc);
}
diff --git a/webrtc/p2p/base/dtlstransportchannel.cc b/webrtc/p2p/base/dtlstransportchannel.cc
index 26bb181..bba7eb9 100644
--- a/webrtc/p2p/base/dtlstransportchannel.cc
+++ b/webrtc/p2p/base/dtlstransportchannel.cc
@@ -31,11 +31,11 @@
static const size_t kMaxPendingPackets = 1;
static bool IsDtlsPacket(const char* data, size_t len) {
- const uint8* u = reinterpret_cast<const uint8*>(data);
+ const uint8_t* u = reinterpret_cast<const uint8_t*>(data);
return (len >= kDtlsRecordHeaderLen && (u[0] > 19 && u[0] < 64));
}
static bool IsRtpPacket(const char* data, size_t len) {
- const uint8* u = reinterpret_cast<const uint8*>(data);
+ const uint8_t* u = reinterpret_cast<const uint8_t*>(data);
return (len >= kMinRtpPacketLen && (u[0] & 0xC0) == 0x80);
}
@@ -196,9 +196,8 @@
bool DtlsTransportChannelWrapper::SetRemoteFingerprint(
const std::string& digest_alg,
- const uint8* digest,
+ const uint8_t* digest,
size_t digest_len) {
-
rtc::Buffer remote_fingerprint_value(digest, digest_len);
if (dtls_state_ != STATE_NONE &&
@@ -570,7 +569,7 @@
size_t size) {
// Sanity check we're not passing junk that
// just looks like DTLS.
- const uint8* tmp_data = reinterpret_cast<const uint8* >(data);
+ const uint8_t* tmp_data = reinterpret_cast<const uint8_t*>(data);
size_t tmp_size = size;
while (tmp_size > 0) {
if (tmp_size < kDtlsRecordHeaderLen)
diff --git a/webrtc/p2p/base/dtlstransportchannel.h b/webrtc/p2p/base/dtlstransportchannel.h
index d27d30e..9a2ccde 100644
--- a/webrtc/p2p/base/dtlstransportchannel.h
+++ b/webrtc/p2p/base/dtlstransportchannel.h
@@ -104,7 +104,7 @@
rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override;
bool SetRemoteFingerprint(const std::string& digest_alg,
- const uint8* digest,
+ const uint8_t* digest,
size_t digest_len) override;
bool IsDtlsActive() const override { return dtls_state_ != STATE_NONE; }
@@ -152,10 +152,10 @@
// encryption. DTLS-SRTP uses this to extract the needed SRTP keys.
// See the SSLStreamAdapter documentation for info on the specific parameters.
bool ExportKeyingMaterial(const std::string& label,
- const uint8* context,
+ const uint8_t* context,
size_t context_len,
bool use_context,
- uint8* result,
+ uint8_t* result,
size_t result_len) override {
return (dtls_.get()) ? dtls_->ExportKeyingMaterial(label, context,
context_len,
@@ -170,7 +170,7 @@
TransportChannelState GetState() const override {
return channel_->GetState();
}
- void SetIceTiebreaker(uint64 tiebreaker) override {
+ void SetIceTiebreaker(uint64_t tiebreaker) override {
channel_->SetIceTiebreaker(tiebreaker);
}
void SetIceCredentials(const std::string& ice_ufrag,
diff --git a/webrtc/p2p/base/dtlstransportchannel_unittest.cc b/webrtc/p2p/base/dtlstransportchannel_unittest.cc
index cad5b56..460e294 100644
--- a/webrtc/p2p/base/dtlstransportchannel_unittest.cc
+++ b/webrtc/p2p/base/dtlstransportchannel_unittest.cc
@@ -34,7 +34,7 @@
static const size_t kPacketNumOffset = 8;
static const size_t kPacketHeaderLen = 12;
-static bool IsRtpLeadByte(uint8 b) {
+static bool IsRtpLeadByte(uint8_t b) {
return ((b & 0xC0) == 0x80);
}
@@ -254,7 +254,7 @@
memset(packet.get(), sent & 0xff, size);
packet[0] = (srtp) ? 0x80 : 0x00;
rtc::SetBE32(packet.get() + kPacketNumOffset,
- static_cast<uint32>(sent));
+ static_cast<uint32_t>(sent));
// Only set the bypass flag if we've activated DTLS.
int flags = (certificate_ && srtp) ? cricket::PF_SRTP_BYPASS : 0;
@@ -287,14 +287,14 @@
return received_.size();
}
- bool VerifyPacket(const char* data, size_t size, uint32* out_num) {
+ bool VerifyPacket(const char* data, size_t size, uint32_t* out_num) {
if (size != packet_size_ ||
- (data[0] != 0 && static_cast<uint8>(data[0]) != 0x80)) {
+ (data[0] != 0 && static_cast<uint8_t>(data[0]) != 0x80)) {
return false;
}
- uint32 packet_num = rtc::GetBE32(data + kPacketNumOffset);
+ uint32_t packet_num = rtc::GetBE32(data + kPacketNumOffset);
for (size_t i = kPacketHeaderLen; i < size; ++i) {
- if (static_cast<uint8>(data[i]) != (packet_num & 0xff)) {
+ if (static_cast<uint8_t>(data[i]) != (packet_num & 0xff)) {
return false;
}
}
@@ -309,10 +309,10 @@
if (size <= packet_size_) {
return false;
}
- uint32 packet_num = rtc::GetBE32(data + kPacketNumOffset);
+ uint32_t packet_num = rtc::GetBE32(data + kPacketNumOffset);
int num_matches = 0;
for (size_t i = kPacketNumOffset; i < size; ++i) {
- if (static_cast<uint8>(data[i]) == (packet_num & 0xff)) {
+ if (static_cast<uint8_t>(data[i]) == (packet_num & 0xff)) {
++num_matches;
}
}
@@ -329,7 +329,7 @@
const char* data, size_t size,
const rtc::PacketTime& packet_time,
int flags) {
- uint32 packet_num = 0;
+ uint32_t packet_num = 0;
ASSERT_TRUE(VerifyPacket(data, size, &packet_num));
received_.insert(packet_num);
// Only DTLS-SRTP packets should have the bypass flag set.
diff --git a/webrtc/p2p/base/faketransportcontroller.h b/webrtc/p2p/base/faketransportcontroller.h
index 6d337a4..7d8e3d7 100644
--- a/webrtc/p2p/base/faketransportcontroller.h
+++ b/webrtc/p2p/base/faketransportcontroller.h
@@ -51,7 +51,7 @@
dtls_fingerprint_("", nullptr, 0) {}
~FakeTransportChannel() { Reset(); }
- uint64 IceTiebreaker() const { return tiebreaker_; }
+ uint64_t IceTiebreaker() const { return tiebreaker_; }
IceMode remote_ice_mode() const { return remote_ice_mode_; }
const std::string& ice_ufrag() const { return ice_ufrag_; }
const std::string& ice_pwd() const { return ice_pwd_; }
@@ -82,7 +82,7 @@
void SetIceRole(IceRole role) override { role_ = role; }
IceRole GetIceRole() const override { return role_; }
- void SetIceTiebreaker(uint64 tiebreaker) override {
+ void SetIceTiebreaker(uint64_t tiebreaker) override {
tiebreaker_ = tiebreaker;
}
void SetIceCredentials(const std::string& ice_ufrag,
@@ -98,7 +98,7 @@
void SetRemoteIceMode(IceMode mode) override { remote_ice_mode_ = mode; }
bool SetRemoteFingerprint(const std::string& alg,
- const uint8* digest,
+ const uint8_t* digest,
size_t digest_len) override {
dtls_fingerprint_ = rtc::SSLFingerprint(alg, digest, digest_len);
return true;
@@ -266,10 +266,10 @@
}
bool ExportKeyingMaterial(const std::string& label,
- const uint8* context,
+ const uint8_t* context,
size_t context_len,
bool use_context,
- uint8* result,
+ uint8_t* result,
size_t result_len) override {
if (!chosen_srtp_cipher_.empty()) {
memset(result, 0xff, result_len);
@@ -323,7 +323,7 @@
int receiving_timeout_ = -1;
bool gather_continually_ = false;
IceRole role_ = ICEROLE_UNKNOWN;
- uint64 tiebreaker_ = 0;
+ uint64_t tiebreaker_ = 0;
std::string ice_ufrag_;
std::string ice_pwd_;
std::string remote_ice_ufrag_;
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index 1b7cb58..fc72131 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -30,18 +30,18 @@
// we don't want to degrade the quality on a modem. These numbers should work
// well on a 28.8K modem, which is the slowest connection on which the voice
// quality is reasonable at all.
-static const uint32 PING_PACKET_SIZE = 60 * 8;
+static const uint32_t PING_PACKET_SIZE = 60 * 8;
// STRONG_PING_DELAY (480ms) is applied when the best connection is both
// writable and receiving.
-static const uint32 STRONG_PING_DELAY = 1000 * PING_PACKET_SIZE / 1000;
+static const uint32_t STRONG_PING_DELAY = 1000 * PING_PACKET_SIZE / 1000;
// WEAK_PING_DELAY (48ms) is applied when the best connection is either not
// writable or not receiving.
-static const uint32 WEAK_PING_DELAY = 1000 * PING_PACKET_SIZE / 10000;
+static const uint32_t WEAK_PING_DELAY = 1000 * PING_PACKET_SIZE / 10000;
// If the current best connection is both writable and receiving, then we will
// also try hard to make sure it is pinged at this rate (a little less than
// 2 * STRONG_PING_DELAY).
-static const uint32 MAX_CURRENT_STRONG_DELAY = 900;
+static const uint32_t MAX_CURRENT_STRONG_DELAY = 900;
static const int MIN_CHECK_RECEIVING_DELAY = 50; // ms
@@ -225,14 +225,14 @@
P2PTransportChannel::~P2PTransportChannel() {
ASSERT(worker_thread_ == rtc::Thread::Current());
- for (uint32 i = 0; i < allocator_sessions_.size(); ++i)
+ for (size_t i = 0; i < allocator_sessions_.size(); ++i)
delete allocator_sessions_[i];
}
// Add the allocator session to our list so that we know which sessions
// are still active.
void P2PTransportChannel::AddAllocatorSession(PortAllocatorSession* session) {
- session->set_generation(static_cast<uint32>(allocator_sessions_.size()));
+ session->set_generation(static_cast<uint32_t>(allocator_sessions_.size()));
allocator_sessions_.push_back(session);
// We now only want to apply new candidates that we receive to the ports
@@ -275,7 +275,7 @@
}
}
-void P2PTransportChannel::SetIceTiebreaker(uint64 tiebreaker) {
+void P2PTransportChannel::SetIceTiebreaker(uint64_t tiebreaker) {
ASSERT(worker_thread_ == rtc::Thread::Current());
if (!ports_.empty()) {
LOG(LS_ERROR)
@@ -553,7 +553,7 @@
// The foundation of the candidate is set to an arbitrary value, different
// from the foundation for all other remote candidates.
remote_candidate.set_foundation(
- rtc::ToString<uint32>(rtc::ComputeCrc32(remote_candidate.id())));
+ rtc::ToString<uint32_t>(rtc::ComputeCrc32(remote_candidate.id())));
remote_candidate.set_priority(remote_candidate_priority);
}
@@ -638,7 +638,7 @@
void P2PTransportChannel::AddRemoteCandidate(const Candidate& candidate) {
ASSERT(worker_thread_ == rtc::Thread::Current());
- uint32 generation = candidate.generation();
+ uint32_t generation = candidate.generation();
// Network may not guarantee the order of the candidate delivery. If a
// remote candidate with an older generation arrives, drop it.
if (generation != 0 && generation < remote_candidate_generation_) {
@@ -765,7 +765,7 @@
return citer != connections_.end();
}
-uint32 P2PTransportChannel::GetRemoteCandidateGeneration(
+uint32_t P2PTransportChannel::GetRemoteCandidateGeneration(
const Candidate& candidate) {
// We need to keep track of the remote ice restart so newer
// connections are prioritized over the older.
@@ -777,7 +777,7 @@
// Check if remote candidate is already cached.
bool P2PTransportChannel::IsDuplicateRemoteCandidate(
const Candidate& candidate) {
- for (uint32 i = 0; i < remote_candidates_.size(); ++i) {
+ for (size_t i = 0; i < remote_candidates_.size(); ++i) {
if (remote_candidates_[i].IsEquivalent(candidate)) {
return true;
}
@@ -790,7 +790,7 @@
const Candidate& remote_candidate, PortInterface* origin_port) {
// Remove any candidates whose generation is older than this one. The
// presence of a new generation indicates that the old ones are not useful.
- uint32 i = 0;
+ size_t i = 0;
while (i < remote_candidates_.size()) {
if (remote_candidates_[i].generation() < remote_candidate.generation()) {
LOG(INFO) << "Pruning candidate from old generation: "
@@ -824,7 +824,7 @@
it->second = value;
}
- for (uint32 i = 0; i < ports_.size(); ++i) {
+ for (size_t i = 0; i < ports_.size(); ++i) {
int val = ports_[i]->SetOption(opt, value);
if (val < 0) {
// Because this also occurs deferred, probably no point in reporting an
@@ -911,11 +911,11 @@
// Monitor connection states.
void P2PTransportChannel::UpdateConnectionStates() {
- uint32 now = rtc::Time();
+ uint32_t now = rtc::Time();
// We need to copy the list of connections since some may delete themselves
// when we call UpdateState.
- for (uint32 i = 0; i < connections_.size(); ++i)
+ for (size_t i = 0; i < connections_.size(); ++i)
connections_[i]->UpdateState(now);
}
@@ -947,7 +947,7 @@
std::stable_sort(connections_.begin(), connections_.end(), cmp);
LOG(LS_VERBOSE) << "Sorting " << connections_.size()
<< " available connections:";
- for (uint32 i = 0; i < connections_.size(); ++i) {
+ for (size_t i = 0; i < connections_.size(); ++i) {
LOG(LS_VERBOSE) << connections_[i]->ToString();
}
@@ -971,7 +971,7 @@
// Check if all connections are timedout.
bool all_connections_timedout = true;
- for (uint32 i = 0; i < connections_.size(); ++i) {
+ for (size_t i = 0; i < connections_.size(); ++i) {
if (connections_[i]->write_state() != Connection::STATE_WRITE_TIMEOUT) {
all_connections_timedout = false;
break;
@@ -1120,7 +1120,7 @@
return best_connection_;
// Otherwise, we return the top-most in sorted order.
- for (uint32 i = 0; i < connections_.size(); ++i) {
+ for (size_t i = 0; i < connections_.size(); ++i) {
if (connections_[i]->port()->Network() == network)
return connections_[i];
}
@@ -1198,7 +1198,7 @@
// reconnecting. The newly created connection should be selected as the ping
// target to become writable instead. See the big comment in CompareConnections.
Connection* P2PTransportChannel::FindNextPingableConnection() {
- uint32 now = rtc::Time();
+ uint32_t now = rtc::Time();
if (best_connection_ && best_connection_->connected() &&
best_connection_->writable() &&
(best_connection_->last_ping_sent() + MAX_CURRENT_STRONG_DELAY <= now)) {
diff --git a/webrtc/p2p/base/p2ptransportchannel.h b/webrtc/p2p/base/p2ptransportchannel.h
index 0e5e019..5249639 100644
--- a/webrtc/p2p/base/p2ptransportchannel.h
+++ b/webrtc/p2p/base/p2ptransportchannel.h
@@ -62,7 +62,7 @@
TransportChannelState GetState() const override;
void SetIceRole(IceRole role) override;
IceRole GetIceRole() const override { return ice_role_; }
- void SetIceTiebreaker(uint64 tiebreaker) override;
+ void SetIceTiebreaker(uint64_t tiebreaker) override;
void SetIceCredentials(const std::string& ice_ufrag,
const std::string& ice_pwd) override;
void SetRemoteIceCredentials(const std::string& ice_ufrag,
@@ -127,10 +127,10 @@
// Allows key material to be extracted for external encryption.
bool ExportKeyingMaterial(const std::string& label,
- const uint8* context,
+ const uint8_t* context,
size_t context_len,
bool use_context,
- uint8* result,
+ uint8_t* result,
size_t result_len) override {
return false;
}
@@ -142,7 +142,7 @@
// Set DTLS Remote fingerprint. Must be after local identity set.
bool SetRemoteFingerprint(const std::string& digest_alg,
- const uint8* digest,
+ const uint8_t* digest,
size_t digest_len) override {
return false;
}
@@ -182,7 +182,7 @@
PortInterface* origin_port);
bool FindConnection(cricket::Connection* connection) const;
- uint32 GetRemoteCandidateGeneration(const Candidate& candidate);
+ uint32_t GetRemoteCandidateGeneration(const Candidate& candidate);
bool IsDuplicateRemoteCandidate(const Candidate& candidate);
void RememberRemoteCandidate(const Candidate& remote_candidate,
PortInterface* origin_port);
@@ -243,13 +243,13 @@
std::string remote_ice_pwd_;
IceMode remote_ice_mode_;
IceRole ice_role_;
- uint64 tiebreaker_;
- uint32 remote_candidate_generation_;
+ uint64_t tiebreaker_;
+ uint32_t remote_candidate_generation_;
IceGatheringState gathering_state_;
int check_receiving_delay_;
int receiving_timeout_;
- uint32 last_ping_sent_ms_ = 0;
+ uint32_t last_ping_sent_ms_ = 0;
bool gather_continually_ = false;
RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
index 56635dc..86f4ec3 100644
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
@@ -93,8 +93,8 @@
"TESTICEPWD00000000000002",
"TESTICEPWD00000000000003"};
-static const uint64 kTiebreaker1 = 11111;
-static const uint64 kTiebreaker2 = 22222;
+static const uint64_t kTiebreaker1 = 11111;
+static const uint64_t kTiebreaker2 = 22222;
enum {
MSG_CANDIDATE
@@ -239,11 +239,11 @@
void SetIceRole(cricket::IceRole role) { role_ = role; }
cricket::IceRole ice_role() { return role_; }
- void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; }
- uint64 GetIceTiebreaker() { return tiebreaker_; }
+ void SetIceTiebreaker(uint64_t tiebreaker) { tiebreaker_ = tiebreaker; }
+ uint64_t GetIceTiebreaker() { return tiebreaker_; }
void OnRoleConflict(bool role_conflict) { role_conflict_ = role_conflict; }
bool role_conflict() { return role_conflict_; }
- void SetAllocationStepDelay(uint32 delay) {
+ void SetAllocationStepDelay(uint32_t delay) {
allocator_->set_step_delay(delay);
}
void SetAllowTcpListen(bool allow_tcp_listen) {
@@ -255,7 +255,7 @@
ChannelData cd1_;
ChannelData cd2_;
cricket::IceRole role_;
- uint64 tiebreaker_;
+ uint64_t tiebreaker_;
bool role_conflict_;
bool save_candidates_;
std::vector<CandidateData*> saved_candidates_;
@@ -382,13 +382,13 @@
void SetIceRole(int endpoint, cricket::IceRole role) {
GetEndpoint(endpoint)->SetIceRole(role);
}
- void SetIceTiebreaker(int endpoint, uint64 tiebreaker) {
+ void SetIceTiebreaker(int endpoint, uint64_t tiebreaker) {
GetEndpoint(endpoint)->SetIceTiebreaker(tiebreaker);
}
bool GetRoleConflict(int endpoint) {
return GetEndpoint(endpoint)->role_conflict();
}
- void SetAllocationStepDelay(int endpoint, uint32 delay) {
+ void SetAllocationStepDelay(int endpoint, uint32_t delay) {
return GetEndpoint(endpoint)->SetAllocationStepDelay(delay);
}
void SetAllowTcpListen(int endpoint, bool allow_tcp_listen) {
@@ -491,7 +491,7 @@
}
void Test(const Result& expected) {
- int32 connect_start = rtc::Time(), connect_time;
+ int32_t connect_start = rtc::Time(), connect_time;
// Create the channels and wait for them to connect.
CreateChannels(1);
@@ -515,7 +515,7 @@
// This may take up to 2 seconds.
if (ep1_ch1()->best_connection() &&
ep2_ch1()->best_connection()) {
- int32 converge_start = rtc::Time(), converge_time;
+ int32_t converge_start = rtc::Time(), converge_time;
int converge_wait = 2000;
EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), converge_wait,
converge_wait);
@@ -1807,7 +1807,7 @@
ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 1));
cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1);
ASSERT_TRUE(conn1 != nullptr);
- uint32 remote_priority = conn1->remote_candidate().priority();
+ uint32_t remote_priority = conn1->remote_candidate().priority();
// Create a higher priority candidate and make the connection
// receiving/writable. This will prune conn1.
@@ -1828,7 +1828,7 @@
request.SetType(cricket::STUN_BINDING_REQUEST);
request.AddAttribute(new cricket::StunByteStringAttribute(
cricket::STUN_ATTR_USERNAME, kIceUfrag[1]));
- uint32 prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24;
+ uint32_t prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24;
request.AddAttribute(new cricket::StunUInt32Attribute(
cricket::STUN_ATTR_PRIORITY, prflx_priority));
EXPECT_NE(prflx_priority, remote_priority);
@@ -1945,7 +1945,7 @@
request.SetType(cricket::STUN_BINDING_REQUEST);
request.AddAttribute(new cricket::StunByteStringAttribute(
cricket::STUN_ATTR_USERNAME, kIceUfrag[1]));
- uint32 prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24;
+ uint32_t prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24;
request.AddAttribute(new cricket::StunUInt32Attribute(
cricket::STUN_ATTR_PRIORITY, prflx_priority));
cricket::Port* port = GetPort(&ch);
@@ -2032,7 +2032,7 @@
request.SetType(cricket::STUN_BINDING_REQUEST);
request.AddAttribute(new cricket::StunByteStringAttribute(
cricket::STUN_ATTR_USERNAME, kIceUfrag[1]));
- uint32 prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24;
+ uint32_t prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24;
request.AddAttribute(new cricket::StunUInt32Attribute(
cricket::STUN_ATTR_PRIORITY, prflx_priority));
request.AddAttribute(
diff --git a/webrtc/p2p/base/packetsocketfactory.h b/webrtc/p2p/base/packetsocketfactory.h
index e51c787..5403724 100644
--- a/webrtc/p2p/base/packetsocketfactory.h
+++ b/webrtc/p2p/base/packetsocketfactory.h
@@ -30,12 +30,12 @@
virtual ~PacketSocketFactory() { }
virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address,
- uint16 min_port,
- uint16 max_port) = 0;
+ uint16_t min_port,
+ uint16_t max_port) = 0;
virtual AsyncPacketSocket* CreateServerTcpSocket(
const SocketAddress& local_address,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
int opts) = 0;
// TODO: |proxy_info| and |user_agent| should be set
diff --git a/webrtc/p2p/base/port.cc b/webrtc/p2p/base/port.cc
index ce28551..39fff5f 100644
--- a/webrtc/p2p/base/port.cc
+++ b/webrtc/p2p/base/port.cc
@@ -30,17 +30,16 @@
// pings fail to have a response.
inline bool TooManyFailures(
const std::vector<cricket::Connection::SentPing>& pings_since_last_response,
- uint32 maximum_failures,
- uint32 rtt_estimate,
- uint32 now) {
-
+ uint32_t maximum_failures,
+ uint32_t rtt_estimate,
+ uint32_t now) {
// If we haven't sent that many pings, then we can't have failed that many.
if (pings_since_last_response.size() < maximum_failures)
return false;
// Check if the window in which we would expect a response to the ping has
// already elapsed.
- uint32 expected_response_time =
+ uint32_t expected_response_time =
pings_since_last_response[maximum_failures - 1].sent_time + rtt_estimate;
return now > expected_response_time;
}
@@ -48,9 +47,8 @@
// Determines whether we have gone too long without seeing any response.
inline bool TooLongWithoutResponse(
const std::vector<cricket::Connection::SentPing>& pings_since_last_response,
- uint32 maximum_time,
- uint32 now) {
-
+ uint32_t maximum_time,
+ uint32_t now) {
if (pings_since_last_response.size() == 0)
return false;
@@ -60,15 +58,15 @@
// We will restrict RTT estimates (when used for determining state) to be
// within a reasonable range.
-const uint32 MINIMUM_RTT = 100; // 0.1 seconds
-const uint32 MAXIMUM_RTT = 3000; // 3 seconds
+const uint32_t MINIMUM_RTT = 100; // 0.1 seconds
+const uint32_t MAXIMUM_RTT = 3000; // 3 seconds
// When we don't have any RTT data, we have to pick something reasonable. We
// use a large value just in case the connection is really slow.
-const uint32 DEFAULT_RTT = MAXIMUM_RTT;
+const uint32_t DEFAULT_RTT = MAXIMUM_RTT;
// Computes our estimate of the RTT given the current estimate.
-inline uint32 ConservativeRTTEstimate(uint32 rtt) {
+inline uint32_t ConservativeRTTEstimate(uint32_t rtt) {
return std::max(MINIMUM_RTT, std::min(MAXIMUM_RTT, 2 * rtt));
}
@@ -128,7 +126,7 @@
const rtc::SocketAddress& base_address) {
std::ostringstream ost;
ost << type << base_address.ipaddr().ToString() << protocol;
- return rtc::ToString<uint32>(rtc::ComputeCrc32(ost.str()));
+ return rtc::ToString<uint32_t>(rtc::ComputeCrc32(ost.str()));
}
Port::Port(rtc::Thread* thread,
@@ -162,8 +160,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username_fragment,
const std::string& password)
: thread_(thread),
@@ -212,7 +210,7 @@
++iter;
}
- for (uint32 i = 0; i < list.size(); i++)
+ for (uint32_t i = 0; i < list.size(); i++)
delete list[i];
}
@@ -231,8 +229,8 @@
const std::string& relay_protocol,
const std::string& tcptype,
const std::string& type,
- uint32 type_preference,
- uint32 relay_preference,
+ uint32_t type_preference,
+ uint32_t relay_preference,
bool final) {
if (protocol == TCP_PROTOCOL_NAME && type == LOCAL_PORT_TYPE) {
ASSERT(!tcptype.empty());
@@ -465,7 +463,7 @@
// Validate ICE_CONTROLLING or ICE_CONTROLLED attributes.
bool ret = true;
IceRole remote_ice_role = ICEROLE_UNKNOWN;
- uint64 remote_tiebreaker = 0;
+ uint64_t remote_tiebreaker = 0;
const StunUInt64Attribute* stun_attr =
stun_msg->GetUInt64(STUN_ATTR_ICE_CONTROLLING);
if (stun_attr) {
@@ -697,8 +695,8 @@
if (connection_->port()->send_retransmit_count_attribute()) {
request->AddAttribute(new StunUInt32Attribute(
STUN_ATTR_RETRANSMIT_COUNT,
- static_cast<uint32>(
- connection_->pings_since_last_response_.size() - 1)));
+ static_cast<uint32_t>(connection_->pings_since_last_response_.size() -
+ 1)));
}
// Adding ICE_CONTROLLED or ICE_CONTROLLING attribute based on the role.
@@ -727,7 +725,8 @@
// priority = (2^24)*(type preference) +
// (2^8)*(local preference) +
// (2^0)*(256 - component ID)
- uint32 prflx_priority = ICE_TYPE_PREFERENCE_PRFLX << 24 |
+ uint32_t prflx_priority =
+ ICE_TYPE_PREFERENCE_PRFLX << 24 |
(connection_->local_candidate().priority() & 0x00FFFFFF);
request->AddAttribute(
new StunUInt32Attribute(STUN_ATTR_PRIORITY, prflx_priority));
@@ -811,8 +810,8 @@
return port_->Candidates()[local_candidate_index_];
}
-uint64 Connection::priority() const {
- uint64 priority = 0;
+uint64_t Connection::priority() const {
+ uint64_t priority = 0;
// RFC 5245 - 5.7.2. Computing Pair Priority and Ordering Pairs
// Let G be the priority for the candidate provided by the controlling
// agent. Let D be the priority for the candidate provided by the
@@ -820,8 +819,8 @@
// pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)
IceRole role = port_->GetIceRole();
if (role != ICEROLE_UNKNOWN) {
- uint32 g = 0;
- uint32 d = 0;
+ uint32_t g = 0;
+ uint32_t d = 0;
if (role == ICEROLE_CONTROLLING) {
g = local_candidate().priority();
d = remote_candidate_.priority();
@@ -1020,8 +1019,8 @@
*s = oss.str();
}
-void Connection::UpdateState(uint32 now) {
- uint32 rtt = ConservativeRTTEstimate(rtt_);
+void Connection::UpdateState(uint32_t now) {
+ uint32_t rtt = ConservativeRTTEstimate(rtt_);
if (LOG_CHECK_LEVEL(LS_VERBOSE)) {
std::string pings;
@@ -1052,7 +1051,7 @@
TooLongWithoutResponse(pings_since_last_response_,
CONNECTION_WRITE_CONNECT_TIMEOUT,
now)) {
- uint32 max_pings = CONNECTION_WRITE_CONNECT_FAILURES;
+ uint32_t max_pings = CONNECTION_WRITE_CONNECT_FAILURES;
LOG_J(LS_INFO, this) << "Unwritable after " << max_pings
<< " ping failures and "
<< now - pings_since_last_response_[0].sent_time
@@ -1077,7 +1076,7 @@
}
// Check the receiving state.
- uint32 last_recv_time = last_received();
+ uint32_t last_recv_time = last_received();
bool receiving = now <= last_recv_time + receiving_timeout_;
set_receiving(receiving);
if (dead(now)) {
@@ -1085,7 +1084,7 @@
}
}
-void Connection::Ping(uint32 now) {
+void Connection::Ping(uint32_t now) {
last_ping_sent_ = now;
ConnectionRequest *req = new ConnectionRequest(this);
pings_since_last_response_.push_back(SentPing(req->id(), now));
@@ -1113,7 +1112,7 @@
last_ping_response_received_ = rtc::Time();
}
-bool Connection::dead(uint32 now) const {
+bool Connection::dead(uint32_t now) const {
if (now < (time_created_ms_ + MIN_CONNECTION_LIFETIME)) {
// A connection that hasn't passed its minimum lifetime is still alive.
// We do this to prevent connections from being pruned too quickly
@@ -1198,7 +1197,7 @@
// connection.
rtc::LoggingSeverity sev = !writable() ? rtc::LS_INFO : rtc::LS_VERBOSE;
- uint32 rtt = request->Elapsed();
+ uint32_t rtt = request->Elapsed();
ReceivedPingResponse();
@@ -1299,7 +1298,7 @@
delete this;
}
-uint32 Connection::last_received() {
+uint32_t Connection::last_received() {
return std::max(last_data_received_,
std::max(last_ping_received_, last_ping_response_received_));
}
@@ -1366,7 +1365,7 @@
<< "stun response message";
return;
}
- const uint32 priority = priority_attr->value();
+ const uint32_t priority = priority_attr->value();
std::string id = rtc::CreateRandomString(8);
Candidate new_local_candidate;
diff --git a/webrtc/p2p/base/port.h b/webrtc/p2p/base/port.h
index c6b7f60..dc54876 100644
--- a/webrtc/p2p/base/port.h
+++ b/webrtc/p2p/base/port.h
@@ -52,19 +52,19 @@
// The minimum time we will wait before destroying a connection after creating
// it.
-const uint32 MIN_CONNECTION_LIFETIME = 10 * 1000; // 10 seconds.
+const uint32_t MIN_CONNECTION_LIFETIME = 10 * 1000; // 10 seconds.
// The timeout duration when a connection does not receive anything.
-const uint32 WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500; // 2.5 seconds
+const uint32_t WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500; // 2.5 seconds
// The length of time we wait before timing out writability on a connection.
-const uint32 CONNECTION_WRITE_TIMEOUT = 15 * 1000; // 15 seconds
+const uint32_t CONNECTION_WRITE_TIMEOUT = 15 * 1000; // 15 seconds
// The length of time we wait before we become unwritable.
-const uint32 CONNECTION_WRITE_CONNECT_TIMEOUT = 5 * 1000; // 5 seconds
+const uint32_t CONNECTION_WRITE_CONNECT_TIMEOUT = 5 * 1000; // 5 seconds
// The number of pings that must fail to respond before we become unwritable.
-const uint32 CONNECTION_WRITE_CONNECT_FAILURES = 5;
+const uint32_t CONNECTION_WRITE_CONNECT_FAILURES = 5;
// This is the length of time that we wait for a ping response to come back.
const int CONNECTION_RESPONSE_TIMEOUT = 5 * 1000; // 5 seconds
@@ -122,8 +122,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username_fragment,
const std::string& password);
virtual ~Port();
@@ -135,8 +135,8 @@
IceRole GetIceRole() const { return ice_role_; }
void SetIceRole(IceRole role) { ice_role_ = role; }
- void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; }
- uint64 IceTiebreaker() const { return tiebreaker_; }
+ void SetIceTiebreaker(uint64_t tiebreaker) { tiebreaker_ = tiebreaker; }
+ uint64_t IceTiebreaker() const { return tiebreaker_; }
virtual bool SharedSocket() const { return shared_socket_; }
void ResetSharedSocket() { shared_socket_ = false; }
@@ -167,8 +167,8 @@
}
// Identifies the generation that this port was created in.
- uint32 generation() { return generation_; }
- void set_generation(uint32 generation) { generation_ = generation; }
+ uint32_t generation() { return generation_; }
+ void set_generation(uint32_t generation) { generation_ = generation; }
// ICE requires a single username/password per content/media line. So the
// |ice_username_fragment_| of the ports that belongs to the same content will
@@ -257,8 +257,8 @@
// Debugging description of this port
virtual std::string ToString() const;
const rtc::IPAddress& ip() const { return ip_; }
- uint16 min_port() { return min_port_; }
- uint16 max_port() { return max_port_; }
+ uint16_t min_port() { return min_port_; }
+ uint16_t max_port() { return max_port_; }
// Timeout shortening function to speed up unit tests.
void set_timeout_delay(int delay) { timeout_delay_ = delay; }
@@ -282,7 +282,7 @@
// Returns the index of the new local candidate.
size_t AddPrflxCandidate(const Candidate& local);
- void set_candidate_filter(uint32 candidate_filter) {
+ void set_candidate_filter(uint32_t candidate_filter) {
candidate_filter_ = candidate_filter;
}
@@ -301,8 +301,8 @@
const std::string& relay_protocol,
const std::string& tcptype,
const std::string& type,
- uint32 type_preference,
- uint32 relay_preference,
+ uint32_t type_preference,
+ uint32_t relay_preference,
bool final);
// Adds the given connection to the list. (Deleting removes them.)
@@ -333,7 +333,7 @@
return rtc::DSCP_NO_CHANGE;
}
- uint32 candidate_filter() { return candidate_filter_; }
+ uint32_t candidate_filter() { return candidate_filter_; }
private:
void Construct();
@@ -352,11 +352,11 @@
bool send_retransmit_count_attribute_;
rtc::Network* network_;
rtc::IPAddress ip_;
- uint16 min_port_;
- uint16 max_port_;
+ uint16_t min_port_;
+ uint16_t max_port_;
std::string content_name_;
int component_;
- uint32 generation_;
+ uint32_t generation_;
// In order to establish a connection to this Port (so that real data can be
// sent through), the other side must send us a STUN binding request that is
// authenticated with this username_fragment and password.
@@ -372,7 +372,7 @@
int timeout_delay_;
bool enable_port_packets_;
IceRole ice_role_;
- uint64 tiebreaker_;
+ uint64_t tiebreaker_;
bool shared_socket_;
// Information to use when going through a proxy.
std::string user_agent_;
@@ -382,7 +382,7 @@
// make its own decision on how to create candidates. For example,
// when IceTransportsType is set to relay, both RelayPort and
// TurnPort will hide raddr to avoid local address leakage.
- uint32 candidate_filter_;
+ uint32_t candidate_filter_;
friend class Connection;
};
@@ -393,12 +393,11 @@
public sigslot::has_slots<> {
public:
struct SentPing {
- SentPing(const std::string id, uint32 sent_time)
- : id(id),
- sent_time(sent_time) {}
+ SentPing(const std::string id, uint32_t sent_time)
+ : id(id), sent_time(sent_time) {}
std::string id;
- uint32 sent_time;
+ uint32_t sent_time;
};
// States are from RFC 5245. http://tools.ietf.org/html/rfc5245#section-5.7.4
@@ -422,7 +421,7 @@
const Candidate& remote_candidate() const { return remote_candidate_; }
// Returns the pair priority.
- uint64 priority() const;
+ uint64_t priority() const;
enum WriteState {
STATE_WRITABLE = 0, // we have received ping responses recently
@@ -444,10 +443,10 @@
return write_state_ != STATE_WRITE_TIMEOUT;
}
// A connection is dead if it can be safely deleted.
- bool dead(uint32 now) const;
+ bool dead(uint32_t now) const;
// Estimate of the round-trip time over this connection.
- uint32 rtt() const { return rtt_; }
+ uint32_t rtt() const { return rtt_; }
size_t sent_total_bytes();
size_t sent_bytes_second();
@@ -501,7 +500,7 @@
remote_ice_mode_ = mode;
}
- void set_receiving_timeout(uint32 receiving_timeout_ms) {
+ void set_receiving_timeout(uint32_t receiving_timeout_ms) {
receiving_timeout_ = receiving_timeout_ms;
}
@@ -510,16 +509,16 @@
// Checks that the state of this connection is up-to-date. The argument is
// the current time, which is compared against various timeouts.
- void UpdateState(uint32 now);
+ void UpdateState(uint32_t now);
// Called when this connection should try checking writability again.
- uint32 last_ping_sent() const { return last_ping_sent_; }
- void Ping(uint32 now);
+ uint32_t last_ping_sent() const { return last_ping_sent_; }
+ void Ping(uint32_t now);
void ReceivedPingResponse();
// Called whenever a valid ping is received on this connection. This is
// public because the connection intercepts the first ping for us.
- uint32 last_ping_received() const { return last_ping_received_; }
+ uint32_t last_ping_received() const { return last_ping_received_; }
void ReceivedPing();
// Debugging description of this connection
@@ -555,7 +554,7 @@
// Returns the last received time of any data, stun request, or stun
// response in milliseconds
- uint32 last_received();
+ uint32_t last_received();
protected:
enum { MSG_DELETE = 0, MSG_FIRST_AVAILABLE };
@@ -599,18 +598,18 @@
bool nominated_;
IceMode remote_ice_mode_;
StunRequestManager requests_;
- uint32 rtt_;
- uint32 last_ping_sent_; // last time we sent a ping to the other side
- uint32 last_ping_received_; // last time we received a ping from the other
- // side
- uint32 last_data_received_;
- uint32 last_ping_response_received_;
+ uint32_t rtt_;
+ uint32_t last_ping_sent_; // last time we sent a ping to the other side
+ uint32_t last_ping_received_; // last time we received a ping from the other
+ // side
+ uint32_t last_data_received_;
+ uint32_t last_ping_response_received_;
std::vector<SentPing> pings_since_last_response_;
rtc::RateTracker recv_rate_tracker_;
rtc::RateTracker send_rate_tracker_;
- uint32 sent_packets_discarded_;
- uint32 sent_packets_total_;
+ uint32_t sent_packets_discarded_;
+ uint32_t sent_packets_total_;
private:
void MaybeAddPrflxCandidate(ConnectionRequest* request,
@@ -619,8 +618,8 @@
bool reported_;
State state_;
// Time duration to switch from receiving to not receiving.
- uint32 receiving_timeout_;
- uint32 time_created_ms_;
+ uint32_t receiving_timeout_;
+ uint32_t time_created_ms_;
friend class Port;
friend class ConnectionRequest;
diff --git a/webrtc/p2p/base/port_unittest.cc b/webrtc/p2p/base/port_unittest.cc
index 4c262bc..4a4ed32 100644
--- a/webrtc/p2p/base/port_unittest.cc
+++ b/webrtc/p2p/base/port_unittest.cc
@@ -62,8 +62,9 @@
// TODO: Update these when RFC5245 is completely supported.
// Magic value of 30 is from RFC3484, for IPv4 addresses.
-static const uint32 kDefaultPrflxPriority = ICE_TYPE_PREFERENCE_PRFLX << 24 |
- 30 << 8 | (256 - ICE_CANDIDATE_COMPONENT_DEFAULT);
+static const uint32_t kDefaultPrflxPriority =
+ ICE_TYPE_PREFERENCE_PRFLX << 24 | 30 << 8 |
+ (256 - ICE_CANDIDATE_COMPONENT_DEFAULT);
static const int kTiebreaker1 = 11111;
static const int kTiebreaker2 = 22222;
@@ -100,13 +101,19 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username_fragment,
const std::string& password)
- : Port(thread, type, factory, network, ip, min_port, max_port,
- username_fragment, password) {
- }
+ : Port(thread,
+ type,
+ factory,
+ network,
+ ip,
+ min_port,
+ max_port,
+ username_fragment,
+ password) {}
~TestPort() {}
// Expose GetStunMessage so that we can test it.
@@ -249,9 +256,7 @@
void Ping() {
Ping(0);
}
- void Ping(uint32 now) {
- conn_->Ping(now);
- }
+ void Ping(uint32_t now) { conn_->Ping(now); }
void Stop() {
if (conn_) {
conn_->Destroy();
@@ -904,8 +909,8 @@
~FakePacketSocketFactory() override { }
AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address,
- uint16 min_port,
- uint16 max_port) override {
+ uint16_t min_port,
+ uint16_t max_port) override {
EXPECT_TRUE(next_udp_socket_ != NULL);
AsyncPacketSocket* result = next_udp_socket_;
next_udp_socket_ = NULL;
@@ -913,8 +918,8 @@
}
AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
int opts) override {
EXPECT_TRUE(next_server_tcp_socket_ != NULL);
AsyncPacketSocket* result = next_server_tcp_socket_;
@@ -1967,13 +1972,13 @@
rtc::PacketTime());
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000);
EXPECT_EQ(STUN_BINDING_RESPONSE, lport->last_stun_msg()->type());
- uint32 last_ping_received1 = lconn->last_ping_received();
+ uint32_t last_ping_received1 = lconn->last_ping_received();
// Adding a delay of 100ms.
rtc::Thread::Current()->ProcessMessages(100);
// Pinging lconn using stun indication message.
lconn->OnReadPacket(buf->Data(), buf->Length(), rtc::PacketTime());
- uint32 last_ping_received2 = lconn->last_ping_received();
+ uint32_t last_ping_received2 = lconn->last_ping_received();
EXPECT_GT(last_ping_received2, last_ping_received1);
}
@@ -1993,15 +1998,15 @@
port->AddCandidateAddress(SocketAddress("3ffe::1234:5678", 1234));
// These should all be:
// (90 << 24) | ([rfc3484 pref value] << 8) | (256 - 177)
- uint32 expected_priority_v4 = 1509957199U;
- uint32 expected_priority_v6 = 1509959759U;
- uint32 expected_priority_ula = 1509962319U;
- uint32 expected_priority_v4mapped = expected_priority_v4;
- uint32 expected_priority_v4compat = 1509949775U;
- uint32 expected_priority_6to4 = 1509954639U;
- uint32 expected_priority_teredo = 1509952079U;
- uint32 expected_priority_sitelocal = 1509949775U;
- uint32 expected_priority_6bone = 1509949775U;
+ uint32_t expected_priority_v4 = 1509957199U;
+ uint32_t expected_priority_v6 = 1509959759U;
+ uint32_t expected_priority_ula = 1509962319U;
+ uint32_t expected_priority_v4mapped = expected_priority_v4;
+ uint32_t expected_priority_v4compat = 1509949775U;
+ uint32_t expected_priority_6to4 = 1509954639U;
+ uint32_t expected_priority_teredo = 1509952079U;
+ uint32_t expected_priority_sitelocal = 1509949775U;
+ uint32_t expected_priority_6bone = 1509949775U;
ASSERT_EQ(expected_priority_v4, port->Candidates()[0].priority());
ASSERT_EQ(expected_priority_v6, port->Candidates()[1].priority());
ASSERT_EQ(expected_priority_ula, port->Candidates()[2].priority());
@@ -2233,10 +2238,10 @@
// Ask the connection to update state as if enough time has passed to lose
// full writability and 5 pings went unresponded to. We'll accomplish the
// latter by sending pings but not pumping messages.
- for (uint32 i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) {
+ for (uint32_t i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) {
ch1.Ping(i);
}
- uint32 unreliable_timeout_delay = CONNECTION_WRITE_CONNECT_TIMEOUT + 500u;
+ uint32_t unreliable_timeout_delay = CONNECTION_WRITE_CONNECT_TIMEOUT + 500u;
ch1.conn()->UpdateState(unreliable_timeout_delay);
EXPECT_EQ(Connection::STATE_WRITE_UNRELIABLE, ch1.conn()->write_state());
@@ -2250,7 +2255,7 @@
// Wait long enough for a full timeout (past however long we've already
// waited).
- for (uint32 i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) {
+ for (uint32_t i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) {
ch1.Ping(unreliable_timeout_delay + i);
}
ch1.conn()->UpdateState(unreliable_timeout_delay + CONNECTION_WRITE_TIMEOUT +
@@ -2283,7 +2288,7 @@
EXPECT_EQ(Connection::STATE_WRITE_INIT, ch1.conn()->write_state());
// Attempt to go directly to write timeout.
- for (uint32 i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) {
+ for (uint32_t i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) {
ch1.Ping(i);
}
ch1.conn()->UpdateState(CONNECTION_WRITE_TIMEOUT + 500u);
diff --git a/webrtc/p2p/base/portallocator.cc b/webrtc/p2p/base/portallocator.cc
index b97ad55..5c4243a 100644
--- a/webrtc/p2p/base/portallocator.cc
+++ b/webrtc/p2p/base/portallocator.cc
@@ -17,7 +17,7 @@
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd,
- uint32 flags)
+ uint32_t flags)
: content_name_(content_name),
component_(component),
flags_(flags),
diff --git a/webrtc/p2p/base/portallocator.h b/webrtc/p2p/base/portallocator.h
index 69b5ed0..4f8ec2f 100644
--- a/webrtc/p2p/base/portallocator.h
+++ b/webrtc/p2p/base/portallocator.h
@@ -55,12 +55,12 @@
PORTALLOCATOR_DISABLE_UDP_RELAY = 0x1000,
};
-const uint32 kDefaultPortAllocatorFlags = 0;
+const uint32_t kDefaultPortAllocatorFlags = 0;
-const uint32 kDefaultStepDelay = 1000; // 1 sec step delay.
+const uint32_t kDefaultStepDelay = 1000; // 1 sec step delay.
// As per RFC 5245 Appendix B.1, STUN transactions need to be paced at certain
// internal. Less than 20ms is not acceptable. We choose 50ms as our default.
-const uint32 kMinimumStepDelay = 50;
+const uint32_t kMinimumStepDelay = 50;
// CF = CANDIDATE FILTER
enum {
@@ -78,13 +78,13 @@
int component,
const std::string& ice_ufrag,
const std::string& ice_pwd,
- uint32 flags);
+ uint32_t flags);
// Subclasses should clean up any ports created.
virtual ~PortAllocatorSession() {}
- uint32 flags() const { return flags_; }
- void set_flags(uint32 flags) { flags_ = flags; }
+ uint32_t flags() const { return flags_; }
+ void set_flags(uint32_t flags) { flags_ = flags; }
std::string content_name() const { return content_name_; }
int component() const { return component_; }
@@ -101,8 +101,8 @@
const std::vector<Candidate>&> SignalCandidatesReady;
sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone;
- virtual uint32 generation() { return generation_; }
- virtual void set_generation(uint32 generation) { generation_ = generation; }
+ virtual uint32_t generation() { return generation_; }
+ virtual void set_generation(uint32_t generation) { generation_ = generation; }
sigslot::signal1<PortAllocatorSession*> SignalDestroyed;
const std::string& ice_ufrag() const { return ice_ufrag_; }
@@ -118,8 +118,8 @@
int component_;
private:
- uint32 flags_;
- uint32 generation_;
+ uint32_t flags_;
+ uint32_t generation_;
std::string ice_ufrag_;
std::string ice_pwd_;
};
@@ -144,8 +144,8 @@
const std::string& ice_ufrag,
const std::string& ice_pwd);
- uint32 flags() const { return flags_; }
- void set_flags(uint32 flags) { flags_ = flags; }
+ uint32_t flags() const { return flags_; }
+ void set_flags(uint32_t flags) { flags_ = flags; }
const std::string& user_agent() const { return agent_; }
const rtc::ProxyInfo& proxy() const { return proxy_; }
@@ -167,18 +167,16 @@
return true;
}
- uint32 step_delay() const { return step_delay_; }
- void set_step_delay(uint32 delay) {
- step_delay_ = delay;
- }
+ uint32_t step_delay() const { return step_delay_; }
+ void set_step_delay(uint32_t delay) { step_delay_ = delay; }
bool allow_tcp_listen() const { return allow_tcp_listen_; }
void set_allow_tcp_listen(bool allow_tcp_listen) {
allow_tcp_listen_ = allow_tcp_listen;
}
- uint32 candidate_filter() { return candidate_filter_; }
- bool set_candidate_filter(uint32 filter) {
+ uint32_t candidate_filter() { return candidate_filter_; }
+ bool set_candidate_filter(uint32_t filter) {
// TODO(mallinath) - Do transition check?
candidate_filter_ = filter;
return true;
@@ -195,14 +193,14 @@
const std::string& ice_ufrag,
const std::string& ice_pwd) = 0;
- uint32 flags_;
+ uint32_t flags_;
std::string agent_;
rtc::ProxyInfo proxy_;
int min_port_;
int max_port_;
- uint32 step_delay_;
+ uint32_t step_delay_;
bool allow_tcp_listen_;
- uint32 candidate_filter_;
+ uint32_t candidate_filter_;
std::string origin_;
};
diff --git a/webrtc/p2p/base/portinterface.h b/webrtc/p2p/base/portinterface.h
index 3c246da..0c5948e 100644
--- a/webrtc/p2p/base/portinterface.h
+++ b/webrtc/p2p/base/portinterface.h
@@ -47,8 +47,8 @@
virtual void SetIceRole(IceRole role) = 0;
virtual IceRole GetIceRole() const = 0;
- virtual void SetIceTiebreaker(uint64 tiebreaker) = 0;
- virtual uint64 IceTiebreaker() const = 0;
+ virtual void SetIceTiebreaker(uint64_t tiebreaker) = 0;
+ virtual uint64_t IceTiebreaker() const = 0;
virtual bool SharedSocket() const = 0;
diff --git a/webrtc/p2p/base/pseudotcp.cc b/webrtc/p2p/base/pseudotcp.cc
index a54127b..5f035ca 100644
--- a/webrtc/p2p/base/pseudotcp.cc
+++ b/webrtc/p2p/base/pseudotcp.cc
@@ -39,40 +39,40 @@
//////////////////////////////////////////////////////////////////////
// Standard MTUs
-const uint16 PACKET_MAXIMUMS[] = {
- 65535, // Theoretical maximum, Hyperchannel
- 32000, // Nothing
- 17914, // 16Mb IBM Token Ring
- 8166, // IEEE 802.4
- //4464, // IEEE 802.5 (4Mb max)
- 4352, // FDDI
- //2048, // Wideband Network
- 2002, // IEEE 802.5 (4Mb recommended)
- //1536, // Expermental Ethernet Networks
- //1500, // Ethernet, Point-to-Point (default)
- 1492, // IEEE 802.3
- 1006, // SLIP, ARPANET
- //576, // X.25 Networks
- //544, // DEC IP Portal
- //512, // NETBIOS
- 508, // IEEE 802/Source-Rt Bridge, ARCNET
- 296, // Point-to-Point (low delay)
- //68, // Official minimum
- 0, // End of list marker
+const uint16_t PACKET_MAXIMUMS[] = {
+ 65535, // Theoretical maximum, Hyperchannel
+ 32000, // Nothing
+ 17914, // 16Mb IBM Token Ring
+ 8166, // IEEE 802.4
+ // 4464, // IEEE 802.5 (4Mb max)
+ 4352, // FDDI
+ // 2048, // Wideband Network
+ 2002, // IEEE 802.5 (4Mb recommended)
+ // 1536, // Expermental Ethernet Networks
+ // 1500, // Ethernet, Point-to-Point (default)
+ 1492, // IEEE 802.3
+ 1006, // SLIP, ARPANET
+ // 576, // X.25 Networks
+ // 544, // DEC IP Portal
+ // 512, // NETBIOS
+ 508, // IEEE 802/Source-Rt Bridge, ARCNET
+ 296, // Point-to-Point (low delay)
+ // 68, // Official minimum
+ 0, // End of list marker
};
-const uint32 MAX_PACKET = 65535;
+const uint32_t MAX_PACKET = 65535;
// Note: we removed lowest level because packet overhead was larger!
-const uint32 MIN_PACKET = 296;
+const uint32_t MIN_PACKET = 296;
-const uint32 IP_HEADER_SIZE = 20; // (+ up to 40 bytes of options?)
-const uint32 UDP_HEADER_SIZE = 8;
+const uint32_t IP_HEADER_SIZE = 20; // (+ up to 40 bytes of options?)
+const uint32_t UDP_HEADER_SIZE = 8;
// TODO: Make JINGLE_HEADER_SIZE transparent to this code?
-const uint32 JINGLE_HEADER_SIZE = 64; // when relay framing is in use
+const uint32_t JINGLE_HEADER_SIZE = 64; // when relay framing is in use
// Default size for receive and send buffer.
-const uint32 DEFAULT_RCV_BUF_SIZE = 60 * 1024;
-const uint32 DEFAULT_SND_BUF_SIZE = 90 * 1024;
+const uint32_t DEFAULT_RCV_BUF_SIZE = 60 * 1024;
+const uint32_t DEFAULT_SND_BUF_SIZE = 90 * 1024;
//////////////////////////////////////////////////////////////////////
// Global Constants and Functions
@@ -102,55 +102,59 @@
#define PSEUDO_KEEPALIVE 0
-const uint32 HEADER_SIZE = 24;
-const uint32 PACKET_OVERHEAD = HEADER_SIZE + UDP_HEADER_SIZE + IP_HEADER_SIZE + JINGLE_HEADER_SIZE;
+const uint32_t HEADER_SIZE = 24;
+const uint32_t PACKET_OVERHEAD =
+ HEADER_SIZE + UDP_HEADER_SIZE + IP_HEADER_SIZE + JINGLE_HEADER_SIZE;
-const uint32 MIN_RTO = 250; // 250 ms (RFC1122, Sec 4.2.3.1 "fractions of a second")
-const uint32 DEF_RTO = 3000; // 3 seconds (RFC1122, Sec 4.2.3.1)
-const uint32 MAX_RTO = 60000; // 60 seconds
-const uint32 DEF_ACK_DELAY = 100; // 100 milliseconds
+const uint32_t MIN_RTO =
+ 250; // 250 ms (RFC1122, Sec 4.2.3.1 "fractions of a second")
+const uint32_t DEF_RTO = 3000; // 3 seconds (RFC1122, Sec 4.2.3.1)
+const uint32_t MAX_RTO = 60000; // 60 seconds
+const uint32_t DEF_ACK_DELAY = 100; // 100 milliseconds
-const uint8 FLAG_CTL = 0x02;
-const uint8 FLAG_RST = 0x04;
+const uint8_t FLAG_CTL = 0x02;
+const uint8_t FLAG_RST = 0x04;
-const uint8 CTL_CONNECT = 0;
+const uint8_t CTL_CONNECT = 0;
// TCP options.
-const uint8 TCP_OPT_EOL = 0; // End of list.
-const uint8 TCP_OPT_NOOP = 1; // No-op.
-const uint8 TCP_OPT_MSS = 2; // Maximum segment size.
-const uint8 TCP_OPT_WND_SCALE = 3; // Window scale factor.
+const uint8_t TCP_OPT_EOL = 0; // End of list.
+const uint8_t TCP_OPT_NOOP = 1; // No-op.
+const uint8_t TCP_OPT_MSS = 2; // Maximum segment size.
+const uint8_t TCP_OPT_WND_SCALE = 3; // Window scale factor.
const long DEFAULT_TIMEOUT = 4000; // If there are no pending clocks, wake up every 4 seconds
const long CLOSED_TIMEOUT = 60 * 1000; // If the connection is closed, once per minute
#if PSEUDO_KEEPALIVE
// !?! Rethink these times
-const uint32 IDLE_PING = 20 * 1000; // 20 seconds (note: WinXP SP2 firewall udp timeout is 90 seconds)
-const uint32 IDLE_TIMEOUT = 90 * 1000; // 90 seconds;
+const uint32_t IDLE_PING =
+ 20 *
+ 1000; // 20 seconds (note: WinXP SP2 firewall udp timeout is 90 seconds)
+const uint32_t IDLE_TIMEOUT = 90 * 1000; // 90 seconds;
#endif // PSEUDO_KEEPALIVE
//////////////////////////////////////////////////////////////////////
// Helper Functions
//////////////////////////////////////////////////////////////////////
-inline void long_to_bytes(uint32 val, void* buf) {
- *static_cast<uint32*>(buf) = rtc::HostToNetwork32(val);
+inline void long_to_bytes(uint32_t val, void* buf) {
+ *static_cast<uint32_t*>(buf) = rtc::HostToNetwork32(val);
}
-inline void short_to_bytes(uint16 val, void* buf) {
- *static_cast<uint16*>(buf) = rtc::HostToNetwork16(val);
+inline void short_to_bytes(uint16_t val, void* buf) {
+ *static_cast<uint16_t*>(buf) = rtc::HostToNetwork16(val);
}
-inline uint32 bytes_to_long(const void* buf) {
- return rtc::NetworkToHost32(*static_cast<const uint32*>(buf));
+inline uint32_t bytes_to_long(const void* buf) {
+ return rtc::NetworkToHost32(*static_cast<const uint32_t*>(buf));
}
-inline uint16 bytes_to_short(const void* buf) {
- return rtc::NetworkToHost16(*static_cast<const uint16*>(buf));
+inline uint16_t bytes_to_short(const void* buf) {
+ return rtc::NetworkToHost16(*static_cast<const uint16_t*>(buf));
}
-uint32 bound(uint32 lower, uint32 middle, uint32 upper) {
+uint32_t bound(uint32_t lower, uint32_t middle, uint32_t upper) {
return std::min(std::max(lower, middle), upper);
}
@@ -196,7 +200,7 @@
// PseudoTcp
//////////////////////////////////////////////////////////////////////
-uint32 PseudoTcp::Now() {
+uint32_t PseudoTcp::Now() {
#if 0 // Use this to synchronize timers with logging timestamps (easier debug)
return rtc::TimeSince(StartTime());
#else
@@ -204,7 +208,7 @@
#endif
}
-PseudoTcp::PseudoTcp(IPseudoTcpNotify* notify, uint32 conv)
+PseudoTcp::PseudoTcp(IPseudoTcpNotify* notify, uint32_t conv)
: m_notify(notify),
m_shutdown(SD_NONE),
m_error(0),
@@ -212,11 +216,10 @@
m_rbuf(m_rbuf_len),
m_sbuf_len(DEFAULT_SND_BUF_SIZE),
m_sbuf(m_sbuf_len) {
-
// Sanity check on buffer sizes (needed for OnTcpWriteable notification logic)
ASSERT(m_rbuf_len + MIN_PACKET < m_sbuf_len);
- uint32 now = Now();
+ uint32_t now = Now();
m_state = TCP_LISTEN;
m_conv = conv;
@@ -273,14 +276,14 @@
return 0;
}
-void PseudoTcp::NotifyMTU(uint16 mtu) {
+void PseudoTcp::NotifyMTU(uint16_t mtu) {
m_mtu_advise = mtu;
if (m_state == TCP_ESTABLISHED) {
adjustMTU();
}
}
-void PseudoTcp::NotifyClock(uint32 now) {
+void PseudoTcp::NotifyClock(uint32_t now) {
if (m_state == TCP_CLOSED)
return;
@@ -303,13 +306,13 @@
return;
}
- uint32 nInFlight = m_snd_nxt - m_snd_una;
+ uint32_t nInFlight = m_snd_nxt - m_snd_una;
m_ssthresh = std::max(nInFlight / 2, 2 * m_mss);
//LOG(LS_INFO) << "m_ssthresh: " << m_ssthresh << " nInFlight: " << nInFlight << " m_mss: " << m_mss;
m_cwnd = m_mss;
// Back off retransmit timer. Note: the limit is lower when connecting.
- uint32 rto_limit = (m_state < TCP_ESTABLISHED) ? DEF_RTO : MAX_RTO;
+ uint32_t rto_limit = (m_state < TCP_ESTABLISHED) ? DEF_RTO : MAX_RTO;
m_rx_rto = std::min(rto_limit, m_rx_rto * 2);
m_rto_base = now;
}
@@ -355,10 +358,10 @@
LOG_F(WARNING) << "packet too large";
return false;
}
- return parse(reinterpret_cast<const uint8 *>(buffer), uint32(len));
+ return parse(reinterpret_cast<const uint8_t*>(buffer), uint32_t(len));
}
-bool PseudoTcp::GetNextClock(uint32 now, long& timeout) {
+bool PseudoTcp::GetNextClock(uint32_t now, long& timeout) {
return clock_check(now, timeout);
}
@@ -391,21 +394,21 @@
}
}
-uint32 PseudoTcp::GetCongestionWindow() const {
+uint32_t PseudoTcp::GetCongestionWindow() const {
return m_cwnd;
}
-uint32 PseudoTcp::GetBytesInFlight() const {
+uint32_t PseudoTcp::GetBytesInFlight() const {
return m_snd_nxt - m_snd_una;
}
-uint32 PseudoTcp::GetBytesBufferedNotSent() const {
+uint32_t PseudoTcp::GetBytesBufferedNotSent() const {
size_t buffered_bytes = 0;
m_sbuf.GetBuffered(&buffered_bytes);
- return static_cast<uint32>(m_snd_una + buffered_bytes - m_snd_nxt);
+ return static_cast<uint32_t>(m_snd_una + buffered_bytes - m_snd_nxt);
}
-uint32 PseudoTcp::GetRoundTripTimeEstimateMs() const {
+uint32_t PseudoTcp::GetRoundTripTimeEstimateMs() const {
return m_rx_srtt;
}
@@ -433,11 +436,11 @@
size_t available_space = 0;
m_rbuf.GetWriteRemaining(&available_space);
- if (uint32(available_space) - m_rcv_wnd >=
- std::min<uint32>(m_rbuf_len / 2, m_mss)) {
+ if (uint32_t(available_space) - m_rcv_wnd >=
+ std::min<uint32_t>(m_rbuf_len / 2, m_mss)) {
// TODO(jbeda): !?! Not sure about this was closed business
bool bWasClosed = (m_rcv_wnd == 0);
- m_rcv_wnd = static_cast<uint32>(available_space);
+ m_rcv_wnd = static_cast<uint32_t>(available_space);
if (bWasClosed) {
attemptSend(sfImmediateAck);
@@ -462,7 +465,7 @@
return SOCKET_ERROR;
}
- int written = queue(buffer, uint32(len), false);
+ int written = queue(buffer, uint32_t(len), false);
attemptSend();
return written;
}
@@ -480,13 +483,13 @@
// Internal Implementation
//
-uint32 PseudoTcp::queue(const char* data, uint32 len, bool bCtrl) {
+uint32_t PseudoTcp::queue(const char* data, uint32_t len, bool bCtrl) {
size_t available_space = 0;
m_sbuf.GetWriteRemaining(&available_space);
- if (len > static_cast<uint32>(available_space)) {
+ if (len > static_cast<uint32_t>(available_space)) {
ASSERT(!bCtrl);
- len = static_cast<uint32>(available_space);
+ len = static_cast<uint32_t>(available_space);
}
// We can concatenate data if the last segment is the same type
@@ -497,29 +500,31 @@
} else {
size_t snd_buffered = 0;
m_sbuf.GetBuffered(&snd_buffered);
- SSegment sseg(static_cast<uint32>(m_snd_una + snd_buffered), len, bCtrl);
+ SSegment sseg(static_cast<uint32_t>(m_snd_una + snd_buffered), len, bCtrl);
m_slist.push_back(sseg);
}
size_t written = 0;
m_sbuf.Write(data, len, &written, NULL);
- return static_cast<uint32>(written);
+ return static_cast<uint32_t>(written);
}
-IPseudoTcpNotify::WriteResult PseudoTcp::packet(uint32 seq, uint8 flags,
- uint32 offset, uint32 len) {
+IPseudoTcpNotify::WriteResult PseudoTcp::packet(uint32_t seq,
+ uint8_t flags,
+ uint32_t offset,
+ uint32_t len) {
ASSERT(HEADER_SIZE + len <= MAX_PACKET);
- uint32 now = Now();
+ uint32_t now = Now();
- rtc::scoped_ptr<uint8[]> buffer(new uint8[MAX_PACKET]);
+ rtc::scoped_ptr<uint8_t[]> buffer(new uint8_t[MAX_PACKET]);
long_to_bytes(m_conv, buffer.get());
long_to_bytes(seq, buffer.get() + 4);
long_to_bytes(m_rcv_nxt, buffer.get() + 8);
buffer[12] = 0;
buffer[13] = flags;
- short_to_bytes(
- static_cast<uint16>(m_rcv_wnd >> m_rwnd_scale), buffer.get() + 14);
+ short_to_bytes(static_cast<uint16_t>(m_rcv_wnd >> m_rwnd_scale),
+ buffer.get() + 14);
// Timestamp computations
long_to_bytes(now, buffer.get() + 16);
@@ -532,7 +537,7 @@
buffer.get() + HEADER_SIZE, len, offset, &bytes_read);
RTC_UNUSED(result);
ASSERT(result == rtc::SR_SUCCESS);
- ASSERT(static_cast<uint32>(bytes_read) == len);
+ ASSERT(static_cast<uint32_t>(bytes_read) == len);
}
#if _DEBUGMSG >= _DBG_VERBOSE
@@ -564,7 +569,7 @@
return IPseudoTcpNotify::WR_SUCCESS;
}
-bool PseudoTcp::parse(const uint8* buffer, uint32 size) {
+bool PseudoTcp::parse(const uint8_t* buffer, uint32_t size) {
if (size < 12)
return false;
@@ -595,7 +600,7 @@
return process(seg);
}
-bool PseudoTcp::clock_check(uint32 now, long& nTimeout) {
+bool PseudoTcp::clock_check(uint32_t now, long& nTimeout) {
if (m_shutdown == SD_FORCEFUL)
return false;
@@ -616,19 +621,19 @@
if (m_t_ack) {
nTimeout =
- std::min<int32>(nTimeout, rtc::TimeDiff(m_t_ack + m_ack_delay, now));
+ std::min<int32_t>(nTimeout, rtc::TimeDiff(m_t_ack + m_ack_delay, now));
}
if (m_rto_base) {
nTimeout =
- std::min<int32>(nTimeout, rtc::TimeDiff(m_rto_base + m_rx_rto, now));
+ std::min<int32_t>(nTimeout, rtc::TimeDiff(m_rto_base + m_rx_rto, now));
}
if (m_snd_wnd == 0) {
nTimeout =
- std::min<int32>(nTimeout, rtc::TimeDiff(m_lastsend + m_rx_rto, now));
+ std::min<int32_t>(nTimeout, rtc::TimeDiff(m_lastsend + m_rx_rto, now));
}
#if PSEUDO_KEEPALIVE
if (m_state == TCP_ESTABLISHED) {
- nTimeout = std::min<int32>(
+ nTimeout = std::min<int32_t>(
nTimeout, rtc::TimeDiff(m_lasttraffic + (m_bOutgoing ? IDLE_PING * 3 / 2
: IDLE_PING),
now));
@@ -647,7 +652,7 @@
return false;
}
- uint32 now = Now();
+ uint32_t now = Now();
m_lasttraffic = m_lastrecv = now;
m_bOutgoing = false;
@@ -704,20 +709,22 @@
if ((seg.ack > m_snd_una) && (seg.ack <= m_snd_nxt)) {
// Calculate round-trip time
if (seg.tsecr) {
- int32 rtt = rtc::TimeDiff(now, seg.tsecr);
+ int32_t rtt = rtc::TimeDiff(now, seg.tsecr);
if (rtt >= 0) {
if (m_rx_srtt == 0) {
m_rx_srtt = rtt;
m_rx_rttvar = rtt / 2;
} else {
- uint32 unsigned_rtt = static_cast<uint32>(rtt);
- uint32 abs_err = unsigned_rtt > m_rx_srtt ? unsigned_rtt - m_rx_srtt
- : m_rx_srtt - unsigned_rtt;
+ uint32_t unsigned_rtt = static_cast<uint32_t>(rtt);
+ uint32_t abs_err = unsigned_rtt > m_rx_srtt
+ ? unsigned_rtt - m_rx_srtt
+ : m_rx_srtt - unsigned_rtt;
m_rx_rttvar = (3 * m_rx_rttvar + abs_err) / 4;
m_rx_srtt = (7 * m_rx_srtt + rtt) / 8;
}
- m_rx_rto = bound(
- MIN_RTO, m_rx_srtt + std::max<uint32>(1, 4 * m_rx_rttvar), MAX_RTO);
+ m_rx_rto =
+ bound(MIN_RTO, m_rx_srtt + std::max<uint32_t>(1, 4 * m_rx_rttvar),
+ MAX_RTO);
#if _DEBUGMSG >= _DBG_VERBOSE
LOG(LS_INFO) << "rtt: " << rtt
<< " srtt: " << m_rx_srtt
@@ -728,16 +735,16 @@
}
}
- m_snd_wnd = static_cast<uint32>(seg.wnd) << m_swnd_scale;
+ m_snd_wnd = static_cast<uint32_t>(seg.wnd) << m_swnd_scale;
- uint32 nAcked = seg.ack - m_snd_una;
+ uint32_t nAcked = seg.ack - m_snd_una;
m_snd_una = seg.ack;
m_rto_base = (m_snd_una == m_snd_nxt) ? 0 : now;
m_sbuf.ConsumeReadData(nAcked);
- for (uint32 nFree = nAcked; nFree > 0; ) {
+ for (uint32_t nFree = nAcked; nFree > 0;) {
ASSERT(!m_slist.empty());
if (nFree < m_slist.front().len) {
m_slist.front().len -= nFree;
@@ -753,7 +760,7 @@
if (m_dup_acks >= 3) {
if (m_snd_una >= m_recover) { // NewReno
- uint32 nInFlight = m_snd_nxt - m_snd_una;
+ uint32_t nInFlight = m_snd_nxt - m_snd_una;
m_cwnd = std::min(m_ssthresh, nInFlight + m_mss); // (Fast Retransmit)
#if _DEBUGMSG >= _DBG_NORMAL
LOG(LS_INFO) << "exit recovery";
@@ -775,12 +782,12 @@
if (m_cwnd < m_ssthresh) {
m_cwnd += m_mss;
} else {
- m_cwnd += std::max<uint32>(1, m_mss * m_mss / m_cwnd);
+ m_cwnd += std::max<uint32_t>(1, m_mss * m_mss / m_cwnd);
}
}
} else if (seg.ack == m_snd_una) {
// !?! Note, tcp says don't do this... but otherwise how does a closed window become open?
- m_snd_wnd = static_cast<uint32>(seg.wnd) << m_swnd_scale;
+ m_snd_wnd = static_cast<uint32_t>(seg.wnd) << m_swnd_scale;
// Check duplicate acks
if (seg.len > 0) {
@@ -797,7 +804,7 @@
return false;
}
m_recover = m_snd_nxt;
- uint32 nInFlight = m_snd_nxt - m_snd_una;
+ uint32_t nInFlight = m_snd_nxt - m_snd_una;
m_ssthresh = std::max(nInFlight / 2, 2 * m_mss);
//LOG(LS_INFO) << "m_ssthresh: " << m_ssthresh << " nInFlight: " << nInFlight << " m_mss: " << m_mss;
m_cwnd = m_ssthresh + 3 * m_mss;
@@ -823,10 +830,11 @@
// If we make room in the send queue, notify the user
// The goal it to make sure we always have at least enough data to fill the
// window. We'd like to notify the app when we are halfway to that point.
- const uint32 kIdealRefillSize = (m_sbuf_len + m_rbuf_len) / 2;
+ const uint32_t kIdealRefillSize = (m_sbuf_len + m_rbuf_len) / 2;
size_t snd_buffered = 0;
m_sbuf.GetBuffered(&snd_buffered);
- if (m_bWriteEnable && static_cast<uint32>(snd_buffered) < kIdealRefillSize) {
+ if (m_bWriteEnable &&
+ static_cast<uint32_t>(snd_buffered) < kIdealRefillSize) {
m_bWriteEnable = false;
if (m_notify) {
m_notify->OnTcpWriteable(this);
@@ -862,7 +870,7 @@
// Adjust the incoming segment to fit our receive buffer
if (seg.seq < m_rcv_nxt) {
- uint32 nAdjust = m_rcv_nxt - seg.seq;
+ uint32_t nAdjust = m_rcv_nxt - seg.seq;
if (nAdjust < seg.len) {
seg.seq += nAdjust;
seg.data += nAdjust;
@@ -875,8 +883,10 @@
size_t available_space = 0;
m_rbuf.GetWriteRemaining(&available_space);
- if ((seg.seq + seg.len - m_rcv_nxt) > static_cast<uint32>(available_space)) {
- uint32 nAdjust = seg.seq + seg.len - m_rcv_nxt - static_cast<uint32>(available_space);
+ if ((seg.seq + seg.len - m_rcv_nxt) >
+ static_cast<uint32_t>(available_space)) {
+ uint32_t nAdjust =
+ seg.seq + seg.len - m_rcv_nxt - static_cast<uint32_t>(available_space);
if (nAdjust < seg.len) {
seg.len -= nAdjust;
} else {
@@ -893,7 +903,7 @@
m_rcv_nxt += seg.len;
}
} else {
- uint32 nOffset = seg.seq - m_rcv_nxt;
+ uint32_t nOffset = seg.seq - m_rcv_nxt;
rtc::StreamResult result = m_rbuf.WriteOffset(seg.data, seg.len,
nOffset, NULL);
@@ -910,7 +920,7 @@
while ((it != m_rlist.end()) && (it->seq <= m_rcv_nxt)) {
if (it->seq + it->len > m_rcv_nxt) {
sflags = sfImmediateAck; // (Fast Recovery)
- uint32 nAdjust = (it->seq + it->len) - m_rcv_nxt;
+ uint32_t nAdjust = (it->seq + it->len) - m_rcv_nxt;
#if _DEBUGMSG >= _DBG_NORMAL
LOG(LS_INFO) << "Recovered " << nAdjust << " bytes (" << m_rcv_nxt << " -> " << m_rcv_nxt + nAdjust << ")";
#endif // _DEBUGMSG
@@ -950,17 +960,17 @@
return true;
}
-bool PseudoTcp::transmit(const SList::iterator& seg, uint32 now) {
+bool PseudoTcp::transmit(const SList::iterator& seg, uint32_t now) {
if (seg->xmit >= ((m_state == TCP_ESTABLISHED) ? 15 : 30)) {
LOG_F(LS_VERBOSE) << "too many retransmits";
return false;
}
- uint32 nTransmit = std::min(seg->len, m_mss);
+ uint32_t nTransmit = std::min(seg->len, m_mss);
while (true) {
- uint32 seq = seg->seq;
- uint8 flags = (seg->bCtrl ? FLAG_CTL : 0);
+ uint32_t seq = seg->seq;
+ uint8_t flags = (seg->bCtrl ? FLAG_CTL : 0);
IPseudoTcpNotify::WriteResult wres = packet(seq,
flags,
seg->seq - m_snd_una,
@@ -1020,7 +1030,7 @@
}
void PseudoTcp::attemptSend(SendFlags sflags) {
- uint32 now = Now();
+ uint32_t now = Now();
if (rtc::TimeDiff(now, m_lastsend) > static_cast<long>(m_rx_rto)) {
m_cwnd = m_mss;
@@ -1032,18 +1042,18 @@
#endif // _DEBUGMSG
while (true) {
- uint32 cwnd = m_cwnd;
+ uint32_t cwnd = m_cwnd;
if ((m_dup_acks == 1) || (m_dup_acks == 2)) { // Limited Transmit
cwnd += m_dup_acks * m_mss;
}
- uint32 nWindow = std::min(m_snd_wnd, cwnd);
- uint32 nInFlight = m_snd_nxt - m_snd_una;
- uint32 nUseable = (nInFlight < nWindow) ? (nWindow - nInFlight) : 0;
+ uint32_t nWindow = std::min(m_snd_wnd, cwnd);
+ uint32_t nInFlight = m_snd_nxt - m_snd_una;
+ uint32_t nUseable = (nInFlight < nWindow) ? (nWindow - nInFlight) : 0;
size_t snd_buffered = 0;
m_sbuf.GetBuffered(&snd_buffered);
- uint32 nAvailable =
- std::min(static_cast<uint32>(snd_buffered) - nInFlight, m_mss);
+ uint32_t nAvailable =
+ std::min(static_cast<uint32_t>(snd_buffered) - nInFlight, m_mss);
if (nAvailable > nUseable) {
if (nUseable * 4 < nWindow) {
@@ -1116,8 +1126,7 @@
}
}
-void
-PseudoTcp::closedown(uint32 err) {
+void PseudoTcp::closedown(uint32_t err) {
LOG(LS_INFO) << "State: TCP_CLOSED";
m_state = TCP_CLOSED;
if (m_notify) {
@@ -1130,7 +1139,7 @@
PseudoTcp::adjustMTU() {
// Determine our current mss level, so that we can adjust appropriately later
for (m_msslevel = 0; PACKET_MAXIMUMS[m_msslevel + 1] > 0; ++m_msslevel) {
- if (static_cast<uint16>(PACKET_MAXIMUMS[m_msslevel]) <= m_mtu_advise) {
+ if (static_cast<uint16_t>(PACKET_MAXIMUMS[m_msslevel]) <= m_mtu_advise) {
break;
}
}
@@ -1166,19 +1175,18 @@
buf.WriteUInt8(1);
buf.WriteUInt8(m_rwnd_scale);
}
- m_snd_wnd = static_cast<uint32>(buf.Length());
- queue(buf.Data(), static_cast<uint32>(buf.Length()), true);
+ m_snd_wnd = static_cast<uint32_t>(buf.Length());
+ queue(buf.Data(), static_cast<uint32_t>(buf.Length()), true);
}
-void
-PseudoTcp::parseOptions(const char* data, uint32 len) {
- std::set<uint8> options_specified;
+void PseudoTcp::parseOptions(const char* data, uint32_t len) {
+ std::set<uint8_t> options_specified;
// See http://www.freesoft.org/CIE/Course/Section4/8.htm for
// parsing the options list.
rtc::ByteBuffer buf(data, len);
while (buf.Length()) {
- uint8 kind = TCP_OPT_EOL;
+ uint8_t kind = TCP_OPT_EOL;
buf.ReadUInt8(&kind);
if (kind == TCP_OPT_EOL) {
@@ -1192,7 +1200,7 @@
// Length of this option.
ASSERT(len != 0);
RTC_UNUSED(len);
- uint8 opt_len = 0;
+ uint8_t opt_len = 0;
buf.ReadUInt8(&opt_len);
// Content of this option.
@@ -1218,8 +1226,7 @@
}
}
-void
-PseudoTcp::applyOption(char kind, const char* data, uint32 len) {
+void PseudoTcp::applyOption(char kind, const char* data, uint32_t len) {
if (kind == TCP_OPT_MSS) {
LOG(LS_WARNING) << "Peer specified MSS option which is not supported.";
// TODO: Implement.
@@ -1234,20 +1241,17 @@
}
}
-void
-PseudoTcp::applyWindowScaleOption(uint8 scale_factor) {
+void PseudoTcp::applyWindowScaleOption(uint8_t scale_factor) {
m_swnd_scale = scale_factor;
}
-void
-PseudoTcp::resizeSendBuffer(uint32 new_size) {
+void PseudoTcp::resizeSendBuffer(uint32_t new_size) {
m_sbuf_len = new_size;
m_sbuf.SetCapacity(new_size);
}
-void
-PseudoTcp::resizeReceiveBuffer(uint32 new_size) {
- uint8 scale_factor = 0;
+void PseudoTcp::resizeReceiveBuffer(uint32_t new_size) {
+ uint8_t scale_factor = 0;
// Determine the scale factor such that the scaled window size can fit
// in a 16-bit unsigned integer.
@@ -1272,7 +1276,7 @@
size_t available_space = 0;
m_rbuf.GetWriteRemaining(&available_space);
- m_rcv_wnd = static_cast<uint32>(available_space);
+ m_rcv_wnd = static_cast<uint32_t>(available_space);
}
} // namespace cricket
diff --git a/webrtc/p2p/base/pseudotcp.h b/webrtc/p2p/base/pseudotcp.h
index b2cfcb7..6d402da 100644
--- a/webrtc/p2p/base/pseudotcp.h
+++ b/webrtc/p2p/base/pseudotcp.h
@@ -30,7 +30,7 @@
virtual void OnTcpOpen(PseudoTcp* tcp) = 0;
virtual void OnTcpReadable(PseudoTcp* tcp) = 0;
virtual void OnTcpWriteable(PseudoTcp* tcp) = 0;
- virtual void OnTcpClosed(PseudoTcp* tcp, uint32 error) = 0;
+ virtual void OnTcpClosed(PseudoTcp* tcp, uint32_t error) = 0;
// Write the packet onto the network
enum WriteResult { WR_SUCCESS, WR_TOO_LARGE, WR_FAIL };
@@ -47,9 +47,9 @@
class PseudoTcp {
public:
- static uint32 Now();
+ static uint32_t Now();
- PseudoTcp(IPseudoTcpNotify* notify, uint32 conv);
+ PseudoTcp(IPseudoTcpNotify* notify, uint32_t conv);
virtual ~PseudoTcp();
int Connect();
@@ -64,11 +64,11 @@
TcpState State() const { return m_state; }
// Call this when the PMTU changes.
- void NotifyMTU(uint16 mtu);
+ void NotifyMTU(uint16_t mtu);
// Call this based on timeout value returned from GetNextClock.
// It's ok to call this too frequently.
- void NotifyClock(uint32 now);
+ void NotifyClock(uint32_t now);
// Call this whenever a packet arrives.
// Returns true if the packet was processed successfully.
@@ -76,7 +76,7 @@
// Call this to determine the next time NotifyClock should be called.
// Returns false if the socket is ready to be destroyed.
- bool GetNextClock(uint32 now, long& timeout);
+ bool GetNextClock(uint32_t now, long& timeout);
// Call these to get/set option values to tailor this PseudoTcp
// instance's behaviour for the kind of data it will carry.
@@ -94,47 +94,46 @@
void SetOption(Option opt, int value);
// Returns current congestion window in bytes.
- uint32 GetCongestionWindow() const;
+ uint32_t GetCongestionWindow() const;
// Returns amount of data in bytes that has been sent, but haven't
// been acknowledged.
- uint32 GetBytesInFlight() const;
+ uint32_t GetBytesInFlight() const;
// Returns number of bytes that were written in buffer and haven't
// been sent.
- uint32 GetBytesBufferedNotSent() const;
+ uint32_t GetBytesBufferedNotSent() const;
// Returns current round-trip time estimate in milliseconds.
- uint32 GetRoundTripTimeEstimateMs() const;
+ uint32_t GetRoundTripTimeEstimateMs() const;
protected:
enum SendFlags { sfNone, sfDelayedAck, sfImmediateAck };
struct Segment {
- uint32 conv, seq, ack;
- uint8 flags;
- uint16 wnd;
+ uint32_t conv, seq, ack;
+ uint8_t flags;
+ uint16_t wnd;
const char * data;
- uint32 len;
- uint32 tsval, tsecr;
+ uint32_t len;
+ uint32_t tsval, tsecr;
};
struct SSegment {
- SSegment(uint32 s, uint32 l, bool c)
- : seq(s), len(l), /*tstamp(0),*/ xmit(0), bCtrl(c) {
- }
- uint32 seq, len;
- //uint32 tstamp;
- uint8 xmit;
+ SSegment(uint32_t s, uint32_t l, bool c)
+ : seq(s), len(l), /*tstamp(0),*/ xmit(0), bCtrl(c) {}
+ uint32_t seq, len;
+ // uint32_t tstamp;
+ uint8_t xmit;
bool bCtrl;
};
typedef std::list<SSegment> SList;
struct RSegment {
- uint32 seq, len;
+ uint32_t seq, len;
};
- uint32 queue(const char* data, uint32 len, bool bCtrl);
+ uint32_t queue(const char* data, uint32_t len, bool bCtrl);
// Creates a packet and submits it to the network. This method can either
// send payload or just an ACK packet.
@@ -144,18 +143,20 @@
// |offset| is the offset to read from |m_sbuf|.
// |len| is the number of bytes to read from |m_sbuf| as payload. If this
// value is 0 then this is an ACK packet, otherwise this packet has payload.
- IPseudoTcpNotify::WriteResult packet(uint32 seq, uint8 flags,
- uint32 offset, uint32 len);
- bool parse(const uint8* buffer, uint32 size);
+ IPseudoTcpNotify::WriteResult packet(uint32_t seq,
+ uint8_t flags,
+ uint32_t offset,
+ uint32_t len);
+ bool parse(const uint8_t* buffer, uint32_t size);
void attemptSend(SendFlags sflags = sfNone);
- void closedown(uint32 err = 0);
+ void closedown(uint32_t err = 0);
- bool clock_check(uint32 now, long& nTimeout);
+ bool clock_check(uint32_t now, long& nTimeout);
bool process(Segment& seg);
- bool transmit(const SList::iterator& seg, uint32 now);
+ bool transmit(const SList::iterator& seg, uint32_t now);
void adjustMTU();
@@ -172,20 +173,20 @@
void queueConnectMessage();
// Parse TCP options in the header.
- void parseOptions(const char* data, uint32 len);
+ void parseOptions(const char* data, uint32_t len);
// Apply a TCP option that has been read from the header.
- void applyOption(char kind, const char* data, uint32 len);
+ void applyOption(char kind, const char* data, uint32_t len);
// Apply window scale option.
- void applyWindowScaleOption(uint8 scale_factor);
+ void applyWindowScaleOption(uint8_t scale_factor);
// Resize the send buffer with |new_size| in bytes.
- void resizeSendBuffer(uint32 new_size);
+ void resizeSendBuffer(uint32_t new_size);
// Resize the receive buffer with |new_size| in bytes. This call adjusts
// window scale factor |m_swnd_scale| accordingly.
- void resizeReceiveBuffer(uint32 new_size);
+ void resizeReceiveBuffer(uint32_t new_size);
IPseudoTcpNotify* m_notify;
enum Shutdown { SD_NONE, SD_GRACEFUL, SD_FORCEFUL } m_shutdown;
@@ -193,43 +194,43 @@
// TCB data
TcpState m_state;
- uint32 m_conv;
+ uint32_t m_conv;
bool m_bReadEnable, m_bWriteEnable, m_bOutgoing;
- uint32 m_lasttraffic;
+ uint32_t m_lasttraffic;
// Incoming data
typedef std::list<RSegment> RList;
RList m_rlist;
- uint32 m_rbuf_len, m_rcv_nxt, m_rcv_wnd, m_lastrecv;
- uint8 m_rwnd_scale; // Window scale factor.
+ uint32_t m_rbuf_len, m_rcv_nxt, m_rcv_wnd, m_lastrecv;
+ uint8_t m_rwnd_scale; // Window scale factor.
rtc::FifoBuffer m_rbuf;
// Outgoing data
SList m_slist;
- uint32 m_sbuf_len, m_snd_nxt, m_snd_wnd, m_lastsend, m_snd_una;
- uint8 m_swnd_scale; // Window scale factor.
+ uint32_t m_sbuf_len, m_snd_nxt, m_snd_wnd, m_lastsend, m_snd_una;
+ uint8_t m_swnd_scale; // Window scale factor.
rtc::FifoBuffer m_sbuf;
// Maximum segment size, estimated protocol level, largest segment sent
- uint32 m_mss, m_msslevel, m_largest, m_mtu_advise;
+ uint32_t m_mss, m_msslevel, m_largest, m_mtu_advise;
// Retransmit timer
- uint32 m_rto_base;
+ uint32_t m_rto_base;
// Timestamp tracking
- uint32 m_ts_recent, m_ts_lastack;
+ uint32_t m_ts_recent, m_ts_lastack;
// Round-trip calculation
- uint32 m_rx_rttvar, m_rx_srtt, m_rx_rto;
+ uint32_t m_rx_rttvar, m_rx_srtt, m_rx_rto;
// Congestion avoidance, Fast retransmit/recovery, Delayed ACKs
- uint32 m_ssthresh, m_cwnd;
- uint8 m_dup_acks;
- uint32 m_recover;
- uint32 m_t_ack;
+ uint32_t m_ssthresh, m_cwnd;
+ uint8_t m_dup_acks;
+ uint32_t m_recover;
+ uint32_t m_t_ack;
// Configuration options
bool m_use_nagling;
- uint32 m_ack_delay;
+ uint32_t m_ack_delay;
// This is used by unit tests to test backward compatibility of
// PseudoTcp implementations that don't support window scaling.
diff --git a/webrtc/p2p/base/pseudotcp_unittest.cc b/webrtc/p2p/base/pseudotcp_unittest.cc
index 03e7293..c9ccbca 100644
--- a/webrtc/p2p/base/pseudotcp_unittest.cc
+++ b/webrtc/p2p/base/pseudotcp_unittest.cc
@@ -27,9 +27,8 @@
class PseudoTcpForTest : public cricket::PseudoTcp {
public:
- PseudoTcpForTest(cricket::IPseudoTcpNotify* notify, uint32 conv)
- : PseudoTcp(notify, conv) {
- }
+ PseudoTcpForTest(cricket::IPseudoTcpNotify* notify, uint32_t conv)
+ : PseudoTcp(notify, conv) {}
bool isReceiveBufferFull() const {
return PseudoTcp::isReceiveBufferFull();
@@ -127,7 +126,7 @@
// virtual void OnTcpReadable(PseudoTcp* tcp)
// and
// virtual void OnTcpWritable(PseudoTcp* tcp)
- virtual void OnTcpClosed(PseudoTcp* tcp, uint32 error) {
+ virtual void OnTcpClosed(PseudoTcp* tcp, uint32_t error) {
// Consider ourselves closed when the remote side gets OnTcpClosed.
// TODO: OnTcpClosed is only ever notified in case of error in
// the current implementation. Solicited close is not (yet) supported.
@@ -141,7 +140,7 @@
const char* buffer, size_t len) {
// Randomly drop the desired percentage of packets.
// Also drop packets that are larger than the configured MTU.
- if (rtc::CreateRandomId() % 100 < static_cast<uint32>(loss_)) {
+ if (rtc::CreateRandomId() % 100 < static_cast<uint32_t>(loss_)) {
LOG(LS_VERBOSE) << "Randomly dropping packet, size=" << len;
} else if (len > static_cast<size_t>(std::min(local_mtu_, remote_mtu_))) {
LOG(LS_VERBOSE) << "Dropping packet that exceeds path MTU, size=" << len;
@@ -156,7 +155,7 @@
void UpdateLocalClock() { UpdateClock(&local_, MSG_LCLOCK); }
void UpdateRemoteClock() { UpdateClock(&remote_, MSG_RCLOCK); }
- void UpdateClock(PseudoTcp* tcp, uint32 message) {
+ void UpdateClock(PseudoTcp* tcp, uint32_t message) {
long interval = 0; // NOLINT
tcp->GetNextClock(PseudoTcp::Now(), interval);
interval = std::max<int>(interval, 0L); // sometimes interval is < 0
@@ -209,7 +208,7 @@
class PseudoTcpTest : public PseudoTcpTestBase {
public:
void TestTransfer(int size) {
- uint32 start, elapsed;
+ uint32_t start, elapsed;
size_t received;
// Create some dummy data to send.
send_stream_.ReserveSize(size);
@@ -326,7 +325,7 @@
bytes_per_send_ = bytes;
}
void TestPingPong(int size, int iterations) {
- uint32 start, elapsed;
+ uint32_t start, elapsed;
iterations_remaining_ = iterations;
receiver_ = &remote_;
sender_ = &local_;
@@ -489,12 +488,12 @@
}
}
- uint32 EstimateReceiveWindowSize() const {
- return static_cast<uint32>(recv_position_[0]);
+ uint32_t EstimateReceiveWindowSize() const {
+ return static_cast<uint32_t>(recv_position_[0]);
}
- uint32 EstimateSendWindowSize() const {
- return static_cast<uint32>(send_position_[0] - recv_position_[0]);
+ uint32_t EstimateSendWindowSize() const {
+ return static_cast<uint32_t>(send_position_[0] - recv_position_[0]);
}
private:
diff --git a/webrtc/p2p/base/relayport.cc b/webrtc/p2p/base/relayport.cc
index fc077ff..ccddab0 100644
--- a/webrtc/p2p/base/relayport.cc
+++ b/webrtc/p2p/base/relayport.cc
@@ -16,7 +16,7 @@
namespace cricket {
-static const uint32 kMessageConnectTimeout = 1;
+static const uint32_t kMessageConnectTimeout = 1;
static const int kKeepAliveDelay = 10 * 60 * 1000;
static const int kRetryTimeout = 50 * 1000; // ICE says 50 secs
// How long to wait for a socket to connect to remote host in milliseconds
@@ -171,19 +171,26 @@
private:
RelayEntry* entry_;
RelayConnection* connection_;
- uint32 start_time_;
+ uint32_t start_time_;
};
RelayPort::RelayPort(rtc::Thread* thread,
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password)
- : Port(thread, RELAY_PORT_TYPE, factory, network, ip, min_port, max_port,
- username, password),
+ : Port(thread,
+ RELAY_PORT_TYPE,
+ factory,
+ network,
+ ip,
+ min_port,
+ max_port,
+ username,
+ password),
ready_(false),
error_(0) {
entries_.push_back(
diff --git a/webrtc/p2p/base/relayport.h b/webrtc/p2p/base/relayport.h
index 6297142..8452b5b 100644
--- a/webrtc/p2p/base/relayport.h
+++ b/webrtc/p2p/base/relayport.h
@@ -35,15 +35,14 @@
typedef std::pair<rtc::Socket::Option, int> OptionValue;
// RelayPort doesn't yet do anything fancy in the ctor.
- static RelayPort* Create(
- rtc::Thread* thread,
- rtc::PacketSocketFactory* factory,
- rtc::Network* network,
- const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
- const std::string& username,
- const std::string& password) {
+ static RelayPort* Create(rtc::Thread* thread,
+ rtc::PacketSocketFactory* factory,
+ rtc::Network* network,
+ const rtc::IPAddress& ip,
+ uint16_t min_port,
+ uint16_t max_port,
+ const std::string& username,
+ const std::string& password) {
return new RelayPort(thread, factory, network, ip, min_port, max_port,
username, password);
}
@@ -74,8 +73,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network*,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password);
bool Init();
diff --git a/webrtc/p2p/base/relayserver.cc b/webrtc/p2p/base/relayserver.cc
index 19e9268..e208d70 100644
--- a/webrtc/p2p/base/relayserver.cc
+++ b/webrtc/p2p/base/relayserver.cc
@@ -27,7 +27,7 @@
const int MAX_LIFETIME = 15 * 60 * 1000;
// The number of bytes in each of the usernames we use.
-const uint32 USERNAME_LENGTH = 16;
+const uint32_t USERNAME_LENGTH = 16;
// Calls SendTo on the given socket and logs any bad results.
void Send(rtc::AsyncPacketSocket* socket, const char* bytes, size_t size,
@@ -263,8 +263,8 @@
return;
}
- uint32 length =
- std::min(static_cast<uint32>(username_attr->length()), USERNAME_LENGTH);
+ uint32_t length =
+ std::min(static_cast<uint32_t>(username_attr->length()), USERNAME_LENGTH);
std::string username(username_attr->bytes(), length);
// TODO: Check the HMAC.
@@ -355,7 +355,7 @@
// else-branch will then disappear.
// Compute the appropriate lifetime for this binding.
- uint32 lifetime = MAX_LIFETIME;
+ uint32_t lifetime = MAX_LIFETIME;
const StunUInt32Attribute* lifetime_attr =
request.GetUInt32(STUN_ATTR_LIFETIME);
if (lifetime_attr)
@@ -530,7 +530,7 @@
void RelayServer::OnMessage(rtc::Message *pmsg) {
#if ENABLE_DEBUG
- static const uint32 kMessageAcceptConnection = 1;
+ static const uint32_t kMessageAcceptConnection = 1;
ASSERT(pmsg->message_id == kMessageAcceptConnection);
#endif
rtc::MessageData* data = pmsg->pdata;
@@ -616,7 +616,7 @@
StunByteStringAttribute* data_attr =
StunAttribute::CreateByteString(STUN_ATTR_DATA);
ASSERT(size <= 65536);
- data_attr->CopyBytes(data, uint16(size));
+ data_attr->CopyBytes(data, uint16_t(size));
msg.AddAttribute(data_attr);
SendStun(msg);
@@ -648,13 +648,16 @@
}
// IDs used for posted messages:
-const uint32 MSG_LIFETIME_TIMER = 1;
+const uint32_t MSG_LIFETIME_TIMER = 1;
-RelayServerBinding::RelayServerBinding(
- RelayServer* server, const std::string& username,
- const std::string& password, uint32 lifetime)
- : server_(server), username_(username), password_(password),
- lifetime_(lifetime) {
+RelayServerBinding::RelayServerBinding(RelayServer* server,
+ const std::string& username,
+ const std::string& password,
+ uint32_t lifetime)
+ : server_(server),
+ username_(username),
+ password_(password),
+ lifetime_(lifetime) {
// For now, every connection uses the standard magic cookie value.
magic_cookie_.append(
reinterpret_cast<const char*>(TURN_MAGIC_COOKIE_VALUE),
diff --git a/webrtc/p2p/base/relayserver.h b/webrtc/p2p/base/relayserver.h
index e0e45d5..f1109f1 100644
--- a/webrtc/p2p/base/relayserver.h
+++ b/webrtc/p2p/base/relayserver.h
@@ -181,13 +181,14 @@
// or in other words, that are "bound" together.
class RelayServerBinding : public rtc::MessageHandler {
public:
- RelayServerBinding(
- RelayServer* server, const std::string& username,
- const std::string& password, uint32 lifetime);
+ RelayServerBinding(RelayServer* server,
+ const std::string& username,
+ const std::string& password,
+ uint32_t lifetime);
virtual ~RelayServerBinding();
RelayServer* server() { return server_; }
- uint32 lifetime() { return lifetime_; }
+ uint32_t lifetime() { return lifetime_; }
const std::string& username() { return username_; }
const std::string& password() { return password_; }
const std::string& magic_cookie() { return magic_cookie_; }
@@ -225,8 +226,8 @@
std::vector<RelayServerConnection*> internal_connections_;
std::vector<RelayServerConnection*> external_connections_;
- uint32 lifetime_;
- uint32 last_used_;
+ uint32_t lifetime_;
+ uint32_t last_used_;
// TODO: bandwidth
};
diff --git a/webrtc/p2p/base/relayserver_unittest.cc b/webrtc/p2p/base/relayserver_unittest.cc
index 4f1164a..83e5353 100644
--- a/webrtc/p2p/base/relayserver_unittest.cc
+++ b/webrtc/p2p/base/relayserver_unittest.cc
@@ -24,7 +24,7 @@
using rtc::SocketAddress;
using namespace cricket;
-static const uint32 LIFETIME = 4; // seconds
+static const uint32_t LIFETIME = 4; // seconds
static const SocketAddress server_int_addr("127.0.0.1", 5000);
static const SocketAddress server_ext_addr("127.0.0.1", 5001);
static const SocketAddress client1_addr("127.0.0.1", 6000 + (rand() % 1000));
diff --git a/webrtc/p2p/base/stun.cc b/webrtc/p2p/base/stun.cc
index 866621f..9c22995 100644
--- a/webrtc/p2p/base/stun.cc
+++ b/webrtc/p2p/base/stun.cc
@@ -38,7 +38,7 @@
const char TURN_MAGIC_COOKIE_VALUE[] = { '\x72', '\xC6', '\x4B', '\xC6' };
const char EMPTY_TRANSACTION_ID[] = "0000000000000000";
-const uint32 STUN_FINGERPRINT_XOR_VALUE = 0x5354554E;
+const uint32_t STUN_FINGERPRINT_XOR_VALUE = 0x5354554E;
// StunMessage
@@ -82,7 +82,7 @@
if (attr_length % 4 != 0) {
attr_length += (4 - (attr_length % 4));
}
- length_ += static_cast<uint16>(attr_length + 4);
+ length_ += static_cast<uint16_t>(attr_length + 4);
return true;
}
@@ -135,7 +135,7 @@
}
// Getting the message length from the STUN header.
- uint16 msg_length = rtc::GetBE16(&data[2]);
+ uint16_t msg_length = rtc::GetBE16(&data[2]);
if (size != (msg_length + kStunHeaderSize)) {
return false;
}
@@ -144,7 +144,7 @@
size_t current_pos = kStunHeaderSize;
bool has_message_integrity_attr = false;
while (current_pos < size) {
- uint16 attr_type, attr_length;
+ uint16_t attr_type, attr_length;
// Getting attribute type and length.
attr_type = rtc::GetBE16(&data[current_pos]);
attr_length = rtc::GetBE16(&data[current_pos + sizeof(attr_type)]);
@@ -187,8 +187,7 @@
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |0 0| STUN Message Type | Message Length |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- rtc::SetBE16(temp_data.get() + 2,
- static_cast<uint16>(new_adjusted_len));
+ rtc::SetBE16(temp_data.get() + 2, static_cast<uint16_t>(new_adjusted_len));
}
char hmac[kStunMessageIntegritySize];
@@ -262,12 +261,12 @@
// Check the fingerprint type and length.
const char* fingerprint_attr_data = data + size - fingerprint_attr_size;
if (rtc::GetBE16(fingerprint_attr_data) != STUN_ATTR_FINGERPRINT ||
- rtc::GetBE16(fingerprint_attr_data + sizeof(uint16)) !=
+ rtc::GetBE16(fingerprint_attr_data + sizeof(uint16_t)) !=
StunUInt32Attribute::SIZE)
return false;
// Check the fingerprint value.
- uint32 fingerprint =
+ uint32_t fingerprint =
rtc::GetBE32(fingerprint_attr_data + kStunAttributeHeaderSize);
return ((fingerprint ^ STUN_FINGERPRINT_XOR_VALUE) ==
rtc::ComputeCrc32(data, size - fingerprint_attr_size));
@@ -287,7 +286,7 @@
int msg_len_for_crc32 = static_cast<int>(
buf.Length() - kStunAttributeHeaderSize - fingerprint_attr->length());
- uint32 c = rtc::ComputeCrc32(buf.Data(), msg_len_for_crc32);
+ uint32_t c = rtc::ComputeCrc32(buf.Data(), msg_len_for_crc32);
// Insert the correct CRC-32, XORed with a constant, into the attribute.
fingerprint_attr->SetValue(c ^ STUN_FINGERPRINT_XOR_VALUE);
@@ -315,8 +314,8 @@
if (!buf->ReadString(&transaction_id, kStunTransactionIdLength))
return false;
- uint32 magic_cookie_int =
- *reinterpret_cast<const uint32*>(magic_cookie.data());
+ uint32_t magic_cookie_int =
+ *reinterpret_cast<const uint32_t*>(magic_cookie.data());
if (rtc::NetworkToHost32(magic_cookie_int) != kStunMagicCookie) {
// If magic cookie is invalid it means that the peer implements
// RFC3489 instead of RFC5389.
@@ -332,7 +331,7 @@
size_t rest = buf->Length() - length_;
while (buf->Length() > rest) {
- uint16 attr_type, attr_length;
+ uint16_t attr_type, attr_length;
if (!buf->ReadUInt16(&attr_type))
return false;
if (!buf->ReadUInt16(&attr_length))
@@ -366,7 +365,7 @@
for (size_t i = 0; i < attrs_->size(); ++i) {
buf->WriteUInt16((*attrs_)[i]->type());
- buf->WriteUInt16(static_cast<uint16>((*attrs_)[i]->length()));
+ buf->WriteUInt16(static_cast<uint16_t>((*attrs_)[i]->length()));
if (!(*attrs_)[i]->Write(buf))
return false;
}
@@ -395,8 +394,8 @@
StunAttribute* StunMessage::CreateAttribute(int type, size_t length) /*const*/ {
StunAttributeValueType value_type = GetAttributeValueType(type);
- return StunAttribute::Create(value_type, type,
- static_cast<uint16>(length), this);
+ return StunAttribute::Create(value_type, type, static_cast<uint16_t>(length),
+ this);
}
const StunAttribute* StunMessage::GetAttribute(int type) const {
@@ -414,7 +413,7 @@
// StunAttribute
-StunAttribute::StunAttribute(uint16 type, uint16 length)
+StunAttribute::StunAttribute(uint16_t type, uint16_t length)
: type_(type), length_(length) {
}
@@ -434,7 +433,8 @@
}
StunAttribute* StunAttribute::Create(StunAttributeValueType value_type,
- uint16 type, uint16 length,
+ uint16_t type,
+ uint16_t length,
StunMessage* owner) {
switch (value_type) {
case STUN_VALUE_ADDRESS:
@@ -456,23 +456,23 @@
}
}
-StunAddressAttribute* StunAttribute::CreateAddress(uint16 type) {
+StunAddressAttribute* StunAttribute::CreateAddress(uint16_t type) {
return new StunAddressAttribute(type, 0);
}
-StunXorAddressAttribute* StunAttribute::CreateXorAddress(uint16 type) {
+StunXorAddressAttribute* StunAttribute::CreateXorAddress(uint16_t type) {
return new StunXorAddressAttribute(type, 0, NULL);
}
-StunUInt64Attribute* StunAttribute::CreateUInt64(uint16 type) {
+StunUInt64Attribute* StunAttribute::CreateUInt64(uint16_t type) {
return new StunUInt64Attribute(type);
}
-StunUInt32Attribute* StunAttribute::CreateUInt32(uint16 type) {
+StunUInt32Attribute* StunAttribute::CreateUInt32(uint16_t type) {
return new StunUInt32Attribute(type);
}
-StunByteStringAttribute* StunAttribute::CreateByteString(uint16 type) {
+StunByteStringAttribute* StunAttribute::CreateByteString(uint16_t type) {
return new StunByteStringAttribute(type, 0);
}
@@ -485,26 +485,26 @@
return new StunUInt16ListAttribute(STUN_ATTR_UNKNOWN_ATTRIBUTES, 0);
}
-StunAddressAttribute::StunAddressAttribute(uint16 type,
- const rtc::SocketAddress& addr)
- : StunAttribute(type, 0) {
+StunAddressAttribute::StunAddressAttribute(uint16_t type,
+ const rtc::SocketAddress& addr)
+ : StunAttribute(type, 0) {
SetAddress(addr);
}
-StunAddressAttribute::StunAddressAttribute(uint16 type, uint16 length)
+StunAddressAttribute::StunAddressAttribute(uint16_t type, uint16_t length)
: StunAttribute(type, length) {
}
bool StunAddressAttribute::Read(ByteBuffer* buf) {
- uint8 dummy;
+ uint8_t dummy;
if (!buf->ReadUInt8(&dummy))
return false;
- uint8 stun_family;
+ uint8_t stun_family;
if (!buf->ReadUInt8(&stun_family)) {
return false;
}
- uint16 port;
+ uint16_t port;
if (!buf->ReadUInt16(&port))
return false;
if (stun_family == STUN_ADDRESS_IPV4) {
@@ -557,15 +557,16 @@
return true;
}
-StunXorAddressAttribute::StunXorAddressAttribute(uint16 type,
- const rtc::SocketAddress& addr)
+StunXorAddressAttribute::StunXorAddressAttribute(uint16_t type,
+ const rtc::SocketAddress& addr)
: StunAddressAttribute(type, addr), owner_(NULL) {
}
-StunXorAddressAttribute::StunXorAddressAttribute(uint16 type,
- uint16 length,
+StunXorAddressAttribute::StunXorAddressAttribute(uint16_t type,
+ uint16_t length,
StunMessage* owner)
- : StunAddressAttribute(type, length), owner_(owner) {}
+ : StunAddressAttribute(type, length), owner_(owner) {
+}
rtc::IPAddress StunXorAddressAttribute::GetXoredIP() const {
if (owner_) {
@@ -581,10 +582,10 @@
in6_addr v6addr = ip.ipv6_address();
const std::string& transaction_id = owner_->transaction_id();
if (transaction_id.length() == kStunTransactionIdLength) {
- uint32 transactionid_as_ints[3];
+ uint32_t transactionid_as_ints[3];
memcpy(&transactionid_as_ints[0], transaction_id.c_str(),
transaction_id.length());
- uint32* ip_as_ints = reinterpret_cast<uint32*>(&v6addr.s6_addr);
+ uint32_t* ip_as_ints = reinterpret_cast<uint32_t*>(&v6addr.s6_addr);
// Transaction ID is in network byte order, but magic cookie
// is stored in host byte order.
ip_as_ints[0] =
@@ -606,7 +607,7 @@
bool StunXorAddressAttribute::Read(ByteBuffer* buf) {
if (!StunAddressAttribute::Read(buf))
return false;
- uint16 xoredport = port() ^ (kStunMagicCookie >> 16);
+ uint16_t xoredport = port() ^ (kStunMagicCookie >> 16);
rtc::IPAddress xored_ip = GetXoredIP();
SetAddress(rtc::SocketAddress(xored_ip, xoredport));
return true;
@@ -640,11 +641,11 @@
return true;
}
-StunUInt32Attribute::StunUInt32Attribute(uint16 type, uint32 value)
+StunUInt32Attribute::StunUInt32Attribute(uint16_t type, uint32_t value)
: StunAttribute(type, SIZE), bits_(value) {
}
-StunUInt32Attribute::StunUInt32Attribute(uint16 type)
+StunUInt32Attribute::StunUInt32Attribute(uint16_t type)
: StunAttribute(type, SIZE), bits_(0) {
}
@@ -670,11 +671,11 @@
return true;
}
-StunUInt64Attribute::StunUInt64Attribute(uint16 type, uint64 value)
+StunUInt64Attribute::StunUInt64Attribute(uint16_t type, uint64_t value)
: StunAttribute(type, SIZE), bits_(value) {
}
-StunUInt64Attribute::StunUInt64Attribute(uint16 type)
+StunUInt64Attribute::StunUInt64Attribute(uint16_t type)
: StunAttribute(type, SIZE), bits_(0) {
}
@@ -689,24 +690,24 @@
return true;
}
-StunByteStringAttribute::StunByteStringAttribute(uint16 type)
+StunByteStringAttribute::StunByteStringAttribute(uint16_t type)
: StunAttribute(type, 0), bytes_(NULL) {
}
-StunByteStringAttribute::StunByteStringAttribute(uint16 type,
+StunByteStringAttribute::StunByteStringAttribute(uint16_t type,
const std::string& str)
: StunAttribute(type, 0), bytes_(NULL) {
CopyBytes(str.c_str(), str.size());
}
-StunByteStringAttribute::StunByteStringAttribute(uint16 type,
+StunByteStringAttribute::StunByteStringAttribute(uint16_t type,
const void* bytes,
size_t length)
: StunAttribute(type, 0), bytes_(NULL) {
CopyBytes(bytes, length);
}
-StunByteStringAttribute::StunByteStringAttribute(uint16 type, uint16 length)
+StunByteStringAttribute::StunByteStringAttribute(uint16_t type, uint16_t length)
: StunAttribute(type, length), bytes_(NULL) {
}
@@ -724,13 +725,13 @@
SetBytes(new_bytes, length);
}
-uint8 StunByteStringAttribute::GetByte(size_t index) const {
+uint8_t StunByteStringAttribute::GetByte(size_t index) const {
ASSERT(bytes_ != NULL);
ASSERT(index < length());
- return static_cast<uint8>(bytes_[index]);
+ return static_cast<uint8_t>(bytes_[index]);
}
-void StunByteStringAttribute::SetByte(size_t index, uint8 value) {
+void StunByteStringAttribute::SetByte(size_t index, uint8_t value) {
ASSERT(bytes_ != NULL);
ASSERT(index < length());
bytes_[index] = value;
@@ -755,17 +756,18 @@
void StunByteStringAttribute::SetBytes(char* bytes, size_t length) {
delete [] bytes_;
bytes_ = bytes;
- SetLength(static_cast<uint16>(length));
+ SetLength(static_cast<uint16_t>(length));
}
-StunErrorCodeAttribute::StunErrorCodeAttribute(uint16 type, int code,
+StunErrorCodeAttribute::StunErrorCodeAttribute(uint16_t type,
+ int code,
const std::string& reason)
: StunAttribute(type, 0) {
SetCode(code);
SetReason(reason);
}
-StunErrorCodeAttribute::StunErrorCodeAttribute(uint16 type, uint16 length)
+StunErrorCodeAttribute::StunErrorCodeAttribute(uint16_t type, uint16_t length)
: StunAttribute(type, length), class_(0), number_(0) {
}
@@ -777,17 +779,17 @@
}
void StunErrorCodeAttribute::SetCode(int code) {
- class_ = static_cast<uint8>(code / 100);
- number_ = static_cast<uint8>(code % 100);
+ class_ = static_cast<uint8_t>(code / 100);
+ number_ = static_cast<uint8_t>(code % 100);
}
void StunErrorCodeAttribute::SetReason(const std::string& reason) {
- SetLength(MIN_SIZE + static_cast<uint16>(reason.size()));
+ SetLength(MIN_SIZE + static_cast<uint16_t>(reason.size()));
reason_ = reason;
}
bool StunErrorCodeAttribute::Read(ByteBuffer* buf) {
- uint32 val;
+ uint32_t val;
if (length() < MIN_SIZE || !buf->ReadUInt32(&val))
return false;
@@ -811,9 +813,9 @@
return true;
}
-StunUInt16ListAttribute::StunUInt16ListAttribute(uint16 type, uint16 length)
+StunUInt16ListAttribute::StunUInt16ListAttribute(uint16_t type, uint16_t length)
: StunAttribute(type, length) {
- attr_types_ = new std::vector<uint16>();
+ attr_types_ = new std::vector<uint16_t>();
}
StunUInt16ListAttribute::~StunUInt16ListAttribute() {
@@ -824,17 +826,17 @@
return attr_types_->size();
}
-uint16 StunUInt16ListAttribute::GetType(int index) const {
+uint16_t StunUInt16ListAttribute::GetType(int index) const {
return (*attr_types_)[index];
}
-void StunUInt16ListAttribute::SetType(int index, uint16 value) {
+void StunUInt16ListAttribute::SetType(int index, uint16_t value) {
(*attr_types_)[index] = value;
}
-void StunUInt16ListAttribute::AddType(uint16 value) {
+void StunUInt16ListAttribute::AddType(uint16_t value) {
attr_types_->push_back(value);
- SetLength(static_cast<uint16>(attr_types_->size() * 2));
+ SetLength(static_cast<uint16_t>(attr_types_->size() * 2));
}
bool StunUInt16ListAttribute::Read(ByteBuffer* buf) {
@@ -842,7 +844,7 @@
return false;
for (size_t i = 0; i < length() / 2; i++) {
- uint16 attr;
+ uint16_t attr;
if (!buf->ReadUInt16(&attr))
return false;
attr_types_->push_back(attr);
diff --git a/webrtc/p2p/base/stun.h b/webrtc/p2p/base/stun.h
index 4bf6547..75b89af 100644
--- a/webrtc/p2p/base/stun.h
+++ b/webrtc/p2p/base/stun.h
@@ -97,7 +97,7 @@
extern const char STUN_ERROR_REASON_SERVER_ERROR[];
// The mask used to determine whether a STUN message is a request/response etc.
-const uint32 kStunTypeMask = 0x0110;
+const uint32_t kStunTypeMask = 0x0110;
// STUN Attribute header length.
const size_t kStunAttributeHeaderSize = 4;
@@ -106,7 +106,7 @@
const size_t kStunHeaderSize = 20;
const size_t kStunTransactionIdOffset = 8;
const size_t kStunTransactionIdLength = 12;
-const uint32 kStunMagicCookie = 0x2112A442;
+const uint32_t kStunMagicCookie = 0x2112A442;
const size_t kStunMagicCookieLength = sizeof(kStunMagicCookie);
// Following value corresponds to an earlier version of STUN from
@@ -145,7 +145,7 @@
// is determined by the lengths of the transaction ID.
bool IsLegacy() const;
- void SetType(int type) { type_ = static_cast<uint16>(type); }
+ void SetType(int type) { type_ = static_cast<uint16_t>(type); }
bool SetTransactionID(const std::string& str);
// Gets the desired attribute value, or NULL if no such attribute type exists.
@@ -198,8 +198,8 @@
const StunAttribute* GetAttribute(int type) const;
static bool IsValidTransactionId(const std::string& transaction_id);
- uint16 type_;
- uint16 length_;
+ uint16_t type_;
+ uint16_t length_;
std::string transaction_id_;
std::vector<StunAttribute*>* attrs_;
};
@@ -228,37 +228,39 @@
virtual bool Write(rtc::ByteBuffer* buf) const = 0;
// Creates an attribute object with the given type and smallest length.
- static StunAttribute* Create(StunAttributeValueType value_type, uint16 type,
- uint16 length, StunMessage* owner);
+ static StunAttribute* Create(StunAttributeValueType value_type,
+ uint16_t type,
+ uint16_t length,
+ StunMessage* owner);
// TODO: Allow these create functions to take parameters, to reduce
// the amount of work callers need to do to initialize attributes.
- static StunAddressAttribute* CreateAddress(uint16 type);
- static StunXorAddressAttribute* CreateXorAddress(uint16 type);
- static StunUInt32Attribute* CreateUInt32(uint16 type);
- static StunUInt64Attribute* CreateUInt64(uint16 type);
- static StunByteStringAttribute* CreateByteString(uint16 type);
+ static StunAddressAttribute* CreateAddress(uint16_t type);
+ static StunXorAddressAttribute* CreateXorAddress(uint16_t type);
+ static StunUInt32Attribute* CreateUInt32(uint16_t type);
+ static StunUInt64Attribute* CreateUInt64(uint16_t type);
+ static StunByteStringAttribute* CreateByteString(uint16_t type);
static StunErrorCodeAttribute* CreateErrorCode();
static StunUInt16ListAttribute* CreateUnknownAttributes();
protected:
- StunAttribute(uint16 type, uint16 length);
- void SetLength(uint16 length) { length_ = length; }
+ StunAttribute(uint16_t type, uint16_t length);
+ void SetLength(uint16_t length) { length_ = length; }
void WritePadding(rtc::ByteBuffer* buf) const;
void ConsumePadding(rtc::ByteBuffer* buf) const;
private:
- uint16 type_;
- uint16 length_;
+ uint16_t type_;
+ uint16_t length_;
};
// Implements STUN attributes that record an Internet address.
class StunAddressAttribute : public StunAttribute {
public:
- static const uint16 SIZE_UNDEF = 0;
- static const uint16 SIZE_IP4 = 8;
- static const uint16 SIZE_IP6 = 20;
- StunAddressAttribute(uint16 type, const rtc::SocketAddress& addr);
- StunAddressAttribute(uint16 type, uint16 length);
+ static const uint16_t SIZE_UNDEF = 0;
+ static const uint16_t SIZE_IP4 = 8;
+ static const uint16_t SIZE_IP6 = 20;
+ StunAddressAttribute(uint16_t type, const rtc::SocketAddress& addr);
+ StunAddressAttribute(uint16_t type, uint16_t length);
virtual StunAttributeValueType value_type() const {
return STUN_VALUE_ADDRESS;
@@ -276,7 +278,7 @@
const rtc::SocketAddress& GetAddress() const { return address_; }
const rtc::IPAddress& ipaddr() const { return address_.ipaddr(); }
- uint16 port() const { return address_.port(); }
+ uint16_t port() const { return address_.port(); }
void SetAddress(const rtc::SocketAddress& addr) {
address_ = addr;
@@ -286,7 +288,7 @@
address_.SetIP(ip);
EnsureAddressLength();
}
- void SetPort(uint16 port) { address_.SetPort(port); }
+ void SetPort(uint16_t port) { address_.SetPort(port); }
virtual bool Read(rtc::ByteBuffer* buf);
virtual bool Write(rtc::ByteBuffer* buf) const;
@@ -316,9 +318,8 @@
// transaction ID of the message.
class StunXorAddressAttribute : public StunAddressAttribute {
public:
- StunXorAddressAttribute(uint16 type, const rtc::SocketAddress& addr);
- StunXorAddressAttribute(uint16 type, uint16 length,
- StunMessage* owner);
+ StunXorAddressAttribute(uint16_t type, const rtc::SocketAddress& addr);
+ StunXorAddressAttribute(uint16_t type, uint16_t length, StunMessage* owner);
virtual StunAttributeValueType value_type() const {
return STUN_VALUE_XOR_ADDRESS;
@@ -337,16 +338,16 @@
// Implements STUN attributes that record a 32-bit integer.
class StunUInt32Attribute : public StunAttribute {
public:
- static const uint16 SIZE = 4;
- StunUInt32Attribute(uint16 type, uint32 value);
- explicit StunUInt32Attribute(uint16 type);
+ static const uint16_t SIZE = 4;
+ StunUInt32Attribute(uint16_t type, uint32_t value);
+ explicit StunUInt32Attribute(uint16_t type);
virtual StunAttributeValueType value_type() const {
return STUN_VALUE_UINT32;
}
- uint32 value() const { return bits_; }
- void SetValue(uint32 bits) { bits_ = bits; }
+ uint32_t value() const { return bits_; }
+ void SetValue(uint32_t bits) { bits_ = bits; }
bool GetBit(size_t index) const;
void SetBit(size_t index, bool value);
@@ -355,36 +356,36 @@
virtual bool Write(rtc::ByteBuffer* buf) const;
private:
- uint32 bits_;
+ uint32_t bits_;
};
class StunUInt64Attribute : public StunAttribute {
public:
- static const uint16 SIZE = 8;
- StunUInt64Attribute(uint16 type, uint64 value);
- explicit StunUInt64Attribute(uint16 type);
+ static const uint16_t SIZE = 8;
+ StunUInt64Attribute(uint16_t type, uint64_t value);
+ explicit StunUInt64Attribute(uint16_t type);
virtual StunAttributeValueType value_type() const {
return STUN_VALUE_UINT64;
}
- uint64 value() const { return bits_; }
- void SetValue(uint64 bits) { bits_ = bits; }
+ uint64_t value() const { return bits_; }
+ void SetValue(uint64_t bits) { bits_ = bits; }
virtual bool Read(rtc::ByteBuffer* buf);
virtual bool Write(rtc::ByteBuffer* buf) const;
private:
- uint64 bits_;
+ uint64_t bits_;
};
// Implements STUN attributes that record an arbitrary byte string.
class StunByteStringAttribute : public StunAttribute {
public:
- explicit StunByteStringAttribute(uint16 type);
- StunByteStringAttribute(uint16 type, const std::string& str);
- StunByteStringAttribute(uint16 type, const void* bytes, size_t length);
- StunByteStringAttribute(uint16 type, uint16 length);
+ explicit StunByteStringAttribute(uint16_t type);
+ StunByteStringAttribute(uint16_t type, const std::string& str);
+ StunByteStringAttribute(uint16_t type, const void* bytes, size_t length);
+ StunByteStringAttribute(uint16_t type, uint16_t length);
~StunByteStringAttribute();
virtual StunAttributeValueType value_type() const {
@@ -397,8 +398,8 @@
void CopyBytes(const char* bytes); // uses strlen
void CopyBytes(const void* bytes, size_t length);
- uint8 GetByte(size_t index) const;
- void SetByte(size_t index, uint8 value);
+ uint8_t GetByte(size_t index) const;
+ void SetByte(size_t index, uint8_t value);
virtual bool Read(rtc::ByteBuffer* buf);
virtual bool Write(rtc::ByteBuffer* buf) const;
@@ -412,9 +413,9 @@
// Implements STUN attributes that record an error code.
class StunErrorCodeAttribute : public StunAttribute {
public:
- static const uint16 MIN_SIZE = 4;
- StunErrorCodeAttribute(uint16 type, int code, const std::string& reason);
- StunErrorCodeAttribute(uint16 type, uint16 length);
+ static const uint16_t MIN_SIZE = 4;
+ StunErrorCodeAttribute(uint16_t type, int code, const std::string& reason);
+ StunErrorCodeAttribute(uint16_t type, uint16_t length);
~StunErrorCodeAttribute();
virtual StunAttributeValueType value_type() const {
@@ -429,23 +430,23 @@
int eclass() const { return class_; }
int number() const { return number_; }
const std::string& reason() const { return reason_; }
- void SetClass(uint8 eclass) { class_ = eclass; }
- void SetNumber(uint8 number) { number_ = number; }
+ void SetClass(uint8_t eclass) { class_ = eclass; }
+ void SetNumber(uint8_t number) { number_ = number; }
void SetReason(const std::string& reason);
bool Read(rtc::ByteBuffer* buf);
bool Write(rtc::ByteBuffer* buf) const;
private:
- uint8 class_;
- uint8 number_;
+ uint8_t class_;
+ uint8_t number_;
std::string reason_;
};
// Implements STUN attributes that record a list of attribute names.
class StunUInt16ListAttribute : public StunAttribute {
public:
- StunUInt16ListAttribute(uint16 type, uint16 length);
+ StunUInt16ListAttribute(uint16_t type, uint16_t length);
~StunUInt16ListAttribute();
virtual StunAttributeValueType value_type() const {
@@ -453,15 +454,15 @@
}
size_t Size() const;
- uint16 GetType(int index) const;
- void SetType(int index, uint16 value);
- void AddType(uint16 value);
+ uint16_t GetType(int index) const;
+ void SetType(int index, uint16_t value);
+ void AddType(uint16_t value);
bool Read(rtc::ByteBuffer* buf);
bool Write(rtc::ByteBuffer* buf) const;
private:
- std::vector<uint16>* attr_types_;
+ std::vector<uint16_t>* attr_types_;
};
// Returns the (successful) response type for the given request type.
diff --git a/webrtc/p2p/base/stun_unittest.cc b/webrtc/p2p/base/stun_unittest.cc
index 9d5779d7..cd4f7e1 100644
--- a/webrtc/p2p/base/stun_unittest.cc
+++ b/webrtc/p2p/base/stun_unittest.cc
@@ -165,7 +165,7 @@
0x61, 0x62, 0x63, 0xcc // abc
};
-// Message with an Unknown Attributes (uint16 list) attribute.
+// Message with an Unknown Attributes (uint16_t list) attribute.
static const unsigned char kStunMessageWithUInt16ListAttribute[] = {
0x00, 0x01, 0x00, 0x0c,
0x21, 0x12, 0xa4, 0x42,
diff --git a/webrtc/p2p/base/stunport.cc b/webrtc/p2p/base/stunport.cc
index 696d323..615bbfe 100644
--- a/webrtc/p2p/base/stunport.cc
+++ b/webrtc/p2p/base/stunport.cc
@@ -106,7 +106,7 @@
UDPPort* port_;
bool keep_alive_;
const rtc::SocketAddress server_addr_;
- uint32 start_time_;
+ uint32_t start_time_;
};
UDPPort::AddressResolver::AddressResolver(
@@ -182,14 +182,21 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
const std::string& origin,
bool emit_localhost_for_anyaddress)
- : Port(thread, LOCAL_PORT_TYPE, factory, network, ip, min_port, max_port,
- username, password),
+ : Port(thread,
+ LOCAL_PORT_TYPE,
+ factory,
+ network,
+ ip,
+ min_port,
+ max_port,
+ username,
+ password),
requests_(thread),
socket_(NULL),
error_(0),
diff --git a/webrtc/p2p/base/stunport.h b/webrtc/p2p/base/stunport.h
index 2967c15..488739c 100644
--- a/webrtc/p2p/base/stunport.h
+++ b/webrtc/p2p/base/stunport.h
@@ -50,8 +50,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
const std::string& origin,
@@ -110,8 +110,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
const std::string& origin,
@@ -220,7 +220,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port, uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
const ServerAddresses& servers,
@@ -247,14 +248,22 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
const ServerAddresses& servers,
const std::string& origin)
- : UDPPort(thread, factory, network, ip, min_port, max_port, username,
- password, origin, false) {
+ : UDPPort(thread,
+ factory,
+ network,
+ ip,
+ min_port,
+ max_port,
+ username,
+ password,
+ origin,
+ false) {
// UDPPort will set these to local udp, updating these to STUN.
set_type(STUN_PORT_TYPE);
set_server_addresses(servers);
diff --git a/webrtc/p2p/base/stunport_unittest.cc b/webrtc/p2p/base/stunport_unittest.cc
index 173bcae..037d448 100644
--- a/webrtc/p2p/base/stunport_unittest.cc
+++ b/webrtc/p2p/base/stunport_unittest.cc
@@ -30,7 +30,7 @@
static const SocketAddress kBadHostnameAddr("not-a-real-hostname", 5000);
static const int kTimeoutMs = 10000;
// stun prio = 100 << 24 | 30 (IPV4) << 8 | 256 - 0
-static const uint32 kStunCandidatePriority = 1677729535;
+static const uint32_t kStunCandidatePriority = 1677729535;
// Tests connecting a StunPort to a fake STUN server (cricket::StunServer)
// TODO: Use a VirtualSocketServer here. We have to use a
diff --git a/webrtc/p2p/base/stunrequest.cc b/webrtc/p2p/base/stunrequest.cc
index c5700c0..df5614d 100644
--- a/webrtc/p2p/base/stunrequest.cc
+++ b/webrtc/p2p/base/stunrequest.cc
@@ -18,7 +18,7 @@
namespace cricket {
-const uint32 MSG_STUN_SEND = 1;
+const uint32_t MSG_STUN_SEND = 1;
const int MAX_SENDS = 9;
const int DELAY_UNIT = 100; // 100 milliseconds
@@ -68,7 +68,7 @@
for (RequestMap::iterator i = requests_.begin(); i != requests_.end(); ++i)
requests.push_back(i->second);
- for (uint32 i = 0; i < requests.size(); ++i) {
+ for (uint32_t i = 0; i < requests.size(); ++i) {
// StunRequest destructor calls Remove() which deletes requests
// from |requests_|.
delete requests[i];
@@ -171,7 +171,7 @@
return msg_;
}
-uint32 StunRequest::Elapsed() const {
+uint32_t StunRequest::Elapsed() const {
return rtc::TimeSince(tstamp_);
}
diff --git a/webrtc/p2p/base/stunrequest.h b/webrtc/p2p/base/stunrequest.h
index e6b9e7d..267b4a1 100644
--- a/webrtc/p2p/base/stunrequest.h
+++ b/webrtc/p2p/base/stunrequest.h
@@ -90,7 +90,7 @@
const StunMessage* msg() const;
// Time elapsed since last send (in ms)
- uint32 Elapsed() const;
+ uint32_t Elapsed() const;
protected:
int count_;
@@ -118,7 +118,7 @@
StunRequestManager* manager_;
StunMessage* msg_;
- uint32 tstamp_;
+ uint32_t tstamp_;
friend class StunRequestManager;
};
diff --git a/webrtc/p2p/base/stunrequest_unittest.cc b/webrtc/p2p/base/stunrequest_unittest.cc
index 3ff6cba..8a23834 100644
--- a/webrtc/p2p/base/stunrequest_unittest.cc
+++ b/webrtc/p2p/base/stunrequest_unittest.cc
@@ -146,13 +146,13 @@
TEST_F(StunRequestTest, TestBackoff) {
StunMessage* req = CreateStunMessage(STUN_BINDING_REQUEST, NULL);
- uint32 start = rtc::Time();
+ uint32_t start = rtc::Time();
manager_.Send(new StunRequestThunker(req, this));
StunMessage* res = CreateStunMessage(STUN_BINDING_RESPONSE, req);
for (int i = 0; i < 9; ++i) {
while (request_count_ == i)
rtc::Thread::Current()->ProcessMessages(1);
- int32 elapsed = rtc::TimeSince(start);
+ int32_t elapsed = rtc::TimeSince(start);
LOG(LS_INFO) << "STUN request #" << (i + 1)
<< " sent at " << elapsed << " ms";
EXPECT_GE(TotalDelay(i + 1), elapsed);
diff --git a/webrtc/p2p/base/tcpport.cc b/webrtc/p2p/base/tcpport.cc
index 86982b0..2590d0a 100644
--- a/webrtc/p2p/base/tcpport.cc
+++ b/webrtc/p2p/base/tcpport.cc
@@ -76,13 +76,20 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
bool allow_listen)
- : Port(thread, LOCAL_PORT_TYPE, factory, network, ip, min_port, max_port,
- username, password),
+ : Port(thread,
+ LOCAL_PORT_TYPE,
+ factory,
+ network,
+ ip,
+ min_port,
+ max_port,
+ username,
+ password),
incoming_only_(false),
allow_listen_(allow_listen),
socket_(NULL),
diff --git a/webrtc/p2p/base/tcpport.h b/webrtc/p2p/base/tcpport.h
index d86f750..a64c5ee 100644
--- a/webrtc/p2p/base/tcpport.h
+++ b/webrtc/p2p/base/tcpport.h
@@ -32,8 +32,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
bool allow_listen) {
@@ -61,8 +61,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
bool allow_listen);
diff --git a/webrtc/p2p/base/transport.h b/webrtc/p2p/base/transport.h
index 6324cd6..dfd512f 100644
--- a/webrtc/p2p/base/transport.h
+++ b/webrtc/p2p/base/transport.h
@@ -160,8 +160,8 @@
void SetIceRole(IceRole role);
IceRole ice_role() const { return ice_role_; }
- void SetIceTiebreaker(uint64 IceTiebreaker) { tiebreaker_ = IceTiebreaker; }
- uint64 IceTiebreaker() { return tiebreaker_; }
+ void SetIceTiebreaker(uint64_t IceTiebreaker) { tiebreaker_ = IceTiebreaker; }
+ uint64_t IceTiebreaker() { return tiebreaker_; }
void SetIceConfig(const IceConfig& config);
@@ -290,7 +290,7 @@
bool channels_destroyed_ = false;
bool connect_requested_ = false;
IceRole ice_role_ = ICEROLE_UNKNOWN;
- uint64 tiebreaker_ = 0;
+ uint64_t tiebreaker_ = 0;
IceMode remote_ice_mode_ = ICEMODE_FULL;
IceConfig ice_config_;
rtc::scoped_ptr<TransportDescription> local_description_;
diff --git a/webrtc/p2p/base/transportchannel.h b/webrtc/p2p/base/transportchannel.h
index ca7d7cf..1223618 100644
--- a/webrtc/p2p/base/transportchannel.h
+++ b/webrtc/p2p/base/transportchannel.h
@@ -124,11 +124,11 @@
// Allows key material to be extracted for external encryption.
virtual bool ExportKeyingMaterial(const std::string& label,
- const uint8* context,
- size_t context_len,
- bool use_context,
- uint8* result,
- size_t result_len) = 0;
+ const uint8_t* context,
+ size_t context_len,
+ bool use_context,
+ uint8_t* result,
+ size_t result_len) = 0;
// Signalled each time a packet is received on this channel.
sigslot::signal5<TransportChannel*, const char*,
diff --git a/webrtc/p2p/base/transportchannelimpl.h b/webrtc/p2p/base/transportchannelimpl.h
index ab3a31e..8d4d4bb 100644
--- a/webrtc/p2p/base/transportchannelimpl.h
+++ b/webrtc/p2p/base/transportchannelimpl.h
@@ -42,7 +42,7 @@
// For ICE channels.
virtual IceRole GetIceRole() const = 0;
virtual void SetIceRole(IceRole role) = 0;
- virtual void SetIceTiebreaker(uint64 tiebreaker) = 0;
+ virtual void SetIceTiebreaker(uint64_t tiebreaker) = 0;
// TODO(pthatcher): Remove this once it's no longer called in
// remoting/protocol/libjingle_transport_factory.cc
virtual void SetIceProtocolType(IceProtocolType type) {}
@@ -90,8 +90,8 @@
// Set DTLS Remote fingerprint. Must be after local identity set.
virtual bool SetRemoteFingerprint(const std::string& digest_alg,
- const uint8* digest,
- size_t digest_len) = 0;
+ const uint8_t* digest,
+ size_t digest_len) = 0;
virtual bool SetSslRole(rtc::SSLRole role) = 0;
diff --git a/webrtc/p2p/base/transportcontroller.h b/webrtc/p2p/base/transportcontroller.h
index 45fcfea..8d57b46 100644
--- a/webrtc/p2p/base/transportcontroller.h
+++ b/webrtc/p2p/base/transportcontroller.h
@@ -214,7 +214,7 @@
IceRole ice_role_ = ICEROLE_CONTROLLING;
// Flag which will be set to true after the first role switch
bool ice_role_switch_ = false;
- uint64 ice_tiebreaker_ = rtc::CreateRandomId64();
+ uint64_t ice_tiebreaker_ = rtc::CreateRandomId64();
rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
};
diff --git a/webrtc/p2p/base/turnport.cc b/webrtc/p2p/base/turnport.cc
index 2e4e26d..3fdcac5 100644
--- a/webrtc/p2p/base/turnport.cc
+++ b/webrtc/p2p/base/turnport.cc
@@ -38,7 +38,7 @@
// STUN_ERROR_ALLOCATION_MISMATCH error per rfc5766.
static const size_t MAX_ALLOCATE_MISMATCH_RETRIES = 2;
-inline bool IsTurnChannelData(uint16 msg_type) {
+inline bool IsTurnChannelData(uint16_t msg_type) {
return ((msg_type & 0xC000) == 0x4000); // MSB are 0b01
}
@@ -196,8 +196,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
const ProtocolAddress& server_address,
@@ -534,7 +534,7 @@
// Check the message type, to see if is a Channel Data message.
// The message will either be channel data, a TURN data indication, or
// a response to a previous request.
- uint16 msg_type = rtc::GetBE16(data);
+ uint16_t msg_type = rtc::GetBE16(data);
if (IsTurnChannelData(msg_type)) {
HandleChannelData(msg_type, data, size, packet_time);
} else if (msg_type == TURN_DATA_INDICATION) {
@@ -779,7 +779,7 @@
// +-------------------------------+
// Extract header fields from the message.
- uint16 len = rtc::GetBE16(data + 2);
+ uint16_t len = rtc::GetBE16(data + 2);
if (len > size - TURN_CHANNEL_HEADER_SIZE) {
LOG_J(LS_WARNING, this) << "Received TURN channel data message with "
<< "incorrect length, len=" << len;
@@ -1325,7 +1325,7 @@
} else {
// If the channel is bound, we can send the data as a Channel Message.
buf.WriteUInt16(channel_id_);
- buf.WriteUInt16(static_cast<uint16>(size));
+ buf.WriteUInt16(static_cast<uint16_t>(size));
buf.WriteBytes(reinterpret_cast<const char*>(data), size);
}
return port_->Send(buf.Data(), buf.Length(), options);
diff --git a/webrtc/p2p/base/turnport.h b/webrtc/p2p/base/turnport.h
index 52546e0..3bca727 100644
--- a/webrtc/p2p/base/turnport.h
+++ b/webrtc/p2p/base/turnport.h
@@ -57,8 +57,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username, // ice username.
const std::string& password, // ice password.
const ProtocolAddress& server_address,
@@ -149,8 +149,8 @@
rtc::PacketSocketFactory* factory,
rtc::Network* network,
const rtc::IPAddress& ip,
- uint16 min_port,
- uint16 max_port,
+ uint16_t min_port,
+ uint16_t max_port,
const std::string& username,
const std::string& password,
const ProtocolAddress& server_address,
diff --git a/webrtc/p2p/base/turnserver.cc b/webrtc/p2p/base/turnserver.cc
index 7d82d55..8d40a90 100644
--- a/webrtc/p2p/base/turnserver.cc
+++ b/webrtc/p2p/base/turnserver.cc
@@ -40,7 +40,7 @@
static const size_t TURN_CHANNEL_HEADER_SIZE = 4U;
// TODO(mallinath) - Move these to a common place.
-inline bool IsTurnChannelData(uint16 msg_type) {
+inline bool IsTurnChannelData(uint16_t msg_type) {
// The first two bits of a channel data message are 0b01.
return ((msg_type & 0xC000) == 0x4000);
}
@@ -200,7 +200,7 @@
InternalSocketMap::iterator iter = server_sockets_.find(socket);
ASSERT(iter != server_sockets_.end());
TurnServerConnection conn(addr, iter->second, socket);
- uint16 msg_type = rtc::GetBE16(data);
+ uint16_t msg_type = rtc::GetBE16(data);
if (!IsTurnChannelData(msg_type)) {
// This is a STUN message.
HandleStunMessage(&conn, data, size);
@@ -394,7 +394,7 @@
std::string TurnServer::GenerateNonce() const {
// Generate a nonce of the form hex(now + HMAC-MD5(nonce_key_, now))
- uint32 now = rtc::Time();
+ uint32_t now = rtc::Time();
std::string input(reinterpret_cast<const char*>(&now), sizeof(now));
std::string nonce = rtc::hex_encode(input.c_str(), input.size());
nonce += rtc::ComputeHmac(rtc::DIGEST_MD5, nonce_key_, input);
@@ -409,7 +409,7 @@
}
// Decode the timestamp.
- uint32 then;
+ uint32_t then;
char* p = reinterpret_cast<char*>(&then);
size_t len = rtc::hex_decode(p, sizeof(then),
nonce.substr(0, sizeof(then) * 2));
@@ -761,7 +761,7 @@
void TurnServerAllocation::HandleChannelData(const char* data, size_t size) {
// Extract the channel number from the data.
- uint16 channel_id = rtc::GetBE16(data);
+ uint16_t channel_id = rtc::GetBE16(data);
Channel* channel = FindChannel(channel_id);
if (channel) {
// Send the data to the peer address.
@@ -784,7 +784,7 @@
// There is a channel bound to this address. Send as a channel message.
rtc::ByteBuffer buf;
buf.WriteUInt16(channel->id());
- buf.WriteUInt16(static_cast<uint16>(size));
+ buf.WriteUInt16(static_cast<uint16_t>(size));
buf.WriteBytes(data, size);
server_->Send(&conn_, buf);
} else if (HasPermission(addr.ipaddr())) {
@@ -806,7 +806,7 @@
int TurnServerAllocation::ComputeLifetime(const TurnMessage* msg) {
// Return the smaller of our default lifetime and the requested lifetime.
- uint32 lifetime = kDefaultAllocationTimeout / 1000; // convert to seconds
+ uint32_t lifetime = kDefaultAllocationTimeout / 1000; // convert to seconds
const StunUInt32Attribute* lifetime_attr = msg->GetUInt32(STUN_ATTR_LIFETIME);
if (lifetime_attr && lifetime_attr->value() < lifetime) {
lifetime = lifetime_attr->value();
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index f343b35..21c8921 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -59,7 +59,7 @@
} // namespace
namespace cricket {
-const uint32 DISABLE_ALL_PHASES =
+const uint32_t DISABLE_ALL_PHASES =
PORTALLOCATOR_DISABLE_UDP | PORTALLOCATOR_DISABLE_TCP |
PORTALLOCATOR_DISABLE_STUN | PORTALLOCATOR_DISABLE_RELAY;
@@ -157,7 +157,7 @@
if (network_thread_ != NULL)
network_thread_->Clear(this);
- for (uint32 i = 0; i < sequences_.size(); ++i) {
+ for (uint32_t i = 0; i < sequences_.size(); ++i) {
// AllocationSequence should clear it's map entry for turn ports before
// ports are destroyed.
sequences_[i]->Clear();
@@ -167,10 +167,10 @@
for (it = ports_.begin(); it != ports_.end(); it++)
delete it->port();
- for (uint32 i = 0; i < configs_.size(); ++i)
+ for (uint32_t i = 0; i < configs_.size(); ++i)
delete configs_[i];
- for (uint32 i = 0; i < sequences_.size(); ++i)
+ for (uint32_t i = 0; i < sequences_.size(); ++i)
delete sequences_[i];
}
@@ -198,7 +198,7 @@
void BasicPortAllocatorSession::ClearGettingPorts() {
network_thread_->Clear(this, MSG_ALLOCATE);
- for (uint32 i = 0; i < sequences_.size(); ++i)
+ for (uint32_t i = 0; i < sequences_.size(); ++i)
sequences_[i]->Stop();
}
@@ -335,12 +335,12 @@
LOG(LS_WARNING) << "Machine has no networks; no ports will be allocated";
done_signal_needed = true;
} else {
- for (uint32 i = 0; i < networks.size(); ++i) {
+ for (uint32_t i = 0; i < networks.size(); ++i) {
PortConfiguration* config = NULL;
if (configs_.size() > 0)
config = configs_.back();
- uint32 sequence_flags = flags();
+ uint32_t sequence_flags = flags();
if ((sequence_flags & DISABLE_ALL_PHASES) == DISABLE_ALL_PHASES) {
// If all the ports are disabled we should just fire the allocation
// done event and return.
@@ -406,9 +406,12 @@
}
void BasicPortAllocatorSession::DisableEquivalentPhases(
- rtc::Network* network, PortConfiguration* config, uint32* flags) {
- for (uint32 i = 0; i < sequences_.size() &&
- (*flags & DISABLE_ALL_PHASES) != DISABLE_ALL_PHASES; ++i) {
+ rtc::Network* network,
+ PortConfiguration* config,
+ uint32_t* flags) {
+ for (uint32_t i = 0; i < sequences_.size() &&
+ (*flags & DISABLE_ALL_PHASES) != DISABLE_ALL_PHASES;
+ ++i) {
sequences_[i]->DisableEquivalentPhases(network, config, flags);
}
}
@@ -429,7 +432,7 @@
PORTALLOCATOR_ENABLE_STUN_RETRANSMIT_ATTRIBUTE) != 0);
// Push down the candidate_filter to individual port.
- uint32 candidate_filter = allocator_->candidate_filter();
+ uint32_t candidate_filter = allocator_->candidate_filter();
// When adapter enumeration is disabled, disable CF_HOST at port level so
// local address is not leaked by stunport in the candidate's related address.
@@ -572,7 +575,7 @@
}
bool BasicPortAllocatorSession::CheckCandidateFilter(const Candidate& c) {
- uint32 filter = allocator_->candidate_filter();
+ uint32_t filter = allocator_->candidate_filter();
// When binding to any address, before sending packets out, the getsockname
// returns all 0s, but after sending packets, it'll be the NIC used to
@@ -714,7 +717,7 @@
AllocationSequence::AllocationSequence(BasicPortAllocatorSession* session,
rtc::Network* network,
PortConfiguration* config,
- uint32 flags)
+ uint32_t flags)
: session_(session),
network_(network),
ip_(network->GetBestIP()),
@@ -757,7 +760,7 @@
}
void AllocationSequence::DisableEquivalentPhases(rtc::Network* network,
- PortConfiguration* config, uint32* flags) {
+ PortConfiguration* config, uint32_t* flags) {
if (network_removed_) {
// If the network of this allocation sequence has ever gone away,
// it won't be equivalent to the new network.
diff --git a/webrtc/p2p/client/basicportallocator.h b/webrtc/p2p/client/basicportallocator.h
index ac2cfbf..c8bcad2 100644
--- a/webrtc/p2p/client/basicportallocator.h
+++ b/webrtc/p2p/client/basicportallocator.h
@@ -171,7 +171,8 @@
void OnNetworksChanged();
void OnAllocationSequenceObjectsCreated();
void DisableEquivalentPhases(rtc::Network* network,
- PortConfiguration* config, uint32* flags);
+ PortConfiguration* config,
+ uint32_t* flags);
void AddAllocatedPort(Port* port, AllocationSequence* seq,
bool prepare_address);
void OnCandidateReady(Port* port, const Candidate& c);
@@ -258,7 +259,7 @@
AllocationSequence(BasicPortAllocatorSession* session,
rtc::Network* network,
PortConfiguration* config,
- uint32 flags);
+ uint32_t flags);
~AllocationSequence();
bool Init();
void Clear();
@@ -272,7 +273,7 @@
// equivalent network setup.
void DisableEquivalentPhases(rtc::Network* network,
PortConfiguration* config,
- uint32* flags);
+ uint32_t* flags);
// Starts and stops the sequence. When started, it will continue allocating
// new ports on its own timed schedule.
@@ -300,7 +301,7 @@
private:
typedef std::vector<ProtocolType> ProtocolList;
- bool IsFlagSet(uint32 flag) { return ((flags_ & flag) != 0); }
+ bool IsFlagSet(uint32_t flag) { return ((flags_ & flag) != 0); }
void CreateUDPPorts();
void CreateTCPPorts();
void CreateStunPorts();
@@ -321,7 +322,7 @@
rtc::IPAddress ip_;
PortConfiguration* config_;
State state_;
- uint32 flags_;
+ uint32_t flags_;
ProtocolList protocols_;
rtc::scoped_ptr<rtc::AsyncPacketSocket> udp_socket_;
// There will be only one udp port per AllocationSequence.
diff --git a/webrtc/p2p/client/portallocator_unittest.cc b/webrtc/p2p/client/portallocator_unittest.cc
index b0c77d3..9617688 100644
--- a/webrtc/p2p/client/portallocator_unittest.cc
+++ b/webrtc/p2p/client/portallocator_unittest.cc
@@ -249,7 +249,7 @@
// also the related address for TURN candidate if it is expected. Otherwise,
// it should be ignore.
void CheckDisableAdapterEnumeration(
- uint32 total_ports,
+ uint32_t total_ports,
const rtc::IPAddress& host_candidate_addr,
const rtc::IPAddress& stun_candidate_addr,
const rtc::IPAddress& relay_candidate_udp_transport_addr,
@@ -264,7 +264,7 @@
session_->StartGettingPorts();
EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
- uint32 total_candidates = 0;
+ uint32_t total_candidates = 0;
if (!host_candidate_addr.IsNil()) {
EXPECT_PRED5(CheckCandidate, candidates_[total_candidates],
cricket::ICE_CANDIDATE_COMPONENT_RTP, "local", "udp",
diff --git a/webrtc/p2p/client/socketmonitor.h b/webrtc/p2p/client/socketmonitor.h
index e0dd81e..eb11516 100644
--- a/webrtc/p2p/client/socketmonitor.h
+++ b/webrtc/p2p/client/socketmonitor.h
@@ -53,7 +53,7 @@
rtc::Thread* worker_thread_;
rtc::Thread* monitoring_thread_;
rtc::CriticalSection crit_;
- uint32 rate_;
+ uint32_t rate_;
bool monitoring_;
};
diff --git a/webrtc/p2p/stunprober/stunprober.cc b/webrtc/p2p/stunprober/stunprober.cc
index 5bfa711..d7d527a 100644
--- a/webrtc/p2p/stunprober/stunprober.cc
+++ b/webrtc/p2p/stunprober/stunprober.cc
@@ -44,16 +44,16 @@
// Each Request maps to a request and response.
struct Request {
// Actual time the STUN bind request was sent.
- int64 sent_time_ms = 0;
+ int64_t sent_time_ms = 0;
// Time the response was received.
- int64 received_time_ms = 0;
+ int64_t received_time_ms = 0;
// Server reflexive address from STUN response for this given request.
rtc::SocketAddress srflx_addr;
rtc::IPAddress server_addr;
- int64 rtt() { return received_time_ms - sent_time_ms; }
+ int64_t rtt() { return received_time_ms - sent_time_ms; }
void ProcessResponse(const char* buf, size_t buf_len);
};
@@ -97,8 +97,8 @@
std::vector<Request*> requests_;
std::vector<rtc::SocketAddress> server_ips_;
- int16 num_request_sent_ = 0;
- int16 num_response_received_ = 0;
+ int16_t num_request_sent_ = 0;
+ int16_t num_response_received_ = 0;
rtc::ThreadChecker& thread_checker_;
@@ -169,7 +169,7 @@
void StunProber::Requester::Request::ProcessResponse(const char* buf,
size_t buf_len) {
- int64 now = rtc::Time();
+ int64_t now = rtc::Time();
rtc::ByteBuffer message(buf, buf_len);
cricket::StunMessage stun_response;
if (!stun_response.Read(&message)) {
@@ -376,7 +376,7 @@
void StunProber::MaybeScheduleStunRequests() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- uint32 now = rtc::Time();
+ uint32_t now = rtc::Time();
if (Done()) {
invoker_.AsyncInvokeDelayed<void>(
@@ -404,8 +404,8 @@
StunProber::Stats stats;
int rtt_sum = 0;
- int64 first_sent_time = 0;
- int64 last_sent_time = 0;
+ int64_t first_sent_time = 0;
+ int64_t last_sent_time = 0;
NatType nat_type = NATTYPE_INVALID;
// Track of how many srflx IP that we have seen.
diff --git a/webrtc/p2p/stunprober/stunprober.h b/webrtc/p2p/stunprober/stunprober.h
index 88dedd5..b71d523 100644
--- a/webrtc/p2p/stunprober/stunprober.h
+++ b/webrtc/p2p/stunprober/stunprober.h
@@ -146,15 +146,15 @@
Requester* current_requester_ = nullptr;
// The time when the next request should go out.
- uint64 next_request_time_ms_ = 0;
+ uint64_t next_request_time_ms_ = 0;
// Total requests sent so far.
- uint32 num_request_sent_ = 0;
+ uint32_t num_request_sent_ = 0;
bool shared_socket_mode_ = false;
// How many requests should be done against each resolved IP.
- uint32 requests_per_ip_ = 0;
+ uint32_t requests_per_ip_ = 0;
// Milliseconds to pause between each STUN request.
int interval_ms_;
diff --git a/webrtc/p2p/stunprober/stunprober_unittest.cc b/webrtc/p2p/stunprober/stunprober_unittest.cc
index 3e03014..cdcc14a 100644
--- a/webrtc/p2p/stunprober/stunprober_unittest.cc
+++ b/webrtc/p2p/stunprober/stunprober_unittest.cc
@@ -59,8 +59,8 @@
const std::vector<rtc::SocketAddress>& addrs,
const rtc::NetworkManager::NetworkList& networks,
bool shared_socket,
- uint16 interval,
- uint16 pings_per_ip) {
+ uint16_t interval,
+ uint16_t pings_per_ip) {
prober.reset(
new StunProber(socket_factory, rtc::Thread::Current(), networks));
prober->Start(addrs, shared_socket, interval, pings_per_ip,
@@ -89,12 +89,12 @@
// Set up the expected results for verification.
std::set<std::string> srflx_addresses;
srflx_addresses.insert(kStunMappedAddr.ToString());
- const uint32 total_pings_tried =
- static_cast<uint32>(pings_per_ip * addrs.size());
+ const uint32_t total_pings_tried =
+ static_cast<uint32_t>(pings_per_ip * addrs.size());
// The reported total_pings should not count for pings sent to the
// kFailedStunAddr.
- const uint32 total_pings_reported = total_pings_tried - pings_per_ip;
+ const uint32_t total_pings_reported = total_pings_tried - pings_per_ip;
StartProbing(socket_factory.get(), addrs, networks, shared_mode, 3,
pings_per_ip);
@@ -106,9 +106,9 @@
EXPECT_EQ(stats.success_percent, 100);
EXPECT_TRUE(stats.nat_type > stunprober::NATTYPE_NONE);
EXPECT_EQ(stats.srflx_addrs, srflx_addresses);
- EXPECT_EQ(static_cast<uint32>(stats.num_request_sent),
+ EXPECT_EQ(static_cast<uint32_t>(stats.num_request_sent),
total_pings_reported);
- EXPECT_EQ(static_cast<uint32>(stats.num_response_received),
+ EXPECT_EQ(static_cast<uint32_t>(stats.num_response_received),
total_pings_reported);
}
diff --git a/webrtc/tools/converter/converter.cc b/webrtc/tools/converter/converter.cc
index 6c9154c..a9b453d 100644
--- a/webrtc/tools/converter/converter.cc
+++ b/webrtc/tools/converter/converter.cc
@@ -45,13 +45,13 @@
}
int input_frame_size = InputFrameSize();
- uint8* rgba_buffer = new uint8[input_frame_size];
+ uint8_t* rgba_buffer = new uint8_t[input_frame_size];
int y_plane_size = YPlaneSize();
- uint8* dst_y = new uint8[y_plane_size];
+ uint8_t* dst_y = new uint8_t[y_plane_size];
int u_plane_size = UPlaneSize();
- uint8* dst_u = new uint8[u_plane_size];
+ uint8_t* dst_u = new uint8_t[u_plane_size];
int v_plane_size = VPlaneSize();
- uint8* dst_v = new uint8[v_plane_size];
+ uint8_t* dst_v = new uint8_t[v_plane_size];
int counter = 0; // Counter to form frame names.
bool success = false; // Is conversion successful.
@@ -106,9 +106,12 @@
return success;
}
-bool Converter::AddYUVToFile(uint8* y_plane, int y_plane_size,
- uint8* u_plane, int u_plane_size,
- uint8* v_plane, int v_plane_size,
+bool Converter::AddYUVToFile(uint8_t* y_plane,
+ int y_plane_size,
+ uint8_t* u_plane,
+ int u_plane_size,
+ uint8_t* v_plane,
+ int v_plane_size,
FILE* output_file) {
bool success = AddYUVPlaneToFile(y_plane, y_plane_size, output_file) &&
AddYUVPlaneToFile(u_plane, u_plane_size, output_file) &&
@@ -116,7 +119,8 @@
return success;
}
-bool Converter::AddYUVPlaneToFile(uint8* yuv_plane, int yuv_plane_size,
+bool Converter::AddYUVPlaneToFile(uint8_t* yuv_plane,
+ int yuv_plane_size,
FILE* file) {
size_t bytes_written = fwrite(yuv_plane, 1, yuv_plane_size, file);
diff --git a/webrtc/tools/converter/converter.h b/webrtc/tools/converter/converter.h
index a23d5a1..f7641ff 100644
--- a/webrtc/tools/converter/converter.h
+++ b/webrtc/tools/converter/converter.h
@@ -75,13 +75,16 @@
// Writes the Y, U and V (in this order) planes to the file, thus adding a
// raw YUV frame to the file.
- bool AddYUVToFile(uint8* y_plane, int y_plane_size,
- uint8* u_plane, int u_plane_size,
- uint8* v_plane, int v_plane_size,
+ bool AddYUVToFile(uint8_t* y_plane,
+ int y_plane_size,
+ uint8_t* u_plane,
+ int u_plane_size,
+ uint8_t* v_plane,
+ int v_plane_size,
FILE* output_file);
// Adds the Y, U or V plane to the file.
- bool AddYUVPlaneToFile(uint8* yuv_plane, int yuv_plane_size, FILE* file);
+ bool AddYUVPlaneToFile(uint8_t* yuv_plane, int yuv_plane_size, FILE* file);
// Reads a RGBA frame from input_file_name with input_frame_size size in bytes
// into the buffer.
diff --git a/webrtc/tools/frame_analyzer/video_quality_analysis.cc b/webrtc/tools/frame_analyzer/video_quality_analysis.cc
index 5c707bb..172baa7 100644
--- a/webrtc/tools/frame_analyzer/video_quality_analysis.cc
+++ b/webrtc/tools/frame_analyzer/video_quality_analysis.cc
@@ -90,8 +90,11 @@
return true;
}
-bool ExtractFrameFromYuvFile(const char* i420_file_name, int width, int height,
- int frame_number, uint8* result_frame) {
+bool ExtractFrameFromYuvFile(const char* i420_file_name,
+ int width,
+ int height,
+ int frame_number,
+ uint8_t* result_frame) {
int frame_size = GetI420FrameSize(width, height);
int offset = frame_number * frame_size; // Calculate offset for the frame.
bool errors = false;
@@ -117,8 +120,11 @@
return !errors;
}
-bool ExtractFrameFromY4mFile(const char* y4m_file_name, int width, int height,
- int frame_number, uint8* result_frame) {
+bool ExtractFrameFromY4mFile(const char* y4m_file_name,
+ int width,
+ int height,
+ int frame_number,
+ uint8_t* result_frame) {
int frame_size = GetI420FrameSize(width, height);
int frame_offset = frame_number * frame_size;
bool errors = false;
@@ -170,20 +176,22 @@
}
double CalculateMetrics(VideoAnalysisMetricsType video_metrics_type,
- const uint8* ref_frame, const uint8* test_frame,
- int width, int height) {
+ const uint8_t* ref_frame,
+ const uint8_t* test_frame,
+ int width,
+ int height) {
if (!ref_frame || !test_frame)
return -1;
else if (height < 0 || width < 0)
return -1;
int half_width = (width + 1) >> 1;
int half_height = (height + 1) >> 1;
- const uint8* src_y_a = ref_frame;
- const uint8* src_u_a = src_y_a + width * height;
- const uint8* src_v_a = src_u_a + half_width * half_height;
- const uint8* src_y_b = test_frame;
- const uint8* src_u_b = src_y_b + width * height;
- const uint8* src_v_b = src_u_b + half_width * half_height;
+ const uint8_t* src_y_a = ref_frame;
+ const uint8_t* src_u_a = src_y_a + width * height;
+ const uint8_t* src_v_a = src_u_a + half_width * half_height;
+ const uint8_t* src_y_b = test_frame;
+ const uint8_t* src_u_b = src_y_b + width * height;
+ const uint8_t* src_v_b = src_u_b + half_width * half_height;
int stride_y = width;
int stride_uv = half_width;
@@ -230,8 +238,8 @@
char line[STATS_LINE_LENGTH];
// Allocate buffers for test and reference frames.
- uint8* test_frame = new uint8[size];
- uint8* reference_frame = new uint8[size];
+ uint8_t* test_frame = new uint8_t[size];
+ uint8_t* reference_frame = new uint8_t[size];
int previous_frame_number = -1;
// While there are entries in the stats file.
diff --git a/webrtc/tools/frame_analyzer/video_quality_analysis.h b/webrtc/tools/frame_analyzer/video_quality_analysis.h
index 49b6f12..475b2fa 100644
--- a/webrtc/tools/frame_analyzer/video_quality_analysis.h
+++ b/webrtc/tools/frame_analyzer/video_quality_analysis.h
@@ -62,8 +62,10 @@
// frames are exactly the same) will be 48. In the case of SSIM the max return
// value will be 1.
double CalculateMetrics(VideoAnalysisMetricsType video_metrics_type,
- const uint8* ref_frame, const uint8* test_frame,
- int width, int height);
+ const uint8_t* ref_frame,
+ const uint8_t* test_frame,
+ int width,
+ int height);
// Prints the result from the analysis in Chromium performance
// numbers compatible format to stdout. If the results object contains no frames
@@ -101,14 +103,19 @@
int ExtractDecodedFrameNumber(std::string line);
// Extracts an I420 frame at position frame_number from the raw YUV file.
-bool ExtractFrameFromYuvFile(const char* i420_file_name, int width, int height,
- int frame_number, uint8* result_frame);
+bool ExtractFrameFromYuvFile(const char* i420_file_name,
+ int width,
+ int height,
+ int frame_number,
+ uint8_t* result_frame);
// Extracts an I420 frame at position frame_number from the Y4M file. The first
// frame has corresponded |frame_number| 0.
-bool ExtractFrameFromY4mFile(const char* i420_file_name, int width, int height,
- int frame_number, uint8* result_frame);
-
+bool ExtractFrameFromY4mFile(const char* i420_file_name,
+ int width,
+ int height,
+ int frame_number,
+ uint8_t* result_frame);
} // namespace test
} // namespace webrtc
diff --git a/webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc b/webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc
index 3fb468b..bae145a 100644
--- a/webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc
+++ b/webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc
@@ -34,8 +34,8 @@
int size = webrtc::test::GetI420FrameSize(width, height);
// Allocate buffers for test and reference frames.
- uint8* test_frame = new uint8[size];
- uint8* ref_frame = new uint8[size];
+ uint8_t* test_frame = new uint8_t[size];
+ uint8_t* ref_frame = new uint8_t[size];
bool read_result = true;
for(int frame_counter = 0; frame_counter < MAX_NUM_FRAMES_PER_FILE;
diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h
index 3034c7e..d875490 100644
--- a/webrtc/typedefs.h
+++ b/webrtc/typedefs.h
@@ -62,19 +62,8 @@
#define WEBRTC_CPU_DETECTION
#endif
-#if !defined(_MSC_VER)
+// TODO(pbos): Use webrtc/base/basictypes.h instead to include fixed-size ints.
#include <stdint.h>
-#else
-// Define C99 equivalent types, since pre-2010 MSVC doesn't provide stdint.h.
-typedef signed char int8_t;
-typedef signed short int16_t;
-typedef signed int int32_t;
-typedef __int64 int64_t;
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned __int64 uint64_t;
-#endif
// Annotate a function indicating the caller must examine the return value.
// Use like:
diff --git a/webrtc/voice_engine/test/auto_test/fakes/conference_transport.cc b/webrtc/voice_engine/test/auto_test/fakes/conference_transport.cc
index 581a768..0677093 100644
--- a/webrtc/voice_engine/test/auto_test/fakes/conference_transport.cc
+++ b/webrtc/voice_engine/test/auto_test/fakes/conference_transport.cc
@@ -207,8 +207,8 @@
packet_queue_.pop_front();
}
- int32 elapsed_time_ms = rtc::TimeSince(packet.send_time_ms_);
- int32 sleep_ms = rtt_ms_ / 2 - elapsed_time_ms;
+ int32_t elapsed_time_ms = rtc::TimeSince(packet.send_time_ms_);
+ int32_t sleep_ms = rtt_ms_ / 2 - elapsed_time_ms;
if (sleep_ms > 0) {
// Every packet should be delayed by half of RTT.
webrtc::SleepMs(sleep_ms);
diff --git a/webrtc/voice_engine/test/auto_test/fakes/conference_transport.h b/webrtc/voice_engine/test/auto_test/fakes/conference_transport.h
index 602f07f..2194de9 100644
--- a/webrtc/voice_engine/test/auto_test/fakes/conference_transport.h
+++ b/webrtc/voice_engine/test/auto_test/fakes/conference_transport.h
@@ -108,7 +108,7 @@
enum Type { Rtp, Rtcp, } type_;
Packet() : len_(0) {}
- Packet(Type type, const void* data, size_t len, uint32 time_ms)
+ Packet(Type type, const void* data, size_t len, uint32_t time_ms)
: type_(type), len_(len), send_time_ms_(time_ms) {
EXPECT_LE(len_, kMaxPacketSizeByte);
memcpy(data_, data, len_);
@@ -116,7 +116,7 @@
uint8_t data_[kMaxPacketSizeByte];
size_t len_;
- uint32 send_time_ms_;
+ uint32_t send_time_ms_;
};
static bool Run(void* transport) {
diff --git a/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.cc b/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.cc
index 9d7239e..d4438a4 100644
--- a/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.cc
+++ b/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.cc
@@ -14,7 +14,7 @@
namespace voetest {
-void LoudestFilter::RemoveTimeoutStreams(uint32 time_ms) {
+void LoudestFilter::RemoveTimeoutStreams(uint32_t time_ms) {
auto it = stream_levels_.begin();
while (it != stream_levels_.end()) {
if (rtc::TimeDiff(time_ms, it->second.last_time_ms) >
@@ -41,7 +41,7 @@
}
bool LoudestFilter::ForwardThisPacket(const webrtc::RTPHeader& rtp_header) {
- uint32 time_now_ms = rtc::Time();
+ uint32_t time_now_ms = rtc::Time();
RemoveTimeoutStreams(time_now_ms);
int source_ssrc = rtp_header.ssrc;
diff --git a/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h b/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h
index 79b0105..73b801c 100644
--- a/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h
+++ b/webrtc/voice_engine/test/auto_test/fakes/loudest_filter.h
@@ -29,21 +29,21 @@
private:
struct Status {
- void Set(int audio_level, uint32 last_time_ms) {
+ void Set(int audio_level, uint32_t last_time_ms) {
this->audio_level = audio_level;
this->last_time_ms = last_time_ms;
}
int audio_level;
- uint32 last_time_ms;
+ uint32_t last_time_ms;
};
- void RemoveTimeoutStreams(uint32 time_ms);
+ void RemoveTimeoutStreams(uint32_t time_ms);
unsigned int FindQuietestStream();
// Keeps the streams being forwarded in pair<SSRC, Status>.
std::map<unsigned int, Status> stream_levels_;
- const int32 kStreamTimeOutMs = 5000;
+ const int32_t kStreamTimeOutMs = 5000;
const size_t kMaxMixSize = 3;
const int kInvalidAudioLevel = 128;
};
diff --git a/webrtc/voice_engine/test/auto_test/voe_conference_test.cc b/webrtc/voice_engine/test/auto_test/voe_conference_test.cc
index d2407f3..f9d2271 100644
--- a/webrtc/voice_engine/test/auto_test/voe_conference_test.cc
+++ b/webrtc/voice_engine/test/auto_test/voe_conference_test.cc
@@ -72,7 +72,7 @@
const int kStatsRequestIntervalMs = 1000;
const int kStatsBufferSize = 3;
- uint32 deadline = rtc::TimeAfter(kMaxRunTimeMs);
+ uint32_t deadline = rtc::TimeAfter(kMaxRunTimeMs);
// Run the following up to |kMaxRunTimeMs| milliseconds.
int successive_pass = 0;
webrtc::CallStatistics stats_1;