Convert the cmdline Profile name from
platform charset to Unicode instead of calling
AssignWithConversion()
/r=ccarlen, /sr=brendan
This commit is contained in:
yokoyama%netscape.com 2001-11-01 22:17:10 +00:00
Родитель c72956b7da
Коммит e277e38c45
3 изменённых файлов: 27 добавлений и 6 удалений

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

@ -774,7 +774,16 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs,
{
if (cmdResult) {
foundProfileCommandArg = PR_TRUE;
nsAutoString currProfileName; currProfileName.AssignWithConversion(cmdResult);
// get a platform charset
nsAutoString charSet;
rv = GetPlatformCharset(charSet);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get a platform charset");
// convert the profile name to Unicode
nsAutoString currProfileName;
nsCAutoString profileName(strtok(NS_CONST_CAST(char*,(const char*)cmdResult), " "));
rv = ConvertStringToUnicode(charSet, profileName.get(), currProfileName);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to convert ProfileName to unicode");
#ifdef DEBUG_profile
printf("ProfileName : %s\n", (const char*)cmdResult);
@ -830,7 +839,18 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs,
#endif
foundProfileCommandArg = PR_TRUE;
nsAutoString currProfileName; currProfileName.AssignWithConversion(strtok(NS_CONST_CAST(char*,(const char*)cmdResult), " "));
// get a platform charset
nsAutoString charSet;
rv = GetPlatformCharset(charSet);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get a platform charset");
// convert the profile name to Unicode
nsAutoString currProfileName;
nsCAutoString profileName(strtok(NS_CONST_CAST(char*,(const char*)cmdResult), " "));
rv = ConvertStringToUnicode(charSet, profileName.get(), currProfileName);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to convert ProfileName to unicode");
nsAutoString currProfileDirString; currProfileDirString.AssignWithConversion(strtok(NULL, " "));
if (!currProfileDirString.IsEmpty()) {

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

@ -113,3 +113,6 @@ public:
nsresult ShowProfileWizard(void);
};
extern nsresult ConvertStringToUnicode(nsString& aCharset, const char* inString, nsAWritableString& outString);
extern nsresult GetPlatformCharset(nsString& aCharset);

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

@ -114,9 +114,8 @@ nsProfileAccess::~nsProfileAccess()
}
// A wrapper function to call the interface to get a platform file charset.
static
nsresult
GetPlatformCharset(nsAutoString& aCharset)
GetPlatformCharset(nsString& aCharset)
{
nsresult rv;
@ -132,9 +131,8 @@ GetPlatformCharset(nsAutoString& aCharset)
}
// Apply a charset conversion from the given charset to Unicode for input C string.
static
nsresult
ConvertStringToUnicode(nsAutoString& aCharset, const char* inString, nsAutoString& outString)
ConvertStringToUnicode(nsString& aCharset, const char* inString, nsAWritableString& outString)
{
nsresult rv;
// convert result to unicode