Commit Graph

9 Commits

Author SHA1 Message Date
Maarten Bosmans
35aeed45ec [engine] Remove two replace functions from KvpValue
These were not used outside a test.

And that test was not leak free, as a result of the functions not doing
what they are supposed to do when the current value is not of the type
that is expected. (NULL is returned, but the value is not replaced)
2023-04-02 21:12:50 +02:00
John Ralls
d2535fe21b KvpValue: Use boost::typeindex::type_id instead of buildtin typeid.
Under some build conditions boost::typeindex will use an internal type
identifier that's different from the C++ builtin. In that case type equality
tests to C++ typeid in boost::variant will fail, breaking it. Using
boost::typeindex::type_id ensures that the comparisons always work.
2021-07-10 17:24:58 -07:00
John Ralls
e81bcf6e33 Fix the remaining static analysis warnings.
Except two incorrect leak warnings and one about mktemp
 being insecure in the XML backend. See the respective
comments about those.
2018-11-30 15:08:41 +09:00
Geert Janssens
48b29f5e91 Fix memory leak in char* type KvpValue and fix improper uses
The core issue was that the delete visitor was never called because its parameter
type (char *) didn't match the boost::variant type (const char *).
Fixing the visitor's parameter type also require a const_cast
back to char * because that's what g_free takes as argument.

The rest of this commit is merely fixing KvpValue instantiations that
tried to create a char* KvpValue from a stack based const string instead
of a heap allocated one. That would bomb out on calling the
delete visitor.
2018-09-10 19:49:43 +02:00
John Ralls
c8b372e390 Convert GNC_TYPE_TIMESPEC to GNC_TYPE_TIME64, Kvp::Type::Timespec to Kvp::Type::Time64
They have to go together because of using gvalues to hide KVP from most of
GnuCash.
2018-08-12 16:12:19 -07:00
lmat
5b03182963 Correct kvp to_string typo 2017-12-21 07:39:33 -05:00
lmat
08aa0104ef Change kvp string representation
The nested representation was very noisy. Now, the string representation
shows one line per value with the full prefix which is also more
expressive than the old version.
2017-12-21 07:39:32 -05:00
lmat
a9cc488cbf Should return std::string
This is only used in C++, so there is no need to g_strdup in here. Also,
this fixes a memory leak in KvpFrameImpl.
2017-08-29 14:12:25 -04:00
Geert Janssens
83d14e1c1c Restructure the src directory
It is split into
- /libgnucash (for the non-gui bits)
- /gnucash (for the gui)
- /common (misc source files used by both)
- /bindings (currently only holds python bindings)

This is the first step in restructuring the code. It will need much
more fine tuning later on.
2017-08-10 18:45:00 +02:00