Commit Graph
443 Commits
Author SHA1 Message Date
Christopher Lam b0c60fb310 [reports] use ICU for Unicode string comparison 2025-06-17 08:42:02 +08:00
Christopher Lam ff759c26bc [engine.i] convert gnc_account_accumulate_at_dates to c++
traversal of account->splits through std::vector instead of scm_list
2025-05-10 14:33:06 +08:00
Christopher Lam c01cccbddc [gnc-engine-guile.cpp] helper gnc_split_to_scm function 2025-05-10 14:33:06 +08:00
Christopher Lam b219744dba [gnc-engine-guile] reduce overhead of gnc_foo_to_scm
by caching the result of SWIG_TypeQuery(typestr)
2025-05-10 13:59:19 +08:00
Oliver Lok Trevor 008980c497 Added unit test 2025-04-24 20:02:54 -04:00
Oliver Lok Trevor 479ecc7b2b Fixed GetInvoiceFromTxn to convert to the right type of Python object for a GncInvoice. 2025-04-16 13:28:26 -04:00
John Ralls b5b2221e72 Test gnc-option-date variable fy start days.
Leverages the FakePrefsBackend from the previous commit to change the
fiscal year for testing.

Makes now_t a defaulted parameter of gnc_relative_date_to_time64 so
that we can inject different reference dates for testing.
2025-03-23 15:32:07 -07:00
John Ralls 0185a2fec8 Bug 799533 - Saved reports configurations are opening with…
No Accounts selected error
Revert "[gnc-optiondb.i] don't add null accounts"
2025-03-17 16:47:46 -07:00
John Ralls 218aa4ad87 Fix test-gnc-option-scheme-output to match fix for bug 799501. 2025-03-17 16:31:06 -07:00
John Ralls 2f0ed09bf1 Bug 799501 - Gnucash grashes on startup ice-9/read.scm error
Correctly format ("'~s" instead of "'~a") the scheme string returned from
gnc_query2scm.
2025-03-10 14:24:33 -07:00
John Ralls 85084e75d6 Fix python bindings build with Swig-4.3.0. 2024-12-26 11:45:10 -08:00
Christopher Lam 5661c45d2a gnc_commodity_table_get_namespaces must be g_list_freed 2024-11-28 08:23:30 +08:00
David Seifert c06bc18dc4 Add missing #include <cstdint>
* GCC 15 has reduced transitive dependencies between headers.

Bug: https://bugs.gentoo.org/939856
2024-11-02 09:55:15 +01:00
Christopher Lam 6d7f4ec4c8 [engine.i] expose xaccAccountGetSplits in bindings
because xaccAccountGetSplitList will create GList, scan and build SCM
reverse order, and scm_reverse.

xaccAccountGetSplits scans the vector, builds the SCM list in reverse.
2024-10-27 22:22:51 +08:00
Christopher Lam e2f5c74bb4 [engine.i] VECTORREF_HELPER_INOUT to handle SplitsVec& 2024-10-27 22:22:51 +08:00
John Ralls 6cabb5d884 Revisit Bug 799308.
Existing files/databases obviously should still be loaded. What's
changed is that databases no longer need to be loaded to force creation,
they do that on their own.
2024-10-26 17:59:25 -07:00
John Ralls 02e2fa0ead Bug 799308 - sqlite backend: Example Python script prints error...
when creating new file.

Reverts the fix for https://bugs.gnucash.org/show_bug.cgi?id=726891. The
underlying problem, that a new SQL database needed to be loaded to force
its creation, is no longer a problem. It was probably corrected as part
of the C++ rewrite of the SQL backend.
2024-09-05 11:53:47 -07:00
Christopher Lam 1718fa0b6e [gnc-pricedb.h] remove unused gnc_pricedb_lookup_at_time64 2024-08-31 20:45:32 +08:00
Christopher Lam 664b1cb77a [gnc-optiondb.i] instead of scm_list_ref, walk the list 2024-07-27 08:39:00 +08:00
Christopher Lam 3e5d6a510b [gnc-optiondb.i] don't add null accounts 2024-07-27 08:38:59 +08:00
John Ralls ad7a51a6ef Merge Chris Lam's 'acc-children-vector' into stable. 2024-06-27 13:21:49 -07:00
Geert Janssens 1def3ce8fd Cleanup - remove deprecated function (re-)defines
They were deprected 11 years ago
2024-06-23 18:23:49 +02:00
Christopher Lam d1807b6c15 [engine.i] move gnc_accounts_and_all_descendants to engine.i 2024-06-07 18:10:40 +08:00
Geert Janssens e8d72ad53f Doxygen - merge separate txt files into respective header files 2024-05-23 15:10:05 +02:00
Geert Janssens 39aa5f9c09 Remove texi design document in engine
It's extremely out of date and we no longer use it to keep track
of our design decisions and suggestions.

Only a section on KVP policy has been move into kvp_doc.txt
as it may make sense there.
2024-05-23 15:10:05 +02:00
Christopher Lam 4c29f69d67 [engine.i] even faster gnc_get_match_commodity_splits
gnc_get_match_commodity_splits needs to scan the account splitlists to
find suitable splits upto end_date. Because splitlist is date-sorted,
use gnc_account_foreach_split_until_date to avoid scanning later
splits.
2024-05-02 22:21:31 +08:00
Christopher Lam 8fb5a6afd6 Fix tests so that they don't fail unnecessarily
- test-begin/test-end names must be consistent
- remove empty test group in test-scm-engine
2024-04-29 22:06:45 +08:00
Christopher Lam 68f60fef68 [engine.i] gnc_get_match_commodity_splits from scheme to c++
The scheme version is very inefficient: (1) it uses QofQuery to
retrieve all splits, and QofQuery is slow. (2) The whole splitlist
typically is thousands splits long needs to be converted from C to
guile via consing and reverse. (3) The scheme list is immediately
filtered to select "interesting" splits only.

This function performs all of the above using Account's efficient
methods, selecting only interesting splits into a GList. This list is
then converted to scheme via cons and reverse.
2024-04-22 19:34:02 +08:00
Christopher Lam cb7196a393 [base-typemaps.i] add VECTOR_HELPER_INOUT for Split* and Account*
efficiently convert std::vector<Obj> to/from guile list of objects
2024-04-22 19:34:02 +08:00
Christopher Lam 94368f4cb4 [Account.cpp] SplitsVec&, ensure xaccAccountGetSplitList is freed 2024-04-16 21:41:48 +08:00
John Ralls e22a57ad26 Merge John Ralls's 'asan' into stable. 2023-12-08 14:56:29 -08:00
John Ralls d92d97aef6 Add Scheme coverage collection with option GUILE_COVERAGE.
This can be used with or without COVERAGE, though if without the
results will reflect only the Scheme code exercised by the tests.
2023-12-08 14:55:49 -08:00
Christopher Lam d8ece96503 [gnc-engine-guile.cpp] plug runaway GSList* leak
The QofQuery param_list is a GSList of const char*. Every SCM Query
would typically leak the GSList. This change will store the params
into the string cache, and the cached string is passed onto the
QofQuery param.
2023-11-30 22:16:53 +08:00
Christopher Lam 3863d6e8dc [engine-common.i] AccountList* arg must be g_list_freed
when used by gnc_accounts_and_all_descendants
2023-11-27 21:05:06 +08:00
John Ralls a3f14759ab Asan: Make leak and ODR violation reporting CMake options.
pass -DLEAKS=ON or -DODR=ON to enable these features. They have an
effect only with CMAKE_BUILD_TYPE=Asan and don't work on Apple because
Apple clang doesn't enable them.
2023-11-25 11:17:14 -08:00
John Ralls e17ba3cc00 Fix UAF in xaccFreeSplit.
xaccSplitComputeCapGains creates gains_split pointers in both the Cap Gains Split and its Income split to the original split, but the original's gains_split pointer can point to only one of them, the Cap Gains split. When the original split is freed both the Cap Gains split's and its Income split need their gains_split pointers NULLed or when it's the Income split's turn to be freed it will try to deref the dangling pointer.
2023-11-02 12:58:55 -07:00
John Ralls 2234fa433e Add Asan build type that enables the Address and UB sanitizers.
Uses generator statements instead of CMAKE_<TYPE>_FLAGS_ASAN to support multiconfig generators like Xcode.
2023-11-02 12:58:46 -07:00
John Ralls a389e0a32e Bug 799092 - GnuCash 5.4 leaves background process running on exit
Clear the schema_hash at app shutdown via gnc_prefs_remove_registered
and make that function available to the Python bindings so that
python programs can do so too.
2023-10-02 12:31:59 -07:00
Christopher Lam 550c43d13a Merge branch 'free-guid-string' into stable #1777 2023-09-20 07:29:16 +08:00
John Ralls a49fd0bc09 [c++options] Correctly implement handling Fancy Date Format.
It's not a simple string.
2023-09-19 16:05:53 -07:00
Christopher Lam 8e21d3328f guid_to_string should be freed. 2023-09-19 20:31:11 +08:00
John Ralls 17ebb8a1d2 [simple-business-create.py] Overwrite an existing file instead of crashing. 2023-09-11 17:39:02 -07:00
Christopher Lam 7ce4198c20 rename string_to_gnc_numeric to gnc_numeric_from_string 2023-08-29 08:45:20 +08:00
Christopher Lam 75f6ee1817 [test-scm-engine] tests gnc-numeric-from-string 2023-08-29 08:30:52 +08:00
Geert Janssens 29b7a9099d Fix cmake warnings while searching for python
There is a new find module since cmake 3.12. Cmake 3.27 will start
emitting warnings if the old modules are still in use.

Current implementation supports both. As soon as we can bump our minimal
cmake version to 3.12, the old support code can be dropped as well.
2023-08-17 18:23:33 +02:00
Christopher Lam 867867da53 Merge Richard Cohen branch 'fix-leaks-in-tests' into stable #1713 2023-07-24 13:09:55 +08:00
John Ralls 50418527b0 Fix two typos. 2023-07-21 13:57:39 -07:00
John Ralls 2e76d2f43d Bug 799021 - Saved report renders default of gnc-register-list-option
save_scm_value was trying too hard to handle the different possible
types that Scheme can set options to and in the process converting
lists to single symobls (e.g. ('good 'ugly) became #{good ugly}#.
That not being one of the possible values it was ignored and the
default value was used.
2023-07-20 14:25:25 -07:00
Richard Cohen e43982375c Valgrind: fix "definitely lost" memory in test - sqlite3test
==64824== 171 (88 direct, 83 indirect) bytes in 1 blocks are definitely lost in loss record 392 of 418
==64824==    at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==64824==    by 0x528A935: qof_session_new (qofsession.cpp:148)
==64824==    by 0x141832: main (sqlite3test.c:34)
2023-07-19 10:21:30 +01:00
Christopher Lam 2a392633ed Bug 798991 - Incorrect Account Name Order in Transaction Report
gnc:string-locale<? uses glib instead of guile string compare
2023-07-11 08:41:09 +08:00