Commit 8933a113 authored by Daniel Veillard's avatar Daniel Veillard

Set-up compression of output, Daniel.

parent beff1ee5
Tue Sep 22 20:50:11 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* src/xml-io.c: set-up for compression of output. Should be tunable
from the interface.
1998-09-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/xml-io.c (writeXmlStyle): Save colors. Save pattern.
......
Tue Sep 22 20:50:11 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* src/xml-io.c: set-up for compression of output. Should be tunable
from the interface.
1998-09-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/xml-io.c (writeXmlStyle): Save colors. Save pattern.
......
Tue Sep 22 20:50:11 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* src/xml-io.c: set-up for compression of output. Should be tunable
from the interface.
1998-09-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/xml-io.c (writeXmlStyle): Save colors. Save pattern.
......
Tue Sep 22 20:50:11 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* src/xml-io.c: set-up for compression of output. Should be tunable
from the interface.
1998-09-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/xml-io.c (writeXmlStyle): Save colors. Save pattern.
......
......@@ -552,31 +552,20 @@ Sheet *gnumericReadXmlSheet(const char *filename) {
*/
int gnumericWriteXmlSheet(Sheet *sheet, const char *filename) {
FILE *output;
xmlDocPtr xml;
xmlNsPtr gmr;
parseXmlContext ctxt;
int ret;
g_return_val_if_fail (sheet != NULL, -1);
g_return_val_if_fail (IS_SHEET (sheet), -1);
g_return_val_if_fail (filename != NULL, -1);
/*
* Open in write mode, !!! Save a bak ?
*/
output = fopen(filename, "w");
if (output == NULL) {
perror("fopen");
fprintf(stderr, "gnumericWriteXmlSheet: couldn't save to file %s\n",
filename);
return(-1);
}
/*
* Create the tree
*/
xml = xmlNewDoc("1.0");
if (xml == NULL) {
fclose(output);
return(-1);
}
gmr = xmlNewGlobalNs(xml, "http://www.gnome.org/gnumeric/", "gmr");
......@@ -591,9 +580,10 @@ int gnumericWriteXmlSheet(Sheet *sheet, const char *filename) {
/*
* Dump it.
*/
xmlDocDump(output, xml); /* !!! Should add a return code and check */
xmlSetCompressMode(9);
ret = xmlSaveFile(filename, xml);
xmlFreeDoc(xml);
fclose(output);
if (ret < 0) return(-1);
return(0);
}
......@@ -653,31 +643,19 @@ Workbook *gnumericReadXmlWorkbook(const char *filename) {
*/
int gnumericWriteXmlWorkbook(Workbook *wb, const char *filename) {
FILE *output;
xmlDocPtr xml;
xmlNsPtr gmr;
parseXmlContext ctxt;
int ret;
g_return_val_if_fail (wb != NULL, -1);
g_return_val_if_fail (filename != NULL, -1);
/*
* Open in write mode, !!! Save a bak ?
*/
output = fopen(filename, "w");
if (output == NULL) {
perror("fopen");
fprintf(stderr, "gnumericWriteXmlWorkbook: couldn't save to file %s\n",
filename);
return(-1);
}
/*
* Create the tree
*/
xml = xmlNewDoc("1.0");
if (xml == NULL) {
fclose(output);
return(-1);
}
gmr = xmlNewGlobalNs(xml, "http://www.gnome.org/gnumeric/", "gmr");
......@@ -692,9 +670,10 @@ int gnumericWriteXmlWorkbook(Workbook *wb, const char *filename) {
/*
* Dump it.
*/
xmlDocDump(output, xml); /* !!! Should add a return code and check */
xmlSetCompressMode(9);
ret = xmlSaveFile(filename, xml);
xmlFreeDoc(xml);
fclose(output);
if (ret < 0) return(-1);
return(0);
}
......
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