The Input::send() method allocated glib strings and copied input data,
but only released the glib string container and leaked the actual string
content. This led to leaks in the size of the verbatim input file, which
is especially wasteful for uncompressed textual representations.
This fixes bug #976.
The new methods wrap the new libsigrok C API helper functions and eliminate
the need to pass complex types back to the user and wrap them with SWIG.
Fixes bugs #479 and #480.
The Java bindings currently have some weird problem with function
arguments passed by const reference. Not all types are affected,
but the collection types that involve custom typemaps are.
For now, revert back to pass-by-value for the problematic types.
Replace custom Deleter classes with std::default_delete<>, declared
as friend so it can invoke the private destructor. Inexplicably,
std::shared_ptr<> does not use default_delete<> by default, so it
is still necessary to explicitly specify the deleter when creating
shared_ptr instances.
With this, unique_ptr and shared_ptr instances now use the same
default delete mechanism.
Make use of std::unique_ptr<> to manage the lifetime of members
or container elements, so that manual invocations of delete can
be avoided. This also provides for exception safety.
Since std::unique_ptr<> is only movable but not copyable, adapt
the code to avoid copies and assignments of these pointers.
Reduce needless over-generalization. There is no design need
for the ParentOwned and UserOwned classes to contain the C base
struct pointer. Instead, just make the _structure pointer a
private member of each class that needs one.
Declare accessor methods that return value members const. For now,
skip all cases where constness would have to be applied transitively
to shared objects.
If one of these functions does throw an exception, std::terminate()
will be called. Without this, the behavior is undefined since the C
stack is not prepared to deal with exceptions.
Make use of std::move() to transfer arguments passed in by value.
Take complex container arguments by const reference, as passing
those by value is rather unorthodox even for C++11 style code.
Completely remove the old session save code that has been
superseded by the srzip output module. Also refactor a bit,
plug a number of leaks and tighten the error checking.
The GNU libstdc++ headers use isascii(), which is not part of any
POSIX standard. On BSD, this breaks the build. It is however part
of XOPEN, which on Linux is apparently enabled implicitly for C++.
This should fix#649.
Since Autoconf places some important feature flags only into the
configuration header, it is necessary to include it globally to
guarantee a consistent build.
The confusingly named sr_log_logdomain_set() simply set a global
string prefixed to the log message by the default log callback.
This is pretty much useless, misleadingly named, and not used by
either sigrok-cli or PulseView.
This requires sr_hw_cleanup_all() and sanity_check_all_drivers()
to also take a context.
The (runtime) generation of the driver list now happens in sr_init()
and sr_driver_list() always returns that pre-generated list. This fixes
a segfault when (correctly) invoking multiple sr_init() and sr_exit()
calls with different contexts (caught by the unit tests).
This fixes bug #565.