summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-21 23:13:45 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-21 23:39:49 -0700
commit478baf107623c3aa0c31c3256cfc3bc794b089b1 (patch)
tree090485f799a36090bf4a301ba8611f0b5686a44a /parse-xml.c
parent5aa8b52f82399bd4343a8213927c7e9694def1bc (diff)
downloadsubsurface-478baf107623c3aa0c31c3256cfc3bc794b089b1.tar.gz
Replace GError handling with a kMessageWidget based approach
Instead of passing pointers to GError around we pass just pointers to error message texts around and use kMessageWidget to show those. Problem is that right now the close button on that doesn't do a thing - so the error stays around indefinitely. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 698b31171..58a9019c9 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -19,22 +19,34 @@
int verbose;
-static xmlDoc *test_xslt_transforms(xmlDoc *doc, GError **error);
+static xmlDoc *test_xslt_transforms(xmlDoc *doc, char **error);
/* the dive table holds the overall dive list; target table points at
* the table we are currently filling */
struct dive_table dive_table;
struct dive_table *target_table = NULL;
-static void parser_error(GError **error, const char *fmt, ...)
+static void parser_error(char **error, const char *fmt, ...)
{
va_list args;
+ char *tmp;
if (!error)
return;
+
+ tmp = malloc(1024);
va_start(args, fmt);
- *error = g_error_new_valist(g_quark_from_string("subsurface"), DIVE_ERROR_PARSE, fmt, args);
+ vsnprintf(tmp, 1024, fmt, args);
va_end(args);
+
+ if (*error) {
+ int len = strlen(*error) + strlen(tmp) + 1;
+ *error = realloc(*error, len);
+ strncat(*error, tmp, strlen(tmp));
+ free(tmp);
+ } else {
+ *error = tmp;
+ }
}
/*
@@ -1579,7 +1591,7 @@ const char *preprocess_divelog_de(const char *buffer)
}
void parse_xml_buffer(const char *url, const char *buffer, int size,
- struct dive_table *table, GError **error)
+ struct dive_table *table, char **error)
{
xmlDoc *doc;
const char *res = preprocess_divelog_de(buffer);
@@ -1802,7 +1814,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
}
int parse_dm4_buffer(const char *url, const char *buffer, int size,
- struct dive_table *table, GError **error)
+ struct dive_table *table, char **error)
{
int retval;
char *err = NULL;
@@ -1906,7 +1918,7 @@ static struct xslt_files {
{ NULL, }
};
-static xmlDoc *test_xslt_transforms(xmlDoc *doc, GError **error)
+static xmlDoc *test_xslt_transforms(xmlDoc *doc, char **error)
{
struct xslt_files *info = xslt_files;
xmlDoc *transformed;