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