From 640c7f02abdafcb72efd03c4e0f2fd186d0aa446 Mon Sep 17 00:00:00 2001 From: "jaggernaut%netscape.com" Date: Thu, 1 Nov 2001 09:09:57 +0000 Subject: [PATCH] Bug 53057: Fixing up users of implicit |CharT*| conversion operators for nsCString to use |.get()| instead, rr=dbaron, rs=scc git-svn-id: svn://10.0.0.236/trunk@106946 18797224-902f-48f8-a5cc-f745e15eee43 --- .../activex/src/control/PropertyDlg.cpp | 6 +- .../embedding/tests/mfcembed/BrowserView.cpp | 2 +- .../mailnews/addrbook/src/nsAbOutlookCard.cpp | 2 +- .../addrbook/src/nsAbOutlookDirFactory.cpp | 2 +- .../addrbook/src/nsAbOutlookDirectory.cpp | 18 ++--- .../base/src/nsMessengerWinIntegration.cpp | 2 +- .../import/eudora/src/nsEudoraAddress.cpp | 18 ++--- .../import/eudora/src/nsEudoraCompose.cpp | 22 +++--- .../import/eudora/src/nsEudoraCompose.h | 2 +- .../import/eudora/src/nsEudoraMailbox.cpp | 4 +- .../import/eudora/src/nsEudoraWin32.cpp | 76 +++++++++---------- .../import/oexpress/nsOEScanBoxes.cpp | 4 +- .../mailnews/import/oexpress/nsOESettings.cpp | 2 +- .../mailnews/import/outlook/src/MapiApi.cpp | 2 +- .../import/outlook/src/MapiMessage.cpp | 8 +- .../mailnews/import/outlook/src/MapiMessage.h | 18 ++--- .../import/outlook/src/MapiMimeTypes.cpp | 2 +- .../import/outlook/src/nsOutlookCompose.cpp | 22 +++--- .../import/outlook/src/nsOutlookCompose.h | 2 +- .../import/outlook/src/nsOutlookMail.cpp | 2 +- .../libpr0n/decoders/icon/nsIconURI.cpp | 4 +- .../exthandler/win/nsOSHelperAppService.cpp | 8 +- mozilla/widget/src/windows/nsFilePicker.cpp | 6 +- mozilla/xpcom/io/nsLocalFileWin.cpp | 29 +++---- .../xpfe/bootstrap/nsNativeAppSupportWin.cpp | 4 +- .../winhooks/nsWindowsHooksUtil.cpp | 40 +++++----- 26 files changed, 154 insertions(+), 153 deletions(-) diff --git a/mozilla/embedding/browser/activex/src/control/PropertyDlg.cpp b/mozilla/embedding/browser/activex/src/control/PropertyDlg.cpp index 061f223ade8..8014270c4e9 100644 --- a/mozilla/embedding/browser/activex/src/control/PropertyDlg.cpp +++ b/mozilla/embedding/browser/activex/src/control/PropertyDlg.cpp @@ -96,8 +96,8 @@ LRESULT CPropertyDlg::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bH LRESULT CPPageDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - SetDlgItemText(IDC_PROTOCOL, mProtocol); - SetDlgItemText(IDC_TYPE, mType); - SetDlgItemText(IDC_ADDRESS, mURL); + SetDlgItemText(IDC_PROTOCOL, mProtocol.get()); + SetDlgItemText(IDC_TYPE, mType.get()); + SetDlgItemText(IDC_ADDRESS, mURL.get()); return 1; } diff --git a/mozilla/embedding/tests/mfcembed/BrowserView.cpp b/mozilla/embedding/tests/mfcembed/BrowserView.cpp index 5000182d94b..0a7675c8bba 100644 --- a/mozilla/embedding/tests/mfcembed/BrowserView.cpp +++ b/mozilla/embedding/tests/mfcembed/BrowserView.cpp @@ -642,7 +642,7 @@ void CBrowserView::OnFileSaveAs() "Web Page, Complete (*.htm;*.html)|*.htm;*.html|" "Text File (*.txt)|*.txt||"; - CFileDialog cf(FALSE, "htm", (const char *)fileName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + CFileDialog cf(FALSE, "htm", fileName.get(), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, lpszFilter, this); if(cf.DoModal() == IDOK) diff --git a/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp b/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp index ecb6281cd9b..f2d1b2cda92 100644 --- a/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp +++ b/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp @@ -197,7 +197,7 @@ nsresult nsAbOutlookCard::Init(const char *aUri) if (cardType == MAPI_DISTLIST) { buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, normalChars) ; normalChars.Append(entry) ; - SetMailListURI(normalChars) ; + SetMailListURI(normalChars.get()) ; } } nsAutoString unichar ; diff --git a/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp b/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp index f74cddd27a7..8161b2b8648 100644 --- a/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp +++ b/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp @@ -139,7 +139,7 @@ NS_IMETHODIMP nsAbOutlookDirFactory::CreateDirectory(PRUint32 aNbProperties, buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ; uri.Append(entryId) ; - retCode = rdf->GetResource(uri, getter_AddRefs(resource)) ; + retCode = rdf->GetResource(uri.get(), getter_AddRefs(resource)) ; NS_ENSURE_SUCCESS(retCode, retCode) ; directories->AppendElement(resource) ; } diff --git a/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp b/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp index 5d5006d47e8..e63ea42dcb9 100644 --- a/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp +++ b/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp @@ -111,7 +111,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::Init(const char *aUri) nsCAutoString entry ; nsCAutoString stub ; - mAbWinType = getAbWinType(kOutlookDirectoryScheme, mURINoQuery, stub, entry) ; + mAbWinType = getAbWinType(kOutlookDirectoryScheme, mURINoQuery.get(), stub, entry) ; if (mAbWinType == nsAbWinType_Unknown) { PRINTF(("Huge problem URI=%s.\n", mURINoQuery)) ; return NS_ERROR_INVALID_ARG ; @@ -421,7 +421,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::AddMailList(nsIAbDirectory *aMailList) buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uri) ; uri.Append(entryString) ; nsCOMPtr resource ; - retCode = gRDFService->GetResource(uri, getter_AddRefs(resource)) ; + retCode = gRDFService->GetResource(uri.get(), getter_AddRefs(resource)) ; NS_ENSURE_SUCCESS(retCode, retCode) ; nsCOMPtr newList(do_QueryInterface(resource, &retCode)) ; @@ -429,7 +429,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::AddMailList(nsIAbDirectory *aMailList) if (!didCopy) { retCode = newList->CopyMailList(aMailList) ; NS_ENSURE_SUCCESS(retCode, retCode) ; - retCode = newList->EditMailListToDatabase(mURINoQuery) ; + retCode = newList->EditMailListToDatabase(mURINoQuery.get()) ; NS_ENSURE_SUCCESS(retCode, retCode) ; } m_AddressList->AppendElement(newList) ; @@ -873,7 +873,7 @@ nsresult FillPropertyValues(nsIAbCard *aCard, nsIAbDirectoryQueryArguments *aArg nsCOMPtr bogusInterface (do_QueryInterface(aCard, &retCode)) ; NS_ENSURE_SUCCESS(retCode, retCode) ; - newValue = new nsAbDirectoryQueryPropertyValue (cPropName, bogusInterface) ; + newValue = new nsAbDirectoryQueryPropertyValue (cPropName.get(), bogusInterface) ; } else if (cPropName.EqualsWithConversion ("card:URI")) { nsCOMPtr rdfResource (do_QueryInterface(aCard, &retCode)) ; @@ -889,7 +889,7 @@ nsresult FillPropertyValues(nsIAbCard *aCard, nsIAbDirectoryQueryArguments *aArg else { nsXPIDLString value ; - retCode = aCard->GetCardValue(cPropName, getter_Copies(value)) ; + retCode = aCard->GetCardValue(cPropName.get(), getter_Copies(value)) ; NS_ENSURE_SUCCESS(retCode, retCode) ; if (value.get() && nsCRT::strlen(value.get()) != 0) { newValue = new nsAbDirectoryQueryPropertyValue(cPropName.get(), value.get()) ; @@ -1123,7 +1123,7 @@ nsresult nsAbOutlookDirectory::GetChildCards(nsISupportsArray **aCards, cardEntries.mEntries [card].ToString(entryId) ; buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ; uriName.Append(entryId) ; - retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ; + retCode = gRDFService->GetResource(uriName.get(), getter_AddRefs(resource)) ; NS_ENSURE_SUCCESS(retCode, retCode) ; cards->AppendElement(resource) ; } @@ -1156,7 +1156,7 @@ nsresult nsAbOutlookDirectory::GetChildNodes(nsISupportsArray **aNodes) nodeEntries.mEntries [node].ToString(entryId) ; buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ; uriName.Append(entryId) ; - retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ; + retCode = gRDFService->GetResource(uriName.get(), getter_AddRefs(resource)) ; NS_ENSURE_SUCCESS(retCode, retCode) ; nodes->AppendElement(resource) ; } @@ -1304,7 +1304,7 @@ nsresult nsAbOutlookDirectory::CreateCard(nsIAbCard *aData, nsIAbCard **aNewCard uri.Append(entryString) ; nsCOMPtr resource ; - retCode = gRDFService->GetResource(uri, getter_AddRefs(resource)) ; + retCode = gRDFService->GetResource(uri.get(), getter_AddRefs(resource)) ; NS_ENSURE_SUCCESS(retCode, retCode) ; nsCOMPtr newCard(do_QueryInterface(resource, &retCode)) ; @@ -1312,7 +1312,7 @@ nsresult nsAbOutlookDirectory::CreateCard(nsIAbCard *aData, nsIAbCard **aNewCard if (!didCopy) { retCode = newCard->Copy(aData) ; NS_ENSURE_SUCCESS(retCode, retCode) ; - retCode = newCard->EditCardToDatabase(mURINoQuery) ; + retCode = newCard->EditCardToDatabase(mURINoQuery.get()) ; NS_ENSURE_SUCCESS(retCode, retCode) ; } *aNewCard = newCard ; diff --git a/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp b/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp index c6932539a9d..4d77e8236ab 100644 --- a/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp +++ b/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp @@ -161,7 +161,7 @@ nsMessengerWinIntegration::Init() mShellDllPath.Append(SHELL32_DLL); // load shell dll. If no such dll found, return - HMODULE hModule = ::LoadLibrary(mShellDllPath); + HMODULE hModule = ::LoadLibrary(mShellDllPath.get()); if (!hModule) return NS_OK; diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp index fc9025d8c0d..385de798790 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp +++ b/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp @@ -536,22 +536,22 @@ void DumpAliasArray( nsVoidArray& a) IMPORT_LOG1( "Alias list size: %ld\n", cnt); for (PRInt32 i = 0; i < cnt; i++) { pEntry = (CAliasEntry *)a.ElementAt( i); - IMPORT_LOG1( "\tAlias: %s\n", (const char *)pEntry->m_name); + IMPORT_LOG1( "\tAlias: %s\n", pEntry->m_name.get()); if (pEntry->m_list.Count() > 1) { IMPORT_LOG1( "\tList count #%ld\n", pEntry->m_list.Count()); for (PRInt32 j = 0; j < pEntry->m_list.Count(); j++) { pData = (CAliasData *) pEntry->m_list.ElementAt( j); IMPORT_LOG0( "\t\t--------\n"); - IMPORT_LOG1( "\t\temail: %s\n", (const char *)pData->m_email); - IMPORT_LOG1( "\t\trealName: %s\n", (const char *)pData->m_realName); - IMPORT_LOG1( "\t\tnickName: %s\n", (const char *)pData->m_nickName); + IMPORT_LOG1( "\t\temail: %s\n", pData->m_email.get()); + IMPORT_LOG1( "\t\trealName: %s\n", pData->m_realName.get()); + IMPORT_LOG1( "\t\tnickName: %s\n", pData->m_nickName.get()); } } else { pData = (CAliasData *) pEntry->m_list.ElementAt( 0); - IMPORT_LOG1( "\t\temail: %s\n", (const char *)pData->m_email); - IMPORT_LOG1( "\t\trealName: %s\n", (const char *)pData->m_realName); - IMPORT_LOG1( "\t\tnickName: %s\n", (const char *)pData->m_nickName); + IMPORT_LOG1( "\t\temail: %s\n", pData->m_email.get()); + IMPORT_LOG1( "\t\trealName: %s\n", pData->m_realName.get()); + IMPORT_LOG1( "\t\tnickName: %s\n", pData->m_nickName.get()); } } } @@ -563,7 +563,7 @@ CAliasEntry *nsEudoraAddress::ResolveAlias( nsCString& name) CAliasEntry *pEntry; for (PRInt32 i = 0; i < max; i++) { pEntry = (CAliasEntry *) m_alias.ElementAt( i); - if (!name.CompareWithConversion( pEntry->m_name, PR_TRUE)) + if (!name.CompareWithConversion( pEntry->m_name.get(), PR_TRUE)) return( pEntry); } @@ -583,7 +583,7 @@ void nsEudoraAddress::ResolveEntries( nsCString& name, nsVoidArray& list, nsVoid for (i = 0; i < max; i++) { pData = (CAliasData *)list.ElementAt( i); // resolve the email to an existing alias! - if (name.CompareWithConversion( (const char *)pData->m_email, PR_TRUE) && ((pEntry = ResolveAlias( pData->m_email)) != nsnull)) { + if (name.CompareWithConversion( pData->m_email.get(), PR_TRUE) && ((pEntry = ResolveAlias( pData->m_email)) != nsnull)) { // This new entry has all of the entries for this puppie. // Resolve all of it's entries! ResolveEntries( pEntry->m_name, pEntry->m_list, result); diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraCompose.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraCompose.cpp index e4303268026..51cb7a6cf08 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraCompose.cpp +++ b/mozilla/mailnews/import/eudora/src/nsEudoraCompose.cpp @@ -708,7 +708,7 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg) nsIMsgSend::nsMsgDeliverNow, // mode nsnull, // no message to replace pMimeType, // body type - body, // body pointer + body.get(), // body pointer body.Length(), // body length nsnull, // remote attachment data pAttach, // local attachments @@ -922,7 +922,7 @@ nsresult nsEudoraCompose::CopyComposedMessage( nsCString& fromLine, nsIFileSpec } PRInt32 written; - rv = pDst->Write( fromLine, fromLine.Length(), &written); + rv = pDst->Write( fromLine.get(), fromLine.Length(), &written); // well, isn't this a hoot! // Read the headers from the new message, get the ones we like @@ -1070,26 +1070,26 @@ nsresult nsEudoraCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCopi GetNthHeader( m_pHeaders, m_headerLen, n, header, val, PR_FALSE); // GetNthHeader( newHeaders.m_pBuffer, newHeaders.m_writeOffset, n, header, val, PR_FALSE); if (header.Length()) { - if ((specialHeader = IsSpecialHeader( header)) != -1) { + if ((specialHeader = IsSpecialHeader( header.get())) != -1) { header.Append( ':'); - GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header, val, PR_FALSE); + GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), val, PR_FALSE); header.Truncate( header.Length() - 1); specials[specialHeader] = PR_TRUE; } - else if (IsReplaceHeader( header)) { + else if (IsReplaceHeader( header.get())) { replaceVal.Truncate( 0); header.Append( ':'); - GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header, replaceVal, PR_FALSE); + GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), replaceVal, PR_FALSE); header.Truncate( header.Length() - 1); if (replaceVal.Length()) val = replaceVal; } if (val.Length()) { - rv = pDst->Write( (const char *)header, header.Length(), &written); + rv = pDst->Write( header.get(), header.Length(), &written); if (NS_SUCCEEDED( rv)) rv = pDst->Write( ": ", 2, &written); if (NS_SUCCEEDED( rv)) - rv = pDst->Write( (const char *)val, val.Length(), &written); + rv = pDst->Write( val.get(), val.Length(), &written); if (NS_SUCCEEDED( rv)) rv = pDst->Write( "\x0D\x0A", 2, &written); @@ -1102,14 +1102,14 @@ nsresult nsEudoraCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCopi if (!specials[i]) { header = gSpecialHeaders[i]; header.Append( ':'); - GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header, val, PR_FALSE); + GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), val, PR_FALSE); header.Truncate( header.Length() - 1); if (val.Length()) { - rv = pDst->Write( (const char *)header, header.Length(), &written); + rv = pDst->Write( header.get(), header.Length(), &written); if (NS_SUCCEEDED( rv)) rv = pDst->Write( ": ", 2, &written); if (NS_SUCCEEDED( rv)) - rv = pDst->Write( (const char *)val, val.Length(), &written); + rv = pDst->Write( val.get(), val.Length(), &written); if (NS_SUCCEEDED( rv)) rv = pDst->Write( "\x0D\x0A", 2, &written); } diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraCompose.h b/mozilla/mailnews/import/eudora/src/nsEudoraCompose.h index 5a6d37f9307..f66861bb167 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraCompose.h +++ b/mozilla/mailnews/import/eudora/src/nsEudoraCompose.h @@ -129,7 +129,7 @@ private: val.Truncate(); nsCString hVal; GetHeaderValue( pData, dataLen, pHeader, hVal, PR_TRUE); - ConvertSysToUnicode( hVal, val); + ConvertSysToUnicode( hVal.get(), val); } void ExtractCharset( nsString& str); void ExtractType( nsString& str); diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraMailbox.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraMailbox.cpp index 939d4137de2..395380eb84f 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraMailbox.cpp +++ b/mozilla/mailnews/import/eudora/src/nsEudoraMailbox.cpp @@ -1015,7 +1015,7 @@ nsresult nsEudoraMailbox::ExamineAttachment( SimpleBufferTonyRCopiedOnce& data) PRBool nsEudoraMailbox::AddAttachment( nsCString& fileName) { - IMPORT_LOG1( "Found attachment: %s\n", (const char *)fileName); + IMPORT_LOG1( "Found attachment: %s\n", fileName.get()); nsIFileSpec * pSpec; nsresult rv = NS_NewFileSpec( &pSpec); @@ -1023,7 +1023,7 @@ PRBool nsEudoraMailbox::AddAttachment( nsCString& fileName) return( PR_FALSE); nsCString mimeType; - if (NS_FAILED( GetAttachmentInfo( fileName, pSpec, mimeType))) { + if (NS_FAILED( GetAttachmentInfo( fileName.get(), pSpec, mimeType))) { NS_RELEASE( pSpec); return( PR_FALSE); } diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraWin32.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraWin32.cpp index 8e50268cb1d..24f3803f7ae 100644 --- a/mozilla/mailnews/import/eudora/src/nsEudoraWin32.cpp +++ b/mozilla/mailnews/import/eudora/src/nsEudoraWin32.cpp @@ -151,10 +151,10 @@ PRBool nsEudoraWin32::FindEudoraLocation( nsIFileSpec *pFolder, PRBool findIni) ConvertPath( path); - IMPORT_LOG1( "** GetShortPath returned: %s\n", (const char *)path); + IMPORT_LOG1( "** GetShortPath returned: %s\n", path.get()); */ - pFolder->SetNativePath( path); + pFolder->SetNativePath( path.get()); PRBool exists = PR_FALSE; if (findIni) { if (NS_SUCCEEDED( pFolder->IsFile( &exists))) { @@ -281,7 +281,7 @@ nsresult nsEudoraWin32::IterateMailDir( nsIFileSpec *pFolder, nsISupportsArray * entry->IsDirectory( &isFolder); if (isFolder) { // add the folder - rv = FoundMailFolder( entry, name, pArray, pImport); + rv = FoundMailFolder( entry, name.get(), pArray, pImport); if (NS_SUCCEEDED( rv)) { rv = ScanMailDir( entry, pArray, pImport); if (NS_FAILED( rv)) { @@ -294,7 +294,7 @@ nsresult nsEudoraWin32::IterateMailDir( nsIFileSpec *pFolder, nsISupportsArray * isFile = PR_FALSE; entry->IsFile( &isFile); if (isFile) { - rv = FoundMailbox( entry, name, pArray, pImport); + rv = FoundMailbox( entry, name.get(), pArray, pImport); } } } @@ -387,17 +387,17 @@ nsresult nsEudoraWin32::ScanDescmap( nsIFileSpec *pFolder, nsISupportsArray *pAr pData++; } - IMPORT_LOG2( "name: %s, fName: %s\n", (const char *)name, (const char *)fName); + IMPORT_LOG2( "name: %s, fName: %s\n", name.get(), fName.get()); if (fName.Length() && name.Length() && (type.Length() == 1)) { entry->FromFileSpec( pFolder); - rv = entry->AppendRelativeUnixPath( fName); + rv = entry->AppendRelativeUnixPath( fName.get()); if (NS_SUCCEEDED( rv)) { if (type.CharAt( 0) == 'F') { isFolder = PR_FALSE; entry->IsDirectory( &isFolder); if (isFolder) { - rv = FoundMailFolder( entry, name, pArray, pImport); + rv = FoundMailFolder( entry, name.get(), pArray, pImport); if (NS_SUCCEEDED( rv)) { rv = ScanMailDir( entry, pArray, pImport); if (NS_FAILED( rv)) { @@ -410,7 +410,7 @@ nsresult nsEudoraWin32::ScanDescmap( nsIFileSpec *pFolder, nsISupportsArray *pAr isFile = PR_FALSE; entry->IsFile( &isFile); if (isFile) { - FoundMailbox( entry, name, pArray, pImport); + FoundMailbox( entry, name.get(), pArray, pImport); } } } @@ -528,7 +528,7 @@ nsresult nsEudoraWin32::FindTOCFile( nsIFileSpec *pMailFile, nsIFileSpec **ppTOC else name = leaf; name.Append( ".toc"); - rv = (*ppTOCFile)->AppendRelativeUnixPath( name); + rv = (*ppTOCFile)->AppendRelativeUnixPath( name.get()); if (NS_FAILED( rv)) return( rv); @@ -583,7 +583,7 @@ PRBool nsEudoraWin32::ImportSettings( nsIFileSpec *pIniFile, nsIMsgAccount **loc do { allocSize += 2048; section.Allocate( allocSize); - sSize = ::GetPrivateProfileSection( "Personalities", section.m_pBuffer, allocSize, iniPath); + sSize = ::GetPrivateProfileSection( "Personalities", section.m_pBuffer, allocSize, iniPath.get()); } while (sSize == (allocSize - 2)); nsIMsgAccount * pAccount; @@ -591,10 +591,10 @@ PRBool nsEudoraWin32::ImportSettings( nsIFileSpec *pIniFile, nsIMsgAccount **loc do { if (sectionName.Length()) { pAccount = nsnull; - valInt = ::GetPrivateProfileInt( sectionName, "UsesPOP", 1, iniPath); + valInt = ::GetPrivateProfileInt( sectionName.get(), "UsesPOP", 1, iniPath.get()); if (valInt) { // This is a POP account - if (BuildPOPAccount( accMgr, sectionName, iniPath, &pAccount)) { + if (BuildPOPAccount( accMgr, sectionName.get(), iniPath.get(), &pAccount)) { accounts++; popCount++; if (popCount > 1) { @@ -612,10 +612,10 @@ PRBool nsEudoraWin32::ImportSettings( nsIFileSpec *pIniFile, nsIMsgAccount **loc } } else { - valInt = ::GetPrivateProfileInt( sectionName, "UsesIMAP", 0, iniPath); + valInt = ::GetPrivateProfileInt( sectionName.get(), "UsesIMAP", 0, iniPath.get()); if (valInt) { // This is an IMAP account - if (BuildIMAPAccount( accMgr, sectionName, iniPath, &pAccount)) { + if (BuildIMAPAccount( accMgr, sectionName.get(), iniPath.get(), &pAccount)) { accounts++; } } @@ -709,7 +709,7 @@ void nsEudoraWin32::GetAccountName( const char *pSection, nsString& str) s.Left( tStr, 8); if (!tStr.CompareWithConversion( "Persona-", PR_TRUE)) { s.Right( tStr, s.Length() - 8); - str.AssignWithConversion((const char *)tStr); + str.AssignWithConversion(tStr.get()); } } } @@ -734,16 +734,16 @@ PRBool nsEudoraWin32::BuildPOPAccount( nsIMsgAccountManager *accMgr, const char // I now have a user name/server name pair, find out if it already exists? nsCOMPtr in; - nsresult rv = accMgr->FindServer( userName, serverName, "pop3", getter_AddRefs( in)); + nsresult rv = accMgr->FindServer( userName.get(), serverName.get(), "pop3", getter_AddRefs( in)); if (NS_FAILED( rv) || (in == nsnull)) { // Create the incoming server and an account for it? - rv = accMgr->CreateIncomingServer( userName, serverName, "pop3", getter_AddRefs( in)); + rv = accMgr->CreateIncomingServer( userName.get(), serverName.get(), "pop3", getter_AddRefs( in)); if (NS_SUCCEEDED( rv) && in) { rv = in->SetType( "pop3"); // rv = in->SetHostName( serverName); // rv = in->SetUsername( userName); - IMPORT_LOG2( "Created POP3 server named: %s, userName: %s\n", (const char *)serverName, (const char *)userName); + IMPORT_LOG2( "Created POP3 server named: %s, userName: %s\n", serverName.get(), userName.get()); nsString prettyName; GetAccountName( pSection, prettyName); @@ -795,16 +795,16 @@ PRBool nsEudoraWin32::BuildIMAPAccount( nsIMsgAccountManager *accMgr, const char PRBool result = PR_FALSE; nsCOMPtr in; - nsresult rv = accMgr->FindServer( userName, serverName, "imap", getter_AddRefs( in)); + nsresult rv = accMgr->FindServer( userName.get(), serverName.get(), "imap", getter_AddRefs( in)); if (NS_FAILED( rv) || (in == nsnull)) { // Create the incoming server and an account for it? - rv = accMgr->CreateIncomingServer( userName, serverName, "imap", getter_AddRefs( in)); + rv = accMgr->CreateIncomingServer( userName.get(), serverName.get(), "imap", getter_AddRefs( in)); if (NS_SUCCEEDED( rv) && in) { rv = in->SetType( "imap"); // rv = in->SetHostName( serverName); // rv = in->SetUsername( userName); - IMPORT_LOG2( "Created IMAP server named: %s, userName: %s\n", (const char *)serverName, (const char *)userName); + IMPORT_LOG2( "Created IMAP server named: %s, userName: %s\n", serverName.get(), userName.get()); nsString prettyName; GetAccountName( pSection, prettyName); @@ -860,7 +860,7 @@ void nsEudoraWin32::SetIdentities(nsIMsgAccountManager *accMgr, nsIMsgAccount *a rv = accMgr->CreateIdentity( getter_AddRefs( id)); if (id) { nsAutoString fullName; - fullName.AssignWithConversion(realName); + fullName.AssignWithConversion(realName.get()); id->SetFullName( fullName.get()); id->SetIdentityName( fullName.get()); if (email.Length() == 0) { @@ -868,15 +868,15 @@ void nsEudoraWin32::SetIdentities(nsIMsgAccountManager *accMgr, nsIMsgAccount *a email += "@"; email += serverName; } - id->SetEmail(email); + id->SetEmail(email.get()); acc->AddIdentity( id); IMPORT_LOG0( "Created identity and added to the account\n"); - IMPORT_LOG1( "\tname: %s\n", (const char *)realName); - IMPORT_LOG1( "\temail: %s\n", (const char *)email); + IMPORT_LOG1( "\tname: %s\n", realName.get()); + IMPORT_LOG1( "\temail: %s\n", email.get()); } - SetSmtpServer( accMgr, acc, server, nsnull); + SetSmtpServer( accMgr, acc, server.get(), nsnull); } @@ -1018,7 +1018,7 @@ PRBool nsEudoraWin32::FindMimeIniFile( nsIFileSpec *pSpec) void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeType) { HKEY sKey; - if (::RegOpenKeyEx( HKEY_CLASSES_ROOT, ext, 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) { + if (::RegOpenKeyEx( HKEY_CLASSES_ROOT, ext.get(), 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) { // get the value of "Current" BYTE *pBytes = GetValueBytes( sKey, "Content Type"); if (pBytes) { @@ -1074,17 +1074,17 @@ void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeTyp delete [] m_pMimeSection; size += 1024; m_pMimeSection = new char[size]; - dSize = ::GetPrivateProfileSection( "Mappings", m_pMimeSection, size, fileName); + dSize = ::GetPrivateProfileSection( "Mappings", m_pMimeSection, size, fileName.get()); } } if (!m_pMimeSection) return; - IMPORT_LOG1( "Looking for mime type for extension: %s\n", (const char *)ext); + IMPORT_LOG1( "Looking for mime type for extension: %s\n", ext.get()); // out/in/both=extension,mac creator,mac type,mime type1,mime type2 - const char *pExt = (const char *)ext; + const char *pExt = ext.get(); pExt++; char * pChar = m_pMimeSection; @@ -1109,7 +1109,7 @@ void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeTyp tStr.Truncate(); tStr.Append( pStart, len); tStr.Trim( kWhitespace); - if (!nsCRT::strcasecmp( (const char *)tStr, pExt)) { + if (!nsCRT::strcasecmp( tStr.get(), pExt)) { // skip the mac creator and type pChar++; while (*pChar && (*pChar != ',')) @@ -1135,7 +1135,7 @@ void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeTyp tStr.Trim( kWhitespace); if (!tStr.Length()) continue; mimeType.Truncate(); - mimeType.Append( (const char *)tStr); + mimeType.Append( tStr.get()); mimeType.Append( "/"); pStart = pChar; len = 0; @@ -1148,9 +1148,9 @@ void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeTyp tStr.Append( pStart, len); tStr.Trim( kWhitespace); if (!tStr.Length()) continue; - mimeType.Append( (const char *)tStr); + mimeType.Append( tStr.get()); - IMPORT_LOG1( "Found Mime Type: %s\n", (const char *)mimeType); + IMPORT_LOG1( "Found Mime Type: %s\n", mimeType.get()); return; } @@ -1253,7 +1253,7 @@ nsresult nsEudoraWin32::FindAddressBooks( nsIFileSpec *pRoot, nsISupportsArray * // Get the extra directories for nicknames and parse it for valid nickname directories // to look into... char *pBuffer = new char[2048]; - DWORD len = ::GetPrivateProfileString( "Settings", "ExtraNicknameDirs", "", pBuffer, 2048, fileName); + DWORD len = ::GetPrivateProfileString( "Settings", "ExtraNicknameDirs", "", pBuffer, 2048, fileName.get()); if (len == 2047) { // If the value is really that large then don't bother! delete [] pBuffer; @@ -1268,7 +1268,7 @@ nsresult nsEudoraWin32::FindAddressBooks( nsIFileSpec *pRoot, nsISupportsArray * dirs.Left( currentDir, idx); currentDir.Trim( kWhitespace); if (currentDir.Length()) { - rv = spec->SetNativePath( currentDir); + rv = spec->SetNativePath( currentDir.get()); exists = PR_FALSE; isDir = PR_FALSE; if (NS_SUCCEEDED( rv)) @@ -1285,7 +1285,7 @@ nsresult nsEudoraWin32::FindAddressBooks( nsIFileSpec *pRoot, nsISupportsArray * dirs.Trim( kWhitespace); } if (dirs.Length()) { - rv = spec->SetNativePath( dirs); + rv = spec->SetNativePath( dirs.get()); exists = PR_FALSE; isDir = PR_FALSE; if (NS_SUCCEEDED( rv)) @@ -1438,7 +1438,7 @@ void nsEudoraWin32::ConvertPath( nsCString& str) str.Mid( temp, start, idx - start); search = path; search.Append( temp); - HANDLE h = FindFirstFile( search, &findFileData); + HANDLE h = FindFirstFile( search.get(), &findFileData); if (h == INVALID_HANDLE_VALUE) return; path.Append( findFileData.cFileName); diff --git a/mozilla/mailnews/import/oexpress/nsOEScanBoxes.cpp b/mozilla/mailnews/import/oexpress/nsOEScanBoxes.cpp index 994f04f5132..24216f22f1c 100644 --- a/mozilla/mailnews/import/oexpress/nsOEScanBoxes.cpp +++ b/mozilla/mailnews/import/oexpress/nsOEScanBoxes.cpp @@ -110,7 +110,7 @@ PRBool nsOEScanBoxes::Find50Mail( nsIFileSpec *pWhere) key += (const char *)pBytes; nsOERegUtil::FreeValueBytes( pBytes); key += "\\Software\\Microsoft\\Outlook Express\\5.0"; - if (::RegOpenKeyEx( HKEY_CURRENT_USER, key, 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) { + if (::RegOpenKeyEx( HKEY_CURRENT_USER, key.get(), 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) { pBytes = nsOERegUtil::GetValueBytes( sKey, "Store Root"); if (pBytes) { pWhere->SetNativePath((char *)pBytes); @@ -722,7 +722,7 @@ void nsOEScanBoxes::BuildMailboxList( MailboxEntry *pBox, nsIFileSpec * root, PR if (pBox->fileName.Length() > 0) { pID->GetFileSpec( &file); file->FromFileSpec( root); - file->AppendRelativeUnixPath( (const char *)pBox->fileName); + file->AppendRelativeUnixPath( pBox->fileName.get()); size = 0; file->GetFileSize( &size); pID->SetSize( size); diff --git a/mozilla/mailnews/import/oexpress/nsOESettings.cpp b/mozilla/mailnews/import/oexpress/nsOESettings.cpp index 6f1c3c1578a..826de804121 100644 --- a/mozilla/mailnews/import/oexpress/nsOESettings.cpp +++ b/mozilla/mailnews/import/oexpress/nsOESettings.cpp @@ -196,7 +196,7 @@ HKEY OESettings::Find50Key( void) key += (const char *)pBytes; nsOERegUtil::FreeValueBytes( pBytes); key += "\\Software\\Microsoft\\Outlook Express\\5.0"; - if (::RegOpenKeyEx( HKEY_CURRENT_USER, key, 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) { + if (::RegOpenKeyEx( HKEY_CURRENT_USER, key.get(), 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) { return( sKey); } } diff --git a/mozilla/mailnews/import/outlook/src/MapiApi.cpp b/mozilla/mailnews/import/outlook/src/MapiApi.cpp index 057b135cf2e..20e7cf59891 100644 --- a/mozilla/mailnews/import/outlook/src/MapiApi.cpp +++ b/mozilla/mailnews/import/outlook/src/MapiApi.cpp @@ -1164,7 +1164,7 @@ BOOL CMapiApi::GetLargeStringProperty( LPMAPIPROP pProp, ULONG tag, nsString& va { nsCString result; if (GetLargeStringProperty( pProp, tag, result)) { - CStrToUnicode( result, val); + CStrToUnicode( result.get(), val); return( TRUE); } diff --git a/mozilla/mailnews/import/outlook/src/MapiMessage.cpp b/mozilla/mailnews/import/outlook/src/MapiMessage.cpp index c1456ad0e25..62f9d8106fd 100644 --- a/mozilla/mailnews/import/outlook/src/MapiMessage.cpp +++ b/mozilla/mailnews/import/outlook/src/MapiMessage.cpp @@ -298,7 +298,7 @@ BOOL CMapiMessage::GetAttachFileLoc( nsIFileSpec * pLoc) { if (m_attachPath.IsEmpty()) return( FALSE); - pLoc->SetNativePath( (const char *) m_attachPath); + pLoc->SetNativePath( m_attachPath.get()); m_ownsAttachFile = FALSE; return( TRUE); } @@ -416,7 +416,7 @@ void CMapiMessage::ProcessHeaders( void) m_bHasFrom = FALSE; m_bHasDate = FALSE; - PC_S8 pChar = (PC_S8) m_headers; + PC_S8 pChar = (PC_S8) m_headers.get(); int start = 0; int len = 0; nsCString line; @@ -577,7 +577,7 @@ BOOL CMapiMessage::IterateAttachTable( void) void CMapiMessage::ClearTempAttachFile( void) { if (m_ownsAttachFile && !m_attachPath.IsEmpty()) { - nsFileSpec spec( (const char *)m_attachPath); + nsFileSpec spec( m_attachPath.get()); spec.Delete( PR_FALSE); } m_ownsAttachFile = FALSE; @@ -642,7 +642,7 @@ BOOL CMapiMessage::CopyBinAttachToFile( LPATTACH lpAttach) lpAttachStream->Release(); lpStreamFile->Release(); if (!bResult) { - nsFileSpec spec( (const char *)m_attachPath); + nsFileSpec spec( m_attachPath.get()); spec.Delete( PR_FALSE); } else diff --git a/mozilla/mailnews/import/outlook/src/MapiMessage.h b/mozilla/mailnews/import/outlook/src/MapiMessage.h index 12cc3a07ab8..92134ccbb41 100644 --- a/mozilla/mailnews/import/outlook/src/MapiMessage.h +++ b/mozilla/mailnews/import/outlook/src/MapiMessage.h @@ -92,11 +92,11 @@ public: // Retrieve info for message BOOL BodyIsHtml( void) { return( m_bodyIsHtml);} - const char *GetFromLine( int& len) { if (m_fromLine.IsEmpty()) return( NULL); else { len = m_fromLine.Length(); return( (const char *)m_fromLine);}} - const char *GetHeaders( int& len) { if (m_headers.IsEmpty()) return( NULL); else { len = m_headers.Length(); return( (const char *)m_headers);}} - const char *GetBody( int& len) { if (m_body.IsEmpty()) return( NULL); else { len = m_body.Length(); return( (const char *)m_body);}} - const char *GetBody( void) { return( (const char *)m_body);} - const char *GetHeaders( void) { return( (const char *)m_headers);} + const char *GetFromLine( int& len) { if (m_fromLine.IsEmpty()) return( NULL); else { len = m_fromLine.Length(); return( m_fromLine.get());}} + const char *GetHeaders( int& len) { if (m_headers.IsEmpty()) return( NULL); else { len = m_headers.Length(); return( m_headers.get());}} + const char *GetBody( int& len) { if (m_body.IsEmpty()) return( NULL); else { len = m_body.Length(); return( m_body.get());}} + const char *GetBody( void) { return( m_body.get());} + const char *GetHeaders( void) { return( m_headers.get());} PRInt32 GetBodyLen( void) { return( m_body.Length());} PRInt32 GetHeaderLen( void) { return( m_headers.Length());} @@ -104,14 +104,14 @@ public: BOOL IsMultipart( void); BOOL HasContentHeader( void) { return( !m_mimeContentType.IsEmpty());} BOOL HasMimeVersion( void) { return( m_bMimeVersion);} - const char *GetMimeContent( void) { return( (const char *)m_mimeContentType);} - const char *GetMimeBoundary( void) { return( (const char *)m_mimeBoundary);} + const char *GetMimeContent( void) { return( m_mimeContentType.get());} + const char *GetMimeBoundary( void) { return( m_mimeBoundary.get());} void GenerateBoundary( void); BOOL GetAttachFileLoc( nsIFileSpec *pLoc); - const char *GetMimeType( void) { return( (const char *) m_attachMimeType);} - const char *GetFileName( void) { return( (const char *) m_attachFileName);} + const char *GetMimeType( void) { return( m_attachMimeType.get());} + const char *GetFileName( void) { return( m_attachFileName.get());} protected: BOOL IterateAttachTable( void); diff --git a/mozilla/mailnews/import/outlook/src/MapiMimeTypes.cpp b/mozilla/mailnews/import/outlook/src/MapiMimeTypes.cpp index 5e46d43d006..724f6675aa6 100644 --- a/mozilla/mailnews/import/outlook/src/MapiMimeTypes.cpp +++ b/mozilla/mailnews/import/outlook/src/MapiMimeTypes.cpp @@ -82,7 +82,7 @@ BOOL CMimeTypes::GetMimeTypeFromReg( const nsCString& ext, LPBYTE *ppBytes) *ppBytes = NULL; - if (GetKey( HKEY_CLASSES_ROOT, ext, &extensionKey)) { + if (GetKey( HKEY_CLASSES_ROOT, ext.get(), &extensionKey)) { result = GetValueBytes( extensionKey, "Content Type", ppBytes); RegCloseKey( extensionKey); } diff --git a/mozilla/mailnews/import/outlook/src/nsOutlookCompose.cpp b/mozilla/mailnews/import/outlook/src/nsOutlookCompose.cpp index 41f69193403..c456470a1ae 100644 --- a/mozilla/mailnews/import/outlook/src/nsOutlookCompose.cpp +++ b/mozilla/mailnews/import/outlook/src/nsOutlookCompose.cpp @@ -844,7 +844,7 @@ nsresult nsOutlookCompose::CopyComposedMessage( nsCString& fromLine, nsIFileSpec } PRInt32 written; - rv = pDst->Write( fromLine, fromLine.Length(), &written); + rv = pDst->Write( fromLine.get(), fromLine.Length(), &written); // well, isn't this a hoot! // Read the headers from the new message, get the ones we like @@ -990,28 +990,28 @@ nsresult nsOutlookCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCop do { GetNthHeader( m_pHeaders, m_headerLen, n, header, val, PR_FALSE); - // GetNthHeader( newHeaders.m_pBuffer, newHeaders.m_writeOffset, n, header, val, PR_FALSE); + // GetNthHeader( newHeaders.m_pBuffer, newHeaders.m_writeOffset, n, header.get(), val, PR_FALSE); if (header.Length()) { - if ((specialHeader = IsSpecialHeader( header)) != -1) { + if ((specialHeader = IsSpecialHeader( header.get())) != -1) { header.Append( ':'); - GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header, val, PR_FALSE); + GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), val, PR_FALSE); header.Truncate( header.Length() - 1); specials[specialHeader] = PR_TRUE; } - else if (IsReplaceHeader( header)) { + else if (IsReplaceHeader( header.get())) { replaceVal.Truncate( 0); header.Append( ':'); - GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header, replaceVal, PR_FALSE); + GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), replaceVal, PR_FALSE); header.Truncate( header.Length() - 1); if (replaceVal.Length()) val = replaceVal; } if (val.Length()) { - rv = pDst->Write( (const char *)header, header.Length(), &written); + rv = pDst->Write( header.get(), header.Length(), &written); if (NS_SUCCEEDED( rv)) rv = pDst->Write( ": ", 2, &written); if (NS_SUCCEEDED( rv)) - rv = pDst->Write( (const char *)val, val.Length(), &written); + rv = pDst->Write( val.get(), val.Length(), &written); if (NS_SUCCEEDED( rv)) rv = pDst->Write( "\x0D\x0A", 2, &written); @@ -1024,14 +1024,14 @@ nsresult nsOutlookCompose::WriteHeaders( nsIFileSpec *pDst, SimpleBufferTonyRCop if (!specials[i]) { header = gSpecialHeaders[i]; header.Append( ':'); - GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header, val, PR_FALSE); + GetHeaderValue( newHeaders.m_pBuffer, newHeaders.m_writeOffset - 1, header.get(), val, PR_FALSE); header.Truncate( header.Length() - 1); if (val.Length()) { - rv = pDst->Write( (const char *)header, header.Length(), &written); + rv = pDst->Write( header.get(), header.Length(), &written); if (NS_SUCCEEDED( rv)) rv = pDst->Write( ": ", 2, &written); if (NS_SUCCEEDED( rv)) - rv = pDst->Write( (const char *)val, val.Length(), &written); + rv = pDst->Write( val.get(), val.Length(), &written); if (NS_SUCCEEDED( rv)) rv = pDst->Write( "\x0D\x0A", 2, &written); } diff --git a/mozilla/mailnews/import/outlook/src/nsOutlookCompose.h b/mozilla/mailnews/import/outlook/src/nsOutlookCompose.h index 174670cecc1..e14ce6b6076 100644 --- a/mozilla/mailnews/import/outlook/src/nsOutlookCompose.h +++ b/mozilla/mailnews/import/outlook/src/nsOutlookCompose.h @@ -126,7 +126,7 @@ private: val.Truncate(); nsCString hVal; GetHeaderValue( pData, dataLen, pHeader, hVal, PR_TRUE); - val.AssignWithConversion(hVal); + val.AssignWithConversion(hVal.get()); } void ExtractCharset( nsString& str); void ExtractType( nsString& str); diff --git a/mozilla/mailnews/import/outlook/src/nsOutlookMail.cpp b/mozilla/mailnews/import/outlook/src/nsOutlookMail.cpp index 5cd62ec2ae0..37140ad823a 100644 --- a/mozilla/mailnews/import/outlook/src/nsOutlookMail.cpp +++ b/mozilla/mailnews/import/outlook/src/nsOutlookMail.cpp @@ -832,7 +832,7 @@ void nsOutlookMail::BuildAttachments( CMapiMessage& msg, int count) nsCRT::free( a->description); nsCString str("Attachment "); str.AppendInt( (PRInt32) i); - a->description = nsCRT::strdup( (const char *)str); + a->description = ToNewCString( str); } a->pAttachment = pSpec; m_attachments.AppendElement( a); diff --git a/mozilla/modules/libpr0n/decoders/icon/nsIconURI.cpp b/mozilla/modules/libpr0n/decoders/icon/nsIconURI.cpp index f4677d78adf..79103017564 100644 --- a/mozilla/modules/libpr0n/decoders/icon/nsIconURI.cpp +++ b/mozilla/modules/libpr0n/decoders/icon/nsIconURI.cpp @@ -79,7 +79,7 @@ nsMozIconURI::FormatSpec(char* *result) spec += mContentType.get(); } - *result = nsCRT::strdup(spec); + *result = ToNewCString(spec); return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } @@ -180,7 +180,7 @@ nsMozIconURI::SetSpec(const char * aSpec) else // we must have a url { // we have a file url.....so store it... - rv = ioService->NewURI(mDummyFilePath, nsnull, getter_AddRefs(mFileIcon)); + rv = ioService->NewURI(mDummyFilePath.get(), nsnull, getter_AddRefs(mFileIcon)); if (NS_FAILED(rv)) return NS_ERROR_MALFORMED_URI; } } diff --git a/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp b/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp index 2acf318d020..778ca6835c2 100644 --- a/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp @@ -88,7 +88,7 @@ nsresult GetExtensionFromWindowsMimeDatabase(const char * aMimeType, nsCString& mimeDatabaseKey += aMimeType; - LONG err = ::RegOpenKeyEx( HKEY_CLASSES_ROOT, mimeDatabaseKey, 0, KEY_QUERY_VALUE, &hKey); + LONG err = ::RegOpenKeyEx( HKEY_CLASSES_ROOT, mimeDatabaseKey.get(), 0, KEY_QUERY_VALUE, &hKey); if (err == ERROR_SUCCESS) { LPBYTE pBytes = GetValueBytes( hKey, "Extension"); @@ -115,7 +115,7 @@ nsresult GetExtensionFrom4xRegistryInfo(const char * aMimeType, nsCString& aFile nsCAutoString command ("Software\\Netscape\\Netscape Navigator\\Suffixes"); nsresult rv = NS_OK; HKEY hKey; - LONG err = ::RegOpenKeyEx( HKEY_CURRENT_USER, command, 0, KEY_QUERY_VALUE, &hKey); + LONG err = ::RegOpenKeyEx( HKEY_CURRENT_USER, command.get(), 0, KEY_QUERY_VALUE, &hKey); if (err == ERROR_SUCCESS) { LPBYTE pBytes = GetValueBytes( hKey, aMimeType); @@ -296,7 +296,7 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromExtension(const char *aFileExt, nsIMI // o.t. try to get an entry from the windows registry. HKEY hKey; - LONG err = ::RegOpenKeyEx( HKEY_CLASSES_ROOT, fileExtToUse, 0, KEY_QUERY_VALUE, &hKey); + LONG err = ::RegOpenKeyEx( HKEY_CLASSES_ROOT, fileExtToUse.get(), 0, KEY_QUERY_VALUE, &hKey); if (err == ERROR_SUCCESS) { LPBYTE pBytes = GetValueBytes( hKey, "Content Type"); @@ -367,7 +367,7 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromMIMEType(const char *aMIMEType, nsIMI // now look up based on the file extension. if (!fileExtension.IsEmpty()) - return GetFromExtension(fileExtension, _retval); + return GetFromExtension(fileExtension.get(), _retval); else rv = NS_ERROR_FAILURE; diff --git a/mozilla/widget/src/windows/nsFilePicker.cpp b/mozilla/widget/src/windows/nsFilePicker.cpp index 5059f9c2aae..2778d0d03b6 100644 --- a/mozilla/widget/src/windows/nsFilePicker.cpp +++ b/mozilla/widget/src/windows/nsFilePicker.cpp @@ -230,7 +230,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); - file->InitWithPath(mFile); + file->InitWithPath(mFile.get()); PRBool exists = PR_FALSE; file->Exists(&exists); @@ -258,7 +258,7 @@ NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile) NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); - file->InitWithPath(mFile); + file->InitWithPath(mFile.get()); NS_ADDREF(*aFile = file); @@ -270,7 +270,7 @@ NS_IMETHODIMP nsFilePicker::GetFileURL(nsIFileURL **aFileURL) { nsCOMPtr file(do_CreateInstance("@mozilla.org/file/local;1")); NS_ENSURE_TRUE(file, NS_ERROR_FAILURE); - file->InitWithPath(mFile); + file->InitWithPath(mFile.get()); nsCOMPtr uri; NS_NewFileURI(getter_AddRefs(uri), file); diff --git a/mozilla/xpcom/io/nsLocalFileWin.cpp b/mozilla/xpcom/io/nsLocalFileWin.cpp index 17091468927..64e11218a7e 100644 --- a/mozilla/xpcom/io/nsLocalFileWin.cpp +++ b/mozilla/xpcom/io/nsLocalFileWin.cpp @@ -35,6 +35,7 @@ #include "nsEscape.h" #include "nsXPIDLString.h" +#include "nsReadableUtils.h" #include #include @@ -574,7 +575,7 @@ nsLocalFile::ResolveAndStat(PRBool resolveTerminal) mResolvedPath.Assign(resolvePath); nsMemory::Free(resolvePath); - status = PR_GetFileInfo64(mResolvedPath, &mFileInfo64); + status = PR_GetFileInfo64(mResolvedPath.get(), &mFileInfo64); if ( status == PR_SUCCESS ) mDirty = PR_FALSE; @@ -660,7 +661,7 @@ nsLocalFile::OpenNSPRFileDesc(PRInt32 flags, PRInt32 mode, PRFileDesc **_retval) if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND) return rv; - *_retval = PR_Open(mResolvedPath, flags, mode); + *_retval = PR_Open(mResolvedPath.get(), flags, mode); if (*_retval) return NS_OK; @@ -676,7 +677,7 @@ nsLocalFile::OpenANSIFileDesc(const char *mode, FILE * *_retval) if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND) return rv; - *_retval = fopen(mResolvedPath, mode); + *_retval = fopen(mResolvedPath.get(), mode); if (*_retval) return NS_OK; @@ -706,7 +707,7 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes) { *slash = '\0'; - if (!CreateDirectoryA(mResolvedPath, NULL)) { + if (!CreateDirectoryA(mResolvedPath.get(), NULL)) { rv = ConvertWinError(GetLastError()); if (rv != NS_ERROR_FILE_ALREADY_EXISTS) return rv; } @@ -718,7 +719,7 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes) if (type == NORMAL_FILE_TYPE) { - PRFileDesc* file = PR_Open(mResolvedPath, PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes); + PRFileDesc* file = PR_Open(mResolvedPath.get(), PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes); if (!file) return NS_ERROR_FILE_ALREADY_EXISTS; PR_Close(file); @@ -727,7 +728,7 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes) if (type == DIRECTORY_TYPE) { - if (!CreateDirectoryA(mResolvedPath, NULL)) + if (!CreateDirectoryA(mResolvedPath.get(), NULL)) return ConvertWinError(GetLastError()); else return NS_OK; @@ -813,7 +814,7 @@ NS_IMETHODIMP nsLocalFile::GetPath(char **_retval) { NS_ENSURE_ARG_POINTER(_retval); - *_retval = (char*) nsMemory::Clone(mWorkingPath, strlen(mWorkingPath)+1); + *_retval = (char*) nsMemory::Clone(mWorkingPath.get(), mWorkingPath.Length()+1); return NS_OK; } @@ -864,9 +865,9 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent, const char int copyOK; if (!move) - copyOK = CopyFile(filePath, destPath, PR_TRUE); + copyOK = CopyFile(filePath, destPath.get(), PR_TRUE); else - copyOK = MoveFile(filePath, destPath); + copyOK = MoveFile(filePath, destPath.get()); if (!copyOK) // CopyFile and MoveFile returns non-zero if succeeds (backward if you ask me). rv = ConvertWinError(GetLastError()); @@ -1128,7 +1129,7 @@ nsLocalFile::Spawn(const char **args, PRUint32 count) // null terminate the array my_argv[count+1] = NULL; - rv = PR_CreateProcessDetached(mResolvedPath, my_argv, NULL, NULL); + rv = PR_CreateProcessDetached(mResolvedPath.get(), my_argv, NULL, NULL); // free up our argv nsMemory::Free(my_argv); @@ -1152,7 +1153,7 @@ nsLocalFile::Load(PRLibrary * *_retval) return NS_ERROR_FILE_IS_DIRECTORY; NS_TIMELINE_START_TIMER("PR_LoadLibrary"); - *_retval = PR_LoadLibrary(mResolvedPath); + *_retval = PR_LoadLibrary(mResolvedPath.get()); NS_TIMELINE_STOP_TIMER("PR_LoadLibrary"); NS_TIMELINE_MARK_TIMER("PR_LoadLibrary"); @@ -1819,7 +1820,7 @@ nsLocalFile::GetTarget(char **_retval) #endif ResolveAndStat(PR_TRUE); - *_retval = (char*) nsMemory::Clone( mResolvedPath, strlen(mResolvedPath)+1 ); + *_retval = (char*) nsMemory::Clone( mResolvedPath.get(), mResolvedPath.Length()+1 ); return NS_OK; } @@ -1911,7 +1912,7 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL) // make sure we have a trailing slash escPath += "/"; } - *aURL = nsCRT::strdup((const char *)escPath); + *aURL = ToNewCString(escPath); rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } } @@ -1969,7 +1970,7 @@ NS_IMETHODIMP nsLocalFile::SetURL(const char * aURL) if (path.CharAt(0) == '\\') path.Cut(0, 1); - rv = InitWithPath(path); + rv = InitWithPath(path.get()); return rv; } diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index ec54dbc8245..5f219bd4190 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -1383,7 +1383,7 @@ nsNativeAppSupportWin::HandleRequest( LPBYTE request, PRBool newWindow ) { nsCString taskURL; rv = GetStartupURL(args, taskURL); if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(nativeApp->EnsureProfile(args))) { - (void)OpenWindow(taskURL, ""); + (void)OpenWindow(taskURL.get(), ""); return; } @@ -1440,7 +1440,7 @@ nsNativeAppSupportWin::HandleRequest( LPBYTE request, PRBool newWindow ) { if (defaultArgs) { nsCAutoString url; url.AssignWithConversion( defaultArgs ); - OpenBrowserWindow((const char*)url); + OpenBrowserWindow(url.get()); } else { OpenBrowserWindow("about:blank"); } diff --git a/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp b/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp index 91b89e001c7..08e4009253a 100644 --- a/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp +++ b/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp @@ -130,7 +130,7 @@ struct SavedRegistryEntry : public RegistryEntry { struct ProtocolRegistryEntry : public SavedRegistryEntry { nsCString protocol; ProtocolRegistryEntry( const char* protocol ) - : SavedRegistryEntry( HKEY_LOCAL_MACHINE, "", "", thisApplication() ), + : SavedRegistryEntry( HKEY_LOCAL_MACHINE, "", "", thisApplication().get() ), protocol( protocol ) { keyName = "Software\\Classes\\"; keyName += protocol; @@ -239,25 +239,25 @@ PRBool RegistryEntry::isAlreadySet() const { // Gives registry entry the desired setting. nsresult RegistryEntry::set() { #ifdef DEBUG_law -printf( "Setting %s=%s\n", (const char*)fullName(), (const char*)setting ); +printf( "Setting %s=%s\n", fullName().get(), setting.get() ); #endif nsresult result = NS_ERROR_FAILURE; HKEY key; - LONG rc = ::RegOpenKey( baseKey, keyName, &key ); + LONG rc = ::RegOpenKey( baseKey, keyName.get(), &key ); // See if key doesn't exist yet... if ( rc == ERROR_FILE_NOT_FOUND ) { - rc = ::RegCreateKey( baseKey, keyName, &key ); + rc = ::RegCreateKey( baseKey, keyName.get(), &key ); } if ( rc == ERROR_SUCCESS ) { char buffer[4096] = { 0 }; DWORD len = sizeof buffer; rc = ::RegQueryValueEx( key, valueNameArg(), NULL, NULL, (LPBYTE)buffer, &len ); - if ( strcmp( setting, buffer ) != 0 ) { - rc = ::RegSetValueEx( key, valueNameArg(), NULL, REG_SZ, (LPBYTE)(const char*)setting, strlen(setting) ); + if ( strcmp( setting.get(), buffer ) != 0 ) { + rc = ::RegSetValueEx( key, valueNameArg(), NULL, REG_SZ, (LPBYTE)setting.get(), setting.Length() ); #ifdef DEBUG_law -NS_WARN_IF_FALSE( rc == ERROR_SUCCESS, (const char*)fullName() ); +NS_WARN_IF_FALSE( rc == ERROR_SUCCESS, fullName().get() ); #endif if ( rc == ERROR_SUCCESS ) { result = NS_OK; @@ -269,7 +269,7 @@ NS_WARN_IF_FALSE( rc == ERROR_SUCCESS, (const char*)fullName() ); ::RegCloseKey( key ); } else { #ifdef DEBUG_law -NS_WARN_IF_FALSE( rc == ERROR_SUCCESS, (const char*)fullName() ); +NS_WARN_IF_FALSE( rc == ERROR_SUCCESS, fullName().get() ); #endif } return result; @@ -285,7 +285,7 @@ nsresult SavedRegistryEntry::set() { rv = RegistryEntry::set(); if ( NS_SUCCEEDED( rv ) ) { // Save old. - RegistryEntry( HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Desktop", fullName(), prev ).set(); + RegistryEntry( HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Desktop", fullName().get(), prev.get() ).set(); } } return rv; @@ -298,7 +298,7 @@ nsresult ProtocolRegistryEntry::set() { nsresult rv = SavedRegistryEntry::set(); // Save and set corresponding DDE entry(ies). - DDERegistryEntry( protocol ).set(); + DDERegistryEntry( protocol.get() ).set(); return rv; } @@ -306,7 +306,7 @@ nsresult ProtocolRegistryEntry::set() { // Not being a "saved" entry, we can't restore, so just delete it. nsresult RegistryEntry::reset() { HKEY key; - LONG rc = ::RegOpenKey( baseKey, keyName, &key ); + LONG rc = ::RegOpenKey( baseKey, keyName.get(), &key ); if ( rc == ERROR_SUCCESS ) { rc = ::RegDeleteValue( key, valueNameArg() ); } @@ -325,7 +325,7 @@ nsresult SavedRegistryEntry::reset() { // Test if we "own" it. if ( current == setting ) { // Unset it, then. First get saved value it had previously. - RegistryEntry saved = RegistryEntry( HKEY_LOCAL_MACHINE, mozillaKeyName, fullName(), "" ); + RegistryEntry saved = RegistryEntry( HKEY_LOCAL_MACHINE, mozillaKeyName, fullName().get(), "" ); saved.setting = saved.currentSetting(); if ( !saved.setting.IsEmpty() ) { // Set to previous value. @@ -348,7 +348,7 @@ nsresult ProtocolRegistryEntry::reset() { nsresult rv = SavedRegistryEntry::reset(); // Do same for corresponding DDE entry. - DDERegistryEntry( protocol ).reset(); + DDERegistryEntry( protocol.get() ).reset(); return rv; } @@ -369,7 +369,7 @@ nsCString RegistryEntry::currentSetting() const { nsCString result; HKEY key; - LONG rc = ::RegOpenKey( baseKey, keyName, &key ); + LONG rc = ::RegOpenKey( baseKey, keyName.get(), &key ); if ( rc == ERROR_SUCCESS ) { char buffer[4096]; DWORD len = sizeof buffer; @@ -392,7 +392,7 @@ nsresult FileTypeRegistryEntry::set() { for ( int i = 0; NS_SUCCEEDED( rv ) && ext[i]; i++ ) { nsCAutoString thisExt( "Software\\Classes\\" ); thisExt += ext[i]; - rv = SavedRegistryEntry( HKEY_LOCAL_MACHINE, thisExt, "", fileType ).set(); + rv = SavedRegistryEntry( HKEY_LOCAL_MACHINE, thisExt.get(), "", fileType.get() ).set(); } // If OK, set file type opener. @@ -403,7 +403,7 @@ nsresult FileTypeRegistryEntry::set() { if ( NS_SUCCEEDED( rv ) ) { nsCAutoString descKey( "Software\\Classes\\" ); descKey += protocol; - RegistryEntry descEntry( HKEY_LOCAL_MACHINE, descKey, NULL, desc ); + RegistryEntry descEntry( HKEY_LOCAL_MACHINE, descKey.get(), NULL, desc.get() ); if ( descEntry.currentSetting().IsEmpty() ) { descEntry.set(); } @@ -411,8 +411,8 @@ nsresult FileTypeRegistryEntry::set() { iconKey += protocol; iconKey += "\\DefaultIcon"; - RegistryEntry iconEntry( HKEY_LOCAL_MACHINE, iconKey, NULL, - nsCAutoString( thisApplication() + NS_LITERAL_CSTRING(",0") ) ); + RegistryEntry iconEntry( HKEY_LOCAL_MACHINE, iconKey.get(), NULL, + nsCAutoString( thisApplication() + NS_LITERAL_CSTRING(",0") ).get() ); if ( iconEntry.currentSetting().IsEmpty() ) { iconEntry.set(); @@ -432,7 +432,7 @@ nsresult FileTypeRegistryEntry::reset() { for ( int i = 0; ext[ i ]; i++ ) { nsCAutoString thisExt( "Software\\Classes\\" ); thisExt += ext[i]; - (void)SavedRegistryEntry( HKEY_LOCAL_MACHINE, thisExt, "", fileType ).reset(); + (void)SavedRegistryEntry( HKEY_LOCAL_MACHINE, thisExt.get(), "", fileType.get() ).reset(); } return rv; @@ -452,7 +452,7 @@ nsresult EditableFileTypeRegistryEntry::set() { editKey += "\\shell\\edit\\command"; nsCAutoString editor( thisApplication() ); editor += " -edit \"%1\""; - rv = RegistryEntry( HKEY_LOCAL_MACHINE, editKey, "", editor ).set(); + rv = RegistryEntry( HKEY_LOCAL_MACHINE, editKey.get(), "", editor.get() ).set(); } return rv; }