Changeset 52824 in webkit for trunk/JavaScriptCore/jsc.cpp
- Timestamp:
- Jan 5, 2010, 2:30:16 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jsc.cpp
r52791 r52824 57 57 #if COMPILER(MSVC) && !OS(WINCE) 58 58 #include <crtdbg.h> 59 #include <mmsystem.h> 59 60 #include <windows.h> 60 #include <mmsystem.h>61 61 #endif 62 62 … … 89 89 struct Script { 90 90 bool isFile; 91 char *argument;92 91 char* argument; 92 93 93 Script(bool isFile, char *argument) 94 94 : isFile(isFile) … … 175 175 { 176 176 for (unsigned i = 0; i < args.size(); ++i) { 177 if (i != 0)177 if (i) 178 178 putchar(' '); 179 179 180 180 printf("%s", args.at(i).toString(exec).UTF8String().c_str()); 181 181 } 182 182 183 183 putchar('\n'); 184 184 fflush(stdout); … … 295 295 cleanupGlobalData(&exec->globalData()); 296 296 exit(EXIT_SUCCESS); 297 298 #if COMPILER(MSVC) && OS(WINCE) 299 // Without this, Visual Studio will complain that this method does not return a value. 300 return jsUndefined(); 301 #endif 297 302 } 298 303 … … 464 469 for (; i < argc; ++i) { 465 470 const char* arg = argv[i]; 466 if ( strcmp(arg, "-f") == 0) {471 if (!strcmp(arg, "-f")) { 467 472 if (++i == argc) 468 473 printUsageStatement(globalData); … … 470 475 continue; 471 476 } 472 if ( strcmp(arg, "-e") == 0) {477 if (!strcmp(arg, "-e")) { 473 478 if (++i == argc) 474 479 printUsageStatement(globalData); … … 476 481 continue; 477 482 } 478 if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) { 479 printUsageStatement(globalData, true); 480 } 481 if (strcmp(arg, "-i") == 0) { 483 if (!strcmp(arg, "-i")) { 482 484 options.interactive = true; 483 485 continue; 484 486 } 485 if ( strcmp(arg, "-d") == 0) {487 if (!strcmp(arg, "-d")) { 486 488 options.dump = true; 487 489 continue; 488 490 } 489 if ( strcmp(arg, "-s") == 0) {491 if (!strcmp(arg, "-s")) { 490 492 #if HAVE(SIGNAL_H) 491 493 signal(SIGILL, _exit); … … 496 498 continue; 497 499 } 498 if ( strcmp(arg, "--") == 0) {500 if (!strcmp(arg, "--")) { 499 501 ++i; 500 502 break; 501 503 } 504 if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) 505 printUsageStatement(globalData, true); 502 506 options.scripts.append(Script(true, argv[i])); 503 507 } 504 508 505 509 if (options.scripts.isEmpty()) 506 510 options.interactive = true; 507 511 508 512 for (; i < argc; ++i) 509 513 options.arguments.append(argv[i]); … … 533 537 } 534 538 535 size_t buffer _size = 0;536 size_t buffer _capacity = 1024;537 538 buffer.resize(buffer _capacity);539 size_t bufferSize = 0; 540 size_t bufferCapacity = 1024; 541 542 buffer.resize(bufferCapacity); 539 543 540 544 while (!feof(f) && !ferror(f)) { 541 buffer _size += fread(buffer.data() + buffer_size, 1, buffer_capacity - buffer_size, f);542 if (buffer _size == buffer_capacity) { // guarantees space for trailing '\0'543 buffer _capacity *= 2;544 buffer.resize(buffer _capacity);545 bufferSize += fread(buffer.data() + bufferSize, 1, bufferCapacity - bufferSize, f); 546 if (bufferSize == bufferCapacity) { // guarantees space for trailing '\0' 547 bufferCapacity *= 2; 548 buffer.resize(bufferCapacity); 545 549 } 546 550 } 547 551 fclose(f); 548 buffer[buffer _size] = '\0';552 buffer[bufferSize] = '\0'; 549 553 550 554 return true;
Note:
See TracChangeset
for help on using the changeset viewer.