Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hello everyone,

I am doing some proactive hardening of the image filters these days,
and I have to say that there is a lot of code like this:

*stream >> meh;
if (! stream->good())
  return sal_False;

It is very cluttered to do this for _every_ read.

A simpler way would be to have opt-in exception handling. Here is how
that would work.

By default, all SvStreams _do not_ throw exceptions.

However, we could have a call like
stream->setThrowExceptions(sal_True) to enable them and then
stream->setThrowExceptions(sal_True) to disable them once the bit of
code that is aware of exceptions is done.
That means that we need a call stream->getThrowExceptions() to handle this.

The only risk I can see is if svstreams are accessed in a
multithreaded manner. I don't know of any case like that.

Another way to implement this would be with a wrapper class such as
ExceptionSvStream that would have the same interface, so that it can
be dropped in wherever needed.

What do you think of these proposals? What could go wrong if we were
to implement it?

Regards,

Marc-André LAVERDIÈRE
"Perseverance must finish its work so that you may be mature and complete,
not lacking anything." -James 1:4
http://asimplediscipleslife.blogspot.com/
mlaverd.theunixplace.com

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.