making string conversions explicit

This commit is contained in:
scc%netscape.com 2000-04-01 22:45:09 +00:00
Родитель 59adfb766c
Коммит f58ac20116
3 изменённых файлов: 7 добавлений и 6 удалений

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

@ -38,7 +38,7 @@ nsAboutBlank::NewChannel(nsIURI *aURI, nsIChannel **result)
nsresult rv;
nsIChannel* channel;
nsISupports* s;
rv = NS_NewStringInputStream(&s, kBlankPage);
rv = NS_NewCStringInputStream(&s, kBlankPage);
if (NS_FAILED(rv)) return rv;
nsIInputStream* in;

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

@ -73,7 +73,7 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result)
nsCOMPtr<nsISupports> s;
const char* msg = "Bloat statistics cleared.";
rv = NS_NewStringInputStream(getter_AddRefs(s), msg);
rv = NS_NewCStringInputStream(getter_AddRefs(s), msg);
if (NS_FAILED(rv)) return rv;
size = nsCRT::strlen(msg);
@ -87,7 +87,7 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result)
nsCOMPtr<nsISupports> s;
const char* msg = "Memory leaks dumped.";
rv = NS_NewStringInputStream(getter_AddRefs(s), msg);
rv = NS_NewCStringInputStream(getter_AddRefs(s), msg);
if (NS_FAILED(rv)) return rv;
size = nsCRT::strlen(msg);

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

@ -130,13 +130,14 @@ nsAboutProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
if (NS_FAILED(rv)) return rv;
// look up a handler to deal with "whatStr"
nsAutoString progID(NS_ABOUT_MODULE_PROGID_PREFIX);
nsAutoString what(whatStr);
nsAutoString progID; progID.AssignWithConversion(NS_ABOUT_MODULE_PROGID_PREFIX);
nsAutoString what; what.AssignWithConversion(whatStr);
nsCRT::free(whatStr);
// only take up to a question-mark if there is one:
PRInt32 amt = what.Find("?");
progID.Append(what, amt); // if amt == -1, take it all
// STRING USE WARNING: this use needs to be examined -- scc
progID.Append(what.GetUnicode(), amt); // if amt == -1, take it all
char* progIDStr = progID.ToNewCString();
if (progIDStr == nsnull)