Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Unified Diff: webrtc/base/physicalsocketserver.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/physicalsocketserver.h ('k') | webrtc/base/profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/physicalsocketserver.cc
diff --git a/webrtc/base/physicalsocketserver.cc b/webrtc/base/physicalsocketserver.cc
index b9c2a07aa546ec4d5ede4c7f7dac553f86f53e97..01f0731f3c21e8d98e6e7a05be1bd55eb798aa11 100644
--- a/webrtc/base/physicalsocketserver.cc
+++ b/webrtc/base/physicalsocketserver.cc
@@ -68,26 +68,26 @@ namespace rtc {
#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 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> {
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 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> {
}
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 @@ class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> {
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 @@ class EventDispatcher : public Dispatcher {
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 @@ class PosixSignalHandler {
// 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 @@ class PosixSignalHandler {
// 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 @@ class PosixSignalDispatcher : public Dispatcher {
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 @@ class PosixSignalDispatcher : public Dispatcher {
}
}
- 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 @@ class SocketDispatcher : public Dispatcher, public PhysicalSocket {
}
}
- 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 @@ class FileDispatcher: public Dispatcher, public AsyncFile {
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 @@ AsyncFile* PhysicalSocketServer::CreateFile(int fd) {
#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 @@ class EventDispatcher : public Dispatcher {
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 @@ class SocketDispatcher : public Dispatcher, public PhysicalSocket {
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 @@ class Signaler : public EventDispatcher {
}
~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 @@ bool PhysicalSocketServer::Wait(int cmsWait, bool process_io) {
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 @@ bool PhysicalSocketServer::Wait(int cmsWait, bool process_io) {
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::InstallSignal(int signum, void (*handler)(int)) {
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 @@ bool PhysicalSocketServer::Wait(int cmsWait, bool process_io) {
}
}
#endif
- uint32 ff = 0;
+ uint32_t ff = 0;
int errcode = 0;
if (wsaEvents.lNetworkEvents & FD_READ)
ff |= DE_READ;
« no previous file with comments | « webrtc/base/physicalsocketserver.h ('k') | webrtc/base/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698