Changeset 52824 in webkit


Ignore:
Timestamp:
Jan 5, 2010 2:30:16 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-25 Patrick Gansterer <paroga@paroga.com>

Reviewed by Eric Seidel.

Buildfix for WinCE + style fixes.
https://bugs.webkit.org/show_bug.cgi?id=32939

  • jsc.cpp: (functionPrint): (functionQuit): (parseArguments): (fillBufferWithContentsOfFile):
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r52822 r52824  
     12009-12-25 Patrick Gansterer <paroga@paroga.com>
     2 
     3        Reviewed by Eric Seidel.
     4
     5        Buildfix for WinCE + style fixes.
     6        https://bugs.webkit.org/show_bug.cgi?id=32939
     7
     8        * jsc.cpp:
     9        (functionPrint):
     10        (functionQuit):
     11        (parseArguments):
     12        (fillBufferWithContentsOfFile):
     13 
    1142010-01-05  Patrick Gansterer  <paroga@paroga.com>
    215
  • trunk/JavaScriptCore/jsc.cpp

    r52791 r52824  
    5757#if COMPILER(MSVC) && !OS(WINCE)
    5858#include <crtdbg.h>
     59#include <mmsystem.h>
    5960#include <windows.h>
    60 #include <mmsystem.h>
    6161#endif
    6262
     
    8989struct Script {
    9090    bool isFile;
    91     char *argument;
    92    
     91    char* argument;
     92
    9393    Script(bool isFile, char *argument)
    9494        : isFile(isFile)
     
    175175{
    176176    for (unsigned i = 0; i < args.size(); ++i) {
    177         if (i != 0)
     177        if (i)
    178178            putchar(' ');
    179        
     179
    180180        printf("%s", args.at(i).toString(exec).UTF8String().c_str());
    181181    }
    182    
     182
    183183    putchar('\n');
    184184    fflush(stdout);
     
    295295    cleanupGlobalData(&exec->globalData());
    296296    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
    297302}
    298303
     
    464469    for (; i < argc; ++i) {
    465470        const char* arg = argv[i];
    466         if (strcmp(arg, "-f") == 0) {
     471        if (!strcmp(arg, "-f")) {
    467472            if (++i == argc)
    468473                printUsageStatement(globalData);
     
    470475            continue;
    471476        }
    472         if (strcmp(arg, "-e") == 0) {
     477        if (!strcmp(arg, "-e")) {
    473478            if (++i == argc)
    474479                printUsageStatement(globalData);
     
    476481            continue;
    477482        }
    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")) {
    482484            options.interactive = true;
    483485            continue;
    484486        }
    485         if (strcmp(arg, "-d") == 0) {
     487        if (!strcmp(arg, "-d")) {
    486488            options.dump = true;
    487489            continue;
    488490        }
    489         if (strcmp(arg, "-s") == 0) {
     491        if (!strcmp(arg, "-s")) {
    490492#if HAVE(SIGNAL_H)
    491493            signal(SIGILL, _exit);
     
    496498            continue;
    497499        }
    498         if (strcmp(arg, "--") == 0) {
     500        if (!strcmp(arg, "--")) {
    499501            ++i;
    500502            break;
    501503        }
     504        if (!strcmp(arg, "-h") || !strcmp(arg, "--help"))
     505            printUsageStatement(globalData, true);
    502506        options.scripts.append(Script(true, argv[i]));
    503507    }
    504    
     508
    505509    if (options.scripts.isEmpty())
    506510        options.interactive = true;
    507    
     511
    508512    for (; i < argc; ++i)
    509513        options.arguments.append(argv[i]);
     
    533537    }
    534538
    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);
    539543
    540544    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);
    545549        }
    546550    }
    547551    fclose(f);
    548     buffer[buffer_size] = '\0';
     552    buffer[bufferSize] = '\0';
    549553
    550554    return true;
Note: See TracChangeset for help on using the changeset viewer.