r=pedemont, sr=bz
Handle unicode conversion failure better
This commit is contained in:
mkaply%us.ibm.com 2003-07-28 21:02:45 +00:00
Родитель 878a435300
Коммит 5a1760adae
2 изменённых файлов: 14 добавлений и 16 удалений

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

@ -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);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------