Follow-up Comment #13, bug #67508 (group denemo):

[comment #11 comment #11:]
> some years ago the saving of denemo files in compressed .gz format stopped
> working and I was unable to find out why... Sorry to be so clueless.

Looks like that was broken in commit f9e5bdf13e5521b9 (May 2014) when
xmlSaveFormatFile() was replaced with xmlSaveToFilename()

Compression is predicated on two things:

1. setting xmlDoc->compression
2. calling xmlSetSocCompressMode

In denemo the calls to functions that save documents:

$ git grep -n xmlSave
src/core/exportxml.c:1382:  xmlSaveCtxt *ctxt = xmlSaveToFilename
(filename->str, "UTF-8", XML_SAVE_FORMAT | XML_SAVE_NO_EMPTY);
src/core/exportxml.c:1383:  if (!ctxt || xmlSaveDoc (ctxt, doc) < 0 ||
xmlSaveClose (ctxt) < 0)
src/core/keymapio.c:646:  xmlSaveFormatFileEnc (filename, doc, XML_ENCODING,
1);
src/core/keymapio.c:698:  xmlSaveFormatFileEnc (filename, doc, XML_ENCODING,
1);
src/core/keymapio.c:733:  xmlSaveFormatFileEnc (filename, doc, XML_ENCODING,
1);
src/core/palettestorage.c:92:    if (xmlSaveFormatFile (localpal, doc, 1) <
0)
src/core/prefops.c:865:  xmlSaveFormatFile (localrc->str, doc, 1);
src/core/prefops.c:902:      xmlSaveFormatFile ((gchar *) filename->str, doc,
0); //What is this for???
src/core/prefops.c:963:      xmlSaveFormatFile (filename->str, doc, 0);
src/export/exportmusicxml.c:884:  xmlSaveCtxt *ctxt = xmlSaveToFilename
(filename->str, "UTF-8", XML_SAVE_FORMAT | XML_SAVE_NO_EMPTY);
src/export/exportmusicxml.c:885:  if (!ctxt || xmlSaveDoc (ctxt, doc) < 0 ||
xmlSaveClose (ctxt) < 0)

Here the relevant function called is xmlSaveToFilename()

And in libxml2 xmlsave.c it ignores 'compression' (it's a TODO) !

xmlSaveCtxtPtr
xmlSaveToFilename(const char *filename, const char *encoding, int options)
{
    xmlSaveCtxtPtr ret;
    int compression = 0; /* TODO handle compression option */

    ret = xmlNewSaveCtxt(encoding, options);
    if (ret == NULL) return(NULL);
    ret->buf = xmlOutputBufferCreateFilename(filename, ret->handler,
                                             compression);

The libxml function that does handle compression is xmlSaveFormatFileEnc()
where it does compression only if libxml is linked with zlib:

#ifdef LIBXML_ZLIB_ENABLED
    if (cur->compression < 0) cur->compression = xmlGetCompressMode();
#endif
    /*
     * save the content to a temp buffer.
     */
    buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression);

But that function is only called from Denemo in src/core/keymapio.c
save_xml_keymap(), save_xml_keybindings(), save_command_metadata() or, via
calling xmlSaveFormatFile(), that is done in src/core/prefops.c
writeXMLPrefs(), readHistory(), writeHistory().


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67508>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to