aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-02-28 02:50:45 +0800
committerChristian Persch <chpe@src.gnome.org>2005-02-28 02:50:45 +0800
commit22e053c43179e739314ac9771932e1394ad91387 (patch)
treefb267e0296a4fcc7c3d9f71bcd1dfb44bf2342d5
parentd8c89be1293cf71ee242f812b3c4552c3f5e8c66 (diff)
downloadgsoc2013-epiphany-22e053c43179e739314ac9771932e1394ad91387.tar
gsoc2013-epiphany-22e053c43179e739314ac9771932e1394ad91387.tar.gz
gsoc2013-epiphany-22e053c43179e739314ac9771932e1394ad91387.tar.bz2
gsoc2013-epiphany-22e053c43179e739314ac9771932e1394ad91387.tar.lz
gsoc2013-epiphany-22e053c43179e739314ac9771932e1394ad91387.tar.xz
gsoc2013-epiphany-22e053c43179e739314ac9771932e1394ad91387.tar.zst
gsoc2013-epiphany-22e053c43179e739314ac9771932e1394ad91387.zip
Fix compress_tilde to only look at the prefix, and not substitute in the
2005-02-27 Christian Persch <chpe@cvs.gnome.org> * lib/eel-gconf-extensions.c: (tilde_compress): Fix compress_tilde to only look at the prefix, and not substitute in the middle.
-rw-r--r--ChangeLog7
-rw-r--r--embed/mozilla/MozDownload.cpp2
-rw-r--r--lib/eel-gconf-extensions.c46
3 files changed, 17 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index f999e1c27..56f0a942b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2005-02-27 Christian Persch <chpe@cvs.gnome.org>
+ * lib/eel-gconf-extensions.c: (tilde_compress):
+
+ Fix compress_tilde to only look at the prefix, and not
+ substitute in the middle.
+
+2005-02-27 Christian Persch <chpe@cvs.gnome.org>
+
* embed/mozilla/MozDownload.cpp:
Try to fix the build with 1.7 branch.
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 248286ff1..419123c76 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -380,7 +380,7 @@ MozDownload::OnStateChange (nsIWebProgress *aWebProgress, nsIRequest *aRequest,
nsEmbedCString cDesc;
NS_UTF16ToCString (description, NS_CSTRING_ENCODING_UTF8, cDesc);
#else
- char *mime;
+ char *mime = nsnull;
rv = mMIMEInfo->GetMIMEType (&mime);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
diff --git a/lib/eel-gconf-extensions.c b/lib/eel-gconf-extensions.c
index 7f616084d..432b0d693 100644
--- a/lib/eel-gconf-extensions.c
+++ b/lib/eel-gconf-extensions.c
@@ -670,47 +670,19 @@ eel_gconf_get_float (const char *key)
static char *
tilde_compress (const char *path)
{
- const char *home_dir = g_get_home_dir();
- int home_dir_l = strlen (home_dir);
- int ntilde = 0;
- const char *scan;
- int path_l, result_l;
- char *result, *scan2;
-
- if (path == NULL)
- return NULL;
+ const char *home;
- path_l = strlen (path);
- for (scan = path; scan != NULL; scan++) {
- if (path_l - (scan - path) < home_dir_l)
- break;
- if (strncmp (scan, home_dir, home_dir_l) == 0)
- ntilde++;
- }
-
- if (ntilde == 0)
- return g_strdup (path);
-
- result_l = strlen (path) + ntilde - (ntilde * home_dir_l);
- result = g_new (char, result_l + 1);
+ if (path == NULL) return NULL;
- for (scan = path, scan2 = result; scan != NULL; scan2++) {
- if (path_l - (scan - path) < home_dir_l) {
- strcpy (scan2, scan);
- scan2 += strlen (scan);
- break;
- }
- if (strncmp (scan, home_dir, home_dir_l) == 0) {
- *scan2 = '~';
- scan += home_dir_l;
- } else {
- *scan2 = *scan;
- scan++;
- }
+ home = g_get_home_dir ();
+ if (home == NULL) return g_strdup (path);
+
+ if (g_str_has_prefix (path, home))
+ {
+ return g_strconcat ("~", path + strlen (home), NULL);
}
- *scan2 = 0;
- return result;
+ return g_strdup (path);
}
void