Supplementary patch to bug 66868 to use attribute AString unicodePath; r=mkaply sr=mscott

This commit is contained in:
neil%parkwaycc.co.uk 2004-01-05 17:22:43 +00:00
parent 97ad17c191
commit 903d0c79bf
3 changed files with 7 additions and 15 deletions

View File

@ -992,7 +992,7 @@ function getFormElementValue(formElement) {
formElement.getAttribute("datatype") == "nsIFileSpec") {
if (formElement.value) {
var filespec = Components.classes["@mozilla.org/filespec;1"].createInstance(Components.interfaces.nsIFileSpec);
filespec.setUnicodePath(formElement.value);
filespec.unicodePath = formElement.value;
return filespec;
}
return null;
@ -1065,7 +1065,7 @@ function setFormElementValue(formElement, value) {
if (value) {
var filespec = value.QueryInterface(Components.interfaces.nsIFileSpec);
try {
formElement.value = filespec.getUnicodePath();
formElement.value = filespec.unicodePath;
} catch (ex) {
dump("Still need to fix uninitialized filespec problem!\n");
}

View File

@ -213,29 +213,22 @@ NS_IMETHODIMP nsFileSpecImpl::SetNativePath(const char * aNativePath)
}
//----------------------------------------------------------------------------------------
NS_IMETHODIMP nsFileSpecImpl::GetUnicodePath(PRUnichar * *aUnicodePath)
NS_IMETHODIMP nsFileSpecImpl::GetUnicodePath(nsAString & aUnicodePath)
//----------------------------------------------------------------------------------------
{
TEST_OUT_PTR(aUnicodePath)
nsAutoString unicode;
nsCAutoString native;
native = mFileSpec.GetNativePathCString();
NS_CopyNativeToUnicode(native, unicode);
*aUnicodePath = nsCRT::strdup(unicode.get());
if (!*aUnicodePath)
return NS_ERROR_OUT_OF_MEMORY;
NS_CopyNativeToUnicode(native, aUnicodePath);
return NS_OK;
}
//----------------------------------------------------------------------------------------
NS_IMETHODIMP nsFileSpecImpl::SetUnicodePath(const PRUnichar * aUnicodePath)
NS_IMETHODIMP nsFileSpecImpl::SetUnicodePath(const nsAString & aUnicodePath)
//----------------------------------------------------------------------------------------
{
nsAutoString unicode;
nsCAutoString native;
unicode = aUnicodePath;
NS_CopyUnicodeToNative(unicode, native);
NS_CopyUnicodeToNative(aUnicodePath, native);
mFileSpec = native.get();
return NS_OK;
}

View File

@ -154,8 +154,7 @@ interface nsIFileSpec : nsISupports
void seek(in long offset);
long tell();
void endLine();
wstring getUnicodePath();
void setUnicodePath(in wstring aUnicodePath);
attribute AString unicodePath;
};