fixing code that relied on implicit string construction

This commit is contained in:
scc%mozilla.org 2000-08-19 22:46:00 +00:00
Родитель 4f2c82d5e5
Коммит 50902d01b6
10 изменённых файлов: 26 добавлений и 25 удалений

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

@ -1001,7 +1001,7 @@ XULContentSinkImpl::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
NS_IMETHODIMP
XULContentSinkImpl::AddCharacterData(const nsIParserNode& aNode)
{
nsAutoString text = aNode.GetText();
nsAutoString text(aNode.GetText());
if (aNode.GetTokenType() == eToken_entity) {
char buf[12];
@ -1371,7 +1371,7 @@ XULContentSinkImpl::ParseTag(const nsString& aText, nsINodeInfo*& aNodeInfo)
// Split the tag into prefix and tag substrings.
nsAutoString prefixStr;
nsAutoString tagStr = aText;
nsAutoString tagStr(aText);
PRInt32 nsoffset = tagStr.FindChar(kNameSpaceSeparator);
if (nsoffset >= 0) {
tagStr.Left(prefixStr, nsoffset);
@ -1406,7 +1406,7 @@ XULContentSinkImpl::ParseAttributeString(const nsString& aText, nsIAtom*& aAttr,
// Split the attribute into prefix and tag substrings.
nsAutoString prefixStr;
nsAutoString attrStr = aText;
nsAutoString attrStr(aText);
PRInt32 nsoffset = attrStr.FindChar(kNameSpaceSeparator);
if (nsoffset >= 0) {
attrStr.Left(prefixStr, nsoffset);

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

@ -6557,7 +6557,7 @@ nsXULDocument::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResu
nsAutoString nameSpace;
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
nsCAutoString progID(NS_ELEMENT_FACTORY_PROGID_PREFIX);
progID.AppendWithConversion(nameSpace);
// Retrieve the appropriate factory.

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

@ -6581,7 +6581,7 @@ nsXULTemplateBuilder::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory*
nsAutoString nameSpace;
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
nsCAutoString progID(NS_ELEMENT_FACTORY_PROGID_PREFIX);
progID.AppendWithConversion(nameSpace.GetUnicode());
// Retrieve the appropriate factory.

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

@ -196,7 +196,7 @@ RDFContainerImpl::GetCount(PRInt32 *aCount)
rv = nextValLiteral->GetValue( getter_Copies(s) );
if (NS_FAILED(rv)) return rv;
nsAutoString nextValStr = (const PRUnichar*) s;
nsAutoString nextValStr(NS_STATIC_CAST(const PRUnichar*, s));
PRInt32 nextVal;
PRInt32 err;

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

@ -688,7 +688,7 @@ RDFContentSinkImpl::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
NS_IMETHODIMP
RDFContentSinkImpl::AddCharacterData(const nsIParserNode& aNode)
{
nsAutoString text = aNode.GetText();
nsAutoString text(aNode.GetText());
if (aNode.GetTokenType() == eToken_entity) {
char buf[12];
@ -1009,7 +1009,7 @@ RDFContentSinkImpl::GetIdAboutAttribute(const nsIParserNode& aNode,
// first thing that was specified and ignore the other.
if (attr.get() == kAboutAtom) {
nsAutoString uri = aNode.GetValueAt(i);
nsAutoString uri(aNode.GetValueAt(i));
nsRDFParserUtils::StripAndConvert(uri);
rdf_MakeAbsoluteURI(NS_ConvertASCIItoUCS2(NS_STATIC_CAST(const char*, docURI)), uri);
@ -1017,7 +1017,7 @@ RDFContentSinkImpl::GetIdAboutAttribute(const nsIParserNode& aNode,
return gRDFService->GetUnicodeResource(uri.GetUnicode(), aResource);
}
else if (attr.get() == kIdAtom) {
nsAutoString name = aNode.GetValueAt(i);
nsAutoString name(aNode.GetValueAt(i));
nsRDFParserUtils::StripAndConvert(name);
// Enforce that this is a valid "XML Name" (see
@ -1087,7 +1087,7 @@ RDFContentSinkImpl::GetResourceAttribute(const nsIParserNode& aNode,
// first thing that was specified and ignore the other.
if (attr.get() == kResourceAtom) {
nsAutoString uri = aNode.GetValueAt(i);
nsAutoString uri(aNode.GetValueAt(i));
nsRDFParserUtils::StripAndConvert(uri);
// XXX Take the URI and make it fully qualified by
@ -1135,7 +1135,7 @@ RDFContentSinkImpl::AddProperties(const nsIParserNode& aNode,
nsAutoString v(aNode.GetValueAt(i));
nsRDFParserUtils::StripAndConvert(v);
nsCAutoString propertyStr = nameSpaceURI;
nsCAutoString propertyStr(nameSpaceURI);
const PRUnichar* attrName;
attr->GetUnicode(&attrName);
@ -1368,7 +1368,7 @@ RDFContentSinkImpl::OpenProperty(const nsIParserNode& aNode)
nsCOMPtr<nsIAtom> tag;
ParseTagString(aNode.GetText(), &nameSpaceURI, getter_AddRefs(tag));
nsCAutoString propertyStr = nameSpaceURI;
nsCAutoString propertyStr(nameSpaceURI);
const PRUnichar *attrName;
tag->GetUnicode(&attrName);
@ -1582,7 +1582,7 @@ RDFContentSinkImpl::PushNameSpacesFrom(const nsIParserNode& aNode)
if (! IsXMLNSDirective(key, getter_AddRefs(prefix)))
continue;
nsAutoString uri = aNode.GetValueAt(i);
nsAutoString uri(aNode.GetValueAt(i));
nsRDFParserUtils::StripAndConvert(uri);
// Open a local namespace

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

@ -1485,7 +1485,7 @@ static const char kRDFLILiteral1[] = " <RDF:li>";
static const char kRDFLILiteral2[] = "</RDF:li>\n";
rdf_BlockingWrite(aStream, kRDFLILiteral1, sizeof(kRDFLILiteral1) - 1);
rdf_BlockingWrite(aStream, (const PRUnichar*) value);
rdf_BlockingWrite(aStream, nsAutoString(NS_STATIC_CAST(const PRUnichar*, value)));
rdf_BlockingWrite(aStream, kRDFLILiteral2, sizeof(kRDFLILiteral2) - 1);
}
NS_RELEASE(literal);
@ -1662,7 +1662,8 @@ static const char kXMLNS[] = "\n xmlns";
nsresult
RDFXMLDataSourceImpl::SerializeEpilogue(nsIOutputStream* aStream)
{
rdf_BlockingWrite(aStream, NS_LITERAL_STRING("</RDF:RDF>\n"));
// can't use |NS_LITERAL_STRING| here until |rdf_BlockingWrite| is fixed to accept readables
rdf_BlockingWrite(aStream, NS_ConvertASCIItoUCS2("</RDF:RDF>\n"));
return NS_OK;
}

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

@ -1001,7 +1001,7 @@ XULContentSinkImpl::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
NS_IMETHODIMP
XULContentSinkImpl::AddCharacterData(const nsIParserNode& aNode)
{
nsAutoString text = aNode.GetText();
nsAutoString text(aNode.GetText());
if (aNode.GetTokenType() == eToken_entity) {
char buf[12];
@ -1371,7 +1371,7 @@ XULContentSinkImpl::ParseTag(const nsString& aText, nsINodeInfo*& aNodeInfo)
// Split the tag into prefix and tag substrings.
nsAutoString prefixStr;
nsAutoString tagStr = aText;
nsAutoString tagStr(aText);
PRInt32 nsoffset = tagStr.FindChar(kNameSpaceSeparator);
if (nsoffset >= 0) {
tagStr.Left(prefixStr, nsoffset);
@ -1406,7 +1406,7 @@ XULContentSinkImpl::ParseAttributeString(const nsString& aText, nsIAtom*& aAttr,
// Split the attribute into prefix and tag substrings.
nsAutoString prefixStr;
nsAutoString attrStr = aText;
nsAutoString attrStr(aText);
PRInt32 nsoffset = attrStr.FindChar(kNameSpaceSeparator);
if (nsoffset >= 0) {
attrStr.Left(prefixStr, nsoffset);

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

@ -6557,7 +6557,7 @@ nsXULDocument::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aResu
nsAutoString nameSpace;
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
nsCAutoString progID(NS_ELEMENT_FACTORY_PROGID_PREFIX);
progID.AppendWithConversion(nameSpace);
// Retrieve the appropriate factory.

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

@ -610,10 +610,10 @@ nsresult nsXULKeyListenerImpl::DoKey(nsIDOMEvent* aKeyEvent, eEventType aEventTy
// Locate the key node and execute the JS on a match.
PRBool handled = PR_FALSE;
nsCAutoString browserFile = "chrome://communicator/content/browserBindings.xul";
nsCAutoString editorFile = "chrome://communicator/content/editorBindings.xul";
nsCAutoString browserPlatformFile = "chrome://communicator/content/platformBrowserBindings.xul";
nsCAutoString editorPlatformFile = "chrome://communicator/content/platformEditorBindings.xul";
nsCAutoString browserFile("chrome://communicator/content/browserBindings.xul");
nsCAutoString editorFile("chrome://communicator/content/editorBindings.xul");
nsCAutoString browserPlatformFile("chrome://communicator/content/platformBrowserBindings.xul");
nsCAutoString editorPlatformFile("chrome://communicator/content/platformEditorBindings.xul");
nsresult result;
@ -1450,7 +1450,7 @@ nsXULKeyListenerImpl::HandleEventUsingKeyset(nsIDOMElement* aKeysetElement, nsID
PRUnichar tempChar[2];
tempChar[0] = theChar;
tempChar[1] = 0;
nsAutoString tempChar2 = tempChar;
nsAutoString tempChar2(tempChar);
//printf("compare key [%s] \n", tempChar2.ToNewCString()); // this leaks
// NOTE - convert theChar and keyName to upper
keyName.ToUpperCase();

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

@ -6581,7 +6581,7 @@ nsXULTemplateBuilder::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory*
nsAutoString nameSpace;
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
nsCAutoString progID(NS_ELEMENT_FACTORY_PROGID_PREFIX);
progID.AppendWithConversion(nameSpace.GetUnicode());
// Retrieve the appropriate factory.