Commit cce5003d authored by Jon K Hellan's avatar Jon K Hellan Committed by Jon Kåre Hellan
Browse files

Return int Return 0 on success, -1 on failure. Use gnumeric_error_read to

2000-01-30  Jon K Hellan  <hellan@acm.org>

	* src/xml-io.h (gnumeric_xml_read_workbook): Return int
	* src/xml-io.c (gnumeric_xml_read_workbook): Return 0 on success,
	-1 on failure. Use gnumeric_error_read to display messages.
parent 523b03fc
2000-01-30 Jon K Hellan <hellan@acm.org>
* src/xml-io.h (gnumeric_xml_read_workbook): Return int
* src/xml-io.c (gnumeric_xml_read_workbook): Return 0 on success,
-1 on failure. Use gnumeric_error_read to display messages.
2000-01-29 Jody Goldberg <jgoldberg@home.com>
* src/commands.c (cmd_set_text_undo) : Special case VALUE_EMPTY.
......
2000-01-30 Jon K Hellan <hellan@acm.org>
* src/xml-io.h (gnumeric_xml_read_workbook): Return int
* src/xml-io.c (gnumeric_xml_read_workbook): Return 0 on success,
-1 on failure. Use gnumeric_error_read to display messages.
2000-01-29 Jody Goldberg <jgoldberg@home.com>
* src/commands.c (cmd_set_text_undo) : Special case VALUE_EMPTY.
......
......@@ -27,6 +27,7 @@
#include "file.h"
#include "workbook-view.h"
#include "selection.h"
#include "command-context.h"
/*
* A parsing context.
......@@ -2238,7 +2239,7 @@ xml_probe (const char *filename)
* the actual in-memory structure.
*/
char *
int
gnumeric_xml_read_workbook (CommandContext *context, Workbook *wb,
const char *filename)
{
......@@ -2246,17 +2247,19 @@ gnumeric_xml_read_workbook (CommandContext *context, Workbook *wb,
xmlNsPtr gmr;
parse_xml_context_t ctxt;
g_return_val_if_fail (filename != NULL, "");
g_return_val_if_fail (filename != NULL, -1);
/*
* Load the file into an XML tree.
*/
res = xmlParseFile (filename);
if (res == NULL)
return "";
return -1;
if (res->root == NULL) {
xmlFreeDoc (res);
return g_strdup ("Invalid xml file. Tree is empty ?");
gnumeric_error_read
(context, _("Invalid xml file. Tree is empty ?"));
return -1;
}
/*
* Do a bit of checking, get the namespaces, and chech the top elem.
......@@ -2266,7 +2269,9 @@ gnumeric_xml_read_workbook (CommandContext *context, Workbook *wb,
gmr = xmlSearchNsByHref (res, res->root, "http://www.gnome.org/gnumeric/v2");
if (strcmp (res->root->name, "Workbook") || (gmr == NULL)) {
xmlFreeDoc (res);
return g_strdup ("Is not an Workbook file");
gnumeric_error_read
(context, _("Is not an Workbook file"));
return -1;
}
ctxt.doc = res;
ctxt.ns = gmr;
......@@ -2275,7 +2280,7 @@ gnumeric_xml_read_workbook (CommandContext *context, Workbook *wb,
workbook_recalc_all (wb);
xmlFreeDoc (res);
return NULL;
return -1;
}
/*
......
......@@ -11,7 +11,7 @@
#include "sheet.h"
char *gnumeric_xml_read_workbook (CommandContext *context, Workbook *wb,
int gnumeric_xml_read_workbook (CommandContext *context, Workbook *wb,
const char *filename);
int gnumeric_xml_write_workbook (CommandContext *context, Workbook *wb,
const char *filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment