| OLD | NEW |
| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 166 CHECK_LT(n, buffer_size); | 166 RTC_CHECK_LT(n, buffer_size); |
| 167 memcpy(buffer, *name, n * sizeof(char)); | 167 memcpy(buffer, *name, n * sizeof(char)); |
| 168 buffer[n] = '\0'; | 168 buffer[n] = '\0'; |
| 169 *name = buffer; | 169 *name = buffer; |
| 170 // get the value | 170 // get the value |
| 171 *value = arg + 1; | 171 *value = arg + 1; |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 250 } |
| 251 *argc = j; | 251 *argc = j; |
| 252 } | 252 } |
| 253 | 253 |
| 254 // parsed all flags successfully | 254 // parsed all flags successfully |
| 255 return 0; | 255 return 0; |
| 256 } | 256 } |
| 257 | 257 |
| 258 void FlagList::Register(Flag* flag) { | 258 void FlagList::Register(Flag* flag) { |
| 259 assert(flag != NULL && strlen(flag->name()) > 0); | 259 assert(flag != NULL && strlen(flag->name()) > 0); |
| 260 CHECK(!Lookup(flag->name())) << "flag " << flag->name() << " declared twice"; | 260 RTC_CHECK(!Lookup(flag->name())) << "flag " << flag->name() |
| 261 << " declared twice"; |
| 261 flag->next_ = list_; | 262 flag->next_ = list_; |
| 262 list_ = flag; | 263 list_ = flag; |
| 263 } | 264 } |
| 264 | 265 |
| 265 #if defined(WEBRTC_WIN) | 266 #if defined(WEBRTC_WIN) |
| 266 WindowsCommandLineArguments::WindowsCommandLineArguments() { | 267 WindowsCommandLineArguments::WindowsCommandLineArguments() { |
| 267 // start by getting the command line. | 268 // start by getting the command line. |
| 268 LPTSTR command_line = ::GetCommandLine(); | 269 LPTSTR command_line = ::GetCommandLine(); |
| 269 // now, convert it to a list of wide char strings. | 270 // now, convert it to a list of wide char strings. |
| 270 LPWSTR *wide_argv = ::CommandLineToArgvW(command_line, &argc_); | 271 LPWSTR *wide_argv = ::CommandLineToArgvW(command_line, &argc_); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 287 // need to free each string in the array, and then the array. | 288 // need to free each string in the array, and then the array. |
| 288 for(int i = 0; i < argc_; i++) { | 289 for(int i = 0; i < argc_; i++) { |
| 289 delete[] argv_[i]; | 290 delete[] argv_[i]; |
| 290 } | 291 } |
| 291 | 292 |
| 292 delete[] argv_; | 293 delete[] argv_; |
| 293 } | 294 } |
| 294 #endif // WEBRTC_WIN | 295 #endif // WEBRTC_WIN |
| 295 | 296 |
| 296 } // namespace rtc | 297 } // namespace rtc |
| OLD | NEW |