зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1488628 - Change nsIDirIndex's wstring/string attributes to AString/ACString. r=valentin
--HG-- extra : rebase_source : c1a6ecf98205caf45e8011b2b83c89a39b345d1f
This commit is contained in:
Родитель
55657f2206
Коммит
ef6bbbc647
|
@ -31,59 +31,44 @@ nsDirIndex::SetType(uint32_t aType)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirIndex::GetContentType(char* *aContentType)
|
||||
nsDirIndex::GetContentType(nsACString& aContentType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentType);
|
||||
|
||||
*aContentType = ToNewCString(mContentType);
|
||||
if (!*aContentType)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
aContentType = mContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirIndex::SetContentType(const char* aContentType)
|
||||
nsDirIndex::SetContentType(const nsACString& aContentType)
|
||||
{
|
||||
mContentType = aContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirIndex::GetLocation(char* *aLocation)
|
||||
nsDirIndex::GetLocation(nsACString& aLocation)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLocation);
|
||||
|
||||
*aLocation = ToNewCString(mLocation);
|
||||
if (!*aLocation)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
aLocation = mLocation;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirIndex::SetLocation(const char* aLocation)
|
||||
nsDirIndex::SetLocation(const nsACString& aLocation)
|
||||
{
|
||||
mLocation = aLocation;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirIndex::GetDescription(char16_t* *aDescription)
|
||||
nsDirIndex::GetDescription(nsAString& aDescription)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDescription);
|
||||
|
||||
*aDescription = ToNewUnicode(mDescription);
|
||||
if (!*aDescription)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
aDescription = mDescription;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDirIndex::SetDescription(const char16_t* aDescription)
|
||||
nsDirIndex::SetDescription(const nsAString& aDescription)
|
||||
{
|
||||
mDescription.Assign(aDescription);
|
||||
mDescription = aDescription;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,9 +246,9 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr, int32_t aLineLen)
|
|||
if (NS_SUCCEEDED(rv = gTextToSubURI->UnEscapeAndConvert(
|
||||
mEncoding, filename, result))) {
|
||||
if (!result.IsEmpty()) {
|
||||
aIdx->SetLocation(filename.get());
|
||||
aIdx->SetLocation(filename);
|
||||
if (!mHasDescription)
|
||||
aIdx->SetDescription(result.get());
|
||||
aIdx->SetDescription(result);
|
||||
success = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -261,16 +261,16 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr, int32_t aLineLen)
|
|||
// just fallback to unescape'ing in-place
|
||||
// XXX - this shouldn't be using UTF8, should it?
|
||||
// when can we fail to get the service, anyway? - bbaetz
|
||||
aIdx->SetLocation(filename.get());
|
||||
aIdx->SetLocation(filename);
|
||||
if (!mHasDescription) {
|
||||
aIdx->SetDescription(NS_ConvertUTF8toUTF16(value).get());
|
||||
aIdx->SetDescription(NS_ConvertUTF8toUTF16(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FIELD_DESCRIPTION:
|
||||
nsUnescape(value);
|
||||
aIdx->SetDescription(NS_ConvertUTF8toUTF16(value).get());
|
||||
aIdx->SetDescription(NS_ConvertUTF8toUTF16(value));
|
||||
break;
|
||||
case FIELD_CONTENTLENGTH:
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr, int32_t aLineLen)
|
|||
}
|
||||
break;
|
||||
case FIELD_CONTENTTYPE:
|
||||
aIdx->SetContentType(value);
|
||||
aIdx->SetContentType(nsDependentCString(value));
|
||||
break;
|
||||
case FIELD_FILETYPE:
|
||||
// unescape in-place
|
||||
|
|
|
@ -687,7 +687,7 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
|
|||
// We don't know the file's character set yet, so retrieve the raw bytes
|
||||
// which will be decoded by the HTML parser.
|
||||
nsCString loc;
|
||||
aIndex->GetLocation(getter_Copies(loc));
|
||||
aIndex->GetLocation(loc);
|
||||
|
||||
// Adjust the length in case unescaping shortened the string.
|
||||
loc.Truncate(nsUnescapeCount(loc.BeginWriting()));
|
||||
|
|
|
@ -41,7 +41,7 @@ interface nsIDirIndex : nsISupports
|
|||
* The content type - may be null if it is unknown.
|
||||
* Unspecified for directories
|
||||
*/
|
||||
attribute string contentType;
|
||||
attribute ACString contentType;
|
||||
|
||||
/**
|
||||
* The fully qualified filename, expressed as a uri
|
||||
|
@ -49,13 +49,13 @@ interface nsIDirIndex : nsISupports
|
|||
* This is encoded with the encoding specified in
|
||||
* the nsIDirIndexParser, and is also escaped.
|
||||
*/
|
||||
attribute string location;
|
||||
attribute ACString location;
|
||||
|
||||
/**
|
||||
* A description for the filename, which should be
|
||||
* displayed by a viewer
|
||||
*/
|
||||
attribute wstring description;
|
||||
attribute AString description;
|
||||
|
||||
/**
|
||||
* File size, with -1 meaning "unknown"
|
||||
|
|
Загрузка…
Ссылка в новой задаче