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

Side by Side Diff: webrtc/rtc_base/flags.cc

Issue 3004363002: Use flag name without 'no' prefix only if it exists (Closed)
Patch Set: Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 * Copyright 2006 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2006 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 bool* is_bool) { 142 bool* is_bool) {
143 *name = nullptr; 143 *name = nullptr;
144 *value = nullptr; 144 *value = nullptr;
145 *is_bool = false; 145 *is_bool = false;
146 146
147 if (*arg == '-') { 147 if (*arg == '-') {
148 // find the begin of the flag name 148 // find the begin of the flag name
149 arg++; // remove 1st '-' 149 arg++; // remove 1st '-'
150 if (*arg == '-') 150 if (*arg == '-')
151 arg++; // remove 2nd '-' 151 arg++; // remove 2nd '-'
152 if (arg[0] == 'n' && arg[1] == 'o') { 152 if (arg[0] == 'n' && arg[1] == 'o' && Lookup(arg + 2)) {
153 arg += 2; // remove "no" 153 arg += 2; // remove "no"
154 *is_bool = true; 154 *is_bool = true;
155 } 155 }
kwiberg-webrtc 2017/09/04 23:30:39 Wait... what? Do we just *ignore* the "no" prefix?
oprypin_webrtc 2017/09/05 06:54:16 Yeah that also threw me off. This variable is more
156 *name = arg; 156 *name = arg;
157 157
158 // find the end of the flag name 158 // find the end of the flag name
159 while (*arg != '\0' && *arg != '=') 159 while (*arg != '\0' && *arg != '=')
160 arg++; 160 arg++;
161 161
162 // get the value if any 162 // get the value if any
163 if (*arg == '=') { 163 if (*arg == '=') {
164 // make a copy so we can NUL-terminate flag name 164 // make a copy so we can NUL-terminate flag name
165 int n = static_cast<int>(arg - *name); 165 int n = static_cast<int>(arg - *name);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // need to free each string in the array, and then the array. 290 // need to free each string in the array, and then the array.
291 for(int i = 0; i < argc_; i++) { 291 for(int i = 0; i < argc_; i++) {
292 delete[] argv_[i]; 292 delete[] argv_[i];
293 } 293 }
294 294
295 delete[] argv_; 295 delete[] argv_;
296 } 296 }
297 #endif // WEBRTC_WIN 297 #endif // WEBRTC_WIN
298 298
299 } // namespace rtc 299 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698