OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 296 } |
297 *name = arg; | 297 *name = arg; |
298 | 298 |
299 // find the end of the flag name | 299 // find the end of the flag name |
300 while (*arg != '\0' && *arg != '=') | 300 while (*arg != '\0' && *arg != '=') |
301 arg++; | 301 arg++; |
302 | 302 |
303 // get the value if any | 303 // get the value if any |
304 if (*arg == '=') { | 304 if (*arg == '=') { |
305 // make a copy so we can NUL-terminate flag name | 305 // make a copy so we can NUL-terminate flag name |
306 int n = arg - *name; | 306 size_t n = arg - *name; |
307 CHECK(n < buffer_size); // buffer is too small | 307 CHECK(n < static_cast<size_t>(buffer_size)); // buffer is too small |
308 memcpy(buffer, *name, n); | 308 memcpy(buffer, *name, n); |
309 buffer[n] = '\0'; | 309 buffer[n] = '\0'; |
310 *name = buffer; | 310 *name = buffer; |
311 // get the value | 311 // get the value |
312 *value = arg + 1; | 312 *value = arg + 1; |
313 } | 313 } |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 | 317 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 const char** JSArguments::argv() { return argv_; } | 546 const char** JSArguments::argv() { return argv_; } |
547 const char*& JSArguments::operator[](int idx) { return argv_[idx]; } | 547 const char*& JSArguments::operator[](int idx) { return argv_[idx]; } |
548 JSArguments& JSArguments::operator=(JSArguments args) { | 548 JSArguments& JSArguments::operator=(JSArguments args) { |
549 argc_ = args.argc_; | 549 argc_ = args.argc_; |
550 argv_ = args.argv_; | 550 argv_ = args.argv_; |
551 return *this; | 551 return *this; |
552 } | 552 } |
553 | 553 |
554 | 554 |
555 } } // namespace v8::internal | 555 } } // namespace v8::internal |
OLD | NEW |