[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:24:52 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit e361889c4ddefdbac21a0d54826e7ea7b6450b1e
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Feb 18 19:18:29 2003 +0000

            Reviewed by Trey and Ken.
    
            - fixed 3142355 -- nil-deref in CFTimeZoneCopyAbbreviation
    
            Although I can't reproduce this bug, it seems that it's caused by CFTimeZoneCopyDefault returning NULL.
            I'm almost certain that the UTC time zone will be created successfully in this case, so I'll just use that.
    
            * kjs/date_object.cpp:
            (UTCTimeZone): Added. Gets the UTC time zone (once in a global).
            (CopyLocalTimeZone): Added. Gets the local time zone, but falls back to UTC.
            (gmtimeUsingCF): Use UTCTimeZone.
            (localtimeUsingCF): Use CopyLocalTimeZone.
            (mktimeUsingCF): Use CopyLocalTimeZone.
            (timegmUsingCF): Use UTCTimeZone.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3660 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 91c265c..65313b4 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,20 @@
+2003-02-18  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey and Ken.
+
+        - fixed 3142355 -- nil-deref in CFTimeZoneCopyAbbreviation
+
+        Although I can't reproduce this bug, it seems that it's caused by CFTimeZoneCopyDefault returning NULL.
+        I'm almost certain that the UTC time zone will be created successfully in this case, so I'll just use that.
+
+        * kjs/date_object.cpp:
+        (UTCTimeZone): Added. Gets the UTC time zone (once in a global).
+        (CopyLocalTimeZone): Added. Gets the local time zone, but falls back to UTC.
+        (gmtimeUsingCF): Use UTCTimeZone.
+        (localtimeUsingCF): Use CopyLocalTimeZone.
+        (mktimeUsingCF): Use CopyLocalTimeZone.
+        (timegmUsingCF): Use UTCTimeZone.
+
 2003-02-12  Darin Adler  <darin at apple.com>
 
         Reviewed by Dave.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 91c265c..65313b4 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,20 @@
+2003-02-18  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey and Ken.
+
+        - fixed 3142355 -- nil-deref in CFTimeZoneCopyAbbreviation
+
+        Although I can't reproduce this bug, it seems that it's caused by CFTimeZoneCopyDefault returning NULL.
+        I'm almost certain that the UTC time zone will be created successfully in this case, so I'll just use that.
+
+        * kjs/date_object.cpp:
+        (UTCTimeZone): Added. Gets the UTC time zone (once in a global).
+        (CopyLocalTimeZone): Added. Gets the local time zone, but falls back to UTC.
+        (gmtimeUsingCF): Use UTCTimeZone.
+        (localtimeUsingCF): Use CopyLocalTimeZone.
+        (mktimeUsingCF): Use CopyLocalTimeZone.
+        (timegmUsingCF): Use UTCTimeZone.
+
 2003-02-12  Darin Adler  <darin at apple.com>
 
         Reviewed by Dave.
diff --git a/JavaScriptCore/kjs/date_object.cpp b/JavaScriptCore/kjs/date_object.cpp
index b65a849..280b2b8 100644
--- a/JavaScriptCore/kjs/date_object.cpp
+++ b/JavaScriptCore/kjs/date_object.cpp
@@ -109,15 +109,31 @@ static struct tm *tmUsingCF(time_t clock, CFTimeZoneRef timeZone)
     return &result;
 }
 
+static CFTimeZoneRef UTCTimeZone()
+{
+    static CFTimeZoneRef zone = CFTimeZoneCreateWithName(NULL, CFSTR("UTC"), TRUE);
+    return zone;
+}
+
+static CFTimeZoneRef CopyLocalTimeZone()
+{
+    CFTimeZoneRef zone = CFTimeZoneCopyDefault();
+    if (zone) {
+        return zone;
+    }
+    zone = UTCTimeZone();
+    CFRetain(zone);
+    return zone;
+}
+
 static struct tm *gmtimeUsingCF(const time_t *clock)
 {
-    static CFTimeZoneRef timeZoneUTC = CFTimeZoneCreateWithName(NULL, CFSTR("UTC"), TRUE);
-    return tmUsingCF(*clock, timeZoneUTC);
+    return tmUsingCF(*clock, UTCTimeZone());
 }
 
 static struct tm *localtimeUsingCF(const time_t *clock)
 {
-    CFTimeZoneRef timeZone = CFTimeZoneCopyDefault();
+    CFTimeZoneRef timeZone = CopyLocalTimeZone();
     struct tm *result = tmUsingCF(*clock, timeZone);
     CFRelease(timeZone);
     return result;
@@ -146,7 +162,7 @@ static time_t timetUsingCF(struct tm *tm, CFTimeZoneRef timeZone)
 
 static time_t mktimeUsingCF(struct tm *tm)
 {
-    CFTimeZoneRef timeZone = CFTimeZoneCopyDefault();
+    CFTimeZoneRef timeZone = CopyLocalTimeZone();
     time_t result = timetUsingCF(tm, timeZone);
     CFRelease(timeZone);
     return result;
@@ -154,8 +170,7 @@ static time_t mktimeUsingCF(struct tm *tm)
 
 static time_t timegmUsingCF(struct tm *tm)
 {
-    static CFTimeZoneRef timeZoneUTC = CFTimeZoneCreateWithName(NULL, CFSTR("UTC"), TRUE);
-    return timetUsingCF(tm, timeZoneUTC);
+    return timetUsingCF(tm, UTCTimeZone());
 }
 
 static time_t timeUsingCF(time_t *clock)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list