diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp index b069c9ea5b1..8f52114665e 100644 --- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp +++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp @@ -31,7 +31,7 @@ NS_IMPL_ISUPPORTS4(nsIndexedToHTML, nsIRequestObserver, nsIStreamListener) -static void AppendNonAsciiToNCR(const nsAString& in, nsAFlatString& out) +static void AppendNonAsciiToNCR(const nsAString& in, nsCString& out) { nsAString::const_iterator start, end; @@ -43,10 +43,8 @@ static void AppendNonAsciiToNCR(const nsAString& in, nsAFlatString& out) out.Append(*start++); } else { out.AppendLiteral("&#x"); - nsAutoString hex; - hex.AppendInt(*start++, 16); - out.Append(hex); - out.Append((char16_t)';'); + out.AppendInt(*start++, 16); + out.Append(';'); } } } @@ -67,22 +65,6 @@ nsIndexedToHTML::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { nsresult nsIndexedToHTML::Init(nsIStreamListener* aListener) { - - nsXPIDLString ellipsis; - nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (prefs) { - nsCOMPtr prefVal; - prefs->GetComplexValue("intl.ellipsis", - NS_GET_IID(nsIPrefLocalizedString), - getter_AddRefs(prefVal)); - if (prefVal) - prefVal->ToString(getter_Copies(ellipsis)); - } - if (ellipsis.IsEmpty()) - mEscapedEllipsis.AppendLiteral("…"); - else - mEscapedEllipsis.Adopt(nsEscapeHTML2(ellipsis.get(), ellipsis.Length())); - nsresult rv = NS_OK; mListener = aListener; @@ -120,7 +102,7 @@ nsIndexedToHTML::AsyncConvertData(const char *aFromType, NS_IMETHODIMP nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) { - nsString buffer; + nsCString buffer; nsresult rv = DoOnStartRequest(request, aContext, buffer); if (NS_FAILED(rv)) { request->Cancel(rv); @@ -136,13 +118,13 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) { // Push our buffer to the listener. - rv = FormatInputStream(request, aContext, buffer); + rv = SendToListener(request, aContext, buffer); return rv; } nsresult nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext, - nsString& aBuffer) { + nsCString& aBuffer) { nsresult rv; nsCOMPtr channel = do_QueryInterface(request); @@ -168,6 +150,9 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext, nsCString parentStr; + nsCString buffer; + buffer.AppendLiteral("\n\n\n"); + // XXX - should be using the 300: line from the parser. // We can't guarantee that that comes before any entry, so we'd have to // buffer, and do other painful stuff. @@ -227,8 +212,7 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext, } // Directory index will be always encoded in UTF-8 if this is file url - rv = mParser->SetEncoding("UTF-8"); - NS_ENSURE_SUCCESS(rv, rv); + buffer.AppendLiteral("\n"); } else if (NS_SUCCEEDED(uri->SchemeIs("jar", &isScheme)) && isScheme) { nsAutoCString path; @@ -263,23 +247,11 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext, } } - nsString buffer; - buffer.AppendLiteral("\n" - "\n\n" - "\n" - "