265333 NS_NewInputStreamChannel should not overwrite a content charset set from

the content type with an empty string r+sr=darin
This commit is contained in:
cbiesinger%web.de 2004-10-25 13:15:25 +00:00
Родитель d630cce6b0
Коммит ded5ac40ed
5 изменённых файлов: 30 добавлений и 11 удалений

Просмотреть файл

@ -136,8 +136,7 @@ EmbedStream::OpenStream(const char *aBaseURI, const char *aContentType)
// create a new input stream channel
rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
NS_STATIC_CAST(nsIInputStream *, this),
nsDependentCString(aContentType),
EmptyCString());
nsDependentCString(aContentType));
if (NS_FAILED(rv))
return rv;

Просмотреть файл

@ -119,8 +119,7 @@ EmbedStream::OpenStream(const char *aBaseURI, const char *aContentType)
// create a new input stream channel
rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
NS_STATIC_CAST(nsIInputStream *, this),
nsDependentCString(aContentType),
NS_LITERAL_CSTRING("") );
nsDependentCString(aContentType));
if (NS_FAILED(rv))
return rv;

Просмотреть файл

@ -141,8 +141,7 @@ EmbedStream::OpenStream(const char *aBaseURI, const char *aContentType)
// create a new input stream channel
rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
this,
nsDependentCString(aContentType),
EmptyCString());
nsDependentCString(aContentType));
if (NS_FAILED(rv))
return rv;

Просмотреть файл

@ -131,8 +131,7 @@ nsEmbedStream::OpenStream(const char *aBaseURI, const char *aContentType)
// create a new input stream channel
rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri,
NS_STATIC_CAST(nsIInputStream *, this),
nsDependentCString(aContentType),
EmptyCString());
nsDependentCString(aContentType));
if (NS_FAILED(rv))
return rv;

Просмотреть файл

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:set ts=4 sw=4 sts=4 et cin: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -287,8 +288,8 @@ inline nsresult
NS_NewInputStreamChannel(nsIChannel **result,
nsIURI *uri,
nsIInputStream *stream,
const nsACString &contentType = EmptyCString(),
const nsACString &contentCharset = EmptyCString())
const nsACString &contentType,
const nsACString *contentCharset)
{
nsresult rv;
static NS_DEFINE_CID(kInputStreamChannelCID, NS_INPUTSTREAMCHANNEL_CID);
@ -298,13 +299,35 @@ NS_NewInputStreamChannel(nsIChannel **result,
rv |= channel->SetURI(uri);
rv |= channel->SetContentStream(stream);
rv |= channel->SetContentType(contentType);
rv |= channel->SetContentCharset(contentCharset);
if (contentCharset && !contentCharset->IsEmpty()) {
rv |= channel->SetContentCharset(*contentCharset);
}
if (NS_SUCCEEDED(rv))
NS_ADDREF(*result = channel);
}
return rv;
}
inline nsresult
NS_NewInputStreamChannel(nsIChannel **result,
nsIURI *uri,
nsIInputStream *stream,
const nsACString &contentType = EmptyCString())
{
return NS_NewInputStreamChannel(result, uri, stream, contentType, nsnull);
}
inline nsresult
NS_NewInputStreamChannel(nsIChannel **result,
nsIURI *uri,
nsIInputStream *stream,
const nsACString &contentType,
const nsACString &contentCharset)
{
return NS_NewInputStreamChannel(result, uri, stream, contentType,
&contentCharset);
}
inline nsresult
NS_NewInputStreamPump(nsIInputStreamPump **result,
nsIInputStream *stream,