[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 06:56:05 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 47d7d0c4d2c63223677d23e8f70003286ad01a8d
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 30 20:15:02 2002 +0000
- fixed 3073230 -- Alex is doing file I/O when executing JavaScript by asking for localtime
I fixed this by using Core Foundation time functions instead.
* kjs/date_object.cpp:
(tmUsingCF): Function that uses Core Foundation to get the time and then puts it into
a tm struct.
(gmtimeUsingCF): Function used instead of gmtime (used a macro to make the substitution).
(localtimeUsingCF): Function used instead of localtime (used a macro to make the substitution).
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 1b4250e..1a323cc 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,15 @@
+2002-10-30 Darin Adler <darin at apple.com>
+
+ - fixed 3073230 -- Alex is doing file I/O when executing JavaScript by asking for localtime
+
+ I fixed this by using Core Foundation time functions instead.
+
+ * kjs/date_object.cpp:
+ (tmUsingCF): Function that uses Core Foundation to get the time and then puts it into
+ a tm struct.
+ (gmtimeUsingCF): Function used instead of gmtime (used a macro to make the substitution).
+ (localtimeUsingCF): Function used instead of localtime (used a macro to make the substitution).
+
2002-10-26 Darin Adler <darin at apple.com>
- changed to use #if APPLE_CHANGES and #if !APPLE_CHANGES consistently
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 1b4250e..1a323cc 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,15 @@
+2002-10-30 Darin Adler <darin at apple.com>
+
+ - fixed 3073230 -- Alex is doing file I/O when executing JavaScript by asking for localtime
+
+ I fixed this by using Core Foundation time functions instead.
+
+ * kjs/date_object.cpp:
+ (tmUsingCF): Function that uses Core Foundation to get the time and then puts it into
+ a tm struct.
+ (gmtimeUsingCF): Function used instead of gmtime (used a macro to make the substitution).
+ (localtimeUsingCF): Function used instead of localtime (used a macro to make the substitution).
+
2002-10-26 Darin Adler <darin at apple.com>
- changed to use #if APPLE_CHANGES and #if !APPLE_CHANGES consistently
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 1b4250e..1a323cc 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,15 @@
+2002-10-30 Darin Adler <darin at apple.com>
+
+ - fixed 3073230 -- Alex is doing file I/O when executing JavaScript by asking for localtime
+
+ I fixed this by using Core Foundation time functions instead.
+
+ * kjs/date_object.cpp:
+ (tmUsingCF): Function that uses Core Foundation to get the time and then puts it into
+ a tm struct.
+ (gmtimeUsingCF): Function used instead of gmtime (used a macro to make the substitution).
+ (localtimeUsingCF): Function used instead of localtime (used a macro to make the substitution).
+
2002-10-26 Darin Adler <darin at apple.com>
- changed to use #if APPLE_CHANGES and #if !APPLE_CHANGES consistently
diff --git a/JavaScriptCore/kjs/date_object.cpp b/JavaScriptCore/kjs/date_object.cpp
index 398b5f6..b6e4b5d 100644
--- a/JavaScriptCore/kjs/date_object.cpp
+++ b/JavaScriptCore/kjs/date_object.cpp
@@ -57,6 +57,62 @@
#include "date_object.lut.h"
+#if APPLE_CHANGES
+
+// Since gmtime and localtime hit the disk, we substitute our own implementation
+// that uses Core Foundation.
+
+#include <CoreFoundation/CoreFoundation.h>
+
+#define gmtime(x) gmtimeUsingCF(x)
+#define localtime(x) localtimeUsingCF(x)
+
+struct tm *tmUsingCF(time_t tv, CFTimeZoneRef timeZone)
+{
+ static struct tm result;
+ static char timeZoneCString[128];
+
+ CFAbsoluteTime absoluteTime = tv - kCFAbsoluteTimeIntervalSince1970;
+
+ CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(absoluteTime, timeZone);
+
+ CFStringRef abbreviation = CFTimeZoneCopyAbbreviation(timeZone, absoluteTime);
+
+ CFStringGetCString(abbreviation, timeZoneCString, sizeof(timeZoneCString), kCFStringEncodingASCII);
+
+ result.tm_sec = (int)date.second;
+ result.tm_min = date.minute;
+ result.tm_hour = date.hour;
+ result.tm_mday = date.day;
+ result.tm_mon = date.month - 1;
+ result.tm_year = date.year - 1900;
+ result.tm_wday = CFAbsoluteTimeGetDayOfWeek(absoluteTime, timeZone) % 7;
+ result.tm_yday = CFAbsoluteTimeGetDayOfYear(absoluteTime, timeZone) - 1;
+ result.tm_isdst = CFTimeZoneIsDaylightSavingTime(timeZone, absoluteTime);
+ result.tm_gmtoff = (int)CFTimeZoneGetSecondsFromGMT(timeZone, absoluteTime);
+ result.tm_zone = timeZoneCString;
+
+ CFRelease(abbreviation);
+
+ return &result;
+}
+
+struct tm *gmtimeUsingCF(const time_t *tv)
+{
+ static CFTimeZoneRef timeZoneUTC = CFTimeZoneCreateWithName(NULL, CFSTR("UTC"), TRUE);
+ return tmUsingCF(*tv, timeZoneUTC);
+}
+
+struct tm *localtimeUsingCF(const time_t *tv)
+{
+ CFTimeZoneRef timeZone = CFTimeZoneCopyDefault();
+ struct tm *result = tmUsingCF(*tv, timeZone);
+ CFRelease(timeZone);
+ return result;
+}
+
+#endif // APPLE_CHANGES
+
using namespace KJS;
// ------------------------------ DateInstanceImp ------------------------------
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list