libgsf tweaks

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

libgsf tweaks

Allin Cottrell
I'd like to propose two small tweaks for libgsf that I think could be
quite useful for third-party users of the library in general.
(Certainly they'd be helpful to me, for use with gretl.)

1) gsf-output-memory: it would be nice to be able to "steal" a
buffer created in this way. At present if you want to make further use
of it after closing and unref'ing the GsfOutput you have to copy the
buffer. Proposal: add a function gsf_output_memory_steal_bytes().

2) gsf-output-gzip: in some contexts it would be useful to be able to
control the zlib compression level in the interest of maximum speed or
maximal compression. Proposal: add a compression-level property, plus
a function gsf_output_gzip_new_full() which allows you to set this
property at construction.

I'm attaching two little patches against git (also 1.14.46, since the
relevant source files haven't changed recently) which do what I'm
talking about.

--
Allin Cottrell
Department of Economics
Wake Forest University, NC

_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list

gsf-output-memory.diff (1K) Download Attachment
gsf-output-gzip.diff (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: libgsf tweaks

GnuMeric mailing list
Can you please remove me from the email list? Discussions are far above my pay grade. 
Rey Cano, SCREA, CG-REP
CA Lic.#AR034439
Tel: 310-457-5905 Fax: 310-457-5591

This message is a PRIVILEGED AND CONFIDENTIAL communication.  This message and all its attachments are a private communication sent by an appraisal firm and may be confidential or protected by law.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the information contained in, or attached to, this message is strictly prohibited.  Please notify the sender of the delivery error by replying to this message and then delete it from your system. Thank you.


On Mon, Oct 14, 2019 at 11:20 AM Allin Cottrell <[hidden email]> wrote:
I'd like to propose two small tweaks for libgsf that I think could be
quite useful for third-party users of the library in general.
(Certainly they'd be helpful to me, for use with gretl.)

1) gsf-output-memory: it would be nice to be able to "steal" a
buffer created in this way. At present if you want to make further use
of it after closing and unref'ing the GsfOutput you have to copy the
buffer. Proposal: add a function gsf_output_memory_steal_bytes().

2) gsf-output-gzip: in some contexts it would be useful to be able to
control the zlib compression level in the interest of maximum speed or
maximal compression. Proposal: add a compression-level property, plus
a function gsf_output_gzip_new_full() which allows you to set this
property at construction.

I'm attaching two little patches against git (also 1.14.46, since the
relevant source files haven't changed recently) which do what I'm
talking about.

--
Allin Cottrell
Department of Economics
Wake Forest University, NC
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list

_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: libgsf tweaks

GnuMeric mailing list
In reply to this post by Allin Cottrell
On Mon, 14 Oct 2019 at 19:20, Allin Cottrell <[hidden email]> wrote:
> 1) gsf-output-memory: it would be nice to be able to "steal" a
> buffer created in this way.

I'd like this too.

> 2) gsf-output-gzip: in some contexts it would be useful to be able to
> control the zlib compression level in the interest of maximum speed or
> maximal compression.

I do this now with eg.:

                        obj = gsf_outfile_new_child_full(out, name, FALSE,
                                "compression-level", GSF_ZIP_DEFLATED,
                                "deflate-level", dir->deflate_level,
                                NULL);

Perhaps the name isn't the clearest :(

John
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: libgsf tweaks

Allin Cottrell
On Tue, 15 Oct 2019, John Cupitt via gnumeric-list wrote:

> On Mon, 14 Oct 2019 at 19:20, Allin Cottrell <[hidden email]> wrote:
>> 1) gsf-output-memory: it would be nice to be able to "steal" a
>> buffer created in this way.
>
> I'd like this too.
>
>> 2) gsf-output-gzip: in some contexts it would be useful to be able to
>> control the zlib compression level in the interest of maximum speed or
>> maximal compression.
>
> I do this now with eg.:
>
>                        obj = gsf_outfile_new_child_full(out, name, FALSE,
>                                "compression-level", GSF_ZIP_DEFLATED,
>                                "deflate-level", dir->deflate_level,
>                                NULL);
>
> Perhaps the name isn't the clearest :(

Hmm, is that "child" approach applicable if you just want a wrapper
for a gzipped file, as in tests/test-out-gzip1.c ? (As opposed to
creating a zip archive.)

Allin Cottrell
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: libgsf tweaks

Morten Welinder-2
In reply to this post by Allin Cottrell
Please open a bug report for this -- it's better for documentation and
keeping track of things.

gsf_output_memory_steal_bytes is pretty straightforward.

gsf_output_gzip_new_full is a bit less so.  Not because the
functionality is not good -- it is very reasonable -- but because
there are other fields in the gzip header that it might make sense to
add and I can't see us having _really_full and _really_really_full
versions.  I need to think about that part.

M.
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: libgsf tweaks

Allin Cottrell
On Tue, 15 Oct 2019, Morten Welinder wrote:

> Please open a bug report for this -- it's better for documentation and
> keeping track of things.
>
> gsf_output_memory_steal_bytes is pretty straightforward.
>
> gsf_output_gzip_new_full is a bit less so.  Not because the
> functionality is not good -- it is very reasonable -- but because
> there are other fields in the gzip header that it might make sense to
> add and I can't see us having _really_full and _really_really_full
> versions.  I need to think about that part.

Thanks, Morten. I take your point about gsf_output_gzip_new_full,
since there are other properties that might be set in a truly "full"
variant. My thinking was that the others seem to be internal matters
that libgsf wouldn't really want to expose to setting, but I accept
that may require some thought.

Allin Cottrell
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: libgsf tweaks

Morten Welinder-2
First patch committed.

Suggested alternative for second patch attached.  The attribute was
renamed to "deflate-level" to match GsfOutputZip.  The attribute is no
longer construct-only, although it has to be set before actual writing
starts.  There is no "full" method.  As an added benefit, the object
class becomes for standard and new objects can be created directly
with g_object_new if desired.

Comments?

Morten

_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list
Reply | Threaded
Open this post in threaded view
|

Re: libgsf tweaks

Allin Cottrell
On Wed, Oct 16, 2019 at 8:18 PM Morten Welinder <[hidden email]> wrote:

>
> First patch committed.
>
> Suggested alternative for second patch attached.  The attribute was
> renamed to "deflate-level" to match GsfOutputZip.  The attribute is no
> longer construct-only, although it has to be set before actual writing
> starts.  There is no "full" method.  As an added benefit, the object
> class becomes for standard and new objects can be created directly
> with g_object_new if desired.
>
> Comments?

This seems to me an excellent solution. Thanks!

--
Allin Cottrell
Department of Economics
Wake Forest University
_______________________________________________
gnumeric-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gnumeric-list