From db363909586281d7d543c6ed54ed7e69013385a0 Mon Sep 17 00:00:00 2001 From: gb10 <gb10> Date: Mon, 18 Oct 2010 14:06:53 +0000 Subject: [PATCH] Added code to unescape the URL tag that is passed in the GFF file for variations --- blxGff3Parser.c | 30 ++++-------------------------- blxview.c | 8 +++++++- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/blxGff3Parser.c b/blxGff3Parser.c index f9789de9..8903d4a1 100644 --- a/blxGff3Parser.c +++ b/blxGff3Parser.c @@ -534,31 +534,6 @@ static void parseAttributes(char *attributes, } -/* Utility to remove any GFF3 escape characters from the given string and replace them with - * the real characters they represent. Takes into account special chars for generic attributes, - * and also the Target-name and ID attributes if requested */ -static void replaceGff3EscapeChars(char **text, const gboolean targetNameAtt, const gboolean idAtt) -{ - GString *gstr = g_string_new(*text); - - seqtools_g_string_replace(gstr, "%3b", ";"); - seqtools_g_string_replace(gstr, "%3d", "="); - seqtools_g_string_replace(gstr, "%09", "\t"); - - /* Target-name and ID attributes additionally have whitespace escaped */ - if (targetNameAtt || idAtt) - seqtools_g_string_replace(gstr, "%20", " "); - - /* ID attribute additional has ">" escaped */ - if (idAtt) - seqtools_g_string_replace(gstr, "%e3", ">"); - - g_free(*text); - *text = gstr->str; - g_string_free(gstr, FALSE); -} - - /* Parse a tag/data pair of the format "tag=data" */ static void parseTagDataPair(char *text, const int lineNum, @@ -607,8 +582,11 @@ static void parseTagDataPair(char *text, } else if (!strcmp(tokens[0], "url")) { +#if GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 16 + gffData->url = g_uri_unescape_string(tokens[1], NULL); +#else gffData->url = g_strdup(tokens[1]); - replaceGff3EscapeChars(&gffData->url, FALSE, FALSE); +#endif } else { diff --git a/blxview.c b/blxview.c index 971ec9fe..e75563b4 100644 --- a/blxview.c +++ b/blxview.c @@ -88,7 +88,7 @@ 01-10-05 Added getsseqsPfetch to fetch all missing sseqs in one go via socket connection to pfetch [RD] * Created: Thu Feb 20 10:27:39 1993 (esr) - * CVS info: $Id: blxview.c,v 1.75 2010-10-05 17:40:20 gb10 Exp $ + * CVS info: $Id: blxview.c,v 1.76 2010-10-18 14:06:53 gb10 Exp $ *------------------------------------------------------------------- */ @@ -1596,6 +1596,12 @@ void destroyMspData(MSP *msp) g_array_free(msp->xy, TRUE); msp->xy = NULL; } + + if (msp->url) + { + g_free(msp->url); + msp->url = NULL; + } } -- GitLab