summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Scorgie <dscorgie@src.gnome.org>2006-05-11 19:13:05 +0000
committerDon Scorgie <dscorgie@src.gnome.org>2006-05-11 19:13:05 +0000
commit87fd91cf93d5c7139376863adabba5edde8def15 (patch)
tree5b19616bf81f21669e1ea8f7e1eae8adbfd1d97a
parent6674d23f74be570cfbf87fe6e87a60bb87cf6768 (diff)
downloadyelp-87fd91cf93d5c7139376863adabba5edde8def15.tar.gz
If the node isn't found while parsing, adjust the offset and try again
* src/yelp-info-parser.c: If the node isn't found while parsing, adjust the offset and try again (stupid broken info page workaround) bug #336838
-rw-r--r--ChangeLog6
-rw-r--r--src/yelp-info-parser.c24
2 files changed, 28 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 94ec3af2..565fc0d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,12 @@
2006-05-11 Don Scorgie <dscorgie@cvs.gnome.org>
* src/yelp-info-parser.c:
+ If the node isn't found while parsing, adjust the offset and
+ try again (stupid broken info page workaround) bug #336838
+
+ * src/yelp-info-parser.c:
Actually check a directory exists before reading it (bug #339978)
-
+
* stylesheets/search2html.xsl:
* src/yelp-window.c:
* src/yelp-search-pager.c:
diff --git a/src/yelp-info-parser.c b/src/yelp-info-parser.c
index 2f18b59a..2f417edf 100644
--- a/src/yelp-info-parser.c
+++ b/src/yelp-info-parser.c
@@ -291,9 +291,31 @@ static int
node2page (GHashTable *nodes2offsets, GHashTable *offsets2pages, char *node)
{
char *offset;
+ gint int_offset;
+ gint page;
offset = g_hash_table_lookup (nodes2offsets, node);
- return GPOINTER_TO_INT (g_hash_table_lookup (offsets2pages, offset));
+ page = GPOINTER_TO_INT (g_hash_table_lookup (offsets2pages, offset));
+ if (!page) {
+ /* We got a badly formed tag table. Most probably bash info page :(
+ * Have to find the correct page.
+ * The bash info file assumess 3 bytes more per node than reality
+ * hence we check backwards in steps of 3
+ * The first one we come across should be the correct node
+ * (fingers crossed at least)
+ */
+ gchar *new_offset = NULL;
+ int_offset = atoi (offset);
+
+ while (!page && int_offset > 0) {
+ int_offset-=3;
+ g_free (new_offset);
+ new_offset = g_strdup_printf ("%d", int_offset);
+ page = GPOINTER_TO_INT (g_hash_table_lookup (offsets2pages, new_offset));
+ }
+ g_free (new_offset);
+ }
+ return page;
}
static GtkTreeIter