Changeset 19945 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Mar 2, 2007, 11:55:21 AM (18 years ago)
Author:
aroben
Message:

Reviewed by Kevin M.

Try to fix the Qt build.

  • kjs/DateMath.cpp: (KJS::msToGregorianDateTime): Removed unnecessary "struct" keyword.
  • kjs/DateMath.h: Moved forward declarations to the top of the file before they are used.
  • kjs/date_object.cpp: (KJS::formatLocaleDate): Changed to take a const GregorianDateTime& since GregorianDateTime is Noncopyable.
Location:
trunk/JavaScriptCore/kjs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/DateMath.cpp

    r19943 r19945  
    402402}
    403403
    404 void msToGregorianDateTime(double ms, bool outputIsUTC, struct GregorianDateTime& tm)
     404void msToGregorianDateTime(double ms, bool outputIsUTC, GregorianDateTime& tm)
    405405{
    406406    // input is UTC
  • trunk/JavaScriptCore/kjs/DateMath.h

    r19943 r19945  
    4848namespace KJS {
    4949
     50struct GregorianDateTime;
     51
     52void msToGregorianDateTime(double, bool outputIsUTC, GregorianDateTime&);
     53double gregorianDateTimeToMS(const GregorianDateTime&, double, bool inputIsUTC);
     54double getUTCOffset();
     55int equivalentYearForDST(int year);
     56
    5057const char * const weekdayName[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
    5158const char * const monthName[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
     
    6269// Intentionally overridding the default tm of the system
    6370// Not all OS' have the same members of their tm's
    64 struct GregorianDateTime : Noncopyable{
     71struct GregorianDateTime : Noncopyable {
    6572    GregorianDateTime()
    6673        : second(0)
     
    142149};
    143150
    144 void msToGregorianDateTime(double, bool outputIsUTC, struct GregorianDateTime&);
    145 double gregorianDateTimeToMS(const GregorianDateTime&, double, bool inputIsUTC);
    146 double getUTCOffset();
    147 int equivalentYearForDST(int year);
    148 
    149151}   //namespace KJS
    150152
  • trunk/JavaScriptCore/kjs/date_object.cpp

    r18658 r19945  
    159159enum LocaleDateTimeFormat { LocaleDateAndTime, LocaleDate, LocaleTime };
    160160 
    161 static JSCell* formatLocaleDate(GregorianDateTime gdt, const LocaleDateTimeFormat format)
     161static JSCell* formatLocaleDate(const GregorianDateTime& gdt, const LocaleDateTimeFormat format)
    162162{
    163163    static const char* formatStrings[] = {"%#c", "%#x", "%X"};
     
    165165    // Offset year if needed
    166166    struct tm localTM = gdt;
    167     gdt.year += 1900;
    168     bool yearNeedsOffset = gdt.year < 1900 || gdt.year > 2038;
     167    int year = gdt.year + 1900;
     168    bool yearNeedsOffset = year < 1900 || year > 2038;
    169169    if (yearNeedsOffset) {
    170         localTM.tm_year = equivalentYearForDST(gdt.year) - 1900;
     170        localTM.tm_year = equivalentYearForDST(year) - 1900;
    171171     }
    172172 
     
    186186        snprintf(yearString, yearLen, "%d", localTM.tm_year + 1900);
    187187        char* yearLocation = strstr(timebuffer, yearString);
    188         snprintf(yearString, yearLen, "%d", gdt.year);
     188        snprintf(yearString, yearLen, "%d", year);
    189189 
    190190        strncpy(yearLocation, yearString, yearLen - 1);
Note: See TracChangeset for help on using the changeset viewer.