summaryrefslogtreecommitdiff
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-03-10 17:51:37 +0000
committerChristian Persch <chpe@src.gnome.org>2004-03-10 17:51:37 +0000
commit628ac884b608de3539ada6ae4c1c627a7688bafd (patch)
tree064ed38d3b11f39dff6475dabf86994255026375 /embed
parentcf20c417c843be351ba5ec8f6c41f0a4d4323c8c (diff)
downloadepiphany-pre-gnome-2-8.tar.gz
Use CopyUTF8toUTF16 where appropriate.pre-gnome-2-8
2004-03-10 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyHeaderSniffer.cpp: * embed/mozilla/FilePicker.cpp: * embed/mozilla/GtkNSSDialogs.cpp: * embed/mozilla/mozilla-embed-persist.cpp: Use CopyUTF8toUTF16 where appropriate.
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/EphyHeaderSniffer.cpp15
-rw-r--r--embed/mozilla/FilePicker.cpp4
-rw-r--r--embed/mozilla/GtkNSSDialogs.cpp4
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp1
4 files changed, 10 insertions, 14 deletions
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp
index 2d3755a20..28bbf7e22 100644
--- a/embed/mozilla/EphyHeaderSniffer.cpp
+++ b/embed/mozilla/EphyHeaderSniffer.cpp
@@ -282,10 +282,7 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
{
nsCAutoString fileNameCString;
url->GetFileName(fileNameCString);
- /* FIXME: when we can depend on moz >= 1.5, use
- * CopyUTF8toUTF16 instead
- */
- defaultFileName = NS_ConvertUTF8toUTF16(fileNameCString);
+ CopyUTF8toUTF16 (fileNameCString, defaultFileName);
}
}
@@ -305,16 +302,13 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
/* 4 Use the host. */
nsCAutoString hostName;
mURL->GetHost(hostName);
- /* FIXME: when we can depend on moz >= 1.5, use
- * CopyUTF8toUTF16 instead
- */
- defaultFileName = NS_ConvertUTF8toUTF16(hostName);
+ CopyUTF8toUTF16 (hostName, defaultFileName);
}
/* 5 One last case to handle about:blank and other untitled pages. */
if (defaultFileName.IsEmpty())
{
- defaultFileName = NS_ConvertUTF8toUTF16 (_("Untitled"));
+ CopyUTF8toUTF16 (_("Untitled"), defaultFileName);
}
/* Validate the file name to ensure legality. */
@@ -324,6 +318,9 @@ nsresult EphyHeaderSniffer::PerformSave (nsIURI* inOriginalURI)
const char *key;
key = ephy_embed_persist_get_persist_key (EPHY_EMBED_PERSIST (mEmbedPersist));
+ /* FIXME: do better here by using nsITextToSubURI service, like in
+ * http://lxr.mozilla.org/seamonkey/source/xpfe/communicator/resources/content/contentAreaUtils.js#763
+ */
char *filename;
filename = gnome_vfs_unescape_string (default_name, NULL);
diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp
index d6cb2b08e..a456be78f 100644
--- a/embed/mozilla/FilePicker.cpp
+++ b/embed/mozilla/FilePicker.cpp
@@ -199,8 +199,9 @@ NS_IMETHODIMP GFilePicker::AppendFilter(const PRUnichar *title, const PRUnichar
NS_ConvertUTF16toUTF8 (title).get(),
NS_ConvertUTF16toUTF8 (filter).get())
- nsCAutoString pattern = NS_ConvertUTF16toUTF8 (filter);
+ NS_ConvertUTF16toUTF8 pattern(filter);
pattern.StripWhitespace();
+ if (pattern.IsEmpty()) return NS_ERROR_FAILURE;
char **patterns = g_strsplit (pattern.get(), ";", -1);
@@ -231,7 +232,6 @@ NS_IMETHODIMP GFilePicker::GetDefaultString(PRUnichar **aDefaultString)
{
converted = g_filename_to_utf8(filename, -1, NULL, NULL, NULL);
- /* FIXME: when can depend on moz >= 1.6, use CopyUTF8toUTF16 here */
*aDefaultString = ToNewUnicode (NS_ConvertUTF8toUTF16 (converted));
g_free (filename);
diff --git a/embed/mozilla/GtkNSSDialogs.cpp b/embed/mozilla/GtkNSSDialogs.cpp
index a07be1dd4..37414822a 100644
--- a/embed/mozilla/GtkNSSDialogs.cpp
+++ b/embed/mozilla/GtkNSSDialogs.cpp
@@ -833,7 +833,7 @@ GtkNSSDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx,
else
{
gchar * text = gtk_editable_get_chars (GTK_EDITABLE (entry1), 0, -1);
- _password = NS_ConvertUTF8toUTF16 (text);
+ CopyUTF8toUTF16 (text, _password);
g_free (text);
*_retval = PR_TRUE;
}
@@ -893,7 +893,7 @@ GtkNSSDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor *ctx,
else
{
gchar * text = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
- _password = NS_ConvertUTF8toUTF16 (text);
+ CopyUTF8toUTF16 (text, _password);
g_free (text);
*_retval = PR_TRUE;
}
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index 907568748..a69c55aad 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -314,7 +314,6 @@ impl_to_string (EphyEmbedPersist *persist)
return g_strdup (NS_ConvertUTF16toUTF8(aOutputString).get());
}
-
static GObject *
mozilla_embed_persist_constructor (GType type, guint n_construct_properties,
GObjectConstructParam *construct_params)