[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c
dbates at webkit.org
dbates at webkit.org
Mon Dec 27 16:27:49 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 30e21e0832a76706417a44616a49275cacd6f986
Author: dbates at webkit.org <dbates at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 21 21:22:14 2010 +0000
2010-12-21 Daniel Bates <dbates at rim.com>
Reviewed by Eric Seidel and Darin Adler.
Deallocate GregorianDateTime.timeZone (if allocated) when copying so that we don't leak memory.
https://bugs.webkit.org/show_bug.cgi?id=51367
Inspired by a patch by George Staikos.
* wtf/DateMath.cpp:
(JSC::msToGregorianDateTime): Modified to set timeZone to nullptr since timeZone is now
of type OwnPtrArray<char>.
* wtf/DateMath.h: Change timeZone to type OwnArrayPtr<char>; Removed destructor since it is no longer needed.
(JSC::GregorianDateTime::GregorianDateTime): Modified to use OwnPtrArray semantics for timeZone.
(JSC::GregorianDateTime::operator tm): Ditto.
(JSC::GregorianDateTime::copyFrom): Ditto.
2010-12-21 Daniel Bates <dbates at rim.com>
Reviewed by Eric Seidel and Darin Adler.
Deallocate GregorianDateTime.timeZone (if allocated) when copying so that we don't leak memory.
https://bugs.webkit.org/show_bug.cgi?id=51367
Add forwarding header for PassOwnArrayPtr.h.
* ForwardingHeaders/wtf/PassOwnArrayPtr.h: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index d80093e..a7ccfe5 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-21 Daniel Bates <dbates at rim.com>
+
+ Reviewed by Eric Seidel and Darin Adler.
+
+ Deallocate GregorianDateTime.timeZone (if allocated) when copying so that we don't leak memory.
+ https://bugs.webkit.org/show_bug.cgi?id=51367
+
+ Inspired by a patch by George Staikos.
+
+ * wtf/DateMath.cpp:
+ (JSC::msToGregorianDateTime): Modified to set timeZone to nullptr since timeZone is now
+ of type OwnPtrArray<char>.
+ * wtf/DateMath.h: Change timeZone to type OwnArrayPtr<char>; Removed destructor since it is no longer needed.
+ (JSC::GregorianDateTime::GregorianDateTime): Modified to use OwnPtrArray semantics for timeZone.
+ (JSC::GregorianDateTime::operator tm): Ditto.
+ (JSC::GregorianDateTime::copyFrom): Ditto.
+
2010-12-21 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r74402.
diff --git a/JavaScriptCore/wtf/DateMath.cpp b/JavaScriptCore/wtf/DateMath.cpp
index 675f093..8873352 100644
--- a/JavaScriptCore/wtf/DateMath.cpp
+++ b/JavaScriptCore/wtf/DateMath.cpp
@@ -1129,7 +1129,7 @@ void msToGregorianDateTime(ExecState* exec, double ms, bool outputIsUTC, Gregori
tm.year = year - 1900;
tm.isDST = dstOff != 0.0;
tm.utcOffset = static_cast<long>((dstOff + utcOff) / WTF::msPerSecond);
- tm.timeZone = NULL;
+ tm.timeZone = nullptr;
}
double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateString)
diff --git a/JavaScriptCore/wtf/DateMath.h b/JavaScriptCore/wtf/DateMath.h
index cb84708..8d0d932 100644
--- a/JavaScriptCore/wtf/DateMath.h
+++ b/JavaScriptCore/wtf/DateMath.h
@@ -2,6 +2,7 @@
* Copyright (C) 1999-2000 Harri Porten (porten at kde.org)
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Research In Motion Limited. All rights reserved.
*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -47,6 +48,8 @@
#include <time.h>
#include <wtf/CurrentTime.h>
#include <wtf/Noncopyable.h>
+#include <wtf/OwnArrayPtr.h>
+#include <wtf/PassOwnArrayPtr.h>
#include <wtf/UnusedParam.h>
namespace WTF {
@@ -90,6 +93,7 @@ double calculateDSTOffset(double ms, double utcOffset);
} // namespace WTF
+using WTF::adoptArrayPtr;
using WTF::dateToDaysFrom1970;
using WTF::dayInMonthFromDayInYear;
using WTF::dayInYear;
@@ -132,11 +136,6 @@ struct GregorianDateTime : Noncopyable {
{
}
- ~GregorianDateTime()
- {
- delete [] timeZone;
- }
-
GregorianDateTime(ExecState* exec, const tm& inTm)
: second(inTm.tm_sec)
, minute(inTm.tm_min)
@@ -157,10 +156,10 @@ struct GregorianDateTime : Noncopyable {
#if HAVE(TM_ZONE)
int inZoneSize = strlen(inTm.tm_zone) + 1;
- timeZone = new char[inZoneSize];
- strncpy(timeZone, inTm.tm_zone, inZoneSize);
+ timeZone = adoptArrayPtr(new char[inZoneSize]);
+ strncpy(timeZone.get(), inTm.tm_zone, inZoneSize);
#else
- timeZone = 0;
+ timeZone = nullptr;
#endif
}
@@ -183,7 +182,7 @@ struct GregorianDateTime : Noncopyable {
ret.tm_gmtoff = static_cast<long>(utcOffset);
#endif
#if HAVE(TM_ZONE)
- ret.tm_zone = timeZone;
+ ret.tm_zone = timeZone.get();
#endif
return ret;
@@ -202,11 +201,11 @@ struct GregorianDateTime : Noncopyable {
isDST = rhs.isDST;
utcOffset = rhs.utcOffset;
if (rhs.timeZone) {
- int inZoneSize = strlen(rhs.timeZone) + 1;
- timeZone = new char[inZoneSize];
- strncpy(timeZone, rhs.timeZone, inZoneSize);
+ int inZoneSize = strlen(rhs.timeZone.get()) + 1;
+ timeZone = adoptArrayPtr(new char[inZoneSize]);
+ strncpy(timeZone.get(), rhs.timeZone.get(), inZoneSize);
} else
- timeZone = 0;
+ timeZone = nullptr;
}
int second;
@@ -219,7 +218,7 @@ struct GregorianDateTime : Noncopyable {
int year;
int isDST;
int utcOffset;
- char* timeZone;
+ OwnArrayPtr<char> timeZone;
};
static inline int gmtoffset(const GregorianDateTime& t)
diff --git a/JavaScriptGlue/ChangeLog b/JavaScriptGlue/ChangeLog
index 8485701..e16f588 100644
--- a/JavaScriptGlue/ChangeLog
+++ b/JavaScriptGlue/ChangeLog
@@ -1,3 +1,14 @@
+2010-12-21 Daniel Bates <dbates at rim.com>
+
+ Reviewed by Eric Seidel and Darin Adler.
+
+ Deallocate GregorianDateTime.timeZone (if allocated) when copying so that we don't leak memory.
+ https://bugs.webkit.org/show_bug.cgi?id=51367
+
+ Add forwarding header for PassOwnArrayPtr.h.
+
+ * ForwardingHeaders/wtf/PassOwnArrayPtr.h: Added.
+
2010-12-18 Gavin Barraclough <barraclough at apple.com>
Reviewed by Oliver Hunt.
diff --git a/JavaScriptGlue/ForwardingHeaders/wtf/PassOwnArrayPtr.h b/JavaScriptGlue/ForwardingHeaders/wtf/PassOwnArrayPtr.h
new file mode 100644
index 0000000..97f4a9d
--- /dev/null
+++ b/JavaScriptGlue/ForwardingHeaders/wtf/PassOwnArrayPtr.h
@@ -0,0 +1 @@
+#include <JavaScriptCore/PassOwnArrayPtr.h>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list