Christopher Lam
55592efe25
[SchedXAction.cpp] convert to c++
2 years ago
Christopher Lam
109497d471
[SX-ttinfo.cpp] convert to c++
2 years ago
Christopher Lam
5b1bb1186f
[SX-book.cpp] convert to c++
2 years ago
Christopher Lam
e80249ce2b
[Account.cpp] gnc_account_remove_split shortcuts removing last split
...
this speeds up book shutdown which empties the account splits in
reverse chrono order.
2 years ago
Geert Janssens
c816d2b34f
Doxygen - minor cleanup of gnc-lot.h
2 years ago
Geert Janssens
e8d72ad53f
Doxygen - merge separate txt files into respective header files
2 years ago
Geert Janssens
6cd8e4e458
Doxygen - drop obvious cases of deprecated code
2 years ago
Geert Janssens
da12a212c3
Drop old migration script to split qof from engine
2 years ago
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.
2 years ago
Geert Janssens
58b4ee35f0
Doxygen - drop several txt files that were included in
...
docygen_mainpage.c
None of them had useful information describing actual
implementation concepts or details.
2 years ago
Geert Janssens
3c860737f1
Doxygen - fold business.txt file in the respective source files
...
The file mostly had short descriptions that were very similar
to the descriptions of business objects it referred to. The
exception was an explanation of how the billing terms and
tax tables handled their immutable copies. That bit has been
moved to its own group under the Business group and is referenced
from the BillTerm and TaxTables group.
This commit also fixes rendering of the Address doxygen info
and expands the BillTerm info to explain how proximo due dates
work.
2 years ago
Christopher Lam
038405b370
Revert "[account.cpp] gnc_account_remove_split searches from the end"
...
This reverts commit 5aff4fb57d . Was not
tested properly...
2 years ago
Christopher Lam
5aff4fb57d
[account.cpp] gnc_account_remove_split searches from the end
...
because removing the latest split is far more common (e.g. from ui or
during book shutdown) than removing an early split.
2 years ago
Christopher Lam
370a06fb61
[qofid.cpp] remove unnecessary struct
2 years ago
Christopher Lam
fe2cdf42c7
[transaction.cpp] speed up book close
2 years ago
Christopher Lam
d21d6f9344
[qofid.cpp] qof_collection_foreach_sorted
2 years ago
Christopher Lam
7b46466ebd
[account.cpp] fix regression caused by 3f7a5a8267
...
whereby deleting an account and moving all splits to another account
would segfault. make a copy of priv->splits and work on the copy
rather than the original.
2 years ago
Christopher Lam
e54e9d8086
[account.cpp] use HashTable for splits
...
reduces xml loading time from 3.5s to 3.1s, i.e. 11% improvement
2 years ago
Christopher Lam
b28ca9bdb4
use c++ placement new
...
to initialize non-c++ object members
2 years ago
John Ralls
579da58a10
Merge Gwynn Ciesla's "Allow building with GCC 14.1" into stable.
2 years ago
Christopher Lam
2817ca195f
[test-commodities.cpp] test stability of c_str names
2 years ago
Christopher Lam
f67233b662
Bug 799305 - Crash when there is more than one unknown quote source for commodities
...
instead of vector which requires reallocation, use a c++ linked list.
2 years ago
Christopher Lam
d867a9d18a
Merge branch 'TransactionP-hpp' into stable #1928
2 years ago
Christopher Lam
9e4b03f71b
[SplitP.hpp] rename to .hpp
2 years ago
Christopher Lam
1e1d21b716
[Transaction.hpp] rename to .hpp
2 years ago
Christopher Lam
ef8afedd09
[gnc-euro.cpp] use c++isms
2 years ago
Christopher Lam
3bc7ce606d
[gnc-euro.cpp] convert to c++
2 years ago
Christopher Lam
80997ee5b4
[gtest-gnc-euro] add rounding test
2 years ago
Christopher Lam
949c9c97c0
Bug 799300 - Nullpointer exception in gnc_quote_source_s
...
avoids constructing std::string with nullptr
2 years ago
Christopher Lam
87dbbf25f8
[account.cpp] add gnc_account_foreach_until_date
...
- uses binary search to find first split after date
- for_each from earliest split to (but excluding) the above first split
2 years ago
John Ralls
9c18bc889c
Don't use Googletest internal API for unused decls.
2 years ago
Bruce P Schuck
d01aad68fb
Update gnc-commodity.cpp
...
Fool.pm not working. Removed references to it from sources JSON structures.
2 years ago
Bruce Schuck
6696bf0a41
Updated QuoteSourceVec to match F::Q v1.59
2 years ago
Christopher Lam
0f791c474a
[Account.cpp][api] gnc_account_foreach_split takes std::function<void(Split*)>
2 years ago
Christopher Lam
871f669a19
[Account.cpp] explicitly destroy priv->splits
...
better than 35b6fb767d
2 years ago
Christopher Lam
35b6fb767d
[Account.cpp] ensure priv->splits releases memory on shutdown
2 years ago
Christopher Lam
94368f4cb4
[Account.cpp] SplitsVec&, ensure xaccAccountGetSplitList is freed
2 years ago
Christopher Lam
2b71219766
[Account.cpp] remove obsolete comment
2 years ago
Christopher Lam
1b50c6261a
g_list_free xaccAccountGetSplitList
2 years ago
Christopher Lam
606da28d25
use xaccAccountGetSplitsSize
2 years ago
Christopher Lam
f70ee754fc
use xaccAccountGetSplits and gnc_account_find_split
2 years ago
Christopher Lam
3f7a5a8267
[Account.hpp][API] xaccAccountGetSplits and gnc_account_find_split
2 years ago
Christopher Lam
a54caaab61
[Account.cpp] GetBalanceAsOfDate gets std::function instead of bool
2 years ago
Christopher Lam
cc10b9a0b7
[SX-book.c] tidy for loop
...
because splits will need to be g_list_free in a future commit
2 years ago
Christopher Lam
c1ee59c39b
[Account.h] size_t xaccAccountGetSplitsSize returns g_list_length (splits)
...
which is easily replaced with vector.size()
2 years ago
Christopher Lam
f08e0f5b61
[policy.cpp] rewrite to avoid goto
2 years ago
Christopher Lam
2251bf8966
[Account.hpp] use std::optional for cached values
...
whereby {} denotes uncached values
2 years ago
Sherlock
f0d45de642
Resolve test assert.
2 years ago
Sherlock
8d6f748aca
Bug 799281 - Deleting a transaction may trigger a crash
...
Update qof_collection_lookup_entity() to prevent returning instances marked to be destroyed.
2 years ago
Christopher Lam
d100df7ef7
[AccountP.hpp] .h -> .hpp, remove extern "C" {} wrapper
2 years ago
Christopher Lam
a67e4651c3
[Query.cpp] convert to cpp
2 years ago
Christopher Lam
4d9836aac2
[TransLog.cpp] convert to cpp
2 years ago
Christopher Lam
093781c018
[policy.cpp] convert to cpp
2 years ago
Christopher Lam
f913bed7e6
[gnc-engine.cpp] convert to cpp
2 years ago
Christopher Lam
96f041a1d6
[cap-gains.cpp] convert to cpp
2 years ago
Christopher Lam
79b7267cdd
[cashobjects.cpp] convert to cpp
2 years ago
Christopher Lam
67d024c11f
[Scrub3.cpp] convert to cpp
2 years ago
Christopher Lam
6b5a4d7c11
[Scrub2.cpp] convert to cpp
2 years ago
Christopher Lam
ddfa664601
[Scrub.cpp] convert to cpp
2 years ago
Christopher Lam
dab32807ef
[engine/*.cpp] NULL -> nullptr changes
...
It's the done thing
2 years ago
Christopher Lam
9a85eb4a2a
[engine/*.h] add extern "C" {} wrappers
2 years ago
Gwyn Ciesla
5132476a2f
Allow building with c++20 and greater/
2 years ago
Christopher Lam
4945db6b7d
[AccountP.h] remove struct members obsolete with 76014f18a0
...
forgot to remove
2 years ago
Christopher Lam
ba403e4a7c
[guid.hpp] GUID::from_string and is_valid_string takes a const char*
...
boost::uuids::string_generator has operator()(const char*).
thus we can avoid allocating std::string, with a consistent 4% speedup
2 years ago
Christopher Lam
cba7da30fd
[gnc-date.cpp] specialise iso-8601 parsing where TZ=+0000
...
- avoid allocating new TZPtr
- parse y/m/d/h/m/s and construct PTime directly
- avoid boost's time_from_string which creates an std::string
2 years ago
Christopher Lam
27c16517e9
[gnc-numeric.cpp] shortcut parsing num/denom as gnc_numeric
...
The gnc_numeric is serialised as "num/denom" with no whitespace, and
denom > 0. This function takes advantage of std::from_chars to parse
it. The "num" serialisation is also optimised as a free side effect of
this function.
2 years ago
Christopher Lam
11da03bc67
[gtest-gnc-numeric.cpp] test int64 limits for GncNumeric
2 years ago
John Ralls
af18ea598e
Bug 799093 - Cannot reconcile since v5.4
...
Covers the final case where having the reconcile window open and
auto-completing a transaction then deleting the transaction before
committing it leaves the transaction in the reconcile window.
We need to signal that the account is modified even if it isn't
because that's what the reconcile window is watching.
2 years ago
John Ralls
2db6988e25
Remove bogus include.
2 years ago
John Ralls
8ebac5b596
Bug 799213 - SIGSEGV caused by revising an auto completed transaction
...
Calling xaccSplitDestroy without also calling xaccSplitCommitEdit then
deleting the split list before calling xaccTransCommitEdit prevents
xaccSplitCommitEdit from being called on the supposedly deleted
splits. Not only does this leak them it leaves them in the book
potentially with a dangling parent pointer.
2 years ago
Christopher Lam
229d9300cf
[engine-helpers.h] key is a const char*
...
thus allowing compilation in cpp with stricter type checking
2 years ago
Christopher Lam
c345fc9d3c
add #ifdef __cplusplus extern "C" {} wrappers to .h files
2 years ago
Christopher Lam
6cb2eeeaa8
Merge branch 'more-engine-cpp' into stable #1866
2 years ago
John Ralls
226bfea108
Fix a bunch of UB errors from ASAN about mismatched function types.
...
The casts fool the compiler but not the UB sanitizer.
2 years ago
John Ralls
7bd97f15d0
Fix transaction delete use-after-free, take 2.
...
The problem with take 1 was that the duplicate split uses the same lot
and account pointers without adding itself to those lists, causing
checks in unit tests to fail.
2 years ago
John Ralls
8546aa975e
Revert "Fix two use-after-free issues found by address sanitizer."
...
This reverts commit 4dbf803041 .
The use-after free errors are caused by the compiler reordering the
steps in xaccSplitFree and Transaction's do_destroy. Unfortunately the
corrections here caused trouble in other places, leading to test failures.
2 years ago
John Ralls
4dbf803041
Fix two use-after-free issues found by address sanitizer.
2 years ago
Christopher Lam
28cc26f207
[gnc-commodities.cpp] gnc_new_iso_codes is a std::unordered_map
2 years ago
Geert Janssens
00640f9ded
Replace naked for loops with C++ algorithms
2 years ago
Geert Janssens
0732436e44
A few NULL/nullptr related cleanups
2 years ago
Christopher Lam
17f422f97c
[gnc-commodity.cpp] convert quote_sources to vector
...
- all quote sources are now vector
- get_quote_source_from_type to convert QuoteSourceType to vector<gnc_quote_source>
- the quote sources are modifiable, therefore cannot be const:
see gnc_quote_source_set_fq_installed
2 years ago
John Ralls
266ae2a931
Bug 798946 - start/end of current/last quarter have off-by-one error
...
Calculating the quarter offset when the current month is less than the
beginning month of the fiscal year was inverted.
2 years ago
Christopher Lam
164453a858
[gnc-commodity.cpp] gnc_quote_source_get_index searches index
...
we can now remove init
2 years ago
Christopher Lam
5d16d025a6
[gnc-commodity.cpp] gnc_quote_source_s is a cpp class
...
... this ensures the new_quote_sources vector now doesn't leak anymore.
2 years ago
Christopher Lam
346499ae04
[gnc-commodity.cpp] gnc_quote_source_set_fq_installed takes a StrVec
...
instead of a GList* of strdup'd chars
2 years ago
Christopher Lam
47a1a56f16
[gnc-commodity.cpp] fq_version is a std::string
...
thus can free itself on exit
2 years ago
Christopher Lam
f49c2735e3
[gnc-commodity.cpp] initialize quote_sources at compile-time
2 years ago
Christopher Lam
d488faacb2
[gnc-commodity.cpp] Convert to cpp
2 years ago
Vincent Lucarelli
f5b7bf3401
removed old_internal_name from gnc_quote_source_s (deprecated)
2 years ago
Christopher Lam
9035391907
[test-commodities.cpp] add some tests for gnc_quote_sources
2 years ago
Christopher Lam
03c5309666
[gnc-lot.cpp] convert to cpp
2 years ago
Christopher Lam
7d8d8f83be
[Recurrence.cpp] convert to cpp
2 years ago
Christopher Lam
783c3df3c0
[Transaction.cpp] convert to cpp
2 years ago
Christopher Lam
fc5d7f872e
[Split.cpp] convert to cpp
2 years ago
Christopher Lam
698cc23051
Add #ifdef __cplusplus extern "C" {} wrappers to .h files
2 years ago
Christopher Lam
928f9245e6
[gtest-gnc-numeric] add operator comparisons
...
with example int64 numbers
2 years ago
Christopher Lam
9782918586
[account.cpp] add more account metadata - assoc account
...
the tag denotes the type of associated account eg. "dividend"
"capgains" "cash" "fees"
2 years ago
John Ralls
c87d480b0d
Move gnc_list_formatter from gnc-date to gnc-ui-util.
...
It has nothing at all to do with dates.
2 years ago
John Ralls
b2fa3ef106
Bug 799210 - Bad encoding of accented chars in account names in...
...
"Import CSV" wizard
In MSWin the UnicodeString(char*) ctor assumes that the input string
is encoded in the current codepage, but the input to
gnc_list_formatter is encoded in UTF8. Use the static class function
UnicodeString::fromUTF8 instead.
2 years ago
John Ralls
e22a57ad26
Merge John Ralls's 'asan' into stable.
2 years ago
John Ralls
6834cb5025
Implement coverage option
...
To use pass -DCMAKE_BUILD_TYPE=Debug or Asan -DCOVERAGE=ON and build as
usual, then do ninja lcov-initialize && ninja check && ninja
lcov-collect. The result will be a directory, <Builddir>/Coverage
containing lcov tracefiles, including an aggregate file gnucash.info
which you can use for further processing. It will also report an overall summary.
Note that only C/C++ files are included.
There's one more target, lcov-generate-html, that you can run after
lcov-collect. It will generate a simple website in
<Builddir>/Coverage-HTML showing coverage by source directory (the
directories in <Builddir> have coverage for generated files). Each
directory path is a clickable link to a page that shows coverage for
each source file; the filenames link to a page for each showing which
lines have been exercised.
2 years ago
John Ralls
6bc12898a8
GncDate: Remove now-superfluous base parameter.
2 years ago
John Ralls
1e289cb2b8
GncDate: Remove pointless normalize_month function.
...
Suggested by Sherlock.
2 years ago
John Ralls
966cef19aa
Bug 799156 - normalize_struct_tm() does not normalize seconds,...
...
minutes, and hours correctly.
Fix proposed by Sherlock.
2 years ago
John Ralls
5005c3cac8
Merge Sherlock's 'bug799151' into stable.
2 years ago
Sherlock
ae8492d73a
Update test-gnc-date.c
2 years ago
Sherlock
5a7b6e9814
Bug 799151 - gnc_date_get_last_mday () does not account for,,,
...
leap years correctly.
2 years ago
Sherlock
07e94b4222
Bug 799152 - normalize_reldate_tm() does not handle dates with...
...
months greater than 11 or less than -11 correctly.
2 years ago
John Ralls
d8dacb86b2
Bug 799143 - FTBFS on 32bit architectures
...
Fix misuse of GUINT_TO_POINTER in 5e09b66 .
2 years ago
John Ralls
92de074e49
Bug 799144 - Date Completion is broken after 5.4 upgrade
...
strptime will reasonable return false for an incomplete date but it
still fills in the parts of the struct tm that it understands, so bail
out of qof_scan_date_internal when it fails only if all three fields
are present.
2 years ago
John Ralls
ed4921271c
Bug 799134 - Fails to build with GCC 14 (‘find_if’ is not a member...
...
of ‘std’; did you mean ‘find’)
2 years ago
Christopher Lam
1d26d99ddb
[gnc-budget] use std::optional<gnc_numeric> instead of bool+gnc_numeric
...
more expressive
2 years ago
John Ralls
dd0b72cdb5
Fix global array index out of range.
...
Tests must set the account type to avoid errors in xaccAccountOrder.
2 years ago
Christopher Lam
8f7eecd3e9
Merge branch 'icu-list-formatter' into stable #1791
2 years ago
Christopher Lam
6940488d2d
recurrencePeriodTypeToString and recurrenceWeekendAdjustToString g_strdup only when necessary
...
... for sql use only. xml use assumes they return a const char*.
3 years ago
Christopher Lam
12f4233396
recurrencePeriodTypeToString and recurrenceWeekendAdjustToString g_strdup only when necessary
...
... for sql use only. xml use assumes they return a const char*.
3 years ago
John Ralls
fa119f8d17
Split test other
3 years ago
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.
3 years ago
Sherlock
52f1076b30
Bug 799104 - "Asset Chart" broken
3 years ago
John Ralls
44c278a82c
Fix GncDateEntry date parsing oddities.
...
The intent was always to default to today if the input string isn't
parsable, but two problems prevented that: First,
qof_scan_date_internal didn't check the return value of strptime and
return FALSE if it failed and second gnc_date_edit_get_date_internal
would unnecessarily munge a valid struct tm from gnc_tm_get_today_neutral.
3 years ago
Christopher Lam
ab7ead39ca
use icu::ListFormatter to combine a list strings into a string
3 years ago
Christopher Lam
d1b2368f4d
Merge Yongun Seong's branch 'utest-gnc-pricedb-types' into stable #1784
3 years ago
Yongun Seong
0bd556c581
[utest-gnc-pricedb] fix test failure due to callback type mismatch
3 years ago
Christopher Lam
550c43d13a
Merge branch 'free-guid-string' into stable #1777
3 years ago
John Ralls
a49fd0bc09
[c++options] Correctly implement handling Fancy Date Format.
...
It's not a simple string.
3 years ago
Christopher Lam
8e21d3328f
guid_to_string should be freed.
3 years ago
Christopher Lam
d21698f7cf
[gnc-option-impl] don't leak char*
...
use the stack
3 years ago
Christopher Lam
01f27e9c53
[test-commodities] clean up commodities
3 years ago
Christopher Lam
fccf0b48c4
[utest-Account] g_free char*
3 years ago
Christopher Lam
c074b82224
[test-qofsession] plugs Account* leak
3 years ago
Christopher Lam
1ddee7dc3f
[test-qofbook] plugs Account* leak
3 years ago
Christopher Lam
34564ef6d0
[test-qofobject] plug some leaks
3 years ago
Christopher Lam
8277f4d559
[test-qofbook] plug leaks
3 years ago
Christopher Lam
0056e5f091
[gtest-import-map] plug leaks
3 years ago
Christopher Lam
235e24a055
[account.cpp] ~GncImapInfo = gnc_account_imap_info_destroy
3 years ago
Christopher Lam
db77fb81a5
[test-job] plug leaks
3 years ago
Christopher Lam
a8dffb8559
[gnc-date.cpp] don't alloc tm* unless GncDateTime() succeeds
...
because GncDateTime() may throw an exception, in which case time will
leak. mainly leaks in test suite.
3 years ago
John Ralls
16c9957cac
Bug 798925 - Python bindings: "invalid unclassed pointer...
...
in cast to 'QofInstance'".
The list ended up with two entries of payment_lot resulting in a
dangling reference when one of them was freed.
3 years ago
John Ralls
89360252fb
Bug 798983 - Empty Orphan account appears after entering transactions in 5.3
...
Caused by trying to set the account on the blank split. The blank split
was present because the method used to clear the split list for the
receiving transaction in gnc_float_txn_to_txn_swap_accounts only removed
splits that belong to the transaction, and the blank split doesn't.
Adds new function xaccTransClearSplits to do a more thorough job.
Also improve the documentation for xaccSplitDestroy to better explain when
a transaction will be destroyed if it empties the split list.
# Please enter the commit message for your
changes. Lines starting
3 years ago
Christopher Lam
c45b9736ab
[gnc-numeric.cpp] parse integer + fraction; e.g."10 1/4" == 10.25
3 years ago
Geert Janssens
e2f8233e1e
Bug 798950 - Bug Report: Incorrect Currency Conversion and Provider Invoice Payment Recording
...
- Balancing lots always involves splits in the same account. So
the relevant number to use in the calculations is the split
amount, not the split value.
- Additionally don't assume transactions are single-currency.
So if amounts change, recalculate the associated values
based on deduced exchange rates.
- Finally if the lot balancing resulted in a split to be broken up
into two splits use conservative calculations for the new
splits' values to avoid introducing imbalances due to
rounding errors.
3 years ago
John Ralls
73dec63d1d
Eliminate a frequent exception in guid_from_string
...
By not trying to construct a GUID from an empty string.
3 years ago
Christopher Lam
fc21c55a0b
[gnc-pricedb.cpp] more glib g_list uses
...
* use g_list_find_custom where appropriate
* also g_list_free_full and g_list_foreach
3 years ago
Christopher Lam
d89544563d
Revert "[gnc-pricedb.cpp] use std::pair instead of a struct for PriceTuple"
...
This reverts commit 2d730e38d5 .
3 years ago
Christopher Lam
2d730e38d5
[gnc-pricedb.cpp] use std::pair instead of a struct for PriceTuple
3 years ago
Christopher Lam
6b741ddf32
[gnc-pricedb.cpp] use forloop instead of do..while and while
...
because they're scanning GLists, and forloop is tidier than while
3 years ago
Christopher Lam
79c0fe4724
[gnc-pricedb.cpp] convert hash_table_to_list to hash_table_to_vector
3 years ago
Christopher Lam
5e09b662a1
[utest-gnc-pricedb] test gnc_pricedb_foreach_price both stable and unstable
3 years ago
Christopher Lam
040ccb79b6
[gnc-pricedb.cpp] rewrite price_list_insert more efficiently
...
no need for PriceListIsDuplStruct
and shortcut "return true" if price is a duplicate
3 years ago
Christopher Lam
d6b49bbc89
[utest-gnc-pricedb.c] tests gnc_pricedb_price_list_insert
...
especially skipping adding duplicate price
3 years ago