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

Side by Side Diff: talk/app/webrtc/peerconnection.cc

Issue 1405023016: Convert usage of ARRAY_SIZE to arraysize. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: static_cast<int> Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/jsepsessiondescription.cc ('k') | talk/app/webrtc/videosource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 28 matching lines...) Expand all
39 #include "talk/app/webrtc/mediastreamproxy.h" 39 #include "talk/app/webrtc/mediastreamproxy.h"
40 #include "talk/app/webrtc/mediastreamtrackproxy.h" 40 #include "talk/app/webrtc/mediastreamtrackproxy.h"
41 #include "talk/app/webrtc/remoteaudiosource.h" 41 #include "talk/app/webrtc/remoteaudiosource.h"
42 #include "talk/app/webrtc/remotevideocapturer.h" 42 #include "talk/app/webrtc/remotevideocapturer.h"
43 #include "talk/app/webrtc/rtpreceiver.h" 43 #include "talk/app/webrtc/rtpreceiver.h"
44 #include "talk/app/webrtc/rtpsender.h" 44 #include "talk/app/webrtc/rtpsender.h"
45 #include "talk/app/webrtc/streamcollection.h" 45 #include "talk/app/webrtc/streamcollection.h"
46 #include "talk/app/webrtc/videosource.h" 46 #include "talk/app/webrtc/videosource.h"
47 #include "talk/app/webrtc/videotrack.h" 47 #include "talk/app/webrtc/videotrack.h"
48 #include "talk/media/sctp/sctpdataengine.h" 48 #include "talk/media/sctp/sctpdataengine.h"
49 #include "webrtc/p2p/client/basicportallocator.h"
50 #include "talk/session/media/channelmanager.h" 49 #include "talk/session/media/channelmanager.h"
50 #include "webrtc/base/arraysize.h"
51 #include "webrtc/base/logging.h" 51 #include "webrtc/base/logging.h"
52 #include "webrtc/base/stringencode.h" 52 #include "webrtc/base/stringencode.h"
53 #include "webrtc/base/stringutils.h" 53 #include "webrtc/base/stringutils.h"
54 #include "webrtc/p2p/client/basicportallocator.h"
54 #include "webrtc/system_wrappers/include/field_trial.h" 55 #include "webrtc/system_wrappers/include/field_trial.h"
55 56
56 namespace { 57 namespace {
57 58
58 using webrtc::DataChannel; 59 using webrtc::DataChannel;
59 using webrtc::MediaConstraintsInterface; 60 using webrtc::MediaConstraintsInterface;
60 using webrtc::MediaStreamInterface; 61 using webrtc::MediaStreamInterface;
61 using webrtc::PeerConnectionInterface; 62 using webrtc::PeerConnectionInterface;
62 using webrtc::StreamCollection; 63 using webrtc::StreamCollection;
63 using webrtc::StunConfigurations; 64 using webrtc::StunConfigurations;
(...skipping 24 matching lines...) Expand all
88 89
89 // NOTE: A loop below assumes that the first value of this enum is 0 and all 90 // NOTE: A loop below assumes that the first value of this enum is 0 and all
90 // other values are incremental. 91 // other values are incremental.
91 enum ServiceType { 92 enum ServiceType {
92 STUN = 0, // Indicates a STUN server. 93 STUN = 0, // Indicates a STUN server.
93 STUNS, // Indicates a STUN server used with a TLS session. 94 STUNS, // Indicates a STUN server used with a TLS session.
94 TURN, // Indicates a TURN server 95 TURN, // Indicates a TURN server
95 TURNS, // Indicates a TURN server used with a TLS session. 96 TURNS, // Indicates a TURN server used with a TLS session.
96 INVALID, // Unknown. 97 INVALID, // Unknown.
97 }; 98 };
98 static_assert(INVALID == ARRAY_SIZE(kValidIceServiceTypes), 99 static_assert(INVALID == arraysize(kValidIceServiceTypes),
99 "kValidIceServiceTypes must have as many strings as ServiceType " 100 "kValidIceServiceTypes must have as many strings as ServiceType "
100 "has values."); 101 "has values.");
101 102
102 enum { 103 enum {
103 MSG_SET_SESSIONDESCRIPTION_SUCCESS = 0, 104 MSG_SET_SESSIONDESCRIPTION_SUCCESS = 0,
104 MSG_SET_SESSIONDESCRIPTION_FAILED, 105 MSG_SET_SESSIONDESCRIPTION_FAILED,
105 MSG_CREATE_SESSIONDESCRIPTION_FAILED, 106 MSG_CREATE_SESSIONDESCRIPTION_FAILED,
106 MSG_GETSTATS, 107 MSG_GETSTATS,
107 }; 108 };
108 109
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 const std::string::size_type colonpos = in_str.find(':'); 150 const std::string::size_type colonpos = in_str.find(':');
150 if (colonpos == std::string::npos) { 151 if (colonpos == std::string::npos) {
151 LOG(LS_WARNING) << "Missing ':' in ICE URI: " << in_str; 152 LOG(LS_WARNING) << "Missing ':' in ICE URI: " << in_str;
152 return false; 153 return false;
153 } 154 }
154 if ((colonpos + 1) == in_str.length()) { 155 if ((colonpos + 1) == in_str.length()) {
155 LOG(LS_WARNING) << "Empty hostname in ICE URI: " << in_str; 156 LOG(LS_WARNING) << "Empty hostname in ICE URI: " << in_str;
156 return false; 157 return false;
157 } 158 }
158 *service_type = INVALID; 159 *service_type = INVALID;
159 for (size_t i = 0; i < ARRAY_SIZE(kValidIceServiceTypes); ++i) { 160 for (size_t i = 0; i < arraysize(kValidIceServiceTypes); ++i) {
160 if (in_str.compare(0, colonpos, kValidIceServiceTypes[i]) == 0) { 161 if (in_str.compare(0, colonpos, kValidIceServiceTypes[i]) == 0) {
161 *service_type = static_cast<ServiceType>(i); 162 *service_type = static_cast<ServiceType>(i);
162 break; 163 break;
163 } 164 }
164 } 165 }
165 if (*service_type == INVALID) { 166 if (*service_type == INVALID) {
166 return false; 167 return false;
167 } 168 }
168 *hostname = in_str.substr(colonpos + 1, std::string::npos); 169 *hostname = in_str.substr(colonpos + 1, std::string::npos);
169 return true; 170 return true;
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const { 1967 DataChannel* PeerConnection::FindDataChannelBySid(int sid) const {
1967 for (const auto& channel : sctp_data_channels_) { 1968 for (const auto& channel : sctp_data_channels_) {
1968 if (channel->id() == sid) { 1969 if (channel->id() == sid) {
1969 return channel; 1970 return channel;
1970 } 1971 }
1971 } 1972 }
1972 return nullptr; 1973 return nullptr;
1973 } 1974 }
1974 1975
1975 } // namespace webrtc 1976 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/jsepsessiondescription.cc ('k') | talk/app/webrtc/videosource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698