Bug 69873: remove nsAutoCString. r=jag rs=scc

This commit is contained in:
dbaron%fas.harvard.edu 2001-10-12 02:57:59 +00:00
parent ec02700cf6
commit a22072c008
25 changed files with 84 additions and 156 deletions

View File

@ -37,7 +37,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsAFMObject.h"
#include "nsFileSpec.h" // for nsAutoCString
#include "Helvetica.h"
#include "Helvetica-Bold.h"
#include "Helvetica-BoldOblique.h"

View File

@ -169,14 +169,10 @@ nsresult nsCollationUnix::Initialize(nsILocale* locale)
}
#if defined(DEBUG_UNIX_COLLATION)
nsAutoCString tmp(mLocale);
if (NULL != (const char *)tmp) {
printf("nsCollationUnix::Initialize mLocale = %s\n", (const char *)tmp);
}
nsAutoCString tmp2(mCharset);
if (NULL != (const char *)tmp2) {
printf("nsCollationUnix::Initialize mCharset = %s\n", (const char *)tmp2);
}
printf("nsCollationUnix::Initialize mLocale = %s\n"
"nsCollationUnix::Initialize mCharset = %s\n",
NS_LossyConvertUCS2toASCII(mLocale).get(),
NS_LossyConvertUCS2toASCII(mCharset).get());
#endif
return NS_OK;

View File

@ -65,12 +65,12 @@ nsPosixLocale::GetPlatformLocale(const nsString* locale,char* posixLocale, size_
char lang_code[MAX_LANGUAGE_CODE_LEN+1];
char extra[MAX_EXTRA_LEN+1];
char posix_locale[MAX_LOCALE_LEN+1];
nsAutoCString xp_locale(*locale);
NS_LossyConvertUCS2toASCII xp_locale(*locale);
if ((const char *)xp_locale!=nsnull) {
if (!ParseLocaleString((const char *)xp_locale,lang_code,country_code,extra,'-')) {
if (xp_locale.get()) {
if (!ParseLocaleString(xp_locale.get(),lang_code,country_code,extra,'-')) {
// strncpy(posixLocale,"C",length);
PL_strncpyz(posixLocale,(const char *)xp_locale,length); // use xp locale if parse failed
PL_strncpyz(posixLocale,xp_locale.get(),length); // use xp locale if parse failed
return NS_OK;
}

View File

@ -1655,7 +1655,7 @@ nsSaveMsgListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
if (m_outputFormat.EqualsWithConversion(TEXT_PLAIN))
{
ConvertBufToPlainText(m_msgBuffer);
rv = nsMsgI18NSaveAsCharset(TEXT_PLAIN, (const char *)nsAutoCString(nsMsgI18NFileSystemCharset()),
rv = nsMsgI18NSaveAsCharset(TEXT_PLAIN, NS_LossyConvertUCS2toASCII(nsMsgI18NFileSystemCharset()).get(),
m_msgBuffer.get(), &conBuf);
if ( NS_SUCCEEDED(rv) && (conBuf) )
conLength = nsCRT::strlen(conBuf);

View File

@ -1639,7 +1639,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
if (! newgroups.IsEmpty())
{
if ((type != nsIMsgCompType::Reply) && (type != nsIMsgCompType::ReplyToSender))
compFields->SetNewsgroups(nsAutoCString(newgroups));
compFields->SetNewsgroups(NS_LossyConvertUCS2toASCII(newgroups).get());
if (type == nsIMsgCompType::ReplyToGroup)
compFields->SetTo(&emptyUnichar);
}
@ -1679,7 +1679,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
else // Process "followup-to: newsgroup-content" here
{
if (type != nsIMsgCompType::ReplyToSender)
compFields->SetNewsgroups(nsAutoCString(followUpTo));
compFields->SetNewsgroups(NS_LossyConvertUCS2toASCII(followUpTo).get());
if (type == nsIMsgCompType::Reply)
compFields->SetTo(&emptyUnichar);
}
@ -1688,7 +1688,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
if (! references.IsEmpty())
references.Append(PRUnichar(' '));
references += messageId;
compFields->SetReferences(nsAutoCString(references));
compFields->SetReferences(NS_LossyConvertUCS2toASCII(references).get());
if (needToRemoveDup)
{

View File

@ -627,14 +627,14 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
headerVal = m_defCharset;
}
}
m_pMsgFields->SetCharacterSet( nsAutoCString(headerVal) );
m_pMsgFields->SetCharacterSet( NS_LossyConvertUCS2toASCII(headerVal).get() );
charSet = headerVal;
GetHeaderValue( m_pHeaders, m_headerLen, "CC:", headerVal);
if (headerVal.Length())
m_pMsgFields->SetCc( headerVal.get());
GetHeaderValue( m_pHeaders, m_headerLen, "Message-ID:", headerVal);
if (headerVal.Length())
m_pMsgFields->SetMessageId( nsAutoCString(headerVal) );
m_pMsgFields->SetMessageId( NS_LossyConvertUCS2toASCII(headerVal).get() );
GetHeaderValue( m_pHeaders, m_headerLen, "Reply-To:", headerVal);
if (headerVal.Length())
m_pMsgFields->SetReplyTo( headerVal.get());

View File

@ -39,7 +39,6 @@
#include "nsIWidget.h"
#include "nsString.h"
#include "nsFileSpec.h" // XXX: For nsAutoCString
NS_IMPL_ISUPPORTS1(nsPopUpMenu, nsIPopUpMenu)
@ -88,7 +87,7 @@ NS_METHOD nsPopUpMenu::AddItem(const nsString &aText)
{
GtkWidget *widget;
widget = gtk_menu_item_new_with_label ((const char*)nsAutoCString(mLabel));
widget = gtk_menu_item_new_with_label (NS_LossyConvertUCS2toASCII(mLabel).get());
gtk_widget_show(widget);
gtk_menu_shell_append (GTK_MENU_SHELL (mMenu), widget);
@ -122,7 +121,7 @@ NS_METHOD nsPopUpMenu::AddMenu(nsIMenu * aMenu)
GetNativeData(voidData);
parentmenu = GTK_WIDGET(voidData);
item = gtk_menu_item_new_with_label ((const char*)nsAutoCString(Label));
item = gtk_menu_item_new_with_label (NS_LossyConvertUCS2toASCII(Label).get());
gtk_widget_show(item);
gtk_menu_shell_append (GTK_MENU_SHELL (parentmenu), item);

View File

@ -114,13 +114,13 @@ NS_IMETHODIMP nsTextHelper::SetText(const nsString& aText, PRUint32& aActualSiz
{
if (GTK_IS_ENTRY(mTextWidget)) {
gtk_entry_set_text(GTK_ENTRY(mTextWidget),
(const gchar *)nsAutoCString(aText));
(const gchar *)NS_LossyConvertUCS2toASCII(aText).get());
} else if (GTK_IS_TEXT(mTextWidget)) {
gtk_editable_delete_text(GTK_EDITABLE(mTextWidget), 0,
gtk_text_get_length(GTK_TEXT (mTextWidget)));
gtk_text_insert(GTK_TEXT(mTextWidget),
nsnull, nsnull, nsnull,
(const char *)nsAutoCString(aText),
NS_LossyConvertUCS2toASCII(aText).get(),
aText.Length());
}
@ -136,7 +136,7 @@ NS_IMETHODIMP nsTextHelper::InsertText(const nsString &aText,
PRUint32& aActualSize)
{
gtk_editable_insert_text(GTK_EDITABLE(mTextWidget),
(const gchar *)nsAutoCString(aText),
(const gchar *)NS_LossyConvertUCS2toASCII(aText).get(),
(gint)aText.Length(), (gint*)&aStartPos);
aActualSize = aText.Length();

View File

@ -44,10 +44,6 @@
#include "nsIRegion.h"
#include "nsIRollupListener.h"
// XXX: This must go away when nsAutoCString moves out of nsFileSpec.h
#include "nsFileSpec.h" // for nsAutoCString()
class nsILookAndFeel;
class nsIAppShell;
class nsIToolkit;

View File

@ -2276,7 +2276,7 @@ NS_IMETHODIMP nsWindow::SetTitle(const nsString& aTitle)
}
// fallback to use bad conversion
gtk_window_set_title(GTK_WINDOW(mShell), nsAutoCString(aTitle));
gtk_window_set_title(GTK_WINDOW(mShell), NS_LossyConvertUCS2toASCII(aTitle).get());
return NS_OK;
}

View File

@ -1256,7 +1256,7 @@ nsWindow::DebugPrintEvent(nsGUIEvent & aEvent,
printf("%4d %-26s(this=%-8p , widget=%-8p",
sPrintCount++,
(const char *) nsAutoCString(debug_GuiEventToString(&aEvent)),
NS_LossyConvertUCS2toASCII(debug_GuiEventToString(&aEvent)).get(),
this,
(void *) aWidget);

View File

@ -42,9 +42,6 @@
#include "nsIKBStateControl.h"
#include "nsIRegion.h"
// XXX: This must go away when nsAutoCString moves out of nsFileSpec.h
#include "nsFileSpec.h" // for nsAutoCString()
class nsILookAndFeel;
class nsIAppShell;
class nsIToolkit;

View File

@ -48,8 +48,6 @@
#include "nsIPlatformCharset.h"
#include "nsIServiceManager.h"
#include "nsFileSpec.h" // for nsAutoCString
#define ABS(i) ( (i)<0 ? 0-(i) : (i) )
// Variables for grabbing
@ -832,7 +830,7 @@ NS_IMETHODIMP nsWindow::SetTitle(const nsString& aTitle)
}
/* if the stuff above failed, replace multibyte with .... */
XStoreName(mDisplay, mBaseWindow, (const char *) nsAutoCString(aTitle));
XStoreName(mDisplay, mBaseWindow, NS_LossyConvertUCS2toASCII(aTitle).get());
return NS_OK;
}

View File

@ -547,15 +547,15 @@ nsFileURL::nsFileURL(const char* inString, PRBool inCreateDirs)
nsFileURL::nsFileURL(const nsString& inString, PRBool inCreateDirs)
//----------------------------------------------------------------------------------------
{
const nsAutoCString aString(inString);
const char* aCString = (const char*) aString;
NS_LossyConvertUCS2toASCII cstring(inString);
if (!inString.Length())
return;
NS_ASSERTION(strstr(aCString, kFileURLPrefix) == aCString, "Not a URL!");
NS_ASSERTION(strstr(cstring.get(), kFileURLPrefix) == cstring.get(),
"Not a URL!");
// Make canonical and absolute. Since it's a parameter to this constructor,
// inString is escaped. We want to make an nsFilePath, which requires
// an unescaped string.
nsSimpleCharString unescapedPath(aCString + kFileURLPrefixLength);
nsSimpleCharString unescapedPath(cstring.get() + kFileURLPrefixLength);
unescapedPath.Unescape();
nsFilePath path(unescapedPath, inCreateDirs);
*this = path;
@ -1374,17 +1374,6 @@ void nsPersistentFileDescriptor::SetData(const char* inData, PRInt32 inSize)
mDescriptorString.CopyFrom(inData, inSize);
}
//========================================================================================
// class nsAutoCString
//========================================================================================
//----------------------------------------------------------------------------------------
nsAutoCString::~nsAutoCString()
//----------------------------------------------------------------------------------------
{
nsMemory::Free(NS_REINTERPRET_CAST(void*, NS_CONST_CAST(char*, mCString)));
}
//========================================================================================
// class nsNSPRPath
//========================================================================================

View File

@ -60,7 +60,7 @@
// Classes defined:
//
// nsFilePath, nsFileURL, nsFileSpec, nsPersistentFileDescriptor
// nsDirectoryIterator. Oh, and a convenience class nsAutoCString.
// nsDirectoryIterator.
//
// Q. How should I represent files at run time?
// A. Use nsFileSpec. Using char* will lose information on some platforms.
@ -243,36 +243,6 @@ class nsIUnicodeDecoder;
nsresult ns_file_convert_result(PRInt32 nativeErr);
#define NS_FILE_FAILURE NS_FILE_RESULT(-1)
//========================================================================================
class NS_COM nsAutoCString
//
// This should be in nsString.h, but the owner would not reply to my proposal. After four
// weeks, I decided to put it in here.
//
// This is a quiet little class that acts as a sort of autoptr for
// a const char*. If you used to call nsString::ToNewCString(), just
// to pass the result a parameter list, it was a nuisance having to
// call delete [] on the result after the call. Now you can say
// nsString myStr;
// ...
// f(nsAutoCString(myStr));
// where f is declared as void f(const char*); This call will
// make a temporary char* pointer on the stack and delete[] it
// when the function returns.
//========================================================================================
{
public:
NS_EXPLICIT nsAutoCString(const nsString& other) : mCString(ToNewCString(other)) {}
virtual ~nsAutoCString();
operator const char*() const { return mCString; }
// operator const char*() { return mCString; }
// don't need this, since |operator const char*() const| can
// serve for both |const| and non-|const| callers
protected:
const char* mCString;
}; // class nsAutoCString
//========================================================================================
class NS_COM nsSimpleCharString
// An envelope for char*: reference counted. Used internally by all the nsFileSpec
@ -609,8 +579,7 @@ class NS_COM nsFileURL
void operator = (const char* inURLString);
void operator = (const nsString& inURLString)
{
const nsAutoCString string(inURLString);
*this = string;
*this = NS_LossyConvertUCS2toASCII(inURLString).get();
}
void operator = (const nsFilePath& inOther);
void operator = (const nsFileSpec& inOther);
@ -668,8 +637,7 @@ class NS_COM nsFilePath
void operator = (const char* inUnixPathString);
void operator = (const nsString& inUnixPathString)
{
const nsAutoCString string(inUnixPathString);
*this = string;
*this = NS_LossyConvertUCS2toASCII(inUnixPathString).get();
}
void operator = (const nsFileURL& inURL);
void operator = (const nsFileSpec& inOther);

View File

@ -634,7 +634,7 @@ nsFileSpec::nsFileSpec(const nsString& inNativePathString, PRBool inCreateDirs)
mError = NS_FILE_RESULT(
MacFileHelpers::FSSpecFromPathname(
nsAutoCString(inNativePathString),
NS_LossyConvertUCS2toASCII(inNativePathString).get(),
mSpec, inCreateDirs));
if (mError == NS_FILE_RESULT(fnfErr))
mError = NS_OK;
@ -1235,7 +1235,8 @@ nsFilePath::nsFilePath(const char* inString, PRBool inCreateDirs)
nsFilePath::nsFilePath(const nsString& inString, PRBool inCreateDirs)
//----------------------------------------------------------------------------------------
{
AssignFromPath(*this, nsAutoCString(inString), inCreateDirs);
AssignFromPath(*this, NS_LossyConvertUCS2toASCII(inString).get(),
inCreateDirs);
}
//----------------------------------------------------------------------------------------
@ -1310,12 +1311,12 @@ nsFileURL::nsFileURL(const nsString& inString, PRBool inCreateDirs)
//----------------------------------------------------------------------------------------
: mURL(nsnull)
{
nsAutoCString autostring(inString);
const char* cstring = (const char*)autostring;
mURL = cstring;
NS_ASSERTION(strstr(cstring, kFileURLPrefix) == cstring, "Not a URL!");
NS_LossyConvertUCS2toASCII cstring(inString);
mURL = cstring.get();
NS_ASSERTION(strstr(cstring.get(), kFileURLPrefix) == cstring.get(),
"Not a URL!");
mFileSpec.mError = NS_FILE_RESULT(MacFileHelpers::FSSpecFromUnixPath(
cstring + kFileURLPrefixLength,
cstring.get() + kFileURLPrefixLength,
mFileSpec.mSpec,
true, // need to decode
false, // resolve alias

View File

@ -2052,9 +2052,9 @@ nsNativeAppSupportWin::SetupSysTrayIcon() {
bundle1->GetStringFromName( NS_LITERAL_STRING( "brandShortName" ).get(),
getter_Copies( tooltip ) );
// (damned strings...)
nsAutoString autoTip( tooltip );
nsAutoCString tip( autoTip );
::strncpy( mIconData.szTip, (const char*)tip, sizeof mIconData.szTip - 1 );
::strncpy( mIconData.szTip,
NS_LossyConvertUCS2toASCII(tooltip).get(),
sizeof mIconData.szTip - 1 );
}
// Build menu.
nsCOMPtr<nsIStringBundle> bundle2;

View File

@ -1860,10 +1860,9 @@ nsNativeAppSupportWin::SetupSysTrayIcon() {
if ( brandBundle ) {
brandBundle->GetStringFromName( NS_LITERAL_STRING( "brandShortName" ).get(),
getter_Copies( tooltip ) );
// (damned strings...)
nsAutoString autoTip( tooltip );
nsAutoCString tip( autoTip );
::strncpy( mIconData.szTip, (const char*)tip, sizeof mIconData.szTip - 1 );
::strncpy( mIconData.szTip,
NS_LossyConvertUCS2toASCII(tooltip).get(),
sizeof mIconData.szTip - 1 );
}
// Build menu.
nsCOMPtr<nsIStringBundle> turboBundle;

View File

@ -731,9 +731,9 @@ nsInstall::DiskSpaceAvailable(const nsString& aFolder, PRInt64* aReturn)
LL_L2D(d, *aReturn);
return NS_OK;
}
nsAutoCString temp(aFolder);
nsCOMPtr<nsILocalFile> folder;
NS_NewLocalFile(temp, PR_TRUE, getter_AddRefs(folder));
NS_NewLocalFile(NS_LossyConvertUCS2toASCII(aFolder).get(), PR_TRUE,
getter_AddRefs(folder));
result = folder->GetDiskSpaceAvailable(aReturn);
return NS_OK;
@ -2628,8 +2628,7 @@ nsInstall::ExtractFileFromJar(const nsString& aJarfile, nsIFile* aSuggestedName,
aJarfile.Right(extension, (aJarfile.Length() - extpos) );
tempFileName += extension;
}
nsAutoCString temp(tempFileName);
tempFile->Append(temp);
tempFile->Append(NS_LossyConvertUCS2toASCII(tempFileName).get());
// Create a temporary file to extract to
MakeUnique(tempFile);
@ -2679,7 +2678,8 @@ nsInstall::ExtractFileFromJar(const nsString& aJarfile, nsIFile* aSuggestedName,
extractHereSpec = temp;
}
rv = mJarFileData->Extract(nsAutoCString(aJarfile), extractHereSpec);
rv = mJarFileData->Extract(NS_LossyConvertUCS2toASCII(aJarfile).get(),
extractHereSpec);
if (NS_FAILED(rv))
{
switch (rv) {
@ -2743,19 +2743,13 @@ nsInstall::ExtractFileFromJar(const nsString& aJarfile, nsIFile* aSuggestedName,
char*
nsInstall::GetResourcedString(const nsString& aResName)
{
nsString rscdStr;
PRBool bStrBdlSuccess = PR_FALSE;
if (mStringBundle)
{
const PRUnichar *ucResName = aResName.get();
PRUnichar *ucRscdStr = nsnull;
nsresult rv = mStringBundle->GetStringFromName(ucResName, &ucRscdStr);
nsXPIDLString ucRscdStr;
nsresult rv = mStringBundle->GetStringFromName(aResName.get(),
getter_Copies(ucRscdStr));
if (NS_SUCCEEDED(rv))
{
bStrBdlSuccess = PR_TRUE;
rscdStr = ucRscdStr;
}
return ToNewCString(ucRscdStr);
}
/*
@ -2763,13 +2757,8 @@ nsInstall::GetResourcedString(const nsString& aResName)
** so we failover to hardcoded english strings so we log something rather
** than nothing due to failure above: always the case for the Install Wizards.
*/
if (!bStrBdlSuccess)
{
nsAutoCString temp(aResName);
rscdStr.AssignWithConversion(nsInstallResources::GetDefaultVal(temp));
}
return ToNewCString(rscdStr);
return nsCRT::strdup(nsInstallResources::GetDefaultVal(
NS_LossyConvertUCS2toASCII(aResName).get()));
}
@ -2782,11 +2771,12 @@ nsInstall::ExtractDirEntries(const nsString& directory, nsVoidArray *paths)
if ( paths )
{
nsString pattern(directory);
pattern.AppendWithConversion("/*");
nsString pattern(directory + NS_LITERAL_STRING("/*"));
PRInt32 prefix_length = directory.Length()+1; // account for slash
nsresult rv = mJarFileData->FindEntries( nsAutoCString(pattern), &jarEnum );
nsresult rv = mJarFileData->FindEntries(
NS_LossyConvertUCS2toASCII(pattern).get(),
&jarEnum );
if (NS_FAILED(rv) || !jarEnum)
goto handle_err;

View File

@ -140,8 +140,7 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
else
{
nsresult rv = inPartialPath.Mid(subString, offset, nodeLength);
nsAutoCString tempSubString(subString);
mFinalFile->Append(tempSubString);
mFinalFile->Append(NS_LossyConvertUCS2toASCII(subString).get());
offset += nodeLength + 1;
if (!finished)
location = inPartialPath.FindChar('/',PR_FALSE, offset);

View File

@ -653,8 +653,8 @@ nsInstallFileOpItem::NativeFileOpFileRenamePrepare()
nsIFile* target;
mSrc->GetParent(&target);
nsAutoCString tempTargetString(*mStrTarget);
nsresult rv = target->Append(tempTargetString);
nsresult rv =
target->Append(NS_LossyConvertUCS2toASCII(*mStrTarget).get());
//90% of the failures during Append will be because the target wasn't in string form
// which it must be.
if (NS_FAILED(rv)) return nsInstall::INVALID_ARGUMENTS;
@ -694,8 +694,7 @@ nsInstallFileOpItem::NativeFileOpFileRenameComplete()
if (target)
{
nsAutoCString tempTargetString(*mStrTarget);
target->Append(tempTargetString);
target->Append(NS_LossyConvertUCS2toASCII(*mStrTarget).get());
}
else
return nsInstall::UNEXPECTED_ERROR;
@ -703,8 +702,8 @@ nsInstallFileOpItem::NativeFileOpFileRenameComplete()
target->Exists(&flagExists);
if(!flagExists)
{
nsAutoCString tempTargetString(*mStrTarget);
mSrc->MoveTo(parent, tempTargetString);
mSrc->MoveTo(parent,
NS_LossyConvertUCS2toASCII(*mStrTarget).get());
}
else
return nsInstall::ALREADY_EXISTS;
@ -739,8 +738,7 @@ nsInstallFileOpItem::NativeFileOpFileRenameAbort()
mSrc->GetParent(getter_AddRefs(parent));
if(parent)
{
nsAutoCString tempTargetString(*mStrTarget);
newFilename->Append(tempTargetString);
newFilename->Append(NS_LossyConvertUCS2toASCII(*mStrTarget).get());
mSrc->GetLeafName(&leafName);
@ -967,7 +965,7 @@ PRInt32
nsInstallFileOpItem::NativeFileOpFileExecuteComplete()
{
//mTarget->Execute(*mParams);
//mTarget->Spawn(nsAutoCString(*mParams), 0);
//mTarget->Spawn(NS_LossyConvertUCS2toASCII(*mParams).get(), 0);
char *cParams[1];
@ -1146,7 +1144,7 @@ nsInstallFileOpItem::NativeFileOpDirRenamePrepare()
nsCOMPtr<nsIFile> target;
mSrc->GetParent(getter_AddRefs(target));
target->Append(nsAutoCString(*mStrTarget));
target->Append(NS_LossyConvertUCS2toASCII(*mStrTarget).get());
target->Exists(&flagExists);
if(flagExists)
@ -1176,16 +1174,15 @@ nsInstallFileOpItem::NativeFileOpDirRenameComplete()
nsCOMPtr<nsIFile> target;
mSrc->GetParent(getter_AddRefs(target));
target->Append(nsAutoCString(*mStrTarget));
target->Append(NS_LossyConvertUCS2toASCII(*mStrTarget).get());
target->Exists(&flagExists);
if(!flagExists)
{
nsAutoCString cStrTarget(*mStrTarget);
nsCOMPtr<nsIFile> parent;
mSrc->GetParent(getter_AddRefs(parent));
ret = mSrc->MoveTo(parent, cStrTarget);
ret = mSrc->MoveTo(parent,
NS_LossyConvertUCS2toASCII(*mStrTarget).get());
}
else
return nsInstall::ALREADY_EXISTS;
@ -1212,7 +1209,7 @@ nsInstallFileOpItem::NativeFileOpDirRenameAbort()
if(!flagExists)
{
mSrc->GetParent(getter_AddRefs(newDirName));
newDirName->Append(nsAutoCString(*mStrTarget));
newDirName->Append(NS_LossyConvertUCS2toASCII(*mStrTarget).get());
mSrc->GetLeafName(&leafName);
mSrc->GetParent(getter_AddRefs(parent));
ret = newDirName->MoveTo(parent, leafName);
@ -1326,7 +1323,7 @@ nsInstallFileOpItem::NativeFileOpWindowsShortcutAbort()
shortcutDescription = *mDescription;
shortcutDescription.AppendWithConversion(".lnk");
mShortcutPath->Clone(getter_AddRefs(shortcutTarget));
shortcutTarget->Append(nsAutoCString(shortcutDescription));
shortcutTarget->Append(NS_LossyConvertUCS2toASCII(shortcutDescription).get());
NativeFileOpFileDeleteComplete(shortcutTarget);
#endif

View File

@ -175,7 +175,7 @@ nsInstallPatch::nsInstallPatch( nsInstall* inInstall,
mVersionInfo->Init(inVInfo);
if(! inPartialPath.IsEmpty())
mTargetFile->Append(nsAutoCString(inPartialPath));
mTargetFile->Append(NS_LossyConvertUCS2toASCII(inPartialPath).get());
}
nsInstallPatch::~nsInstallPatch()
@ -470,7 +470,7 @@ nsInstallPatch::NativePatch(nsIFile *sourceFile, nsIFile *patchFile, nsIFile **n
rv = sourceFile->Clone(getter_AddRefs(tempSrcFile)); //Clone the sourceFile
tempSrcFile->SetLeafName(nsAutoCString(tmpFileName)); //Append the new leafname
tempSrcFile->SetLeafName(NS_LossyConvertUCS2toASCII(tmpFileName).get()); //Append the new leafname
uniqueSrcFile = do_QueryInterface(tempSrcFile, &rv); //Create an nsILocalFile version to pass to MakeUnique
MakeUnique(uniqueSrcFile);
@ -537,7 +537,7 @@ nsInstallPatch::NativePatch(nsIFile *sourceFile, nsIFile *patchFile, nsIFile **n
}
outFileSpec->SetLeafName(nsAutoCString(newFileName)); //Set new leafname
outFileSpec->SetLeafName(NS_LossyConvertUCS2toASCII(newFileName).get()); //Set new leafname
nsCOMPtr<nsILocalFile> outFileLocal = do_QueryInterface(outFileSpec, &rv); //Create an nsILocalFile version
//to send to MakeUnique()
MakeUnique(outFileLocal);

View File

@ -54,7 +54,7 @@ nsInstallUninstall::nsInstallUninstall( nsInstall* inInstall,
mRegName.Assign(regName);
char* userName = (char*)PR_Malloc(MAXREGPATHLEN);
PRInt32 err = VR_GetUninstallUserName( (char*) (const char*) nsAutoCString(regName),
PRInt32 err = VR_GetUninstallUserName( NS_CONST_CAST(char*, NS_LossyConvertUCS2toASCII(regName).get()),
userName,
MAXREGPATHLEN );
@ -88,7 +88,7 @@ PRInt32 nsInstallUninstall::Complete()
if (mInstall == NULL)
return nsInstall::INVALID_ARGUMENTS;
err = SU_Uninstall( (char*)(const char*) nsAutoCString(mRegName) );
err = SU_Uninstall( NS_CONST_CAST(char*, NS_LossyConvertUCS2toASCII(mRegName).get()) );
return err;
}

View File

@ -1163,15 +1163,15 @@ InstallFileOpFileWindowsShortcut(JSContext *cx, JSObject *obj, uintN argc, jsval
ConvertJSValToStr(b0, cx, argv[0]);
NS_NewLocalFile(nsAutoCString(b0), PR_TRUE, getter_AddRefs(nsfsB0));
NS_NewLocalFile(NS_LossyConvertUCS2toASCII(b0).get(), PR_TRUE, getter_AddRefs(nsfsB0));
ConvertJSValToStr(b1, cx, argv[1]);
NS_NewLocalFile(nsAutoCString(b1), PR_TRUE, getter_AddRefs(nsfsB1));
NS_NewLocalFile(NS_LossyConvertUCS2toASCII(b1).get(), PR_TRUE, getter_AddRefs(nsfsB1));
ConvertJSValToStr(b2, cx, argv[2]);
ConvertJSValToStr(b3, cx, argv[3]);
NS_NewLocalFile(nsAutoCString(b3), PR_TRUE, getter_AddRefs(nsfsB3));
NS_NewLocalFile(NS_LossyConvertUCS2toASCII(b3).get(), PR_TRUE, getter_AddRefs(nsfsB3));
ConvertJSValToStr(b4, cx, argv[4]);
ConvertJSValToStr(b5, cx, argv[5]);
NS_NewLocalFile(nsAutoCString(b5), PR_TRUE, getter_AddRefs(nsfsB5));
NS_NewLocalFile(NS_LossyConvertUCS2toASCII(b5).get(), PR_TRUE, getter_AddRefs(nsfsB5));
if(JSVAL_IS_NULL(argv[6]))
{
@ -1273,7 +1273,7 @@ InstallFileOpFileMacAlias(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
}
ConvertJSValToStr(sourceLeaf, cx, argv[1]);
rv1 = iFileSource->Append(nsAutoCString(sourceLeaf));
rv1 = iFileSource->Append(NS_LossyConvertUCS2toASCII(sourceLeaf).get());
// public int FileMacAlias( InstallFolder aSourceFolder,
// String aSourceFileName,
@ -1298,7 +1298,7 @@ InstallFileOpFileMacAlias(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
aliasLeaf.AppendWithConversion(" alias"); // XXX use GetResourcedString(id)
}
rv2 = iFileAlias->Append(nsAutoCString(aliasLeaf));
rv2 = iFileAlias->Append(NS_LossyConvertUCS2toASCII(aliasLeaf).get());
if (!NS_SUCCEEDED(rv1) || !NS_SUCCEEDED(rv2))
{
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);

View File

@ -551,7 +551,7 @@ nsXPINotifierImpl::OnEndLoad(nsIRDFXMLSink *aSink)
nsMemory::Free(regkeyCString);
// check to see if this software title should be "flashed"
if (IsNewerOrUninstalled(nsAutoCString(regKeyString), nsAutoCString(versionString)))
if (IsNewerOrUninstalled(NS_LossyConvertUCS2toASCII(regKeyString).get(), NS_LossyConvertUCS2toASCII(versionString).get()))
{
//assert into flash