- Revision
- 159171
- Author
- aes...@apple.com
- Date
- 2013-11-12 18:04:18 -0800 (Tue, 12 Nov 2013)
Log Message
[Mac] Fix some deprecation warnings
https://bugs.webkit.org/show_bug.cgi?id=124252
Reviewed by Mark Rowe.
Source/WebCore:
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create): Use CFPropertyListCreateWithData()
instead of CFPropertyListCreateFromXMLData().
(WebCore::LegacyWebArchive::rawDataRepresentation): Use
CFPropertyListWrite() instead of CFPropertyListWriteToStream().
* platform/mac/HTMLConverter.mm:
(_dateForString): Rewrite this method in terms of NSDateComponents and
NSCalendar instead of using CFGregorianDate.
Source/WebKit/mac:
* Plugins/WebBasePluginPackage.mm:
(-[WebBasePluginPackage pListForPath:createFile:]): Use +[NSPropertyListSerialization propertyListWithData:options:format:error:] instead of +[NSPropertyListSerialization propertyListFromData:mutabilityOption:format:errorDescription:].
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (159170 => 159171)
--- trunk/Source/WebCore/ChangeLog 2013-11-13 01:59:37 UTC (rev 159170)
+++ trunk/Source/WebCore/ChangeLog 2013-11-13 02:04:18 UTC (rev 159171)
@@ -1,3 +1,19 @@
+2013-11-12 Andy Estes <aes...@apple.com>
+
+ [Mac] Fix some deprecation warnings
+ https://bugs.webkit.org/show_bug.cgi?id=124252
+
+ Reviewed by Mark Rowe.
+
+ * loader/archive/cf/LegacyWebArchive.cpp:
+ (WebCore::LegacyWebArchive::create): Use CFPropertyListCreateWithData()
+ instead of CFPropertyListCreateFromXMLData().
+ (WebCore::LegacyWebArchive::rawDataRepresentation): Use
+ CFPropertyListWrite() instead of CFPropertyListWriteToStream().
+ * platform/mac/HTMLConverter.mm:
+ (_dateForString): Rewrite this method in terms of NSDateComponents and
+ NSCalendar instead of using CFGregorianDate.
+
2013-11-12 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r159160, r159161, and r159164.
Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (159170 => 159171)
--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp 2013-11-13 01:59:37 UTC (rev 159170)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp 2013-11-13 02:04:18 UTC (rev 159171)
@@ -273,16 +273,17 @@
if (!cfData)
return 0;
- CFStringRef errorString = 0;
+ CFErrorRef error = 0;
- RetainPtr<CFDictionaryRef> plist = adoptCF(static_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(0, cfData.get(), kCFPropertyListImmutable, &errorString)));
+ RetainPtr<CFDictionaryRef> plist = adoptCF(static_cast<CFDictionaryRef>(CFPropertyListCreateWithData(0, cfData.get(), kCFPropertyListImmutable, 0, &error)));
if (!plist) {
#ifndef NDEBUG
- const char* cError = errorString ? CFStringGetCStringPtr(errorString, kCFStringEncodingUTF8) : "unknown error";
+ RetainPtr<CFStringRef> errorString = error ? adoptCF(CFErrorCopyDescription(error)) : 0;
+ const char* cError = errorString ? CFStringGetCStringPtr(errorString.get(), kCFStringEncodingUTF8) : "unknown error";
LOG(Archives, "LegacyWebArchive - Error parsing PropertyList from archive data - %s", cError);
#endif
- if (errorString)
- CFRelease(errorString);
+ if (error)
+ CFRelease(error);
return 0;
}
@@ -389,7 +390,7 @@
RetainPtr<CFWriteStreamRef> stream = adoptCF(CFWriteStreamCreateWithAllocatedBuffers(0, 0));
CFWriteStreamOpen(stream.get());
- CFPropertyListWriteToStream(propertyList.get(), stream.get(), kCFPropertyListBinaryFormat_v1_0, 0);
+ CFPropertyListWrite(propertyList.get(), stream.get(), kCFPropertyListBinaryFormat_v1_0, 0, 0);
RetainPtr<CFDataRef> plistData = adoptCF(static_cast<CFDataRef>(CFWriteStreamCopyProperty(stream.get(), kCFStreamPropertyDataWritten)));
ASSERT(plistData);
Modified: trunk/Source/WebCore/platform/mac/HTMLConverter.mm (159170 => 159171)
--- trunk/Source/WebCore/platform/mac/HTMLConverter.mm 2013-11-13 01:59:37 UTC (rev 159170)
+++ trunk/Source/WebCore/platform/mac/HTMLConverter.mm 2013-11-13 02:04:18 UTC (rev 159171)
@@ -1529,29 +1529,47 @@
static inline NSDate *_dateForString(NSString *string)
{
- CFGregorianDate date;
const char *p = [string UTF8String];
- int8_t secval = 0;
- BOOL wellFormed = YES;
+ RetainPtr<NSDateComponents> dateComponents = adoptNS([[NSDateComponents alloc] init]);
- date.year = 0;
+ // Set the time zone to GMT
+ [dateComponents setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+
+ NSInteger year = 0;
while (*p && isASCIIDigit(*p))
- date.year = 10 * date.year + *p++ - '0';
+ year = 10 * year + *p++ - '0';
if (*p++ != '-')
- wellFormed = NO;
- if (!wellFormed || !read2DigitNumber(&p, &date.month) || *p++ != '-')
- wellFormed = NO;
- if (!wellFormed || !read2DigitNumber(&p, &date.day) || *p++ != 'T')
- wellFormed = NO;
- if (!wellFormed || !read2DigitNumber(&p, &date.hour) || *p++ != ':')
- wellFormed = NO;
- if (!wellFormed || !read2DigitNumber(&p, &date.minute) || *p++ != ':')
- wellFormed = NO;
- if (!wellFormed || !read2DigitNumber(&p, &secval) || *p++ != 'Z')
- wellFormed = NO;
- if (wellFormed)
- date.second = secval;
- return wellFormed ? [(NSDate *)CFDateCreate(NULL, CFGregorianDateGetAbsoluteTime(date, NULL)) autorelease] : nil;
+ return nil;
+ [dateComponents setYear:year];
+
+ int8_t component;
+ if (!read2DigitNumber(&p, &component) || *p++ != '-')
+ return nil;
+ [dateComponents setMonth:component];
+
+ if (!read2DigitNumber(&p, &component) || *p++ != 'T')
+ return nil;
+ [dateComponents setDay:component];
+
+ if (!read2DigitNumber(&p, &component) || *p++ != ':')
+ return nil;
+ [dateComponents setHour:component];
+
+ if (!read2DigitNumber(&p, &component) || *p++ != ':')
+ return nil;
+ [dateComponents setMinute:component];
+
+ if (!read2DigitNumber(&p, &component) || *p++ != 'Z')
+ return nil;
+ [dateComponents setSecond:component];
+
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+ NSString *calendarIdentifier = NSCalendarIdentifierGregorian;
+#else
+ NSString *calendarIdentifier = NSGregorianCalendar;
+#endif
+
+ return [[NSCalendar calendarWithIdentifier:calendarIdentifier] dateFromComponents:dateComponents.get()];
}
static NSInteger _colCompare(id block1, id block2, void *)
Modified: trunk/Source/WebKit/mac/ChangeLog (159170 => 159171)
--- trunk/Source/WebKit/mac/ChangeLog 2013-11-13 01:59:37 UTC (rev 159170)
+++ trunk/Source/WebKit/mac/ChangeLog 2013-11-13 02:04:18 UTC (rev 159171)
@@ -1,3 +1,13 @@
+2013-11-12 Andy Estes <aes...@apple.com>
+
+ [Mac] Fix some deprecation warnings
+ https://bugs.webkit.org/show_bug.cgi?id=124252
+
+ Reviewed by Mark Rowe.
+
+ * Plugins/WebBasePluginPackage.mm:
+ (-[WebBasePluginPackage pListForPath:createFile:]): Use +[NSPropertyListSerialization propertyListWithData:options:format:error:] instead of +[NSPropertyListSerialization propertyListFromData:mutabilityOption:format:errorDescription:].
+
2013-11-12 Anders Carlsson <ander...@apple.com>
Remove -[WebHistoryItem _lastVisitedDate]
Modified: trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm (159170 => 159171)
--- trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm 2013-11-13 01:59:37 UTC (rev 159170)
+++ trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm 2013-11-13 02:04:18 UTC (rev 159171)
@@ -162,12 +162,8 @@
NSDictionary *pList = nil;
NSData *data = "" dataWithContentsOfFile:pListPath];
- if (data) {
- pList = [NSPropertyListSerialization propertyListFromData:data
- mutabilityOption:NSPropertyListImmutable
- format:nil
- errorDescription:nil];
- }
+ if (data)
+ pList = [NSPropertyListSerialization propertyListWithData:data options:kCFPropertyListImmutable format:nil error:nil];
return pList;
}