aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-10-12 02:23:14 +0800
committerChristian Persch <chpe@src.gnome.org>2003-10-12 02:23:14 +0800
commit26c341eb29803fc00f382a7a157772852a4848bc (patch)
treeb3971283f04a91422b4a003d8a90879f72df0c09 /embed
parent79f0ce300ef1ab356e4fb911db0dc90c560e1fef (diff)
downloadgsoc2013-epiphany-26c341eb29803fc00f382a7a157772852a4848bc.tar
gsoc2013-epiphany-26c341eb29803fc00f382a7a157772852a4848bc.tar.gz
gsoc2013-epiphany-26c341eb29803fc00f382a7a157772852a4848bc.tar.bz2
gsoc2013-epiphany-26c341eb29803fc00f382a7a157772852a4848bc.tar.lz
gsoc2013-epiphany-26c341eb29803fc00f382a7a157772852a4848bc.tar.xz
gsoc2013-epiphany-26c341eb29803fc00f382a7a157772852a4848bc.tar.zst
gsoc2013-epiphany-26c341eb29803fc00f382a7a157772852a4848bc.zip
Adapt EphyWrapper::GetEncoding to varying mozilla APIs.
2003-10-11 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyWrapper.cpp: * embed/mozilla/EphyWrapper.h: * embed/mozilla/mozilla-embed.cpp: Adapt EphyWrapper::GetEncoding to varying mozilla APIs.
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/EphyWrapper.cpp20
-rw-r--r--embed/mozilla/EphyWrapper.h2
-rw-r--r--embed/mozilla/mozilla-embed.cpp8
3 files changed, 20 insertions, 10 deletions
diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp
index bd3fe3ab4..9c229acc1 100644
--- a/embed/mozilla/EphyWrapper.cpp
+++ b/embed/mozilla/EphyWrapper.cpp
@@ -752,7 +752,7 @@ nsresult EphyWrapper::PopTargetDocument ()
return NS_OK;
}
-nsresult EphyWrapper::GetEncoding (nsCString &aEncoding)
+nsresult EphyWrapper::GetEncoding (char **aEncoding)
{
nsresult result;
@@ -762,6 +762,20 @@ nsresult EphyWrapper::GetEncoding (nsCString &aEncoding)
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc, &result);
if (NS_FAILED (result) || !doc) return NS_ERROR_FAILURE;
-
- return doc->GetDocumentCharacterSet (aEncoding);
+
+#if MOZILLA_SNAPSHOT >= 10
+ nsCAutoString enc;
+ result = doc->GetDocumentCharacterSet (enc);
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ *aEncoding = g_strdup (enc.get());
+#else
+ nsAutoString enc;
+ result = doc->GetDocumentCharacterSet (enc);
+ if (NS_FAILED (result)) return NS_ERROR_FAILURE;
+
+ *aEncoding = g_strdup (NS_ConvertUCS2toUTF8(enc).get());
+#endif
+
+ return NS_OK;
}
diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyWrapper.h
index 51e99ad66..32cfe5efd 100644
--- a/embed/mozilla/EphyWrapper.h
+++ b/embed/mozilla/EphyWrapper.h
@@ -78,7 +78,7 @@ public:
nsresult ForceEncoding (const char *encoding);
- nsresult GetEncoding (nsCString &aEncoding);
+ nsresult GetEncoding (char **aEncoding);
nsresult CanCutSelection(PRBool *result);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index ae1f7f7b1..de87457e3 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -1197,7 +1197,6 @@ impl_get_encoding (EphyEmbed *embed,
{
nsresult result;
EphyWrapper *wrapper;
- nsCAutoString enc;
g_return_val_if_fail (encoding != NULL, G_FAILED);
*encoding = NULL;
@@ -1205,12 +1204,9 @@ impl_get_encoding (EphyEmbed *embed,
wrapper = MOZILLA_EMBED(embed)->priv->wrapper;
g_return_val_if_fail (wrapper != NULL, G_FAILED);
- result = wrapper->GetEncoding (enc);
- if (NS_FAILED (result)) return G_FAILED;
-
- *encoding = g_strdup (enc.get());
+ result = wrapper->GetEncoding (encoding);
- return G_OK;
+ return NS_SUCCEEDED(result) ? G_OK : G_FAILED;
}
static void