зеркало из https://github.com/mozilla/gecko-dev.git
fix for bug 206379:
- combine nsICharsetConverterManager2 and nsICharsetConverterManager - get rid of nsIAtom in most of the methods - provide versions of getUnicodeDecoder/Encoder which don't do alias resolution - change all charset types to ASCII strings - clean up some other i18n APIs which could be simplified - fix all consumers of all changed i18n interfaces r=jshin, smontagu rs=sfraser
This commit is contained in:
Родитель
8a1178805d
Коммит
7ec0c04351
|
@ -600,7 +600,7 @@ BookmarkParser::Init(nsIFile *aFile, nsIRDFDataSource *aDataSource,
|
|||
do_GetService(kPlatformCharsetCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && (platformCharset))
|
||||
{
|
||||
nsAutoString defaultCharset;
|
||||
nsCAutoString defaultCharset;
|
||||
if (NS_SUCCEEDED(rv = platformCharset->GetCharset(kPlatformCharsetSel_4xBookmarkFile, defaultCharset)))
|
||||
{
|
||||
// found the default platform charset, now try and get a decoder from it to Unicode
|
||||
|
@ -608,7 +608,8 @@ BookmarkParser::Init(nsIFile *aFile, nsIRDFDataSource *aDataSource,
|
|||
do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && (charsetConv))
|
||||
{
|
||||
rv = charsetConv->GetUnicodeDecoder(&defaultCharset, getter_AddRefs(mUnicodeDecoder));
|
||||
rv = charsetConv->GetUnicodeDecoderRaw(defaultCharset.get(),
|
||||
getter_AddRefs(mUnicodeDecoder));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1032,22 +1033,10 @@ BookmarkParser::ParseMetaTag(const nsString &aLine, nsIUnicodeDecoder **decoder)
|
|||
NS_ASSERTION(start >= 0, "no 'charset=' string: how'd we get here?");
|
||||
if (start < 0) return NS_ERROR_UNEXPECTED;
|
||||
start += (sizeof(kCharsetEquals)-1);
|
||||
nsAutoString charset;
|
||||
content.Mid(charset, start, content.Length() - start);
|
||||
nsCAutoString charset;
|
||||
charset.AssignWithConversion(Substring(content, start, content.Length() - start));
|
||||
if (charset.Length() < 1) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
if (gCharsetAlias)
|
||||
{
|
||||
nsAutoString charsetName;
|
||||
if (NS_SUCCEEDED(rv = gCharsetAlias->GetPreferred(charset, charsetName)))
|
||||
{
|
||||
if (!charsetName.IsEmpty())
|
||||
{
|
||||
charset = charsetName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// found a charset, now try and get a decoder from it to Unicode
|
||||
nsICharsetConverterManager *charsetConv = nsnull;
|
||||
rv = nsServiceManager::GetService(kCharsetConverterManagerCID,
|
||||
|
@ -1055,7 +1044,7 @@ BookmarkParser::ParseMetaTag(const nsString &aLine, nsIUnicodeDecoder **decoder)
|
|||
(nsISupports**)&charsetConv);
|
||||
if (NS_SUCCEEDED(rv) && (charsetConv))
|
||||
{
|
||||
rv = charsetConv->GetUnicodeDecoder(&charset, decoder);
|
||||
rv = charsetConv->GetUnicodeDecoderRaw(charset.get(), decoder);
|
||||
NS_RELEASE(charsetConv);
|
||||
}
|
||||
return rv;
|
||||
|
@ -1371,7 +1360,9 @@ BookmarkParser::ParseLiteral(nsIRDFResource *arc, nsString& aValue, nsIRDFNode**
|
|||
{
|
||||
if (gCharsetAlias)
|
||||
{
|
||||
gCharsetAlias->GetPreferred(aValue, aValue);
|
||||
nsCAutoString charset; charset.AssignWithConversion(aValue);
|
||||
gCharsetAlias->GetPreferred(charset, charset);
|
||||
aValue.AssignWithConversion(charset.get());
|
||||
}
|
||||
}
|
||||
else if (arc == kWEB_LastPingETag)
|
||||
|
|
Загрузка…
Ссылка в новой задаче