Commit 9f71d5e6 authored by Makoto Kato's avatar Makoto Kato
Browse files

Bug 1351543 - Remove nsIPlatformCharset::GetDefaultCharsetForLocale. r=jfkthame

After landing bug bug 943283, no one uses nsIPlatformCharset::GetDefaultCharsetForLocale.  Also, nsIPlatformCharset isn't scriptable interface, so it is unnecessary now.

MozReview-Commit-ID: Giy68AS9yK2

--HG--
extra : rebase_source : a0ae86c5472e1ed74b41c2f6af5cdace353b335d
parent 05006bd2
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -29,13 +29,6 @@ nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsACString& oResult
  return NS_OK;
}

NS_IMETHODIMP 
nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACString &oResult)
{
  oResult.AssignLiteral("UTF-8");
  return NS_OK;
}

nsresult
nsPlatformCharset::InitGetCharset(nsACString &oString)
{
+0 −7
Original line number Diff line number Diff line
@@ -27,13 +27,6 @@ nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsACString& oResult
  return NS_OK;
}

NS_IMETHODIMP 
nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACString &oResult)
{
  oResult.AssignLiteral("UTF-8");
  return NS_OK;
}

NS_IMETHODIMP 
nsPlatformCharset::Init()
{
+0 −3
Original line number Diff line number Diff line
@@ -48,9 +48,6 @@ public:
  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPLATFORMCHARSET_IID)

  NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsACString& oResult) = 0;

  NS_IMETHOD GetDefaultCharsetForLocale(const nsAString& localeName, nsACString& oResult) = 0;

};

NS_DEFINE_STATIC_IID_ACCESSOR(nsIPlatformCharset, NS_IPLATFORMCHARSET_IID)
+1 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@

#include "nsIPlatformCharset.h"

class nsPlatformCharset : public nsIPlatformCharset
class nsPlatformCharset final : public nsIPlatformCharset
{
  NS_DECL_ISUPPORTS

@@ -17,7 +17,6 @@ public:

  NS_IMETHOD Init();
  NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsACString& oResult) override;
  NS_IMETHOD GetDefaultCharsetForLocale(const nsAString& localeName, nsACString& oResult) override;

private:
  nsCString mCharset;
+0 −48
Original line number Diff line number Diff line
@@ -65,54 +65,6 @@ nsPlatformCharset::GetCharset(nsPlatformCharsetSel selector, nsACString& oResult
  return NS_OK;
}

NS_IMETHODIMP 
nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACString &oResult)
{
  // 
  // if this locale is the user's locale then use the charset 
  // we already determined at initialization
  // 
  if (mLocale.Equals(localeName) ||
    // support the 4.x behavior
    (mLocale.LowerCaseEqualsLiteral("en_us") && 
     localeName.LowerCaseEqualsLiteral("c"))) {
    oResult = mCharset;
    return NS_OK;
  }

#if HAVE_LANGINFO_CODESET
  //
  // This locale appears to be a different locale from the user's locale. 
  // To do this we would need to lock the global resource we are currently 
  // using or use a library that provides multi locale support. 
  // ICU is a possible example of a multi locale library.
  //     http://oss.software.ibm.com/icu/
  //
  // A more common cause of hitting this warning than the above is that 
  // Mozilla is launched under an ll_CC.UTF-8 locale. In xpLocale, 
  // we only store the language and the region (ll-CC) losing 'UTF-8', which
  // leads |mLocale| to be different from |localeName|. Although we lose
  // 'UTF-8', we init'd |mCharset| with the value obtained via 
  // |nl_langinfo(CODESET)| so that we're all right here.
  // 
  NS_WARNING("GetDefaultCharsetForLocale: need to add multi locale support");
#ifdef DEBUG_jungshik
  printf("localeName=%s mCharset=%s\n", NS_ConvertUTF16toUTF8(localeName).get(),
         mCharset.get());
#endif
  // until we add multi locale support: use the the charset of the user's locale
  oResult = mCharset;
  return NS_SUCCESS_USING_FALLBACK_LOCALE;
#else
  //
  // convert from locale to charset
  // using the deprecated locale to charset mapping 
  //
  NS_LossyConvertUTF16toASCII localeStr(localeName);
  return ConvertLocaleToCharsetUsingDeprecatedConfig(localeStr, oResult);
#endif
}

nsresult
nsPlatformCharset::InitGetCharset(nsACString &oString)
{
Loading