зеркало из https://github.com/mozilla/gecko-dev.git
r=pedemont, sr=bz Handle unicode conversion failure better
This commit is contained in:
Родитель
8b14ddcf8f
Коммит
6c13a8f4d9
|
@ -1710,16 +1710,13 @@ nsLocalFile::GetTarget(nsAString &_retval)
|
|||
nsresult
|
||||
NS_NewLocalFile(const nsAString &path, PRBool followLinks, nsILocalFile* *result)
|
||||
{
|
||||
if (path.IsEmpty())
|
||||
return NS_NewNativeLocalFile(nsCString(), followLinks, result);
|
||||
|
||||
nsCAutoString tmp;
|
||||
nsresult rv = NS_CopyUnicodeToNative(path, tmp);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return NS_NewNativeLocalFile(tmp, followLinks, result);
|
||||
|
||||
return NS_OK;
|
||||
nsCAutoString buf;
|
||||
nsresult rv = NS_CopyUnicodeToNative(path, buf);
|
||||
if (NS_FAILED(rv)) {
|
||||
*result = nsnull;
|
||||
return rv;
|
||||
}
|
||||
return NS_NewNativeLocalFile(buf, followLinks, result);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -2424,12 +2424,13 @@ nsLocalFile::GetTarget(nsAString &_retval)
|
|||
nsresult
|
||||
NS_NewLocalFile(const nsAString &path, PRBool followLinks, nsILocalFile* *result)
|
||||
{
|
||||
nsCAutoString tmp;
|
||||
nsresult rv = NS_CopyUnicodeToNative(path, tmp);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return NS_NewNativeLocalFile(tmp, followLinks, result);
|
||||
|
||||
return NS_OK;
|
||||
nsCAutoString buf;
|
||||
nsresult rv = NS_CopyUnicodeToNative(path, buf);
|
||||
if (NS_FAILED(rv)) {
|
||||
*result = nsnull;
|
||||
return rv;
|
||||
}
|
||||
return NS_NewNativeLocalFile(buf, followLinks, result);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче