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_;