Twelfth round of fixes for implicit 64-32 bit conversion errors.
<rdar://problem/
5292262>
- Add casts and accompanying FIXMEs to avoid remaining compiler errors.
* WebCore.xcodeproj/project.pbxproj:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::opened):
(WebCore::FrameLoader::sendRemainingDelegateMessages):
* loader/FrameLoader.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveData):
* platform/network/mac/ResourceHandleMac.mm:
(-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]):
(-[WebCoreResourceHandleAsDelegate connection:willStopBufferingData:]):
* platform/network/mac/ResourceResponseMac.mm:
(WebCore::ResourceResponse::nsURLResponse):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23964
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-07-03 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin.
+
+ Twelfth round of fixes for implicit 64-32 bit conversion errors.
+ <rdar://problem/5292262>
+
+ - Add casts and accompanying FIXMEs to avoid remaining compiler errors.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::opened):
+ (WebCore::FrameLoader::sendRemainingDelegateMessages):
+ * loader/FrameLoader.h:
+ * loader/ResourceLoader.cpp:
+ (WebCore::ResourceLoader::didReceiveData):
+ * platform/network/mac/ResourceHandleMac.mm:
+ (-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]):
+ (-[WebCoreResourceHandleAsDelegate connection:willStopBufferingData:]):
+ * platform/network/mac/ResourceResponseMac.mm:
+ (WebCore::ResourceResponse::nsURLResponse):
+
2007-07-03 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
unsigned long identifier;
ResourceRequest request(response.url());
requestFromDelegate(request, identifier, error);
- sendRemainingDelegateMessages(identifier, response, response.expectedContentLength(), error);
+ // FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
+ // However, with today's computers and networking speeds, this won't happen in practice.
+ // Could be an issue with a giant local file.
+ sendRemainingDelegateMessages(identifier, response, static_cast<int>(response.expectedContentLength()), error);
}
pageCache()->remove(m_currentHistoryItem.get());
mainFrame->loader()->load(request, NavigationAction(), FrameLoadTypeStandard, formState);
}
-void FrameLoader::sendRemainingDelegateMessages(unsigned long identifier, const ResourceResponse& response, unsigned length, const ResourceError& error)
+void FrameLoader::sendRemainingDelegateMessages(unsigned long identifier, const ResourceResponse& response, int length, const ResourceError& error)
{
if (!response.isNull())
dispatchDidReceiveResponse(m_documentLoader.get(), identifier, response);
bool isQuickRedirectComing() const;
- void sendRemainingDelegateMessages(unsigned long identifier, const ResourceResponse&, unsigned length, const ResourceError&);
+ void sendRemainingDelegateMessages(unsigned long identifier, const ResourceResponse&, int length, const ResourceError&);
void requestFromDelegate(ResourceRequest&, unsigned long& identifier, ResourceError&);
void loadedResourceFromMemoryCache(const ResourceRequest&, const ResourceResponse&, int length);
RefPtr<ResourceLoader> protector(this);
addData(data, length, allAtOnce);
+ // FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
+ // However, with today's computers and networking speeds, this won't happen in practice.
+ // Could be an issue with a giant local file.
if (m_sendResourceLoadCallbacks && m_frame)
- frameLoader()->didReceiveData(this, data, length, lengthReceived);
+ frameLoader()->didReceiveData(this, data, length, static_cast<int>(lengthReceived));
}
void ResourceLoader::willStopBufferingData(const char* data, int length)
{
if (!m_handle)
return;
+ // FIXME: If we get more than 2B bytes in a single chunk, this code won't do the right thing.
+ // However, with today's computers and networking speeds, this won't happen in practice.
+ // Could be an issue with a giant local file.
++inNSURLConnectionCallback;
- m_handle->client()->didReceiveData(m_handle, (const char*)[data bytes], [data length], lengthReceived);
+ m_handle->client()->didReceiveData(m_handle, (const char*)[data bytes], [data length], static_cast<int>(lengthReceived));
--inNSURLConnectionCallback;
}
{
if (!m_handle)
return;
+ // FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
+ // However, with today's computers and networking speeds, this won't happen in practice.
+ // Could be an issue with a giant local file.
++inNSURLConnectionCallback;
- m_handle->client()->willStopBufferingData(m_handle, (const char*)[data bytes], [data length]);
+ m_handle->client()->willStopBufferingData(m_handle, (const char*)[data bytes], static_cast<int>([data length]));
--inNSURLConnectionCallback;
}
- (NSTimeInterval)_calculatedExpiration;
@end
+#ifdef BUILDING_ON_TIGER
+typedef int NSInteger;
+#endif
+
namespace WebCore {
NSURLResponse *ResourceResponse::nsURLResponse() const
{
- if (!m_nsResponse && !m_isNull)
- const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url.getNSURL() MIMEType:m_mimeType expectedContentLength:m_expectedContentLength textEncodingName:m_textEncodingName]);
-
+ if (!m_nsResponse && !m_isNull) {
+ // Work around a mistake in the NSURLResponse class.
+ // The init function takes an NSInteger, even though the accessor returns a long long.
+ // For values that won't fit in an NSInteger, pass -1 instead.
+ NSInteger expectedContentLength;
+ if (m_expectedContentLength < 0 || m_expectedContentLength > std::numeric_limits<NSInteger>::max())
+ expectedContentLength = -1;
+ else
+ expectedContentLength = static_cast<NSInteger>(m_expectedContentLength);
+ const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url.getNSURL() MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]);
+ }
return m_nsResponse.get();
}