2004-02-06 Hans Petter Jansson <hpj@ximian.com>
* libebook/e-address-western.c (e_address_western_extract_region):
Don't allow end index to go below start index when extracting the
region. Also handle the case where there is no whitespace after comma
more gracefully.
+2004-02-06 Hans Petter Jansson <hpj@ximian.com>
+
+ * libebook/e-address-western.c (e_address_western_extract_region):
+ Don't allow end index to go below start index when extracting the
+ region. Also handle the case where there is no whitespace after comma
+ more gracefully.
+
2004-02-06 Chris Toshok <toshok@ximian.com>
* libebook/e-book.c (e_book_activate): if bonobo hasn't been
static gchar *
e_address_western_extract_region (gchar *line)
{
- gint start, end;
+ gint start, end, alt_end;
start = strcspn (line, ",");
start++;
while (isspace (line[end]))
end--;
+ alt_end = end;
+
while (!isspace (line[end]))
end--;
end--;
end++;
+ if (end <= start)
+ end = alt_end;
+ if (end <= start)
+ return g_strdup ("");
+
/* Between start and end lie the string. */
return g_strndup ( (line+start), end-start);
}