diff --git a/mozilla/extensions/finger/nsFingerChannel.cpp b/mozilla/extensions/finger/nsFingerChannel.cpp index dffeae8ed5a..702ed9f8625 100644 --- a/mozilla/extensions/finger/nsFingerChannel.cpp +++ b/mozilla/extensions/finger/nsFingerChannel.cpp @@ -198,7 +198,7 @@ nsFingerChannel::Open(nsIInputStream **_retval) do_GetService(kSocketTransportServiceCID, &rv); if (NS_FAILED(rv)) return rv; - rv = socketService->CreateTransport(mHost, mPort, mProxyInfo, BUFFER_SEG_SIZE, + rv = socketService->CreateTransport(mHost.get(), mPort, mProxyInfo, BUFFER_SEG_SIZE, BUFFER_MAX_SIZE, getter_AddRefs(mTransport)); if (NS_FAILED(rv)) return rv; @@ -221,7 +221,7 @@ nsFingerChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt) do_GetService(kSocketTransportServiceCID, &rv); if (NS_FAILED(rv)) return rv; - rv = socketService->CreateTransport(mHost, mPort, mProxyInfo, BUFFER_SEG_SIZE, + rv = socketService->CreateTransport(mHost.get(), mPort, mProxyInfo, BUFFER_SEG_SIZE, BUFFER_MAX_SIZE, getter_AddRefs(mTransport)); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/modules/libjar/nsJARURI.cpp b/mozilla/modules/libjar/nsJARURI.cpp index db0c6e4e6a4..eb16e8ea192 100644 --- a/mozilla/modules/libjar/nsJARURI.cpp +++ b/mozilla/modules/libjar/nsJARURI.cpp @@ -89,7 +89,7 @@ nsJARURI::FormatSpec(const char* entryPath, char* *result) spec += NS_JAR_DELIMITER; spec += entryPath; - *result = nsCRT::strdup(spec); + *result = ToNewCString(spec); return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } @@ -147,7 +147,7 @@ nsJARURI::SetSpec(const char * aSpec) jarPath.Cut(pos, jarPath.Length()); jarPath.Cut(0, endPos); - rv = serv->NewURI(jarPath, nsnull, getter_AddRefs(mJARFile)); + rv = serv->NewURI(jarPath.get(), nsnull, getter_AddRefs(mJARFile)); if (NS_FAILED(rv)) return rv; nsCAutoString entry(aSpec); @@ -155,7 +155,7 @@ nsJARURI::SetSpec(const char * aSpec) while (entry.CharAt(0) == '/') entry.Cut(0,1); // Strip any additional leading slashes from entry path - rv = serv->ResolveRelativePath(entry, nsnull, &mJAREntry); + rv = serv->ResolveRelativePath(entry.get(), nsnull, &mJAREntry); return rv; } diff --git a/mozilla/netwerk/base/src/nsFileTransport.cpp b/mozilla/netwerk/base/src/nsFileTransport.cpp index 707545dd61c..00d0c1afb96 100644 --- a/mozilla/netwerk/base/src/nsFileTransport.cpp +++ b/mozilla/netwerk/base/src/nsFileTransport.cpp @@ -341,9 +341,7 @@ nsFileTransport::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult) NS_IMETHODIMP nsFileTransport::GetName(PRUnichar* *result) { - nsAutoString name; - name.AppendWithConversion(mStreamName); - *result = ToNewUnicode(name); + *result = ToNewUnicode(mStreamName); return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } @@ -847,11 +845,9 @@ nsFileTransport::Process(void) saveListener = 0; } if (mProgressSink) { - nsAutoString fileName; - fileName.AssignWithConversion(mStreamName); mProgressSink->OnStatus(this, saveContext, NS_NET_STATUS_READ_FROM, - fileName.get()); + NS_ConvertASCIItoUCS2(mStreamName).get()); } break; @@ -1015,10 +1011,9 @@ nsFileTransport::Process(void) mProvider = 0; } if (mProgressSink) { - nsAutoString fileName; fileName.AssignWithConversion(mStreamName); nsresult rv = mProgressSink->OnStatus(this, mContext, NS_NET_STATUS_WROTE_TO, - fileName.get()); + NS_ConvertASCIItoUCS2(mStreamName).get()); NS_ASSERTION(NS_SUCCEEDED(rv), "unexpected OnStatus failure"); } mContext = 0; diff --git a/mozilla/netwerk/base/src/nsStdURL.cpp b/mozilla/netwerk/base/src/nsStdURL.cpp index 67d9254e20b..3a25568e811 100644 --- a/mozilla/netwerk/base/src/nsStdURL.cpp +++ b/mozilla/netwerk/base/src/nsStdURL.cpp @@ -1205,7 +1205,7 @@ nsStdURL::GetFile(nsIFile * *aFile) path.Cut(0, 1); #endif nsCOMPtr localFile; - rv = NS_NewLocalFile(path, PR_FALSE, getter_AddRefs(localFile)); + rv = NS_NewLocalFile(path.get(), PR_FALSE, getter_AddRefs(localFile)); mFile = localFile; *aFile = mFile; diff --git a/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp b/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp index b9f8a2b238d..e31e854e804 100644 --- a/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp +++ b/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp @@ -211,7 +211,7 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions ) PRInt32 breakLocation = -1; while ( (breakLocation= extList.FindCharInSet( ",",0 ) )!= -1) { - nsCString ext( extList, breakLocation ); + nsCString ext( extList.get(), breakLocation ); mExtensions.AppendCString( ext ); extList.Cut(0, breakLocation+1 ); } @@ -344,7 +344,7 @@ void nsMIMEInfoImpl::SetRememberPrefForMimeType(const char * prefName) // always escape the pref b4 storing it in case someone enters some funky characters for a mime type... nsXPIDLCString escapedPrefString; - *((char **)getter_Copies(escapedPrefString)) = nsEscape(prefValue, url_XAlphas); + escapedPrefString.Adopt(nsEscape(prefValue.get(), url_XAlphas)); prefBranch->SetCharPref(prefName, escapedPrefString); } } diff --git a/mozilla/netwerk/mime/src/nsMIMEService.cpp b/mozilla/netwerk/mime/src/nsMIMEService.cpp index b0241612f01..a6c2ac49b67 100644 --- a/mozilla/netwerk/mime/src/nsMIMEService.cpp +++ b/mozilla/netwerk/mime/src/nsMIMEService.cpp @@ -232,6 +232,6 @@ NS_IMETHODIMP nsMIMEService::GetTypeFromFile( nsIFile* aFile, char **aContentTyp // Windows, unix and mac when no type match occured. - return GetTypeFromExtension( fileExt, aContentType ); + return GetTypeFromExtension( fileExt.get(), aContentType ); } diff --git a/mozilla/netwerk/mime/src/nsXMLMIMEDataSource.cpp b/mozilla/netwerk/mime/src/nsXMLMIMEDataSource.cpp index fc1484c289b..fd044dcceb4 100644 --- a/mozilla/netwerk/mime/src/nsXMLMIMEDataSource.cpp +++ b/mozilla/netwerk/mime/src/nsXMLMIMEDataSource.cpp @@ -330,7 +330,7 @@ nsXMLMIMEDataSource::Serialize() { PRUint32 bytesWritten; PRBool more; - rv = stream->Write( buffer , buffer.Length(), &bytesWritten ); + rv = stream->Write( buffer.get() , buffer.Length(), &bytesWritten ); while ( NS_SUCCEEDED( enumerator->HasMoreElements(& more ) )&& more ) { @@ -403,7 +403,7 @@ nsXMLMIMEDataSource::Serialize() { buffer+="/>\r"; - rv = stream->Write( buffer , buffer.Length(), &bytesWritten ); + rv = stream->Write( buffer.get() , buffer.Length(), &bytesWritten ); if ( NS_FAILED( rv ) ) return rv; @@ -655,29 +655,29 @@ static nsresult AddAttribute( nsIMIMEInfo* inElement, nsCString& inAttribute, ns nsresult rv = NS_OK; if ( inAttribute == nsDependentCString(kMIMEType) ) { - rv = inElement->SetMIMEType( inValue ); + rv = inElement->SetMIMEType( inValue.get() ); } else if ( inAttribute == nsDependentCString(kDescription) ) { PRUnichar* unicode; - convertUTF8ToUnicode( inValue, &unicode ); + convertUTF8ToUnicode( inValue.get(), &unicode ); rv =inElement->SetDescription( unicode ); nsTextFormatter::smprintf_free(unicode); } else if ( inAttribute == nsDependentCString(kExtensions) ) { - rv = inElement->SetFileExtensions( inValue ); + rv = inElement->SetFileExtensions( inValue.get() ); } else if ( inAttribute == nsDependentCString(kMacType) ) { PRUint32 value; - sscanf ( inValue, "%x", &value); + sscanf ( inValue.get(), "%x", &value); rv = inElement->SetMacType( value ); } else if ( inAttribute == nsDependentCString(kMacCreator) ) { PRUint32 value; - sscanf ( inValue, "%x", &value); + sscanf ( inValue.get(), "%x", &value); rv = inElement->SetMacCreator( value ); } diff --git a/mozilla/netwerk/protocol/about/src/nsAboutBloat.cpp b/mozilla/netwerk/protocol/about/src/nsAboutBloat.cpp index eb3406b18d2..d3ddffcb814 100644 --- a/mozilla/netwerk/protocol/about/src/nsAboutBloat.cpp +++ b/mozilla/netwerk/protocol/about/src/nsAboutBloat.cpp @@ -143,7 +143,7 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result) char time[128]; PR_FormatTimeUSEnglish(time, 128, "%Y-%m-%d-%H%M%S.txt", &expTime); dumpFileName += time; - rv = file->Append((const char*)dumpFileName); + rv = file->Append(dumpFileName.get()); if (NS_FAILED(rv)) return rv; char* nativePath; diff --git a/mozilla/netwerk/protocol/about/src/nsAboutCache.cpp b/mozilla/netwerk/protocol/about/src/nsAboutCache.cpp index 3dd53257f34..56dcff33f6d 100644 --- a/mozilla/netwerk/protocol/about/src/nsAboutCache.cpp +++ b/mozilla/netwerk/protocol/about/src/nsAboutCache.cpp @@ -121,7 +121,7 @@ nsAboutCache::NewChannel(nsIURI *aURI, nsIChannel **result) "\nInformation about the Cache Service\n\n" "\n
\n"); - outputStream->Write(mBuffer, mBuffer.Length(), &bytesWritten); + outputStream->Write(mBuffer.get(), mBuffer.Length(), &bytesWritten); rv = ParseURI(aURI, mDeviceID); if (NS_FAILED(rv)) return rv; @@ -135,7 +135,7 @@ nsAboutCache::NewChannel(nsIURI *aURI, nsIChannel **result) mBuffer.Append("\n"); } mBuffer.Append("
\n\n\n"); - outputStream->Write(mBuffer, mBuffer.Length(), &bytesWritten); + outputStream->Write(mBuffer.get(), mBuffer.Length(), &bytesWritten); nsCOMPtr inStr; PRUint32 size; @@ -215,7 +215,7 @@ nsAboutCache::VisitDevice(const char *deviceID, mBuffer.Append("
\n
\n");
         }
         
-        mStream->Write(mBuffer, mBuffer.Length(), &bytesWritten);
+        mStream->Write(mBuffer.get(), mBuffer.Length(), &bytesWritten);
     }
 
     return NS_OK;
@@ -300,7 +300,7 @@ nsAboutCache::VisitEntry(const char *deviceID,
     // Entry is done...
     mBuffer.Append("\n\n");
 
-    mStream->Write(mBuffer, mBuffer.Length(), &bytesWritten);
+    mStream->Write(mBuffer.get(), mBuffer.Length(), &bytesWritten);
 
     *visitNext = PR_TRUE;
     return NS_OK;
diff --git a/mozilla/netwerk/protocol/about/src/nsAboutCacheEntry.cpp b/mozilla/netwerk/protocol/about/src/nsAboutCacheEntry.cpp
index 7f211d408bc..5987cb62717 100644
--- a/mozilla/netwerk/protocol/about/src/nsAboutCacheEntry.cpp
+++ b/mozilla/netwerk/protocol/about/src/nsAboutCacheEntry.cpp
@@ -104,7 +104,7 @@ nsAboutCacheEntry::OnCacheEntryAvailable(nsICacheEntryDescriptor *descriptor,
                   "\n\n\n");
-    outputStream->Write(buffer, buffer.Length(), &n);
+    outputStream->Write(buffer.get(), buffer.Length(), &n);
 
     if (NS_SUCCEEDED(status))
         rv = WriteCacheEntryDescription(outputStream, descriptor);
@@ -113,7 +113,7 @@ nsAboutCacheEntry::OnCacheEntryAvailable(nsICacheEntryDescriptor *descriptor,
     if (NS_FAILED(rv)) return rv;
 
     buffer.Assign("\n\n");
-    outputStream->Write(buffer, buffer.Length(), &n);
+    outputStream->Write(buffer.get(), buffer.Length(), &n);
         
     nsCOMPtr inStr;
     PRUint32 size;
@@ -327,7 +327,7 @@ nsAboutCacheEntry::AsyncOpen(nsIStreamListener *listener, nsISupports *context)
         do_GetService(NS_CACHESERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv)) return rv;
 
-    rv = serv->CreateSession(clientID,
+    rv = serv->CreateSession(clientID.get(),
                              nsICache::STORE_ANYWHERE,
                              streamBased,
                              getter_AddRefs(mCacheSession));
@@ -339,7 +339,7 @@ nsAboutCacheEntry::AsyncOpen(nsIStreamListener *listener, nsISupports *context)
     mListener = listener;
     mListenerContext = context;
 
-    return mCacheSession->AsyncOpenCacheEntry(key, nsICache::ACCESS_READ, this);
+    return mCacheSession->AsyncOpenCacheEntry(key.get(), nsICache::ACCESS_READ, this);
 }
 
 
@@ -486,7 +486,7 @@ nsAboutCacheEntry::WriteCacheEntryDescription(nsIOutputStream *outputStream,
 
     buffer.Append("\n");
 
-    outputStream->Write(buffer, buffer.Length(), &n);
+    outputStream->Write(buffer.get(), buffer.Length(), &n);
     return NS_OK;
 }
 
@@ -497,7 +497,7 @@ nsAboutCacheEntry::WriteCacheEntryUnavailable(nsIOutputStream *outputStream,
     PRUint32 n;
     nsCAutoString buffer;
     buffer.Assign("The cache entry you selected is no longer available.");
-    outputStream->Write(buffer, buffer.Length(), &n);
+    outputStream->Write(buffer.get(), buffer.Length(), &n);
     return NS_OK;
 }
 
diff --git a/mozilla/netwerk/protocol/finger/src/nsFingerChannel.cpp b/mozilla/netwerk/protocol/finger/src/nsFingerChannel.cpp
index dffeae8ed5a..702ed9f8625 100644
--- a/mozilla/netwerk/protocol/finger/src/nsFingerChannel.cpp
+++ b/mozilla/netwerk/protocol/finger/src/nsFingerChannel.cpp
@@ -198,7 +198,7 @@ nsFingerChannel::Open(nsIInputStream **_retval)
              do_GetService(kSocketTransportServiceCID, &rv);
     if (NS_FAILED(rv)) return rv;
 
-    rv = socketService->CreateTransport(mHost, mPort, mProxyInfo, BUFFER_SEG_SIZE,
+    rv = socketService->CreateTransport(mHost.get(), mPort, mProxyInfo, BUFFER_SEG_SIZE,
             BUFFER_MAX_SIZE, getter_AddRefs(mTransport));
     if (NS_FAILED(rv)) return rv;
 
@@ -221,7 +221,7 @@ nsFingerChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
              do_GetService(kSocketTransportServiceCID, &rv);
     if (NS_FAILED(rv)) return rv;
 
-    rv = socketService->CreateTransport(mHost, mPort, mProxyInfo, BUFFER_SEG_SIZE,
+    rv = socketService->CreateTransport(mHost.get(), mPort, mProxyInfo, BUFFER_SEG_SIZE,
       BUFFER_MAX_SIZE, getter_AddRefs(mTransport));
     if (NS_FAILED(rv)) return rv;
 
diff --git a/mozilla/netwerk/protocol/ftp/src/nsFTPChannel.cpp b/mozilla/netwerk/protocol/ftp/src/nsFTPChannel.cpp
index 5c44210d4e8..eaa8c9c81a3 100644
--- a/mozilla/netwerk/protocol/ftp/src/nsFTPChannel.cpp
+++ b/mozilla/netwerk/protocol/ftp/src/nsFTPChannel.cpp
@@ -326,7 +326,7 @@ nsFTPChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt)
         nsCAutoString cacheKey;
         GenerateCacheKey(cacheKey);
 
-        return mCacheSession->AsyncOpenCacheEntry(cacheKey, accessRequested, this);
+        return mCacheSession->AsyncOpenCacheEntry(cacheKey.get(), accessRequested, this);
     }
     
     return SetupState();
diff --git a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
index 77e18e24c19..9d7a26bca39 100644
--- a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
+++ b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
@@ -505,7 +505,7 @@ nsFtpState::OnDataAvailable(nsIRequest *request,
     if (!mControlReadContinue)
         {
             if (mFTPEventSink)
-                mFTPEventSink->OnFTPControlLog(PR_TRUE, mResponseMsg);
+                mFTPEventSink->OnFTPControlLog(PR_TRUE, mResponseMsg.get());
 
         return Process();
         }
@@ -1228,7 +1228,7 @@ nsFtpState::SetContentType()
         SetDirMIMEType(fromStr);
 
         nsCAutoString contentType;contentType.AssignWithConversion(fromStr);
-        return mChannel->SetContentType(contentType);
+        return mChannel->SetContentType(contentType.get());
     }
 
     return mChannel->SetContentType("application/http-index-format");
@@ -1250,7 +1250,7 @@ nsFtpState::S_list() {
     if(mCacheEntry) {
         nsCAutoString serverType;
         serverType.AppendInt(mServerType);
-        (void) mCacheEntry->SetMetaDataElement("servertype", serverType);
+        (void) mCacheEntry->SetMetaDataElement("servertype", serverType.get());
     }
 
     nsCOMPtr converter;
@@ -1933,12 +1933,10 @@ nsFtpState::StopProcessing() {
     {
         // check to see if the control status is bad.
         // web shell wont throw an alert.  we better:
-        nsAutoString    text;
-        text.AssignWithConversion(mResponseMsg);
         
         NS_ASSERTION(mPrompter, "no prompter!");
         if (mPrompter)
-            (void) mPrompter->Alert(nsnull, text.get());
+            (void) mPrompter->Alert(nsnull, NS_ConvertASCIItoUCS2(mResponseMsg).get());
     }
     
     nsresult broadcastErrorCode = mControlStatus;
diff --git a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp
index d890874edfc..0794af8e196 100644
--- a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp
+++ b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp
@@ -183,7 +183,7 @@ nsHttpChannel::Init(nsIURI *uri,
         hostLine.Append(':');
         hostLine.AppendInt(port);
     }
-    rv = mRequestHead.SetHeader(nsHttp::Host, hostLine);
+    rv = mRequestHead.SetHeader(nsHttp::Host, hostLine.get());
     if (NS_FAILED(rv)) return rv;
 
     rv = nsHttpHandler::get()->
@@ -695,11 +695,11 @@ nsHttpChannel::OpenCacheEntry(PRBool *delayed)
     // we'll try to synchronously open the cache entry... however, it may be
     // in use and not yet validated, in which case we'll try asynchronously
     // opening the cache entry.
-    rv = session->OpenCacheEntry(cacheKey, accessRequested, PR_FALSE,
+    rv = session->OpenCacheEntry(cacheKey.get(), accessRequested, PR_FALSE,
                                  getter_AddRefs(mCacheEntry));
     if (rv == NS_ERROR_CACHE_WAIT_FOR_VALIDATION) {
         // access to the cache entry has been denied
-        rv = session->AsyncOpenCacheEntry(cacheKey, accessRequested, this);
+        rv = session->AsyncOpenCacheEntry(cacheKey.get(), accessRequested, this);
         if (NS_FAILED(rv)) return rv;
         // we'll have to wait for the cache entry
         *delayed = PR_TRUE;
@@ -1270,9 +1270,9 @@ nsHttpChannel::ProcessAuthentication(PRUint32 httpStatus)
 
     // set the authentication credentials
     if (proxyAuth)
-        mRequestHead.SetHeader(nsHttp::Proxy_Authorization, creds);
+        mRequestHead.SetHeader(nsHttp::Proxy_Authorization, creds.get());
     else
-        mRequestHead.SetHeader(nsHttp::Authorization, creds);
+        mRequestHead.SetHeader(nsHttp::Authorization, creds.get());
 
     // kill off the current transaction
     mTransaction->Cancel(NS_BINDING_REDIRECTED);
@@ -1458,7 +1458,7 @@ nsHttpChannel::GetAuthenticator(const char *scheme, nsIHttpAuthenticator **auth)
     contractid.Append(scheme);
 
     nsresult rv;
-    nsCOMPtr serv = do_GetService(contractid, &rv);
+    nsCOMPtr serv = do_GetService(contractid.get(), &rv);
     if (NS_FAILED(rv)) return rv;
 
     *auth = serv;
@@ -2074,7 +2074,7 @@ nsHttpChannel::SetReferrer(nsIURI *referrer, PRUint32 referrerType)
                 PRUint32 prehostLoc = PRUint32(ref.Find(prehost, PR_TRUE));
                 ref.Cut(prehostLoc, nsCharTraits::length(prehost) + 1); // + 1 for @
             }
-            mRequestHead.SetHeader(nsHttp::Referer, ref);
+            mRequestHead.SetHeader(nsHttp::Referer, ref.get());
         }
     }
     return NS_OK;
diff --git a/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp b/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp
index 9af97d9934b..4849bdc52b2 100644
--- a/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp
+++ b/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp
@@ -333,7 +333,7 @@ nsHttpHandler::IsAcceptableEncoding(const char *enc)
     if (!PL_strncasecmp(enc, "x-", 2))
         enc += 2;
     
-    return PL_strcasestr(mAcceptEncodings, enc) != nsnull;
+    return PL_strcasestr(mAcceptEncodings.get(), enc) != nsnull;
 }
 
 nsresult
diff --git a/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp b/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp
index db0c6e4e6a4..eb16e8ea192 100644
--- a/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp
+++ b/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp
@@ -89,7 +89,7 @@ nsJARURI::FormatSpec(const char* entryPath, char* *result)
     spec += NS_JAR_DELIMITER;
     spec += entryPath;
     
-    *result = nsCRT::strdup(spec);
+    *result = ToNewCString(spec);
     return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
@@ -147,7 +147,7 @@ nsJARURI::SetSpec(const char * aSpec)
     jarPath.Cut(pos, jarPath.Length());
     jarPath.Cut(0, endPos);
 
-    rv = serv->NewURI(jarPath, nsnull, getter_AddRefs(mJARFile));
+    rv = serv->NewURI(jarPath.get(), nsnull, getter_AddRefs(mJARFile));
     if (NS_FAILED(rv)) return rv;
 
     nsCAutoString entry(aSpec);
@@ -155,7 +155,7 @@ nsJARURI::SetSpec(const char * aSpec)
     while (entry.CharAt(0) == '/')
         entry.Cut(0,1); // Strip any additional leading slashes from entry path
 
-    rv = serv->ResolveRelativePath(entry, nsnull, &mJAREntry);
+    rv = serv->ResolveRelativePath(entry.get(), nsnull, &mJAREntry);
     return rv;
 }
 
diff --git a/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp b/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp
index 24591eb11db..c7d01267c31 100644
--- a/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp
+++ b/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp
@@ -276,10 +276,10 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr) {
       
       if (gTextToSubURI) {
         PRUnichar   *result = nsnull;
-        if (NS_SUCCEEDED(rv = gTextToSubURI->UnEscapeAndConvert(mEncoding.get(), filename,
+        if (NS_SUCCEEDED(rv = gTextToSubURI->UnEscapeAndConvert(mEncoding.get(), filename.get(),
                                                                 &result)) && (result)) {
           if (nsCRT::strlen(result) > 0) {
-            aIdx->SetLocation(filename);
+            aIdx->SetLocation(filename.get());
             if (!mHasDescription)
               aIdx->SetDescription(result);
             success = PR_TRUE;
@@ -295,7 +295,7 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr) {
         // just fallback to unescape'ing in-place
         // XXX - this shouldn't be using UTF8, should it?
         // when can we fail to get the service, anyway? - bbaetz
-        aIdx->SetLocation(filename);
+        aIdx->SetLocation(filename.get());
         if (!mHasDescription) {
           aIdx->SetDescription(NS_ConvertUTF8toUCS2(value).get());
         }
diff --git a/mozilla/netwerk/streamconv/converters/nsMultiMixedConv.cpp b/mozilla/netwerk/streamconv/converters/nsMultiMixedConv.cpp
index 68bf6b21c99..807abf05099 100644
--- a/mozilla/netwerk/streamconv/converters/nsMultiMixedConv.cpp
+++ b/mozilla/netwerk/streamconv/converters/nsMultiMixedConv.cpp
@@ -714,7 +714,7 @@ nsMultiMixedConv::SendStart(nsIChannel *aChannel) {
     // Set up the new part channel...
     mPartChannel = newChannel;
 
-    rv = mPartChannel->SetContentType(mContentType);
+    rv = mPartChannel->SetContentType(mContentType.get());
     if (NS_FAILED(rv)) return rv;
 
     mPartChannel->SetContentLength(mContentLength);
@@ -871,7 +871,7 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr,
                 // it's header observers.
                 nsCOMPtr httpChannel = do_QueryInterface(aChannel);
                 if (httpChannel) {
-                    rv = httpChannel->SetResponseHeader(headerStr, headerVal);
+                    rv = httpChannel->SetResponseHeader(headerStr.get(), headerVal.get());
                     if (NS_FAILED(rv)) return rv;
                 }
             } else if (headerStr.EqualsIgnoreCase("content-range") || 
diff --git a/mozilla/netwerk/streamconv/converters/nsUnknownDecoder.cpp b/mozilla/netwerk/streamconv/converters/nsUnknownDecoder.cpp
index 95849e9b853..d16848fb6b5 100644
--- a/mozilla/netwerk/streamconv/converters/nsUnknownDecoder.cpp
+++ b/mozilla/netwerk/streamconv/converters/nsUnknownDecoder.cpp
@@ -418,7 +418,7 @@ nsresult nsUnknownDecoder::FireListenerNotifications(nsIRequest* request,
   if (NS_FAILED(rv)) return rv;
 
   // Set the new content type on the channel...
-  rv = channel->SetContentType(mContentType);
+  rv = channel->SetContentType(mContentType.get());
 
   NS_ASSERTION(NS_SUCCEEDED(rv), "Unable to set content type on channel!");
   if (NS_FAILED(rv))
diff --git a/mozilla/netwerk/test/TestDBMAccess.cpp b/mozilla/netwerk/test/TestDBMAccess.cpp
index 11aac5b56ef..8d5dc1839e1 100644
--- a/mozilla/netwerk/test/TestDBMAccess.cpp
+++ b/mozilla/netwerk/test/TestDBMAccess.cpp
@@ -188,7 +188,7 @@ writeFile(int cycles)
         for (x=0; x<32; x++) {
             nsCAutoString filename; filename.Assign(TMPDIR "foo" DIRSEP);
             filename.AppendInt(x);
-            PR_MakeDir(filename, 0755);
+            PR_MakeDir(filename.get(), 0755);
         }
         
         // create "cache" files
@@ -201,7 +201,7 @@ writeFile(int cycles)
             PRIntervalTime i1, i2, i3;
             i1 = PR_IntervalNow();
 
-            fd = PR_OpenFile(filename, PR_WRONLY|PR_TRUNCATE, 0644);
+            fd = PR_OpenFile(filename.get(), PR_WRONLY|PR_TRUNCATE, 0644);
             if (!fd)
                 printf("bad filename?  %s\n", filename.get());
 
@@ -218,7 +218,7 @@ writeFile(int cycles)
 
 /*
             printf(" - writing %s [topen=%d twrite=%d]\n", 
-                (const char *) filename,
+                   filename.get(),
                 PR_IntervalToMilliseconds(i2 - i1), 
                 PR_IntervalToMilliseconds(i3 - i2));
 */
@@ -244,7 +244,7 @@ readFile(int cycles)
             filename.Append(DIRSEP);
             filename.AppendInt( x );
             
-            fd = PR_OpenFile(filename, PR_RDONLY, 0);
+            fd = PR_OpenFile(filename.get(), PR_RDONLY, 0);
             
             PRInt32 size = PR_Available(fd);
             
diff --git a/mozilla/netwerk/test/TestFileTransport.cpp b/mozilla/netwerk/test/TestFileTransport.cpp
index 4352eea2dcb..5009ec2f6c5 100644
--- a/mozilla/netwerk/test/TestFileTransport.cpp
+++ b/mozilla/netwerk/test/TestFileTransport.cpp
@@ -164,7 +164,7 @@ public:
         nsCAutoString str(name);
         nsMemory::Free(name);
         str.Append(".bak");
-        rv = file->SetLeafName(str);
+        rv = file->SetLeafName(str.get());
         if (NS_FAILED(rv)) return rv;
         rv = NS_NewLocalFileOutputStream(getter_AddRefs(mOut),
                                          file, 
@@ -255,7 +255,7 @@ TestAsyncWrite(const char* fileName, PRUint32 offset, PRInt32 length)
     outFile.Append(".out");
     nsITransport* fileTrans;
     nsCOMPtr file;
-    rv = NS_NewLocalFile(outFile, PR_FALSE, getter_AddRefs(file));
+    rv = NS_NewLocalFile(outFile.get(), PR_FALSE, getter_AddRefs(file));
     if (NS_FAILED(rv)) return rv;
     rv = fts->CreateTransport(file,
                               PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE,
@@ -266,7 +266,7 @@ TestAsyncWrite(const char* fileName, PRUint32 offset, PRInt32 length)
     if (listener == nsnull)
         return NS_ERROR_OUT_OF_MEMORY;
     NS_ADDREF(listener);
-    rv = listener->Init(outFile);
+    rv = listener->Init(outFile.get());
     if (NS_FAILED(rv)) return rv;
 
     MyProgressEventSink* progressSink = new MyProgressEventSink();
diff --git a/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp b/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp
index b9f8a2b238d..e31e854e804 100644
--- a/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp
+++ b/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp
@@ -211,7 +211,7 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions )
 	PRInt32 breakLocation = -1;
 	while ( (breakLocation= extList.FindCharInSet( ",",0 ) )!= -1)
 	{
-		nsCString ext( extList, breakLocation );
+		nsCString ext( extList.get(), breakLocation );
 		mExtensions.AppendCString( ext );
 		extList.Cut(0, breakLocation+1 );
 	}
@@ -344,7 +344,7 @@ void nsMIMEInfoImpl::SetRememberPrefForMimeType(const char * prefName)
 
     // always escape the pref b4 storing it in case someone enters some funky characters for a mime type...
     nsXPIDLCString escapedPrefString;
-    *((char **)getter_Copies(escapedPrefString)) = nsEscape(prefValue, url_XAlphas);
+    escapedPrefString.Adopt(nsEscape(prefValue.get(), url_XAlphas));
     prefBranch->SetCharPref(prefName, escapedPrefString);
   }
 }