From c3b3057466637a176e9ad5301acd8c036512fdb5 Mon Sep 17 00:00:00 2001 From: "scc%netscape.com" Date: Sat, 1 Apr 2000 00:36:50 +0000 Subject: [PATCH] make string conversions explicit --- caps/src/nsCodebasePrincipal.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/caps/src/nsCodebasePrincipal.cpp b/caps/src/nsCodebasePrincipal.cpp index 3b2a3817bfc..d95ba351c86 100644 --- a/caps/src/nsCodebasePrincipal.cpp +++ b/caps/src/nsCodebasePrincipal.cpp @@ -44,13 +44,14 @@ NSBASEPRINCIPALS_RELEASE(nsCodebasePrincipal); NS_IMETHODIMP nsCodebasePrincipal::ToString(char **result) { + // STRING USE WARNING: perhaps |str| should be an |nsCAutoString|? -- scc nsAutoString buf; - buf += "[Codebase "; + buf.AppendWithConversion("[Codebase "); nsXPIDLCString origin; if (NS_FAILED(GetOrigin(getter_Copies(origin)))) return NS_ERROR_FAILURE; - buf += origin; - buf += ']'; + buf.AppendWithConversion(origin); + buf.AppendWithConversion(']'); *result = buf.ToNewCString(); return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } @@ -135,14 +136,17 @@ nsCodebasePrincipal::GetOrigin(char **origin) nsXPIDLCString s; if (NS_FAILED(mURI->GetScheme(getter_Copies(s)))) return NS_ERROR_FAILURE; - nsAutoString t(s); - t += "://"; + + // STRING USE WARNING: perhaps |str| should be an |nsCAutoString|? -- scc + nsAutoString t; + t.AssignWithConversion(s); + t.AppendWithConversion("://"); if (NS_SUCCEEDED(mURI->GetHost(getter_Copies(s)))) { - t.Append(s); + t.AppendWithConversion(s); } else if (NS_SUCCEEDED(mURI->GetSpec(getter_Copies(s)))) { // Some URIs (e.g., nsSimpleURI) don't support host. Just // get the full spec. - t.Assign(s); + t.AssignWithConversion(s); } else { return NS_ERROR_FAILURE; }