From e2205bb1be6e1e39ecd7dfdf86ec21643056e854 Mon Sep 17 00:00:00 2001 From: "disttsc%bart.nl" Date: Mon, 12 Feb 2001 03:12:57 +0000 Subject: [PATCH] From Small Gods, by Terry Pratchett: The light was brilliant, crystalline, in a black sky filled with stars. 'Ah. There really is a desert. Does everyone get this?' said Brutha. WHO KNOWS? 'And what is at the end of the desert?' JUDGEMENT. Brutha considered this. 'Which end?' Death grinned and stepped aside. What Brutha had thought was a rock in the sand was a hunched figure, sitting clutching its knees. It looked paralysed with fear. He stared. 'Vorbis?' he said. He looked at Death. 'But Vobis died a hundred years ago!' YES. HE HAD TO WALK IT ALL ALONE. ALL ALONE WITH HIMSELF. IF HE DARED. 'He's been here fore a hundred years?' POSSIBLY NOT. TIME IS DIFFERENT HERE. IT IS . . . MORE PERSONAL. 'Ah. You mean a hundred years can pass like a few seconds?' A HUNDRED YEARS CAN PASS LIKE INFINITY. The black-on-black eyes stared imploringly at Brutha, who reached out automatically, without thinking . . . and then hesitated. HE WAS A MURDERER, said Death. AND A CREATOR OF MURDERERS. A TORTURER. WITHOUT PASSION. CRUEL. CALLOUS. COMPASSIONLESS. 'Yes. I know. He's Vorbis,' said Brutha. Vorbis changed people. Sometimes he changed them into dead people. But he always changed them. That was his triumph. He sighed. 'But I'm me,' he said. Vobis stood up, uncertainly, and followed Brutha across the desert. Death watched them walk away. The End. git-svn-id: svn://10.0.0.236/trunk@86791 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLContentSink.cpp | 8 +-- .../html/document/src/nsHTMLDocument.cpp | 52 +++++++++---------- .../html/document/src/nsImageDocument.cpp | 16 +++--- mozilla/content/xbl/src/nsXBLService.cpp | 37 ++++++------- .../content/xml/document/src/nsXMLDocument.h | 2 +- 5 files changed, 51 insertions(+), 64 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 75ccd42adbe..c9950719f75 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -4715,12 +4715,8 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader, nsCOMPtr httpChannel; nsCOMPtr channel; - nsCOMPtr request; - rv = aLoader->GetRequest(getter_AddRefs(request)); - NS_ASSERTION(request, "StreamLoader's request went away prematurely"); - if (NS_FAILED(rv)) return rv; - - channel = do_QueryInterface(request); + rv = aLoader->GetChannel(getter_AddRefs(channel)); + NS_ASSERTION(channel, "StreamLoader's channel went away prematurely"); if (channel) { httpChannel = do_QueryInterface(channel); diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 75c15c3096f..fd9adb6e18d 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -585,35 +585,33 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, nsCOMPtr file; rv = fileChannel->GetFile(getter_AddRefs(file)); - if (NS_SUCCEEDED(rv)) - { - // if we failed to get a last modification date, then we don't want to necessarily - // fail to create a document for this file. Just don't set the last modified date on it... - rv = file->GetLastModificationDate(&modDate); - if (NS_SUCCEEDED(rv)) - { - PRExplodedTime prtime; - char buf[100]; - PRInt64 intermediateValue; + if (NS_FAILED(rv)) { return rv; } + // if we failed to get a last modification date, then we don't want to necessarily + // fail to create a document for this file. Just don't set the last modified date on it... + rv = file->GetLastModificationDate(&modDate); + if (NS_SUCCEEDED(rv)) + { + PRExplodedTime prtime; + char buf[100]; + PRInt64 intermediateValue; - LL_I2L(intermediateValue, PR_USEC_PER_MSEC); - LL_MUL(usecs, modDate, intermediateValue); - PR_ExplodeTime(usecs, PR_LocalTimeParameters, &prtime); + LL_I2L(intermediateValue, PR_USEC_PER_MSEC); + LL_MUL(usecs, modDate, intermediateValue); + PR_ExplodeTime(usecs, PR_LocalTimeParameters, &prtime); - // Use '%#c' for windows, because '%c' is backward-compatible and - // non-y2k with msvc; '%#c' requests that a full year be used in the - // result string. Other OSes just use "%c". - PR_FormatTime(buf, sizeof buf, - #if defined(XP_PC) && !defined(XP_OS2) - "%#c", - #else - "%c", - #endif - &prtime); - lastModified.AssignWithConversion(buf); - SetLastModified(lastModified); - } - } + // Use '%#c' for windows, because '%c' is backward-compatible and + // non-y2k with msvc; '%#c' requests that a full year be used in the + // result string. Other OSes just use "%c". + PR_FormatTime(buf, sizeof buf, +#if defined(XP_PC) && !defined(XP_OS2) + "%#c", +#else + "%c", +#endif + &prtime); + lastModified.AssignWithConversion(buf); + SetLastModified(lastModified); + } } static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID); diff --git a/mozilla/content/html/document/src/nsImageDocument.cpp b/mozilla/content/html/document/src/nsImageDocument.cpp index 4201b7d24d9..4e4a62c4d67 100644 --- a/mozilla/content/html/document/src/nsImageDocument.cpp +++ b/mozilla/content/html/document/src/nsImageDocument.cpp @@ -121,14 +121,10 @@ ImageListener::~ImageListener() NS_IMPL_THREADSAFE_ISUPPORTS(ImageListener, NS_GET_IID(nsIStreamListener)) NS_IMETHODIMP -ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt) +ImageListener::OnStartRequest(nsIChannel* channel, nsISupports *ctxt) { nsresult rv; nsIURI* uri; - - nsCOMPtr channel = do_QueryInterface(request); - if (!channel) return NS_ERROR_NULL_POINTER; - rv = channel->GetURI(&uri); if (NS_FAILED(rv)) return rv; @@ -137,11 +133,11 @@ ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt) if (nsnull == mNextStream) { return NS_ERROR_FAILURE; } - return mNextStream->OnStartRequest(request, ctxt); + return mNextStream->OnStartRequest(channel, ctxt); } NS_IMETHODIMP -ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt, +ImageListener::OnStopRequest(nsIChannel* channel, nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg) { if(mDocument){ @@ -151,17 +147,17 @@ ImageListener::OnStopRequest(nsIRequest* request, nsISupports *ctxt, if (nsnull == mNextStream) { return NS_ERROR_FAILURE; } - return mNextStream->OnStopRequest(request, ctxt, status, errorMsg); + return mNextStream->OnStopRequest(channel, ctxt, status, errorMsg); } NS_IMETHODIMP -ImageListener::OnDataAvailable(nsIRequest* request, nsISupports *ctxt, +ImageListener::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count) { if (nsnull == mNextStream) { return NS_ERROR_FAILURE; } - return mNextStream->OnDataAvailable(request, ctxt, inStr, sourceOffset, count); + return mNextStream->OnDataAvailable(channel, ctxt, inStr, sourceOffset, count); } //---------------------------------------------------------------------- diff --git a/mozilla/content/xbl/src/nsXBLService.cpp b/mozilla/content/xbl/src/nsXBLService.cpp index 9b57da9ebbd..2119b7ef260 100644 --- a/mozilla/content/xbl/src/nsXBLService.cpp +++ b/mozilla/content/xbl/src/nsXBLService.cpp @@ -260,37 +260,38 @@ nsXBLStreamListener::~nsXBLStreamListener() } } +/* void onDataAvailable (in nsIChannel channel, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */ NS_IMETHODIMP -nsXBLStreamListener::OnDataAvailable(nsIRequest *request, nsISupports* aCtxt, nsIInputStream* aInStr, +nsXBLStreamListener::OnDataAvailable(nsIChannel* aChannel, nsISupports* aCtxt, nsIInputStream* aInStr, PRUint32 aSourceOffset, PRUint32 aCount) { if (mInner) - return mInner->OnDataAvailable(request, aCtxt, aInStr, aSourceOffset, aCount); + return mInner->OnDataAvailable(aChannel, aCtxt, aInStr, aSourceOffset, aCount); return NS_ERROR_FAILURE; } +/* void onStartRequest (in nsIChannel channel, in nsISupports ctxt); */ NS_IMETHODIMP -nsXBLStreamListener::OnStartRequest(nsIRequest* request, nsISupports* aCtxt) +nsXBLStreamListener::OnStartRequest(nsIChannel* aChannel, nsISupports* aCtxt) { if (mInner) - return mInner->OnStartRequest(request, aCtxt); + return mInner->OnStartRequest(aChannel, aCtxt); return NS_ERROR_FAILURE; } +/* void onStopRequest (in nsIChannel channel, in nsISupports ctxt, in nsresult status, in wstring statusArg); */ NS_IMETHODIMP -nsXBLStreamListener::OnStopRequest(nsIRequest* request, nsISupports* aCtxt, nsresult aStatus, const PRUnichar* aStatusArg) +nsXBLStreamListener::OnStopRequest(nsIChannel* aChannel, nsISupports* aCtxt, nsresult aStatus, const PRUnichar* aStatusArg) { nsresult rv = NS_OK; if (mInner) { - rv = mInner->OnStopRequest(request, aCtxt, aStatus, aStatusArg); + rv = mInner->OnStopRequest(aChannel, aCtxt, aStatus, aStatusArg); } if (NS_FAILED(rv) || NS_FAILED(aStatus)) { - - nsCOMPtr aChannel = do_QueryInterface(request); - if (aChannel) + if (aChannel) { nsCOMPtr channelURI; aChannel->GetURI(getter_AddRefs(channelURI)); @@ -1190,7 +1191,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun nsCOMPtr loadGroup; if (aBoundDocument) aBoundDocument->GetDocumentLoadGroup(getter_AddRefs(loadGroup)); - nsCOMPtr request; + nsCOMPtr channel; rv = NS_OpenURI(getter_AddRefs(channel), aURI, nsnull, loadGroup); if (NS_FAILED(rv)) return rv; @@ -1232,22 +1233,18 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun xblListener->AddRequest(req); // Now kick off the async read. - channel->AsyncOpen(xblListener, nsnull); + channel->AsyncRead(xblListener, nsnull); return NS_OK; } // Now do a blocking synchronous parse of the file. nsCOMPtr in; PRUint32 sourceOffset = 0; - rv = channel->Open(getter_AddRefs(in)); + rv = channel->OpenInputStream(getter_AddRefs(in)); // If we couldn't open the channel, then just return. if (NS_FAILED(rv)) return NS_OK; - - request = do_QueryInterface(channel); - - NS_ASSERTION(request != nsnull, "no request info"); - + NS_ASSERTION(in != nsnull, "no input stream"); if (! in) return NS_ERROR_FAILURE; @@ -1256,7 +1253,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun if (! proxy) return NS_ERROR_FAILURE; - listener->OnStartRequest(request, nsnull); + listener->OnStartRequest(channel, nsnull); while (PR_TRUE) { char buf[1024]; PRUint32 readCount; @@ -1269,12 +1266,12 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun proxy->SetBuffer(buf, readCount); - rv = listener->OnDataAvailable(request, nsnull, proxy, sourceOffset, readCount); + rv = listener->OnDataAvailable(channel, nsnull, proxy, sourceOffset, readCount); sourceOffset += readCount; if (NS_FAILED(rv)) break; } - listener->OnStopRequest(request, nsnull, NS_OK, nsnull); + listener->OnStopRequest(channel, nsnull, NS_OK, nsnull); // don't leak proxy! proxy->Close(); diff --git a/mozilla/content/xml/document/src/nsXMLDocument.h b/mozilla/content/xml/document/src/nsXMLDocument.h index c5fe3152dd1..8832b5cf43a 100644 --- a/mozilla/content/xml/document/src/nsXMLDocument.h +++ b/mozilla/content/xml/document/src/nsXMLDocument.h @@ -52,7 +52,7 @@ public: NS_IMETHOD GetContentType(nsAWritableString& aContentType) const; NS_IMETHOD StartDocumentLoad(const char* aCommand, - nsIChannel* channel, + nsIChannel* aChannel, nsILoadGroup* aLoadGroup, nsISupports* aContainer, nsIStreamListener **aDocListener,