[giggle] [libgiggle] Make more robust the author creation
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [giggle] [libgiggle] Make more robust the author creation
- Date: Wed, 31 Mar 2010 03:24:36 +0000 (UTC)
commit dbf60990d3f987bf184c8b99a2c7e694b4c8825c
Author: Javier Jardón <jjardon gnome org>
Date: Wed Mar 31 05:13:35 2010 +0200
[libgiggle] Make more robust the author creation
Use G_REGEX_RAW to avoid problems with incorrectly encoded author
names.
Thank you to Germán Póo-Caamaño for the help.
libgiggle/giggle-author.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/libgiggle/giggle-author.c b/libgiggle/giggle-author.c
index 6f48f7e..375ccb8 100644
--- a/libgiggle/giggle-author.c
+++ b/libgiggle/giggle-author.c
@@ -68,6 +68,7 @@ author_set_string (GiggleAuthorPriv *priv,
{
static GRegex *regex = NULL;
GMatchInfo *match = NULL;
+ GError *error = NULL;
g_free (priv->name);
g_free (priv->email);
@@ -78,13 +79,17 @@ author_set_string (GiggleAuthorPriv *priv,
if (G_UNLIKELY (!regex)) {
regex = g_regex_new ("^\\s*([^<]+?)?\\s*(?:<([^>]+)>)?\\s*$",
- G_REGEX_OPTIMIZE, 0, NULL);
+ G_REGEX_OPTIMIZE | G_REGEX_RAW, 0, &error);
+ g_warning ("%s", error->message);
+ g_error_free (error);
}
if (g_regex_match (regex, priv->string, 0, &match)) {
priv->name = g_match_info_fetch (match, 1);
priv->email = g_match_info_fetch (match, 2);
}
+ g_assert (priv->name != NULL);
+ g_assert (priv->email != NULL);
g_match_info_free (match);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]