зеркало из https://github.com/mozilla/gecko-dev.git
Bug 104305
Convert the cmdline Profile name from platform charset to Unicode instead of calling AssignWithConversion() /r=ccarlen, /sr=brendan
This commit is contained in:
Родитель
c72956b7da
Коммит
e277e38c45
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче