Title: [149725] trunk/Tools
Revision
149725
Author
[email protected]
Date
2013-05-08 02:41:11 -0700 (Wed, 08 May 2013)

Log Message

Fix one more place that needed to use adoptCF/NS
https://bugs.webkit.org/show_bug.cgi?id=115778

Reviewed by Benjamin Poulain.

Not sure why I missed this code last time, but found a bit more code that needs
to switch to the newer style adoptCF/NS.

* WebKitTestRunner/cf/WebArchiveDumpSupport.cpp:
(convertWebResourceDataToString): Use adoptCF.
(convertWebResourceResponseToDictionary): Ditto.
(createXMLStringFromWebArchiveData): Ditto.
* WebKitTestRunner/mac/WebArchiveDumpSupportMac.mm:
(createCFURLResponseFromResponseData): Use adoptNS and adoptCF.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (149724 => 149725)


--- trunk/Tools/ChangeLog	2013-05-08 09:23:14 UTC (rev 149724)
+++ trunk/Tools/ChangeLog	2013-05-08 09:41:11 UTC (rev 149725)
@@ -1,3 +1,20 @@
+2013-05-08  Darin Adler  <[email protected]>
+
+        Fix one more place that needed to use adoptCF/NS
+        https://bugs.webkit.org/show_bug.cgi?id=115778
+
+        Reviewed by Benjamin Poulain.
+
+        Not sure why I missed this code last time, but found a bit more code that needs
+        to switch to the newer style adoptCF/NS.
+
+        * WebKitTestRunner/cf/WebArchiveDumpSupport.cpp:
+        (convertWebResourceDataToString): Use adoptCF.
+        (convertWebResourceResponseToDictionary): Ditto.
+        (createXMLStringFromWebArchiveData): Ditto.
+        * WebKitTestRunner/mac/WebArchiveDumpSupportMac.mm:
+        (createCFURLResponseFromResponseData): Use adoptNS and adoptCF.
+
 2013-05-08  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r149271.

Modified: trunk/Tools/WebKitTestRunner/cf/WebArchiveDumpSupport.cpp (149724 => 149725)


--- trunk/Tools/WebKitTestRunner/cf/WebArchiveDumpSupport.cpp	2013-05-08 09:23:14 UTC (rev 149724)
+++ trunk/Tools/WebKitTestRunner/cf/WebArchiveDumpSupport.cpp	2013-05-08 09:41:11 UTC (rev 149725)
@@ -70,7 +70,7 @@
             stringEncoding = kCFStringEncodingUTF8;
 
         CFDataRef data = "" CFSTR("WebResourceData")));
-        RetainPtr<CFStringRef> dataAsString(AdoptCF, CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, stringEncoding));
+        RetainPtr<CFStringRef> dataAsString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, stringEncoding));
         if (dataAsString)
             CFDictionarySetValue(resource, CFSTR("WebResourceData"), dataAsString.get());
     }
@@ -109,17 +109,17 @@
     if (CFGetTypeID(responseData) != CFDataGetTypeID())
         return;
 
-    RetainPtr<CFURLResponseRef> response(AdoptCF, createCFURLResponseFromResponseData(responseData));
+    RetainPtr<CFURLResponseRef> response = adoptCF(createCFURLResponseFromResponseData(responseData));
     if (!response)
         return;
 
-    RetainPtr<CFMutableDictionaryRef> responseDictionary(AdoptCF, CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    RetainPtr<CFMutableDictionaryRef> responseDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    RetainPtr<CFMutableStringRef> urlString(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLGetString(CFURLResponseGetURL(response.get()))));
+    RetainPtr<CFMutableStringRef> urlString = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLGetString(CFURLResponseGetURL(response.get()))));
     normalizeWebResourceURL(urlString.get());
     CFDictionarySetValue(responseDictionary.get(), CFSTR("URL"), urlString.get());
 
-    RetainPtr<CFMutableStringRef> mimeTypeString(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLResponseGetMIMEType(response.get())));
+    RetainPtr<CFMutableStringRef> mimeTypeString = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLResponseGetMIMEType(response.get())));
     convertMIMEType(mimeTypeString.get());
     CFDictionarySetValue(responseDictionary.get(), CFSTR("MIMEType"), mimeTypeString.get());
 
@@ -128,17 +128,17 @@
         CFDictionarySetValue(responseDictionary.get(), CFSTR("textEncodingName"), textEncodingName);
 
     SInt64 expectedContentLength = CFURLResponseGetExpectedContentLength(response.get());
-    RetainPtr<CFNumberRef> expectedContentLengthNumber(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &expectedContentLength));
+    RetainPtr<CFNumberRef> expectedContentLengthNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &expectedContentLength));
     CFDictionarySetValue(responseDictionary.get(), CFSTR("expectedContentLength"), expectedContentLengthNumber.get());
 
     if (CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(response.get())) {
-        RetainPtr<CFDictionaryRef> allHeaders(AdoptCF, CFHTTPMessageCopyAllHeaderFields(httpMessage));
-        RetainPtr<CFMutableDictionaryRef> allHeaderFields(AdoptCF, CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, allHeaders.get()));
+        RetainPtr<CFDictionaryRef> allHeaders = adoptCF(CFHTTPMessageCopyAllHeaderFields(httpMessage));
+        RetainPtr<CFMutableDictionaryRef> allHeaderFields = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, allHeaders.get()));
         normalizeHTTPResponseHeaderFields(allHeaderFields.get());
         CFDictionarySetValue(responseDictionary.get(), CFSTR("allHeaderFields"), allHeaderFields.get());
 
         CFIndex statusCode = CFHTTPMessageGetResponseStatusCode(httpMessage);
-        RetainPtr<CFNumberRef> statusCodeNumber(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &statusCode));
+        RetainPtr<CFNumberRef> statusCodeNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &statusCode));
         CFDictionarySetValue(responseDictionary.get(), CFSTR("statusCode"), statusCodeNumber.get());
     }
 
@@ -160,12 +160,12 @@
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
     CFIndex bytesCount = CFDataGetLength(webArchiveData);
-    RetainPtr<CFReadStreamRef> readStream(AdoptCF, CFReadStreamCreateWithBytesNoCopy(kCFAllocatorDefault, CFDataGetBytePtr(webArchiveData), bytesCount, kCFAllocatorNull));
+    RetainPtr<CFReadStreamRef> readStream = adoptCF(CFReadStreamCreateWithBytesNoCopy(kCFAllocatorDefault, CFDataGetBytePtr(webArchiveData), bytesCount, kCFAllocatorNull));
     CFReadStreamOpen(readStream.get());
-    RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, (CFMutableDictionaryRef)CFPropertyListCreateFromStream(kCFAllocatorDefault, readStream.get(), bytesCount, kCFPropertyListMutableContainersAndLeaves, &format, 0));
+    RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF((CFMutableDictionaryRef)CFPropertyListCreateFromStream(kCFAllocatorDefault, readStream.get(), bytesCount, kCFPropertyListMutableContainersAndLeaves, &format, 0));
     CFReadStreamClose(readStream.get());
 #else
-    RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, (CFMutableDictionaryRef)CFPropertyListCreateWithData(kCFAllocatorDefault, webArchiveData, kCFPropertyListMutableContainersAndLeaves, &format, &error));
+    RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF((CFMutableDictionaryRef)CFPropertyListCreateWithData(kCFAllocatorDefault, webArchiveData, kCFPropertyListMutableContainersAndLeaves, &format, &error));
 #endif
 
     if (!propertyList) {
@@ -174,7 +174,7 @@
         return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting data to property list.")));
     }
 
-    RetainPtr<CFMutableArrayRef> resources(AdoptCF, CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> resources = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
     CFArrayAppendValue(resources.get(), propertyList.get());
 
     while (CFArrayGetCount(resources.get())) {
@@ -209,9 +209,9 @@
     error = 0;
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
-    RetainPtr<CFDataRef> xmlData(AdoptCF, CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList.get()));
+    RetainPtr<CFDataRef> xmlData = adoptCF(CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList.get()));
 #else
-    RetainPtr<CFDataRef> xmlData(AdoptCF, CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error));
+    RetainPtr<CFDataRef> xmlData = adoptCF(CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error));
 #endif
 
     if (!xmlData) {
@@ -220,8 +220,8 @@
         return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting property list to data.")));
     }
 
-    RetainPtr<CFStringRef> xmlString(AdoptCF, CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, xmlData.get(), kCFStringEncodingUTF8));
-    RetainPtr<CFMutableStringRef> string(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, xmlString.get()));
+    RetainPtr<CFStringRef> xmlString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, xmlData.get(), kCFStringEncodingUTF8));
+    RetainPtr<CFMutableStringRef> string = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, xmlString.get()));
 
     // Replace "Apple Computer" with "Apple" in the DTD declaration.
     CFStringFindAndReplace(string.get(), CFSTR("-//Apple Computer//"), CFSTR("-//Apple//"), CFRangeMake(0, CFStringGetLength(string.get())), 0);

Modified: trunk/Tools/WebKitTestRunner/mac/WebArchiveDumpSupportMac.mm (149724 => 149725)


--- trunk/Tools/WebKitTestRunner/mac/WebArchiveDumpSupportMac.mm	2013-05-08 09:23:14 UTC (rev 149724)
+++ trunk/Tools/WebKitTestRunner/mac/WebArchiveDumpSupportMac.mm	2013-05-08 09:41:11 UTC (rev 149725)
@@ -52,7 +52,7 @@
 CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData)
 {
     // Decode NSURLResponse
-    RetainPtr<NSKeyedUnarchiver> unarchiver(AdoptNS, [[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
+    RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
     NSURLResponse *response = [unarchiver.get() decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
     [unarchiver.get() finishDecoding];
 
@@ -62,7 +62,7 @@
     NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
 
     // NSURLResponse is not toll-free bridged to CFURLResponse.
-    RetainPtr<CFHTTPMessageRef> httpMessage(AdoptCF, CFHTTPMessageCreateResponse(kCFAllocatorDefault, [httpResponse statusCode], 0, kCFHTTPVersion1_1));
+    RetainPtr<CFHTTPMessageRef> httpMessage = adoptCF(CFHTTPMessageCreateResponse(kCFAllocatorDefault, [httpResponse statusCode], 0, kCFHTTPVersion1_1));
 
     NSDictionary *headerFields = [httpResponse allHeaderFields];
     for (NSString *headerField in [headerFields keyEnumerator])
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to