aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorJesse Pavel <jpavel@src.gnome.org>2000-09-11 00:17:32 +0800
committerJesse Pavel <jpavel@src.gnome.org>2000-09-11 00:17:32 +0800
commit7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5 (patch)
treecf614519e5c3a2aa973afadc84dec2f05024c386 /e-util
parentdbe32028e0dfb37adc2bfe4fa1bc27236a8e523a (diff)
downloadgsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.tar
gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.tar.gz
gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.tar.bz2
gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.tar.lz
gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.tar.xz
gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.tar.zst
gsoc2013-evolution-7dc0bc621e9dfa3bcc0d2aee4f2b15a5945829f5.zip
Fixed a bug regarding the extraction of the region.
svn path=/trunk/; revision=5302
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ename/e-address-western.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/e-util/ename/e-address-western.c b/e-util/ename/e-address-western.c
index d4dcda995e..b6ced3bebf 100644
--- a/e-util/ename/e-address-western.c
+++ b/e-util/ename/e-address-western.c
@@ -13,8 +13,15 @@
#include <string.h>
#include <glib.h>
+#ifdef E_ADDRESS_WESTERN_TEST
+
+#include "e-address-western.h"
+
+#else
+
#include <ename/e-address-western.h>
+#endif
static gboolean
e_address_western_is_line_blank (gchar *line)
@@ -195,6 +202,10 @@ e_address_western_extract_locality (gchar *line)
return g_strndup (line, index);
}
+
+/* Whatever resides between the comma and the start of the
+ postal code is deemed to be the region. */
+
gchar *
e_address_western_extract_region (gchar *line)
{
@@ -205,10 +216,17 @@ e_address_western_extract_region (gchar *line)
while (isspace(line[start]))
start++;
- end = start;
+ end = strlen(line) - 1;
+ while (isspace (line[end]))
+ end--;
+
while (!isspace (line[end]))
- end++;
-
+ end--;
+
+ while (isspace (line[end]))
+ end--;
+ end++;
+
/* Between start and end lie the string. */
return g_strndup ( (line+start), end-start);
}